IoTivity-Lite
oc_endpoint.h File Reference
#include "oc_export.h"
#include "oc_helpers.h"
#include "oc_uuid.h"
#include "util/oc_compiler.h"
#include <stdbool.h>

Data Structures

struct  oc_endpoint_t
 the endpoint information More...
 
struct  oc_ipv4_addr_t
 ipv4 data structure More...
 
struct  oc_ipv6_addr_t
 ipv6 data structure More...
 
struct  oc_le_addr_t
 ble address data structure More...
 

Macros

#define oc_make_ipv4_endpoint(__name__, __flags__, __port__, ...)
 
#define oc_make_ipv6_endpoint(__name__, __flags__, __port__, ...)
 

Typedefs

typedef struct oc_endpoint_t oc_endpoint_t
 the endpoint information More...
 
typedef enum transport_flags transport_flags
 transport flags (bit map) More...
 

Enumerations

enum  ocf_version_t { OCF_VER_1_0_0 = 2048 , OIC_VER_1_1_0 = 2112 }
 
enum  transport_flags {
  DISCOVERY = 1 << 0 , SECURED = 1 << 1 , IPV4 = 1 << 2 , IPV6 = 1 << 3 ,
  TCP = 1 << 4 , GATT = 1 << 5 , MULTICAST = 1 << 6 , ACCEPTED = 1 << 7
}
 transport flags (bit map) More...
 

Functions

int oc_endpoint_compare (const oc_endpoint_t *ep1, const oc_endpoint_t *ep2)
 compare endpoint More...
 
int oc_endpoint_compare_address (const oc_endpoint_t *ep1, const oc_endpoint_t *ep2)
 compare address of the endpoint More...
 
void oc_endpoint_copy (oc_endpoint_t *dst, const oc_endpoint_t *src)
 copy endpoint More...
 
bool oc_endpoint_is_empty (const oc_endpoint_t *endpoint)
 check if all fields of the endpoint struct are empty More...
 
int oc_endpoint_list_copy (oc_endpoint_t **dst, const oc_endpoint_t *src)
 copy list of endpoints More...
 
void oc_endpoint_list_free (oc_endpoint_t *eps)
 deallocate a linked list of endpoints More...
 
void oc_endpoint_set_di (oc_endpoint_t *endpoint, const oc_uuid_t *di)
 set device identifier (di) for the endpoint More...
 
void oc_endpoint_set_local_address (oc_endpoint_t *ep, unsigned interface_index)
 set local address on endpoint from the first device endpoint with matching flags and interface index More...
 
int oc_endpoint_string_parse_path (const oc_string_t *endpoint_str, oc_string_t *path)
 parse path component (ie. More...
 
int oc_endpoint_to_cstring (const oc_endpoint_t *endpoint, char *buffer, size_t buffer_size)
 convert the endpoint to a human readable string (e.g. More...
 
int oc_endpoint_to_string (const oc_endpoint_t *endpoint, oc_string_t *endpoint_str)
 convert the endpoint to a human readable string (e.g. More...
 
void oc_free_endpoint (oc_endpoint_t *endpoint)
 free endpoint More...
 
int oc_ipv6_endpoint_is_link_local (const oc_endpoint_t *endpoint)
 is endpoint (ipv6) link local More...
 
oc_endpoint_toc_new_endpoint (void)
 create new endpoint More...
 
int oc_string_to_endpoint (const oc_string_t *endpoint_str, oc_endpoint_t *endpoint, oc_string_t *uri)
 string to endpoint More...
 

Macro Definition Documentation

◆ oc_make_ipv4_endpoint

#define oc_make_ipv4_endpoint (   __name__,
  __flags__,
  __port__,
  ... 
)
Value:
oc_endpoint_t __name__ = { .flags = __flags__, \
.addr.ipv4 = { .port = __port__, \
.address = { __VA_ARGS__ } } }
the endpoint information
Definition: oc_endpoint.h:91
transport_flags flags
the transport flags
Definition: oc_endpoint.h:94

◆ oc_make_ipv6_endpoint

#define oc_make_ipv6_endpoint (   __name__,
  __flags__,
  __port__,
  ... 
)
Value:
oc_endpoint_t __name__ = { .flags = __flags__, \
.addr.ipv6 = { .port = __port__, \
.address = { __VA_ARGS__ } } }

Typedef Documentation

◆ oc_endpoint_t

typedef struct oc_endpoint_t oc_endpoint_t

the endpoint information

◆ transport_flags

transport flags (bit map)

Enumeration Type Documentation

◆ transport_flags

transport flags (bit map)

Enumerator
DISCOVERY 

used for discovery

SECURED 

secure communication

IPV4 

ipv4 communication

IPV6 

ipv6 communication

TCP 

tcp communication

GATT 

BLE GATT communication.

MULTICAST 

multicast enabled

ACCEPTED 

accepted

Function Documentation

◆ oc_endpoint_compare()

int oc_endpoint_compare ( const oc_endpoint_t ep1,
const oc_endpoint_t ep2 
)

compare endpoint

Parameters
ep1endpoint 1 to compare
ep2endpoint 2 to compare
Returns
int 0 = equal

◆ oc_endpoint_compare_address()

int oc_endpoint_compare_address ( const oc_endpoint_t ep1,
const oc_endpoint_t ep2 
)

compare address of the endpoint

Parameters
ep1endpoint 1 to compare
ep2endpoint 2 to compare
Returns
int 0 = equal

◆ oc_endpoint_copy()

void oc_endpoint_copy ( oc_endpoint_t dst,
const oc_endpoint_t src 
)

copy endpoint

Parameters
dstdestination endpoint (cannot be NULL)
srcsource endpoint (cannot be NULL)

◆ oc_endpoint_is_empty()

bool oc_endpoint_is_empty ( const oc_endpoint_t endpoint)

check if all fields of the endpoint struct are empty

Parameters
endpointendpoint to check (cannot be NULL)
Returns
true all fields of the endpoint are empty
false otherwise

◆ oc_endpoint_list_copy()

int oc_endpoint_list_copy ( oc_endpoint_t **  dst,
const oc_endpoint_t src 
)

copy list of endpoints

Parameters
dstdestination list of endpoints (cannot be NULL)
srcsource list of endpoints
Returns
0 on success
-1 on failure

◆ oc_endpoint_list_free()

void oc_endpoint_list_free ( oc_endpoint_t eps)

deallocate a linked list of endpoints

Parameters
epslinked list to deallocate

◆ oc_endpoint_set_di()

void oc_endpoint_set_di ( oc_endpoint_t endpoint,
const oc_uuid_t *  di 
)

set device identifier (di) for the endpoint

Parameters
endpointendpoint (cannot be NULL)
didevice identifier (cannot be NULL)

◆ oc_endpoint_set_local_address()

void oc_endpoint_set_local_address ( oc_endpoint_t ep,
unsigned  interface_index 
)

set local address on endpoint from the first device endpoint with matching flags and interface index

Parameters
[in,out]epthe endpoint (cannot be NULL)
interface_indexthe interface index

◆ oc_endpoint_string_parse_path()

int oc_endpoint_string_parse_path ( const oc_string_t endpoint_str,
oc_string_t path 
)

parse path component (ie.

the part after the first '/') of a uri

Parameters
endpoint_struri to parse
[out]pathoutput variable
Returns
0 on success
-1 on failure

◆ oc_endpoint_to_cstring()

int oc_endpoint_to_cstring ( const oc_endpoint_t endpoint,
char *  buffer,
size_t  buffer_size 
)

convert the endpoint to a human readable string (e.g.

"coaps://[fe::22]:1234")

Parameters
endpointthe endpoint (cannot be NULL)
bufferoutput buffer (cannot be NULL)
buffer_sizesize of output buffer
Returns
number of written bytes, -1 for error

◆ oc_endpoint_to_string()

int oc_endpoint_to_string ( const oc_endpoint_t endpoint,
oc_string_t endpoint_str 
)

convert the endpoint to a human readable string (e.g.

"coaps://[fe::22]:1234")

Parameters
endpointthe endpoint
endpoint_strendpoint as human readable string
Returns
int 0 success

◆ oc_free_endpoint()

void oc_free_endpoint ( oc_endpoint_t endpoint)

free endpoint

Parameters
endpointendpoint to be freed

◆ oc_ipv6_endpoint_is_link_local()

int oc_ipv6_endpoint_is_link_local ( const oc_endpoint_t endpoint)

is endpoint (ipv6) link local

Parameters
endpointthe endpoint to check
Returns
int 0 = endpoint is link local

◆ oc_new_endpoint()

oc_endpoint_t* oc_new_endpoint ( void  )

create new endpoint

Returns
oc_endpoint_t* created new endpoint

◆ oc_string_to_endpoint()

int oc_string_to_endpoint ( const oc_string_t endpoint_str,
oc_endpoint_t endpoint,
oc_string_t uri 
)

string to endpoint

Parameters
endpoint_strthe endpoint as string (e.g. "coaps://[fe::22]:/blah")
endpointthe address part of the string
urithe uri part of the endpoint
Returns
int 0 success