IoTivity-Lite
oc_connectivity.h File Reference
#include "messaging/coap/conf.h"
#include "oc_config.h"
#include "oc_endpoint.h"
#include "oc_export.h"
#include "oc_network_events.h"
#include "oc_session_events.h"
#include "util/oc_atomic.h"
#include "util/oc_features.h"
#include "util/oc_memb.h"
#include "util/oc_process.h"
#include <stddef.h>
#include <stdint.h>
#include "oc_buffer_settings.h"

Macros

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

Typedefs

typedef struct oc_message_s oc_message_t
 

Enumerations

enum  oc_tcp_socket_error_t {
  OC_TCP_SOCKET_ERROR = -1 , OC_TCP_SOCKET_ERROR_NOT_CONNECTED = -2 , OC_TCP_SOCKET_ERROR_TIMEOUT = -3 , OC_TCP_SOCKET_ERROR_EXISTS_CONNECTING ,
  OC_TCP_SOCKET_ERROR_EXISTS_CONNECTED
}
 
enum  oc_tcp_socket_state_t { OC_TCP_SOCKET_STATE_CONNECTING = 1 , OC_TCP_SOCKET_STATE_CONNECTED }
 
enum  tcp_csm_state_t { CSM_NONE , CSM_SENT , CSM_DONE , CSM_ERROR = 255 }
 The CSM states. More...
 

Functions

void oc_connectivity_end_session (const oc_endpoint_t *endpoint)
 end TCP 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_dns_lookup (const char *domain, oc_string_t *addr, transport_flags flags)
 dns look up 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...
 
int oc_tcp_connection_state (const oc_endpoint_t *endpoint)
 Get state of TCP connection for given endpoint. More...
 
tcp_csm_state_t oc_tcp_get_csm_state (const oc_endpoint_t *endpoint)
 retrieve the csm state More...
 
int oc_tcp_update_csm_state (const oc_endpoint_t *endpoint, tcp_csm_state_t csm)
 update the csm state on the tcp connection More...
 

Enumeration Type Documentation

◆ tcp_csm_state_t

The CSM states.

Enumerator
CSM_NONE 

None.

CSM_SENT 

Send.

CSM_DONE 

Done.

CSM_ERROR 

Error.

Function Documentation

◆ oc_connectivity_end_session()

void oc_connectivity_end_session ( const oc_endpoint_t endpoint)

end TCP session for the specific endpoint.

Parameters
endpointthe endpoint to close the session for
Deprecated:
replaced by oc_close_session in v2.2.5.14

◆ 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_dns_lookup()

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

dns look up

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

◆ oc_send_buffer()

int oc_send_buffer ( oc_message_t *  message)

send buffer

Parameters
messagemessage to send
Returns
int >=0 number of sent bytes
int -1 on error

◆ oc_send_discovery_request()

void oc_send_discovery_request ( oc_message_t *  message)

send discovery request

Parameters
messagethe message

◆ oc_tcp_connection_state()

int oc_tcp_connection_state ( const oc_endpoint_t endpoint)

Get state of TCP connection for given endpoint.

Parameters
endpointthe endpoint (cannot be NULL)
Returns
OC_TCP_SOCKET_STATE_CONNECTED TCP connection exists and it is ongoing
OC_TCP_SOCKET_STATE_CONNECTING TCP connection is waiting to be established
-1 otherwise

◆ oc_tcp_get_csm_state()

tcp_csm_state_t oc_tcp_get_csm_state ( const oc_endpoint_t endpoint)

retrieve the csm state

Parameters
endpointthe endpoint
Returns
tcp_csm_state_t the cms state

◆ oc_tcp_update_csm_state()

int oc_tcp_update_csm_state ( const 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