20 #ifndef OC_CONNECTIVITY_H
21 #define OC_CONNECTIVITY_H
23 #include "messaging/coap/conf.h"
24 #include "oc_config.h"
29 #include "util/oc_process.h"
36 #ifndef OC_DYNAMIC_ALLOCATION
37 #ifndef OC_MAX_APP_DATA_SIZE
38 #error "Set OC_MAX_APP_DATA_SIZE in oc_config.h"
41 #ifdef OC_BLOCK_WISE_SET_MTU
43 #if OC_BLOCK_WISE_SET_MTU < (COAP_MAX_HEADER_SIZE + 16)
44 #error "OC_BLOCK_WISE_SET_MTU must be >= (COAP_MAX_HEADER_SIZE + 2^4)"
46 #define OC_MAX_BLOCK_SIZE (OC_BLOCK_WISE_SET_MTU - COAP_MAX_HEADER_SIZE)
47 #define OC_BLOCK_SIZE \
48 (OC_MAX_BLOCK_SIZE < 32 \
50 : (OC_MAX_BLOCK_SIZE < 64 \
52 : (OC_MAX_BLOCK_SIZE < 128 \
54 : (OC_MAX_BLOCK_SIZE < 256 \
56 : (OC_MAX_BLOCK_SIZE < 512 \
58 : (OC_MAX_BLOCK_SIZE < 1024 \
60 : (OC_MAX_BLOCK_SIZE < 2048 ? 1024 : 2048)))))))
62 #define OC_BLOCK_SIZE (OC_MAX_APP_DATA_SIZE)
68 OC_PDU_SIZE = (OC_MAX_APP_DATA_SIZE + 2 * COAP_MAX_HEADER_SIZE)
70 OC_PDU_SIZE = (OC_MAX_APP_DATA_SIZE + COAP_MAX_HEADER_SIZE)
75 OC_PDU_SIZE = (OC_BLOCK_SIZE + 2 * COAP_MAX_HEADER_SIZE)
77 OC_PDU_SIZE = (OC_BLOCK_SIZE + COAP_MAX_HEADER_SIZE)
80 OC_PDU_SIZE = (OC_BLOCK_SIZE + COAP_MAX_HEADER_SIZE)
94 #define OC_PDU_SIZE (oc_get_max_app_data_size() + 2 * COAP_MAX_HEADER_SIZE)
96 #define OC_PDU_SIZE (oc_get_max_app_data_size() + COAP_MAX_HEADER_SIZE)
99 #define OC_PDU_SIZE (oc_get_mtu_size())
101 #define OC_BLOCK_SIZE (oc_get_block_size())
102 #define OC_MAX_APP_DATA_SIZE (oc_get_max_app_data_size())
107 struct oc_message_s *next;
108 struct oc_memb *pool;
113 #ifdef OC_DYNAMIC_ALLOCATION
114 #ifdef OC_INOUT_BUFFER_SIZE
115 uint8_t data[OC_INOUT_BUFFER_SIZE];
120 uint8_t data[OC_PDU_SIZE];
126 void (*soft_ref_cb)(
struct oc_message_s *);
200 void oc_dns_clear_cache(
void);
CoAP message buffer setting implementation.
oc_endpoint_t * oc_connectivity_get_endpoints(size_t device)
retrieve list of endpoints for the device
int oc_connectivity_set_port(uint32_t port)
set the default (unicast) CoAp port to another value
void oc_connectivity_unsubscribe_mcast_ipv6(oc_endpoint_t *address)
unsubscribe to a multicast address
int oc_send_buffer(oc_message_t *message)
send buffer
tcp_csm_state_t oc_tcp_get_csm_state(oc_endpoint_t *endpoint)
retrieve the cms state
void oc_connectivity_end_session(oc_endpoint_t *endpoint)
end session for the specific endpoint
tcp_csm_state_t
The CSM states.
void oc_connectivity_shutdown(size_t device)
shut down the connectivity for device at device index
void handle_session_event_callback(const oc_endpoint_t *endpoint, oc_session_state_t state)
the session callback
int oc_connectivity_init(size_t device)
initialize the connectivity (e.g.
int oc_tcp_update_csm_state(oc_endpoint_t *endpoint, tcp_csm_state_t csm)
update the csm state on the tcp connection
void handle_network_interface_event_callback(oc_interface_event_t event)
the callback function for an network change
oc_message_t * oc_get_incoming_message_with_ptr(uint8_t *data)
get buffer of a received message
void oc_send_discovery_request(oc_message_t *message)
send discovery request
void oc_connectivity_subscribe_mcast_ipv6(oc_endpoint_t *address)
Subscribe to a multicast address.
int oc_dns_lookup(const char *domain, oc_string_t *addr, enum transport_flags flags)
DNS look up.
end point implementation, e.g.
transport_flags
transport flags (bit map) these flags are used to determine what to do on communication level
platform abstraction of logging
network events (network interfaces going up/down)
oc_interface_event_t
network events
oc_session_state_t
session states