10#ifndef ANJAY_INCLUDE_ANJAY_CORE_H
11#define ANJAY_INCLUDE_ANJAY_CORE_H
15#include <avsystem/coap/udp.h>
17#include <avsystem/commons/avs_list.h>
18#include <avsystem/commons/avs_net.h>
19#include <avsystem/commons/avs_prng.h>
20#include <avsystem/commons/avs_sched.h>
21#include <avsystem/commons/avs_stream.h>
22#include <avsystem/commons/avs_time.h>
36#define ANJAY_SSID_ANY 0
42#define ANJAY_SSID_BOOTSTRAP UINT16_MAX
61#define ANJAY_COAP_DEFAULT_UDP_TX_PARAMS \
76#define ANJAY_DTLS_DEFAULT_UDP_HS_TX_PARAMS \
91#define ANJAY_COAP_DEFAULT_SMS_TX_PARAMS \
101#ifdef ANJAY_WITH_NIDD
112#define ANJAY_COAP_DEFAULT_NIDD_TX_PARAMS \
122#ifdef ANJAY_WITH_LWM2M11
218# ifdef ANJAY_WITH_LWM2M11
259# ifdef ANJAY_WITH_EST_ENGINE_SUPPORT
290 void *arg,
const void *x509_der_data,
size_t x509_der_data_size);
294#ifdef ANJAY_WITH_CONN_STATUS_API
660#if defined(WITH_AVS_COAP_TCP) \
661 && (defined(ANJAY_WITH_LWM2M11) || defined(ANJAY_WITH_COAP_DOWNLOAD))
695#ifdef ANJAY_WITH_NIDD
717#ifdef ANJAY_WITH_NIDD
753#ifdef ANJAY_WITH_LWM2M11
854# ifdef ANJAY_WITH_LWM2M11
862# ifdef ANJAY_WITH_EST_ENGINE_SUPPORT
898#ifdef ANJAY_WITH_CONN_STATUS_API
952#ifdef ANJAY_WITH_CORE_PERSISTENCE
996 avs_stream_t *in_stream);
1025 avs_stream_t *out_stream);
1197#define ANJAY_ID_INVALID UINT16_MAX
1201#define ANJAY_COAP_STATUS(Maj, Min) ((uint8_t) ((Maj << 5) | (Min & 0x1F)))
1208#define ANJAY_ERR_BAD_REQUEST (-(int) ANJAY_COAP_STATUS(4, 0))
1213#define ANJAY_ERR_UNAUTHORIZED (-(int) ANJAY_COAP_STATUS(4, 1))
1218#define ANJAY_ERR_BAD_OPTION (-(int) ANJAY_COAP_STATUS(4, 2))
1219#define ANJAY_ERR_FORBIDDEN (-(int) ANJAY_COAP_STATUS(4, 3))
1221#define ANJAY_ERR_NOT_FOUND (-(int) ANJAY_COAP_STATUS(4, 4))
1226#define ANJAY_ERR_METHOD_NOT_ALLOWED (-(int) ANJAY_COAP_STATUS(4, 5))
1231#define ANJAY_ERR_NOT_ACCEPTABLE (-(int) ANJAY_COAP_STATUS(4, 6))
1236#define ANJAY_ERR_REQUEST_ENTITY_INCOMPLETE (-(int) ANJAY_COAP_STATUS(4, 8))
1241#define ANJAY_ERR_UNSUPPORTED_CONTENT_FORMAT (-(int) ANJAY_COAP_STATUS(4, 15))
1243#define ANJAY_ERR_INTERNAL (-(int) ANJAY_COAP_STATUS(5, 0))
1245#define ANJAY_ERR_NOT_IMPLEMENTED (-(int) ANJAY_COAP_STATUS(5, 1))
1250#define ANJAY_ERR_SERVICE_UNAVAILABLE (-(int) ANJAY_COAP_STATUS(5, 3))
1323#ifdef ANJAY_WITH_EVENT_LOOP
1408 avs_time_duration_t max_wait_time);
1531#ifdef ANJAY_WITH_LWM2M11
1615 avs_time_duration_t timeout);
1659#ifdef ANJAY_WITH_SMS
1662#ifdef ANJAY_WITH_NIDD
1693#ifdef ANJAY_WITH_SMS
1701#ifdef ANJAY_WITH_NIDD
1829#ifdef ANJAY_WITH_LWM2M11
2006#if defined(ANJAY_WITH_EST) && defined(AVS_COMMONS_WITH_AVS_PERSISTENCE)
2136static inline avs_time_real_t
2413 const avs_coap_udp_tx_params_t *tx_params);
2431 avs_time_duration_t exchange_timeout);
2444 avs_net_dtls_handshake_timeouts_t dtls_handshake_timeouts);
2446#ifdef ANJAY_WITH_COMMUNICATION_TIMESTAMP_API
2469 avs_time_real_t *out_time);
2502 avs_time_real_t *out_time);
2525 avs_time_real_t *out_time);
2528#ifdef ANJAY_WITH_SMS
2529# ifdef ANJAY_WITH_LWM2M11
2545 bool *out_sms_trigger);
2561 const char *server_msisdn,
anjay_registration_expiration_status_t
Definition core.h:2058
@ ANJAY_REGISTRATION_EXPIRATION_STATUS_VALID
Definition core.h:2064
@ ANJAY_REGISTRATION_EXPIRATION_STATUS_INFINITE_LIFETIME
Definition core.h:2074
@ ANJAY_REGISTRATION_EXPIRATION_STATUS_EXPIRED
Definition core.h:2069
static avs_time_real_t anjay_registration_expiration_time(anjay_t *anjay, anjay_ssid_t ssid)
Definition core.h:2137
bool anjay_est_state_is_ready_for_persistence(anjay_t *anjay)
const anjay_transport_set_t ANJAY_TRANSPORT_SET_NIDD
anjay_t * anjay_new(const anjay_configuration_t *config)
int anjay_set_queue_mode_preference(anjay_t *anjay, anjay_queue_mode_preference_t preference)
avs_error_t anjay_update_coap_exchange_timeout(anjay_t *anjay, anjay_transport_set_t transport_set, avs_time_duration_t exchange_timeout)
const anjay_transport_set_t ANJAY_TRANSPORT_SET_SMS
anjay_est_cacerts_policy_t
Definition core.h:219
@ ANJAY_EST_CACERTS_FOR_EST_SECURITY_AND_BOOTSTRAP
Definition core.h:226
@ ANJAY_EST_CACERTS_IF_EST_CONFIGURED
Definition core.h:243
@ ANJAY_EST_CACERTS_DISABLED
Definition core.h:255
@ ANJAY_EST_CACERTS_ALWAYS
Definition core.h:250
@ ANJAY_EST_CACERTS_FOR_EST_SECURITY
Definition core.h:236
enum anjay_server_conn_status anjay_server_conn_status_t
avs_time_real_t anjay_transport_next_planned_pmax_notify_trigger(anjay_t *anjay, anjay_transport_set_t transport_set)
int anjay_delete_with_core_persistence(anjay_t *anjay, avs_stream_t *out_stream)
avs_time_real_t anjay_next_planned_lifecycle_operation(anjay_t *anjay, anjay_ssid_t ssid)
void anjay_delete(anjay_t *anjay)
avs_time_real_t anjay_next_planned_pmax_notify_trigger(anjay_t *anjay, anjay_ssid_t ssid)
int anjay_get_sms_trigger(anjay_t *anjay, anjay_ssid_t ssid, bool *out_sms_trigger)
anjay_socket_transport_t
Definition core.h:1077
@ ANJAY_SOCKET_TRANSPORT_NIDD
Definition core.h:1082
@ ANJAY_SOCKET_TRANSPORT_INVALID
Definition core.h:1078
@ ANJAY_SOCKET_TRANSPORT_UDP
Definition core.h:1079
@ ANJAY_SOCKET_TRANSPORT_TCP
Definition core.h:1080
@ ANJAY_SOCKET_TRANSPORT_SMS
Definition core.h:1081
int anjay_sched_time_to_next_ms(anjay_t *anjay, int *out_delay_ms)
const anjay_transport_set_t ANJAY_TRANSPORT_SET_TCP
uint16_t anjay_oid_t
Definition core.h:1182
uint16_t anjay_rid_t
Definition core.h:1188
int anjay_event_loop_interrupt(anjay_t *anjay)
bool anjay_all_connections_failed(anjay_t *anjay)
uint16_t anjay_iid_t
Definition core.h:1185
bool anjay_ongoing_registration_exists(anjay_t *anjay)
bool anjay_transport_has_unsent_notifications(anjay_t *anjay, anjay_transport_set_t transport_set)
int anjay_transport_enter_offline(anjay_t *anjay, anjay_transport_set_t transport_set)
anjay_security_config_t anjay_security_config_pkix(anjay_t *anjay)
avs_error_t anjay_update_dtls_handshake_timeouts(anjay_t *anjay, avs_net_dtls_handshake_timeouts_t dtls_handshake_timeouts)
bool anjay_has_unsent_notifications(anjay_t *anjay, anjay_ssid_t ssid)
anjay_server_conn_status_t anjay_get_server_connection_status(anjay_t *anjay, anjay_ssid_t ssid)
int anjay_transport_set_online(anjay_t *anjay, anjay_transport_set_t transport_set)
int anjay_server_schedule_reconnect(anjay_t *anjay, anjay_ssid_t ssid)
struct anjay_struct anjay_t
Definition core.h:45
anjay_queue_mode_preference_t
Definition core.h:1830
@ ANJAY_FORCE_ONLINE_MODE
Definition core.h:1865
@ ANJAY_PREFER_QUEUE_MODE
Definition core.h:1846
@ ANJAY_FORCE_QUEUE_MODE
Definition core.h:1839
@ ANJAY_PREFER_ONLINE_MODE
Definition core.h:1855
anjay_t * anjay_new_from_core_persistence(const anjay_configuration_t *config, avs_stream_t *in_stream)
int anjay_transport_exit_offline(anjay_t *anjay, anjay_transport_set_t transport_set)
avs_time_real_t anjay_transport_next_planned_notify_trigger(anjay_t *anjay, anjay_transport_set_t transport_set)
uint16_t anjay_ssid_t
Definition core.h:31
avs_time_real_t anjay_next_planned_notify_trigger(anjay_t *anjay, anjay_ssid_t ssid)
int anjay_event_loop_run(anjay_t *anjay, avs_time_duration_t max_wait_time)
avs_error_t anjay_update_transport_tx_params(anjay_t *anjay, anjay_transport_set_t transport_set, const avs_coap_udp_tx_params_t *tx_params)
const anjay_transport_set_t ANJAY_TRANSPORT_SET_UDP
const anjay_transport_set_t ANJAY_TRANSPORT_SET_IP
avs_error_t anjay_get_server_last_registration_time(anjay_t *anjay, anjay_ssid_t ssid, avs_time_real_t *out_time)
avs_error_t anjay_get_server_last_communication_time(anjay_t *anjay, anjay_ssid_t ssid, avs_time_real_t *out_time)
int anjay_disable_server(anjay_t *anjay, anjay_ssid_t ssid)
const char * anjay_est_engine_cacert_address_gen_t(void *arg, const void *x509_der_data, size_t x509_der_data_size)
Definition core.h:289
AVS_LIST[avs_net_socket_t *const ] anjay_get_sockets(anjay_t *anjay)
avs_time_real_t anjay_transport_next_planned_lifecycle_operation(anjay_t *anjay, anjay_transport_set_t transport_set)
void anjay_server_connection_status_cb_t(void *arg, anjay_t *anjay, anjay_ssid_t ssid, anjay_server_conn_status_t status)
Definition core.h:408
int anjay_schedule_registration_update(anjay_t *anjay, anjay_ssid_t ssid)
int anjay_serve(anjay_t *anjay, avs_net_socket_t *ready_socket)
void anjay_sched_run(anjay_t *anjay)
int anjay_schedule_register(anjay_t *anjay, anjay_ssid_t ssid)
AVS_LIST[const anjay_socket_entry_t] anjay_get_socket_entries(anjay_t *anjay)
bool anjay_transport_is_offline(anjay_t *anjay, anjay_transport_set_t transport_set)
int anjay_get_server_ssid_by_msisdn(anjay_t *anjay, const char *server_msisdn, anjay_ssid_t *out_ssid)
int anjay_schedule_bootstrap_request(anjay_t *anjay)
anjay_server_conn_status
Definition core.h:301
@ ANJAY_SERV_CONN_STATUS_INITIAL
Definition core.h:320
@ ANJAY_SERV_CONN_STATUS_REGISTERING
Definition core.h:341
@ ANJAY_SERV_CONN_STATUS_BOOTSTRAPPING
Definition core.h:331
@ ANJAY_SERV_CONN_STATUS_DEREGISTERING
Definition core.h:357
@ ANJAY_SERV_CONN_STATUS_INVALID
Definition core.h:306
@ ANJAY_SERV_CONN_STATUS_REREGISTERING
Definition core.h:382
@ ANJAY_SERV_CONN_STATUS_ERROR
Definition core.h:313
@ ANJAY_SERV_CONN_STATUS_UPDATING
Definition core.h:387
@ ANJAY_SERV_CONN_STATUS_REGISTERED
Definition core.h:346
@ ANJAY_SERV_CONN_STATUS_REG_FAILURE
Definition core.h:352
@ ANJAY_SERV_CONN_STATUS_SUSPENDING
Definition core.h:371
@ ANJAY_SERV_CONN_STATUS_DEREGISTERED
Definition core.h:365
@ ANJAY_SERV_CONN_STATUS_SUSPENDED
Definition core.h:376
@ ANJAY_SERV_CONN_STATUS_CONNECTING
Definition core.h:326
@ ANJAY_SERV_CONN_STATUS_BOOTSTRAPPED
Definition core.h:336
avs_sched_t * anjay_get_scheduler(anjay_t *anjay)
int anjay_enable_server(anjay_t *anjay, anjay_ssid_t ssid)
avs_error_t anjay_get_server_next_update_time(anjay_t *anjay, anjay_ssid_t ssid, avs_time_real_t *out_time)
int anjay_serve_any(anjay_t *anjay, avs_time_duration_t max_wait_time)
int anjay_security_config_from_dm(anjay_t *anjay, anjay_security_config_t *out_config, const char *uri)
int anjay_disable_server_with_timeout(anjay_t *anjay, anjay_ssid_t ssid, avs_time_duration_t timeout)
int anjay_event_loop_run_with_error_handling(anjay_t *anjay_locked, avs_time_duration_t max_wait_time)
avs_time_real_t anjay_registration_expiration_time_with_status(anjay_t *anjay, anjay_ssid_t ssid, anjay_registration_expiration_status_t *out_status)
int anjay_sched_time_to_next(anjay_t *anjay, avs_time_duration_t *out_delay)
int anjay_transport_schedule_reconnect(anjay_t *anjay, anjay_transport_set_t transport_set)
anjay_lwm2m_version_t
Definition core.h:123
@ ANJAY_LWM2M_VERSION_1_1
Definition core.h:135
@ ANJAY_LWM2M_VERSION_1_0
Definition core.h:128
const char * anjay_get_version(void)
struct anjay_configuration anjay_configuration_t
avs_error_t anjay_est_state_restore(anjay_t *anjay, avs_stream_t *out_stream)
int anjay_sched_calculate_wait_time_ms(anjay_t *anjay, int limit_ms)
avs_error_t anjay_est_state_persist(anjay_t *anjay, avs_stream_t *out_stream)
const anjay_transport_set_t ANJAY_TRANSPORT_SET_ALL
uint16_t anjay_riid_t
Definition core.h:1191
bool use_connection_id
Definition core.h:591
bool enable_self_notify
Definition core.h:615
size_t in_buffer_size
Definition core.h:459
avs_net_socket_configuration_t socket_config
Definition core.h:487
bool prefer_multipart_sms
Definition core.h:750
size_t msg_cache_size
Definition core.h:478
avs_time_duration_t coap_tcp_request_timeout
Definition core.h:677
size_t out_buffer_size
Definition core.h:468
void * server_connection_status_cb_arg
Definition core.h:917
const anjay_lwm2m_version_config_t * lwm2m_version_config
Definition core.h:772
void * est_engine_cacerts_address_gen_cb_arg
Definition core.h:895
anjay_nidd_driver_t * nidd_driver
Definition core.h:722
avs_crypto_certificate_chain_info_t trust_store_certs
Definition core.h:808
bool use_system_trust_store
Definition core.h:792
bool confirmable_notifications
Definition core.h:541
avs_crypto_prng_ctx_t * prng_ctx
Definition core.h:651
const avs_coap_udp_tx_params_t * udp_tx_params
Definition core.h:499
bool prefer_hierarchical_formats
Definition core.h:585
avs_crypto_cert_revocation_list_info_t trust_store_crls
Definition core.h:824
bool update_immediately_on_dm_change
Definition core.h:606
bool disable_legacy_server_initiated_bootstrap
Definition core.h:558
anjay_est_cacerts_policy_t est_cacerts_policy
Definition core.h:859
size_t coap_tcp_max_options_size
Definition core.h:668
const char * endpoint_name
Definition core.h:440
avs_net_ssl_version_t dtls_version
Definition core.h:452
avs_net_socket_tls_ciphersuites_t default_tls_ciphersuites
Definition core.h:639
const avs_coap_udp_tx_params_t * sms_tx_params
Definition core.h:692
const char * local_msisdn
Definition core.h:739
const avs_net_dtls_handshake_timeouts_t * udp_dtls_hs_tx_params
Definition core.h:535
const char * est_engine_key_address
Definition core.h:869
anjay_est_engine_cacert_address_gen_t * est_engine_cacerts_address_gen_cb
Definition core.h:886
bool rebuild_client_cert_chain
Definition core.h:837
anjay_server_connection_status_cb_t * server_connection_status_cb
Definition core.h:906
uint16_t udp_listen_port
Definition core.h:447
bool connection_error_is_registration_failure
Definition core.h:627
const char * est_engine_cert_address
Definition core.h:877
const avs_coap_udp_tx_params_t * nidd_tx_params
Definition core.h:706
const anjay_est_reenroll_config_t * est_reenroll_config
Definition core.h:852
avs_ssl_additional_configuration_clb_t * additional_tls_config_clb
Definition core.h:658
size_t stored_notification_limit
Definition core.h:574
anjay_smsdrv_t * sms_driver
Definition core.h:714
double nominal_usage
Definition core.h:187
avs_time_duration_t max_margin
Definition core.h:215
bool enable
Definition core.h:158
anjay_lwm2m_version_t minimum_version
Definition core.h:142
anjay_lwm2m_version_t maximum_version
Definition core.h:148
avs_net_security_info_t security_info
Definition core.h:1910
const char * server_name_indication
Definition core.h:1934
avs_net_socket_tls_ciphersuites_t tls_ciphersuites
Definition core.h:1925
const avs_net_socket_dane_tlsa_record_t * dane_tlsa_record
Definition core.h:1916
bool queue_mode
Definition core.h:1129
anjay_ssid_t ssid
Definition core.h:1115
anjay_socket_transport_t transport
Definition core.h:1103
avs_net_socket_t * socket
Definition core.h:1095
bool sms
Definition core.h:1660
bool tcp
Definition core.h:1658
bool udp
Definition core.h:1657
bool nidd
Definition core.h:1663