mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-28 17:47:09 +03:00
Add in new ./configure options --enable-client-mode or --enable-server-mode which by default are enabled. If --disable-client-mode is set, then disable all the client specific code. [ COAP_CLIENT_SUPPORT is not defined ] If --disable-server-mode is set, then disable all the server specific code. [ COAP_SERVER_SUPPORT is not defined ] Functions and variables are only #ifdef'd out in the include/coap3/*_internal.h files. They cannot be #ifdef'd out in the other include files as COAP_CLIENT_SUPPORT and COAP_SERVER_SUPPORT are not available for application compilations. The result of this is if, say, client only API functons are used in a server application and COAP_CLIENT_SUPPORT is not defined, there will be linking issues (missing functions). Providing stub functions unecessarily increases the code size. For coap-server, if it is able to provide proxy support, requires both COAP_SERVER_SUPPORT and COAP_CLIENT_SUPPORT to set up the ongoing sessions. So, the build environment deliberatly sets SERVER_CAN_PROXY=0 if COAP_CLIENT_SUPPORT is not available to allow linking. Some of the tests have to be disabled if COAP_SERVER_SUPPORT or COAP_CLIENT_SUPPORT is not set. Code size change indications text data bss sum filename 155912 1728 12080 169720 libcoap-3-notls.a 138300 1728 12080 152108 libcoap-3-notls.a --disable-client-mode 106734 1632 10304 118670 libcoap-3-notls.a --disable-server-mode 180485 1733 12080 194298 libcoap-3-openssl.a 160306 1733 12080 174119 libcoap-3-openssl.a --disable-client-mode 125543 1637 10304 137484 libcoap-3-openssl.a --disable-server-mode 181755 1728 12080 195563 libcoap-3-gnutls.a 160972 1728 12080 174780 libcoap-3-gnutls.a --disable-client-mode 127178 1632 10304 139114 libcoap-3-gnutls.a --disable-server-mode 165879 1855 12128 179862 libcoap-3-tinydtls.a 147022 1855 12128 161005 libcoap-3-tinydtls.a --disable-client-mode 115618 1759 10352 127729 libcoap-3-tinydtls.a --disable-server-mode 171690 1728 13744 187162 libcoap-3-mbedtls.a 152099 1728 13712 167539 libcoap-3-mbedtls.a --disable-client-mode 118786 1632 11984 132402 libcoap-3-mbedtls.a --disable-server-mode
70 lines
2.0 KiB
C
70 lines
2.0 KiB
C
/*
|
|
* coap_async_internal.h -- state management for asynchronous messages
|
|
*
|
|
* Copyright (C) 2010-2021 Olaf Bergmann <bergmann@tzi.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* This file is part of the CoAP library libcoap. Please see README for terms
|
|
* of use.
|
|
*/
|
|
|
|
/**
|
|
* @file coap_async_internal.h
|
|
* @brief CoAP async internal information
|
|
*/
|
|
|
|
#ifndef COAP_ASYNC_INTERNAL_H_
|
|
#define COAP_ASYNC_INTERNAL_H_
|
|
|
|
#include "coap_internal.h"
|
|
#include "net.h"
|
|
|
|
/* Note that if COAP_SERVER_SUPPORT is not set, then WITHOUT_ASYNC undefined */
|
|
#ifndef WITHOUT_ASYNC
|
|
|
|
/**
|
|
* @defgroup coap_async_internal Asynchronous Messaging (Internal)
|
|
* @{
|
|
* CoAP Async Structures, Enums and Functions that are not exposed to
|
|
* applications.
|
|
* A coap_context_t object holds a list of coap_async_t objects that can be
|
|
* used to generate a separate response in the case a result of a request cannot
|
|
* be delivered immediately.
|
|
*/
|
|
struct coap_async_t {
|
|
struct coap_async_t *next; /**< internally used for linking */
|
|
coap_tick_t delay; /**< When to delay to before triggering the response
|
|
0 indicates never trigger */
|
|
coap_session_t *session; /**< transaction session */
|
|
coap_pdu_t *pdu; /**< copy of request pdu */
|
|
void* appdata; /** User definable data pointer */
|
|
};
|
|
|
|
/**
|
|
* Checks if there are any pending Async requests - if so, send them off.
|
|
* Otherewise return the time remaining for the next Async to be triggered
|
|
* or 0 if nothing to do.
|
|
*
|
|
* @param context The current context.
|
|
* @param now The current time in ticks.
|
|
*
|
|
* @return The tick time before the next Async needs to go, else 0 if
|
|
* nothing to do.
|
|
*/
|
|
coap_tick_t coap_check_async(coap_context_t *context, coap_tick_t now);
|
|
|
|
/**
|
|
* Removes and frees off all of the async entries for the given context.
|
|
*
|
|
* @param context The context to remove all async entries from.
|
|
*/
|
|
void
|
|
coap_delete_all_async(coap_context_t *context);
|
|
|
|
/** @} */
|
|
|
|
#endif /* WITHOUT_ASYNC */
|
|
|
|
#endif /* COAP_ASYNC_INTERNAL_H_ */
|