libcoap 4.3.5-develop-72190a8
|
Handling of network addresses. More...
#include "coap3/coap_libcoap_build.h"
Go to the source code of this file.
Macros | |
#define | COAP_BCST_CNT 15 |
#define | COAP_BCST_REFRESH_SECS 30 |
Functions | |
uint16_t | coap_address_get_port (const coap_address_t *addr) |
Returns the port from addr in host byte order. | |
void | coap_address_set_port (coap_address_t *addr, uint16_t port) |
Set the port field of addr to port (in host byte order). | |
int | coap_address_equals (const coap_address_t *a, const coap_address_t *b) |
Compares given address objects a and b . | |
int | coap_is_af_unix (const coap_address_t *a) |
Checks if given address a denotes a AF_UNIX address. | |
int | coap_is_mcast (const coap_address_t *a) |
Checks if given address a denotes a multicast address. | |
int | coap_is_bcast (const coap_address_t *a) |
Checks if given address a denotes a broadcast address. | |
void | coap_address_init (coap_address_t *addr) |
Resets the given coap_address_t object addr to its default values. | |
int | coap_address_set_unix_domain (coap_address_t *addr, const uint8_t *host, size_t host_len) |
Copy the parsed unix domain host into coap_address_t structure translating %2F into / on the way. | |
static void | update_port (coap_address_t *addr, uint16_t port, uint16_t default_port, int update_port0) |
uint32_t | coap_get_available_scheme_hint_bits (int have_pki_psk, int ws_check, coap_proto_t use_unix_proto) |
Determine and set up scheme_hint_bits for a server that can be used in a call to coap_resolve_address_info(). | |
static coap_addr_info_t * | get_coap_addr_info (coap_uri_scheme_t scheme) |
static void | update_coap_addr_port (coap_uri_scheme_t scheme, coap_addr_info_t *info, uint16_t port, uint16_t secure_port, uint16_t ws_port, uint16_t ws_secure_port, coap_resolve_type_t type) |
coap_addr_info_t * | coap_resolve_address_info (const coap_str_const_t *address, uint16_t port, uint16_t secure_port, uint16_t ws_port, uint16_t ws_secure_port, int ai_hints_flags, int scheme_hint_bits, coap_resolve_type_t type) |
Resolve the specified address into a set of coap_address_t that can be used to bind() (local) or connect() (remote) to. | |
void | coap_free_address_info (coap_addr_info_t *info) |
Free off the one or more linked sets of coap_addr_info_t returned from coap_resolve_address_info(). | |
void | coap_address_copy (coap_address_t *dst, const coap_address_t *src) |
int | _coap_address_isany_impl (const coap_address_t *a) |
Handling of network addresses.
Definition in file coap_address.c.
#define COAP_BCST_CNT 15 |
Definition at line 149 of file coap_address.c.
#define COAP_BCST_REFRESH_SECS 30 |
Definition at line 154 of file coap_address.c.
int _coap_address_isany_impl | ( | const coap_address_t * | a | ) |
void coap_address_copy | ( | coap_address_t * | dst, |
const coap_address_t * | src | ||
) |
int coap_address_equals | ( | const coap_address_t * | a, |
const coap_address_t * | b | ||
) |
Compares given address objects a
and b
.
This function returns 1
if addresses are equal, 0
otherwise. The parameters a
and b
must not be NULL
;
Definition at line 81 of file coap_address.c.
uint16_t coap_address_get_port | ( | const coap_address_t * | addr | ) |
Returns the port from addr
in host byte order.
Definition at line 44 of file coap_address.c.
void coap_address_init | ( | coap_address_t * | addr | ) |
Resets the given coap_address_t object addr
to its default values.
In particular, the member size must be initialized to the available size for storing addresses.
addr | The coap_address_t object to initialize. |
Definition at line 253 of file coap_address.c.
void coap_address_set_port | ( | coap_address_t * | addr, |
uint16_t | port | ||
) |
Set the port field of addr
to port
(in host byte order).
Definition at line 62 of file coap_address.c.
int coap_address_set_unix_domain | ( | coap_address_t * | addr, |
const uint8_t * | host, | ||
size_t | host_len | ||
) |
Copy the parsed unix domain host into coap_address_t structure translating %2F into / on the way.
All other fields set as appropriate.
addr | coap_address_t to update. |
host | The parsed host from the CoAP URI with potential %2F encoding. |
host_len | The length of the parsed host from the CoAP URI with potential %2F encoding. |
1
success, 0
failure. Definition at line 263 of file coap_address.c.
void coap_free_address_info | ( | coap_addr_info_t * | info_list | ) |
Free off the one or more linked sets of coap_addr_info_t returned from coap_resolve_address_info().
info_list | The set of coap_addr_info_t to free off. |
Definition at line 790 of file coap_address.c.
uint32_t coap_get_available_scheme_hint_bits | ( | int | have_pki_psk, |
int | ws_check, | ||
coap_proto_t | use_unix_proto | ||
) |
Determine and set up scheme_hint_bits for a server that can be used in a call to coap_resolve_address_info().
have_pki_psk | Set to 1 if PSK/PKI information is known else 0 . |
ws_check | Set to 1 is WebSockets is to be included in the list else 0 . |
use_unix_proto | Set to the appropriate protocol to use for Unix sockets, else set to COAP_PROTO_NONE for INET / INET6 sockets. |
0
if none) suitable for passing to coap_resolve_address_info(). Definition at line 311 of file coap_address.c.
int coap_is_af_unix | ( | const coap_address_t * | a | ) |
Checks if given address a
denotes a AF_UNIX address.
This function returns 1
if a
is of type AF_UNIX, 0
otherwise.
Definition at line 109 of file coap_address.c.
int coap_is_bcast | ( | const coap_address_t * | a | ) |
Checks if given address a
denotes a broadcast address.
This function returns 1
if a
is broadcast, 0
otherwise.
Definition at line 164 of file coap_address.c.
int coap_is_mcast | ( | const coap_address_t * | a | ) |
Checks if given address a
denotes a multicast address.
This function returns 1
if a
is multicast, 0
otherwise.
Definition at line 119 of file coap_address.c.
coap_addr_info_t * coap_resolve_address_info | ( | const coap_str_const_t * | address, |
uint16_t | port, | ||
uint16_t | secure_port, | ||
uint16_t | ws_port, | ||
uint16_t | ws_secure_port, | ||
int | ai_hints_flags, | ||
int | scheme_hint_bits, | ||
coap_resolve_type_t | type | ||
) |
Resolve the specified address
into a set of coap_address_t that can be used to bind() (local) or connect() (remote) to.
address | The Address to resolve. |
port | The unsecured protocol port to use. |
secure_port | The secured protocol port to use. |
ws_port | The unsecured WebSockets port to use. |
ws_secure_port | The secured WebSockets port to use. |
ai_hints_flags | AI_* Hint flags to use for internal getaddrinfo(). |
scheme_hint_bits | Which schemes to return information for. One or more of COAP_URI_SCHEME_*_BIT or'd together. |
type | COAP_ADDRESS_TYPE_LOCAL or COAP_ADDRESS_TYPE_REMOTE |
NULL
if error. Definition at line 486 of file coap_address.c.
|
static |
Definition at line 383 of file coap_address.c.
|
static |
Definition at line 442 of file coap_address.c.
|
static |
Definition at line 296 of file coap_address.c.