anjay
anjay_config.h File Reference

Go to the source code of this file.

Macros

#define ANJAY_WITH_LOGS
 
#define ANJAY_WITH_TRACE_LOGS
 
#define ANJAY_WITH_ACCESS_CONTROL
 
#define ANJAY_WITH_ATTR_STORAGE
 
#define ANJAY_WITH_DOWNLOADER
 
#define ANJAY_WITH_COAP_DOWNLOAD
 
#define ANJAY_WITH_HTTP_DOWNLOAD
 
#define ANJAY_WITH_BOOTSTRAP
 
#define ANJAY_WITH_DISCOVER
 
#define ANJAY_WITH_OBSERVE
 
#define ANJAY_WITH_NET_STATS
 
#define ANJAY_WITH_COMMUNICATION_TIMESTAMP_API
 
#define ANJAY_WITH_OBSERVATION_STATUS
 
#define ANJAY_MAX_OBSERVATION_SERVERS_REPORTED_NUMBER   0
 
#define ANJAY_WITH_THREAD_SAFETY
 
#define ANJAY_WITH_EVENT_LOOP
 
#define ANJAY_WITH_LWM2M11
 
#define ANJAY_WITH_SEND
 
#define ANJAY_WITH_SMS
 
#define ANJAY_WITH_SMS_MULTIPART
 
#define ANJAY_WITH_NIDD
 
#define ANJAY_WITH_CORE_PERSISTENCE
 
#define ANJAY_WITH_LWM2M_JSON
 
#define ANJAY_WITH_SENML_JSON
 
#define ANJAY_WITH_CBOR
 
#define ANJAY_WITH_EST
 
#define ANJAY_WITH_EST_ENGINE_SUPPORT
 
#define ANJAY_WITH_CON_ATTR
 
#define ANJAY_WITH_SECURITY_STRUCTURED
 
#define ANJAY_MAX_PK_OR_IDENTITY_SIZE   2048
 
#define ANJAY_MAX_SECRET_KEY_SIZE   256
 
#define ANJAY_MAX_DOUBLE_STRING_SIZE   512
 
#define ANJAY_MAX_URI_SEGMENT_SIZE   256
 
#define ANJAY_MAX_URI_QUERY_SEGMENT_SIZE   256
 
#define ANJAY_DTLS_SESSION_BUFFER_SIZE   1024
 
#define ANJAY_DEFAULT_SEND_FORMAT   AVS_COAP_FORMAT_NONE
 
#define ANJAY_WITH_MODULE_ACCESS_CONTROL
 
#define ANJAY_WITH_MODULE_SECURITY
 
#define ANJAY_WITH_MODULE_SECURITY_ENGINE_SUPPORT
 
#define ANJAY_WITH_MODULE_SERVER
 
#define ANJAY_WITH_MODULE_FW_UPDATE
 
#define ANJAY_WITH_MODULE_ADVANCED_FW_UPDATE
 
#define ANJAY_WITH_MODULE_SW_MGMT
 
#define ANJAY_WITH_MODULE_IPSO_OBJECTS
 
#define ANJAY_WITH_MODULE_IPSO_OBJECTS_V2
 
#define ANJAY_WITH_MODULE_AT_SMS
 
#define ANJAY_WITH_MODULE_BG96_NIDD
 
#define ANJAY_WITH_MODULE_BOOTSTRAPPER
 
#define ANJAY_WITH_MODULE_SIM_BOOTSTRAP
 
#define ANJAY_WITH_MODULE_FACTORY_PROVISIONING
 

Detailed Description

Anjay library configuration.

The preferred way to compile Anjay is to use CMake, in which case this file will be generated automatically by CMake.

However, to provide compatibility with various build systems used especially by embedded platforms, it is alternatively supported to compile Anjay by other means, in which case this file will need to be provided manually.

NOTE: To compile this library without using CMake, you need to configure avs_commons and avs_coap first. Please refer to documentation in the avs_commons_config.h and avs_coap_config.h files (provided in the repositories as avs_commons_config.h.in and avs_coap_config.h.in, respectively) for details.

Anjay requires the following avs_coap options to be enabled:

  • WITH_AVS_COAP_UDP
  • WITH_AVS_COAP_STREAMING_API
  • WITH_AVS_COAP_BLOCK is highly recommended
  • WITH_AVS_COAP_OBSERVE (if ANJAY_WITH_OBSERVE is enabled)
  • WITH_AVS_COAP_OSCORE (if ANJAY_WITH_COAP_OSCORE is enabled, available only as a commercial feature)

Anjay requires the following avs_commons components to be enabled:

  • All components required by avs_coap, see avs_coap_config.h
  • avs_algorithm
  • avs_stream
  • avs_url
  • avs_persistence is highly recommended
  • avs_http (if ANJAY_WITH_HTTP_DOWNLOAD is enabled)
  • avs_rbtree (if ANJAY_WITH_OBSERVE or ANJAY_WITH_MODULE_ACCESS_CONTROL is enabled)

In the repository, this file is provided as anjay_config.h.in, intended to be processed by CMake. If editing this file manually, please copy or rename it to anjay_config.h and for each of the #cmakedefine directives, please either replace it with regular #define to enable it, or comment it out to disable. You may also need to replace variables wrapped in @ signs with concrete values. Please refer to the comments above each of the specific definition for details.

If you are editing a file previously generated by CMake, these #cmakedefines will be already replaced by either #define or commented out #undef directives.

Macro Definition Documentation

◆ ANJAY_DEFAULT_SEND_FORMAT

#define ANJAY_DEFAULT_SEND_FORMAT   AVS_COAP_FORMAT_NONE

Value of Content-Format used in Send messages. Only a few specific values are supported:

  • AVS_COAP_FORMAT_NONE means no default value is used and Anjay will decide the format based on the what is available.
  • AVS_COAP_FORMAT_OMA_LWM2M_CBOR Anjay will generate a Send message in LwM2M CBOR format.
  • AVS_COAP_FORMAT_SENML_CBOR Anjay will generate a Send message in SenML CBOR format.
  • AVS_COAP_FORMAT_SENML_JSON Anjay will generate a Send message in SenML JSON format.

Note that to use a specific format it must be available during compilation.

The default value defined in CMake build scripts is AVS_COAP_FORMAT_NONE.

◆ ANJAY_DTLS_SESSION_BUFFER_SIZE

#define ANJAY_DTLS_SESSION_BUFFER_SIZE   1024

Size of buffer allocated for storing DTLS session state when connection is not in use (e.g. during queue mode operation).

If editing this file manually, 1024 shall be replaced with a positive integer literal. The default value defined in CMake build scripts is 1024.

◆ ANJAY_MAX_DOUBLE_STRING_SIZE

#define ANJAY_MAX_DOUBLE_STRING_SIZE   512

Maximum length supported for stringified floating-point values.

Used when parsing plaintext and SenML JSON content formats - when parsing a floating-point value, any string of length equal or greater than this setting will automatically be considered invalid, even if it could in theory be parsed as a valid number.

If editing this file manually, 512 shall be replaced with a positive integer literal.

The default value defined in CMake build scripts is 512. Minimal suggested setting for low-resource builds is 64.

◆ ANJAY_MAX_OBSERVATION_SERVERS_REPORTED_NUMBER

#define ANJAY_MAX_OBSERVATION_SERVERS_REPORTED_NUMBER   0

Maximum number of servers observing a given Resource listed by anjay_resource_observation_status() function.

Only meaningful if ANJAY_WITH_OBSERVATION_STATUS is enabled.

◆ ANJAY_MAX_PK_OR_IDENTITY_SIZE

#define ANJAY_MAX_PK_OR_IDENTITY_SIZE   2048

Maximum size in bytes supported for the "Public Key or Identity" resource in the LwM2M Security object.

If editing this file manually, 2048 shall be replaced with a positive integer literal.

The default value defined in CMake build scripts is 2048. Minimal suggested setting for low-resource builds is 256.

◆ ANJAY_MAX_SECRET_KEY_SIZE

#define ANJAY_MAX_SECRET_KEY_SIZE   256

Maximum size in bytes supported for the "Secret Key" resource in the LwM2M Security Object.

If editing this file manually, 256 shall be replaced with a positive integer literal.

The default value defined in CMake build scripts is 256. Minimal suggested setting for low-resource builds is 128.

◆ ANJAY_MAX_URI_QUERY_SEGMENT_SIZE

#define ANJAY_MAX_URI_QUERY_SEGMENT_SIZE   256

Maximum length supported for a single Uri-Query segment.

When handling incoming CoAP messages, any Uri-Query option of length equal or greater than this setting will be considered invalid.

If editing this file manually, 256 shall be replaced with a positive integer literal.

The default value defined in CMake build scripts is 256. Minimal suggested setting for low-resource builds is 64.

◆ ANJAY_MAX_URI_SEGMENT_SIZE

#define ANJAY_MAX_URI_SEGMENT_SIZE   256

Maximum length supported for a single Uri-Path or Location-Path segment.

When handling incoming CoAP messages, any Uri-Path or Location-Path option of length equal or greater than this setting will be considered invalid.

If editing this file manually, 256 shall be replaced with a positive integer literal.

The default value defined in CMake build scripts is 256. Minimal suggested setting for low-resource builds is 64.

◆ ANJAY_WITH_ACCESS_CONTROL

#define ANJAY_WITH_ACCESS_CONTROL

Enable core support for Access Control mechanisms.

Requires separate implementation of the Access Control object itself. Either the implementation available as part of ANJAY_WITH_MODULE_ACCESS_CONTROL, or a custom application-provided one may be used.

◆ ANJAY_WITH_ATTR_STORAGE

#define ANJAY_WITH_ATTR_STORAGE

Enable automatic attribute storage.

Requires AVS_COMMONS_WITH_AVS_PERSISTENCE to be enabled in avs_commons configuration.

◆ ANJAY_WITH_BOOTSTRAP

#define ANJAY_WITH_BOOTSTRAP

Enable support for the LwM2M Bootstrap Interface.

◆ ANJAY_WITH_CBOR

#define ANJAY_WITH_CBOR

Enable support for CBOR and SenML CBOR formats, as specified in LwM2M TS 1.1.

Requires ANJAY_WITH_LWM2M11 to be enabled.

◆ ANJAY_WITH_COAP_DOWNLOAD

#define ANJAY_WITH_COAP_DOWNLOAD

Enable support for CoAP(S) downloads.

Only meaningful if ANJAY_WITH_DOWNLOADER is enabled.

◆ ANJAY_WITH_COMMUNICATION_TIMESTAMP_API

#define ANJAY_WITH_COMMUNICATION_TIMESTAMP_API

◆ ANJAY_WITH_CON_ATTR

#define ANJAY_WITH_CON_ATTR

Enable support for the Confirmable Notification attribute, as specified in LwM2M TS 1.2.

Before TS 1.2, this has been supported in Anjay as a custom extension, and thus it is available independently from TS 1.2 support itself, including in the open source version.

Requires ANJAY_WITH_OBSERVE to be enabled.

◆ ANJAY_WITH_CORE_PERSISTENCE

#define ANJAY_WITH_CORE_PERSISTENCE

Enable support for core state persistence (anjay_new_from_core_persistence() and anjay_delete_with_core_persistence() APIs).

Requires ANJAY_WITH_OBSERVE to be enabled, AVS_COMMONS_WITH_AVS_PERSISTENCE to be enabled in avs_commons, and WITH_AVS_COAP_OBSERVE_PERSISTENCE to be enabled in avs_coap configuration.

IMPORTANT: Only available as a commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_DISCOVER

#define ANJAY_WITH_DISCOVER

Enable support for the LwM2M Discover operation.

Note that it is required for full compliance with the LwM2M protocol.

◆ ANJAY_WITH_DOWNLOADER

#define ANJAY_WITH_DOWNLOADER

Enable support for the anjay_download() API.

◆ ANJAY_WITH_EST

#define ANJAY_WITH_EST

Enable support for Enrollment over Secure Transport.

Requires ANJAY_WITH_BOOTSTRAP to be enabled.

IMPORTANT: Only available as part of the EST commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_EST_ENGINE_SUPPORT

#define ANJAY_WITH_EST_ENGINE_SUPPORT

Enable support for hardware security engine in the EST subsystem.

Requires ANJAY_WITH_EST to be enabled in Anjay configuration and AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE to be enabled in avs_commons configuration.

IMPORTANT: Only available in commercial versions that include both the EST and HSM features. Ignored in versions distributed without these features.

◆ ANJAY_WITH_EVENT_LOOP

#define ANJAY_WITH_EVENT_LOOP

Enable standard implementation of an event loop.

Requires C11 stdatomic.h header to be available, and either a platform that provides a BSD-compatible socket API, or a compatibility layer file (see AVS_COMMONS_POSIX_COMPAT_HEADER in avs_commons_config.h). This is designed to best work with the defalt implementation of avs_net sockets (see AVS_COMMONS_NET_WITH_POSIX_AVS_SOCKET), but alternative socket implementations can also be used.

The event loop is most useful when thread safety features (ANJAY_WITH_THREAD_SAFETY and AVS_COMMONS_SCHED_THREAD_SAFE) are enabled as well, but this is not a hard requirement. See the documentation for anjay_event_loop_run() for details.

◆ ANJAY_WITH_HTTP_DOWNLOAD

#define ANJAY_WITH_HTTP_DOWNLOAD

Enable support for HTTP(S) downloads.

Only meaningful if ANJAY_WITH_DOWNLOADER is enabled.

◆ ANJAY_WITH_LOGS

#define ANJAY_WITH_LOGS

Enable logging in Anjay.

If this flag is disabled, no logging is compiled into the binary at all.

◆ ANJAY_WITH_LWM2M11

#define ANJAY_WITH_LWM2M11

Enable support for features new to LwM2M protocol version 1.1.

◆ ANJAY_WITH_LWM2M_JSON

#define ANJAY_WITH_LWM2M_JSON

Disable automatic closing of server connection sockets after MAX_TRANSMIT_WAIT of inactivity. Enable support for CoAP Content-Format numerical values 1541-1544 that have been used before final LwM2M TS 1.0. Enable support for JSON format as specified in LwM2M TS 1.0.

NOTE: Anjay is only capable of generating this format, there is no parsing support regardless of the state of this option.

◆ ANJAY_WITH_MODULE_ACCESS_CONTROL

#define ANJAY_WITH_MODULE_ACCESS_CONTROL

Optional Anjay modules. Enable access_control module (implementation of the Access Control object).

Requires ANJAY_WITH_ACCESS_CONTROL to be enabled.

◆ ANJAY_WITH_MODULE_ADVANCED_FW_UPDATE

#define ANJAY_WITH_MODULE_ADVANCED_FW_UPDATE

Enable advanced_fw_update module (implementation of the 33629 custom Advanced Firmware Update object).

◆ ANJAY_WITH_MODULE_AT_SMS

#define ANJAY_WITH_MODULE_AT_SMS

Enable at_sms module (implementation of an SMS driver for AT modem devices).

Requires ANJAY_WITH_SMS to be enabled and the operating system to support the POSIX poll() function.

IMPORTANT: Only available as part of the SMS commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_MODULE_BG96_NIDD

#define ANJAY_WITH_MODULE_BG96_NIDD

Enable bg96_nidd module (implementation of NB-IoT-based NIDD driver for Quectel BG96).

Requires ANJAY_WITH_NIDD to be enabled.

IMPORTANT: Only available as part of the NIDD commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_MODULE_BOOTSTRAPPER

#define ANJAY_WITH_MODULE_BOOTSTRAPPER

Enable bootstrapper module (loader for bootstrap information formatted as per the "Storage of LwM2M Bootstrap Information on the Smartcard" appendix to the LwM2M TS).

Requires ANJAY_WITH_BOOTSTRAP to be enabled and AVS_COMMONS_WITH_AVS_PERSISTENCE to be enabled in avs_commons configuration.

IMPORTANT: Only available with the bootstrapper feature. Ignored in the open source version.

◆ ANJAY_WITH_MODULE_FACTORY_PROVISIONING

#define ANJAY_WITH_MODULE_FACTORY_PROVISIONING

Forced ID of the file to read the SIM bootstrap information from.

If not defined (default), the bootstrap information file will be discovered through the ODF file, as mandated by the specification.

Requires ANJAY_WITH_MODULE_BOOTSTRAPPER to be enabled. At most one of ANJAY_MODULE_SIM_BOOTSTRAP_HARDCODED_FILE_ID and ANJAY_MODULE_SIM_BOOTSTRAP_DATA_OID_OVERRIDE_HEX may be defined at the same time.

IMPORTANT: Only available with the bootstrapper feature. Ignored in the open source version. Overridden OID of the SIM bootstrap information to look for in the DODF file, expressed as a hexlified DER representation (without the header).

This is the hexlified expected value of the 'id' field within the 'OidDO' sequence in the DODF file (please refer to the PKCS #15 document for more information).

If not defined, the default value of "672b0901", which corresponds to OID 2.23.43.9.1 {joint-iso-itu-t(2) international-organizations(23) wap(43) oma-lwm2m(9) lwm2m-bootstrap(1)}, will be used.

No other values than the default are valid according to the specification, but some SIM cards are known to use other non-standard values, e.g. "0604672b0901" - including a superfluous nested BER-TLV header, as erroneously illustrated in the EF(DODF-bootstrap) file coding example in LwM2M TS 1.2 and earlier (fixed in LwM2M TS 1.2.1) - which is interpreted as OID 0.6.4.103.43.9.1 (note that it is invalid as the 0.6 tree does not exist in the repository as of writing this note).

Requires ANJAY_WITH_MODULE_BOOTSTRAPPER to be enabled. At most one of ANJAY_MODULE_SIM_BOOTSTRAP_HARDCODED_FILE_ID and ANJAY_MODULE_SIM_BOOTSTRAP_DATA_OID_OVERRIDE_HEX may be defined at the same time.

IMPORTANT: Only available with the bootstrapper feature. Ignored in the open source version. Enable factory provisioning module. Data provided during provisioning uses SenML CBOR format.

◆ ANJAY_WITH_MODULE_FW_UPDATE

#define ANJAY_WITH_MODULE_FW_UPDATE

Enable fw_update module (implementation of the Firmware Update object).

◆ ANJAY_WITH_MODULE_IPSO_OBJECTS

#define ANJAY_WITH_MODULE_IPSO_OBJECTS

Enables ipso_objects module (generic implementation of basic sensor, three axis sensor and Push Button IPSO objects).

◆ ANJAY_WITH_MODULE_IPSO_OBJECTS_V2

#define ANJAY_WITH_MODULE_IPSO_OBJECTS_V2

Enables experimental ipso_objects_v2 module (generic implementation of basic sensor and three axis sensor IPSO objects).

◆ ANJAY_WITH_MODULE_SECURITY

#define ANJAY_WITH_MODULE_SECURITY

Enable security module (implementation of the LwM2M Security object).

◆ ANJAY_WITH_MODULE_SECURITY_ENGINE_SUPPORT

#define ANJAY_WITH_MODULE_SECURITY_ENGINE_SUPPORT

Enable support for hardware security engine in the security module.

This feature allows security credentials provisioned into the LwM2M Security object to be automatically moved into a hardware security module.

Requires ANJAY_WITH_MODULE_SECURITY to be enabled in Anjay configuration, and at least one of AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE or AVS_COMMONS_WITH_AVS_CRYPTO_PSK_ENGINE to be enabled in avs_commons configuration.

IMPORTANT: Only available as part of the HSM support commercial feature. Ignored in versions distributed without this feature.

◆ ANJAY_WITH_MODULE_SERVER

#define ANJAY_WITH_MODULE_SERVER

Enable server module (implementation of the LwM2M Server object).

◆ ANJAY_WITH_MODULE_SIM_BOOTSTRAP

#define ANJAY_WITH_MODULE_SIM_BOOTSTRAP

Enable the SIM bootstrap module, which enables reading the SIM bootstrap information from a smartcard, which can then be passed through to the bootstrapper module.

Requires ANJAY_WITH_MODULE_BOOTSTRAPPER to be enabled.

IMPORTANT: Only available with the bootstrapper feature. Ignored in the open source version.

◆ ANJAY_WITH_MODULE_SW_MGMT

#define ANJAY_WITH_MODULE_SW_MGMT

Disable support for PUSH mode Firmware Update.

Only meaningful if ANJAY_WITH_MODULE_FW_UPDATE is enabled. Requires ANJAY_WITH_DOWNLOADER to be enabled. Enable sw_mgmt module (implementation of the Software Management object).

◆ ANJAY_WITH_NET_STATS

#define ANJAY_WITH_NET_STATS

◆ ANJAY_WITH_NIDD

#define ANJAY_WITH_NIDD

Enable support for Non-IP Data Delivery.

Requires ANJAY_WITH_LWM2M11 to be enabled, and WITH_AVS_COAP_UDP to be enabled in avs_coap configuration.

IMPORTANT: Only available as a commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_OBSERVATION_STATUS

#define ANJAY_WITH_OBSERVATION_STATUS

Enable support for the anjay_resource_observation_status() API.

◆ ANJAY_WITH_OBSERVE

#define ANJAY_WITH_OBSERVE

Enable support for the LwM2M Information Reporting interface (Observe and Notify operations).

Requires WITH_AVS_COAP_OBSERVE to be enabled in avs_coap configuration.

Note that it is required for full compliance with the LwM2M protocol.

◆ ANJAY_WITH_SECURITY_STRUCTURED

#define ANJAY_WITH_SECURITY_STRUCTURED

Enable support for handling security credentials in the data model using structured avs_crypto types.

If the security module is also enabled (see ANJAY_WITH_MODULE_SECURITY), it also enables support for passing these credentials through such structured types when adding Security object instances via the anjay_security_instance_t structure.

◆ ANJAY_WITH_SEND

#define ANJAY_WITH_SEND

Enable support for OSCORE-based security for LwM2M connections.

Requires ANJAY_WITH_LWM2M11 to be enabled, and WITH_AVS_COAP_OSCORE to be enabled in avs_coap configuration.

IMPORTANT: Only available as part of the OSCORE commercial feature. Ignored in the open source version. Enable support for the LwM2M Send operation.

Requires ANJAY_WITH_LWM2M11 and either ANJAY_WITH_SENML_JSON or ANJAY_WITH_CBOR to be enabled.

◆ ANJAY_WITH_SENML_JSON

#define ANJAY_WITH_SENML_JSON

Disable support for TLV format as specified in LwM2M TS 1.0.

NOTE: LwM2M Client using LwM2M 1.0 MUST support this format. It may be disabled if LwM2M 1.1 is used and SenML JSON or SenML CBOR is enabled. Disable support for Plain Text format as specified in LwM2M TS 1.0 and 1.1.

NOTE: LwM2M Client SHOULD support this format. It may be disabled to reduce library size if LwM2M Server is configured to not use it in requests. Disable use of the Deregister message. Disable support for "IP stickiness", i.e. preference of the same IP address when reconnecting to a server using a domain name. Enable support for SenML JSON format, as specified in LwM2M TS 1.1.

NOTE: As opposed to ANJAY_WITH_LWM2M_JSON, both generating and parsing is supported.

Requires ANJAY_WITH_LWM2M11 to be enabled.

◆ ANJAY_WITH_SMS

#define ANJAY_WITH_SMS

Enable support for the SMS binding and the SMS trigger mechanism.

Requires WITH_AVS_COAP_UDP to be enabled in avs_coap configuration.

IMPORTANT: Only available as part of the SMS commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_SMS_MULTIPART

#define ANJAY_WITH_SMS_MULTIPART

Enable support for sending and receiving multipart SMS messages.

Requires ANJAY_WITH_SMS to be enabled.

IMPORTANT: Only available as part of the SMS commercial feature. Ignored in the open source version.

◆ ANJAY_WITH_THREAD_SAFETY

#define ANJAY_WITH_THREAD_SAFETY

Enable guarding of all accesses to anjay_t with a mutex.

◆ ANJAY_WITH_TRACE_LOGS

#define ANJAY_WITH_TRACE_LOGS

Enable TRACE-level logs in Anjay.

Only meaningful if ANJAY_WITH_LOGS is enabled.