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

end point implementation, e.g. More...

#include "oc_helpers.h"
#include "oc_uuid.h"
#include "messaging/coap/oscore_constants.h"

Go to the source code of this file.

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...
 

Macros

#define oc_make_ipv4_endpoint(__name__, __flags__, __port__, ...)
 
#define oc_make_ipv6_endpoint(__name__, __flags__, __port__, ...)
 
#define SERIAL_NUM_SIZE   (12)
 binary: 6 bytes: in hex: 12 bytes More...
 

Typedefs

typedef struct oc_endpoint_t oc_endpoint_t
 the endpoint information More...
 

Enumerations

enum  transport_flags {
  DISCOVERY = 1 << 0 , SECURED = 1 << 1 , IPV4 = 1 << 2 , IPV6 = 1 << 3 ,
  TCP = 1 << 4 , OSCORE = 1 << 5 , MULTICAST = 1 << 6 , ACCEPTED = 1 << 7 ,
  OSCORE_DECRYPTED = 1 << 8 , OSCORE_ENCRYPTED = 1 << 9
}
 transport flags (bit map) these flags are used to determine what to do on communication level 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, oc_endpoint_t *src)
 copy endpoint More...
 
void oc_endpoint_list_copy (oc_endpoint_t **dst, oc_endpoint_t *src)
 copy list of endpoint More...
 
void oc_endpoint_print (oc_endpoint_t *ep)
 print the (first) endpoint to std out More...
 
void oc_endpoint_set_auth_at_index (oc_endpoint_t *endpoint, int32_t index)
 set auth at index for the endpoint, e.g. More...
 
void oc_endpoint_set_local_address (oc_endpoint_t *ep, int interface_index)
 set interface index on the endpoint More...
 
int oc_endpoint_set_oscore_id (oc_endpoint_t *endpoint, char *oscore_id, int oscore_id_len)
 set the OSCORE identifier (SID) More...
 
int oc_endpoint_set_oscore_id_from_str (oc_endpoint_t *endpoint, char *oscore_str_id)
 set the OSCORE identifier (SID) More...
 
int oc_endpoint_string_parse_path (oc_string_t *endpoint_str, oc_string_t *path)
 parse endpoint More...
 
int oc_endpoint_to_string (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 (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 (oc_string_t *endpoint_str, oc_endpoint_t *endpoint, oc_string_t *uri)
 string to endpoint More...
 

Detailed Description

end point implementation, e.g.

IP(v6) addressing for sending & receiving data

Definition in file oc_endpoint.h.

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:78
enum transport_flags flags
the transport flags
Definition: oc_endpoint.h:81

Definition at line 110 of file oc_endpoint.h.

◆ oc_make_ipv6_endpoint

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

Definition at line 114 of file oc_endpoint.h.

◆ SERIAL_NUM_SIZE

#define SERIAL_NUM_SIZE   (12)

binary: 6 bytes: in hex: 12 bytes

Definition at line 72 of file oc_endpoint.h.

Typedef Documentation

◆ oc_endpoint_t

typedef struct oc_endpoint_t oc_endpoint_t

the endpoint information

Enumeration Type Documentation

◆ transport_flags

transport flags (bit map) these flags are used to determine what to do on communication level

Enumerator
DISCOVERY 

used for discovery

SECURED 

secure communication

IPV4 

ipv4 communication

IPV6 

ipv6 communication

TCP 

tcp communication

OSCORE 

OSCORE communication.

MULTICAST 

multicast enabled

ACCEPTED 

accepted

OSCORE_DECRYPTED 

OSCORE decrypted message.

OSCORE_ENCRYPTED 

OSCORE encrypted message.

Definition at line 59 of file oc_endpoint.h.

59  {
60  DISCOVERY = 1 << 0,
61  SECURED = 1 << 1,
62  IPV4 = 1 << 2,
63  IPV6 = 1 << 3,
64  TCP = 1 << 4,
65  OSCORE = 1 << 5,
66  MULTICAST = 1 << 6,
67  ACCEPTED = 1 << 7,
68  OSCORE_DECRYPTED = 1 << 8,
69  OSCORE_ENCRYPTED = 1 << 9,
70 };
@ DISCOVERY
used for discovery
Definition: oc_endpoint.h:60
@ SECURED
secure communication
Definition: oc_endpoint.h:61
@ MULTICAST
multicast enabled
Definition: oc_endpoint.h:66
@ ACCEPTED
accepted
Definition: oc_endpoint.h:67
@ OSCORE_DECRYPTED
OSCORE decrypted message.
Definition: oc_endpoint.h:68
@ OSCORE_ENCRYPTED
OSCORE encrypted message.
Definition: oc_endpoint.h:69
@ TCP
tcp communication
Definition: oc_endpoint.h:64
@ OSCORE
OSCORE communication.
Definition: oc_endpoint.h:65
@ IPV4
ipv4 communication
Definition: oc_endpoint.h:62
@ IPV6
ipv6 communication
Definition: oc_endpoint.h:63

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,
oc_endpoint_t src 
)

copy endpoint

Parameters
dstthe destination endpoint
srcthe source endpoint

◆ oc_endpoint_list_copy()

void oc_endpoint_list_copy ( oc_endpoint_t **  dst,
oc_endpoint_t src 
)

copy list of endpoint

Parameters
dstthe destination list of endpoints
srcthe source list of endpoints

◆ oc_endpoint_print()

void oc_endpoint_print ( oc_endpoint_t ep)

print the (first) endpoint to std out

Parameters
ep

◆ oc_endpoint_set_auth_at_index()

void oc_endpoint_set_auth_at_index ( oc_endpoint_t endpoint,
int32_t  index 
)

set auth at index for the endpoint, e.g.

the used security context

Parameters
endpointthe end point
indexthe auth at index

◆ oc_endpoint_set_local_address()

void oc_endpoint_set_local_address ( oc_endpoint_t ep,
int  interface_index 
)

set interface index on the endpoint

Parameters
epthe endpoint
interface_indexthe interface index

◆ oc_endpoint_set_oscore_id()

int oc_endpoint_set_oscore_id ( oc_endpoint_t endpoint,
char *  oscore_id,
int  oscore_id_len 
)

set the OSCORE identifier (SID)

Parameters
endpointthe end point
oscore_idthe OSCORE id (SID) to use for encryption/decryption
oscore_id_lenthe length of the oscore_id
Returns
int 0 success

◆ oc_endpoint_set_oscore_id_from_str()

int oc_endpoint_set_oscore_id_from_str ( oc_endpoint_t endpoint,
char *  oscore_str_id 
)

set the OSCORE identifier (SID)

Parameters
endpointthe end point
oscore_str_idthe OSCORE id (as string in hex) to use for encryption/decryption
Returns
int 0 success

◆ oc_endpoint_string_parse_path()

int oc_endpoint_string_parse_path ( oc_string_t *  endpoint_str,
oc_string_t *  path 
)

parse endpoint

Parameters
endpoint_str
path
Returns
int

◆ oc_endpoint_to_string()

int oc_endpoint_to_string ( oc_endpoint_t endpoint,
oc_string_t *  endpoint_str 
)

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

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

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
endpointthe endpoint to be freed

◆ oc_ipv6_endpoint_is_link_local()

int oc_ipv6_endpoint_is_link_local ( 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 ( 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