KNX IoT
KNX IoT Point API stack implementation
oc_connectivity.h File Reference

platform abstraction of networking More...

#include "messaging/coap/conf.h"
#include "oc_config.h"
#include "oc_endpoint.h"
#include "oc_network_events.h"
#include "oc_session_events.h"
#include "port/oc_log.h"
#include "util/oc_process.h"
#include <stdint.h>
#include "oc_buffer_settings.h"

Go to the source code of this file.

Macros

#define OC_BLOCK_SIZE   (oc_get_block_size())
 
#define OC_MAX_APP_DATA_SIZE   (oc_get_max_app_data_size())
 
#define OC_PDU_SIZE   (oc_get_max_app_data_size() + COAP_MAX_HEADER_SIZE)
 

Enumerations

enum  tcp_csm_state_t { CSM_NONE , CSM_SENT , CSM_DONE , CSM_ERROR = 255 }
 The CSM states. More...
 

Functions

void handle_network_interface_event_callback (oc_interface_event_t event)
 the callback function for an network change More...
 
void handle_session_event_callback (const oc_endpoint_t *endpoint, oc_session_state_t state)
 the session callback More...
 
void oc_connectivity_end_session (oc_endpoint_t *endpoint)
 end session for the specific endpoint More...
 
oc_endpoint_toc_connectivity_get_endpoints (size_t device)
 retrieve list of endpoints for the device More...
 
int oc_connectivity_init (size_t device)
 initialize the connectivity (e.g. More...
 
int oc_connectivity_set_port (uint32_t port)
 set the default (unicast) CoAp port to another value More...
 
void oc_connectivity_shutdown (size_t device)
 shut down the connectivity for device at device index More...
 
void oc_connectivity_subscribe_mcast_ipv6 (oc_endpoint_t *address)
 Subscribe to a multicast address. More...
 
void oc_connectivity_unsubscribe_mcast_ipv6 (oc_endpoint_t *address)
 unsubscribe to a multicast address More...
 
int oc_dns_lookup (const char *domain, oc_string_t *addr, enum transport_flags flags)
 DNS look up. More...
 
oc_message_t * oc_get_incoming_message_with_ptr (uint8_t *data)
 get buffer of a received message More...
 
int oc_send_buffer (oc_message_t *message)
 send buffer More...
 
void oc_send_discovery_request (oc_message_t *message)
 send discovery request More...
 
tcp_csm_state_t oc_tcp_get_csm_state (oc_endpoint_t *endpoint)
 retrieve the cms state More...
 
int oc_tcp_update_csm_state (oc_endpoint_t *endpoint, tcp_csm_state_t csm)
 update the csm state on the tcp connection More...
 

Detailed Description

platform abstraction of networking

Definition in file oc_connectivity.h.

Enumeration Type Documentation

◆ tcp_csm_state_t

The CSM states.

Enumerator
CSM_NONE 

None.

CSM_SENT 

Send.

CSM_DONE 

Done.

CSM_ERROR 

Error.

Definition at line 251 of file oc_connectivity.h.

251  {
252  CSM_NONE,
253  CSM_SENT,
254  CSM_DONE,
255  CSM_ERROR = 255
tcp_csm_state_t
The CSM states.
@ CSM_NONE
None.
@ CSM_SENT
Send.
@ CSM_DONE
Done.
@ CSM_ERROR
Error.

Function Documentation

◆ handle_network_interface_event_callback()

void handle_network_interface_event_callback ( oc_interface_event_t  event)

the callback function for an network change

Parameters
eventthe network event

◆ handle_session_event_callback()

void handle_session_event_callback ( const oc_endpoint_t endpoint,
oc_session_state_t  state 
)

the session callback

Parameters
endpointthe endpoint for the session
statethe state of the session

◆ oc_connectivity_end_session()

void oc_connectivity_end_session ( oc_endpoint_t endpoint)

end session for the specific endpoint

Parameters
endpointthe endpoint to close the session for

◆ oc_connectivity_get_endpoints()

oc_endpoint_t* oc_connectivity_get_endpoints ( size_t  device)

retrieve list of endpoints for the device

Parameters
devicethe device index
Returns
oc_endpoint_t* list of endpoints

◆ oc_connectivity_init()

int oc_connectivity_init ( size_t  device)

initialize the connectivity (e.g.

open sockets) for the device

Parameters
devicethe device index
Returns
int 0 = success

◆ oc_connectivity_set_port()

int oc_connectivity_set_port ( uint32_t  port)

set the default (unicast) CoAp port to another value

Note: must be called before oc_connectivity_init

Parameters
portthe port number to change
Returns
int 0 = success

◆ oc_connectivity_shutdown()

void oc_connectivity_shutdown ( size_t  device)

shut down the connectivity for device at device index

Parameters
devicethe device index

◆ oc_connectivity_subscribe_mcast_ipv6()

void oc_connectivity_subscribe_mcast_ipv6 ( oc_endpoint_t address)

Subscribe to a multicast address.

Parameters
addressendpoint describing the address to subscribe to. The device & addr.ipv6.address members must be set for the function call to be valid.

◆ oc_connectivity_unsubscribe_mcast_ipv6()

void oc_connectivity_unsubscribe_mcast_ipv6 ( oc_endpoint_t address)

unsubscribe to a multicast address

Parameters
addressendpoint describing the address to un subscribe from. The device & addr.ipv6.address members must be set for the function call to be valid.

◆ oc_dns_lookup()

int oc_dns_lookup ( const char *  domain,
oc_string_t *  addr,
enum transport_flags  flags 
)

DNS look up.

Parameters
domainthe url
addrthe address
flagsthe transport flags
Returns
int 0 = success

◆ oc_get_incoming_message_with_ptr()

oc_message_t* oc_get_incoming_message_with_ptr ( uint8_t *  data)

get buffer of a received message

Parameters
datapointer to data within a received message
Returns
oc_message_t* the buffer containing the data, or NULL if such a buffer could not be found

◆ oc_send_buffer()

int oc_send_buffer ( oc_message_t *  message)

send buffer

Parameters
messagethe message to send
Returns
int 0 = success

◆ oc_send_discovery_request()

void oc_send_discovery_request ( oc_message_t *  message)

send discovery request

Parameters
messagethe message

◆ oc_tcp_get_csm_state()

tcp_csm_state_t oc_tcp_get_csm_state ( oc_endpoint_t endpoint)

retrieve the cms state

Parameters
endpointthe endpoint
Returns
tcp_csm_state_t the cms state

◆ oc_tcp_update_csm_state()

int oc_tcp_update_csm_state ( oc_endpoint_t endpoint,
tcp_csm_state_t  csm 
)

update the csm state on the tcp connection

Parameters
endpointthe endpoint
csmthe cms state
Returns
int 0 = success