#include "coap_config.h"
#include <errno.h>
#include "debug.h"
#include "mem.h"
#include "coap_io.h"
Go to the source code of this file.
|
static struct coap_endpoint_t * | coap_malloc_posix_endpoint (void) |
|
static void | coap_free_posix_endpoint (struct coap_endpoint_t *ep) |
|
coap_endpoint_t * | coap_new_endpoint (const coap_address_t *addr, int flags) |
|
void | coap_free_endpoint (coap_endpoint_t *ep) |
|
ssize_t | coap_network_send (struct coap_context_t *context UNUSED_PARAM, const coap_endpoint_t *local_interface, const coap_address_t *dst, unsigned char *data, size_t datalen) |
|
static coap_packet_t * | coap_malloc_packet (void) |
|
void | coap_free_packet (coap_packet_t *packet) |
| Releases the storage allocated for packet . More...
|
|
static size_t | coap_get_max_packetlength (const coap_packet_t *packet UNUSED_PARAM) |
|
void | coap_packet_populate_endpoint (coap_packet_t *packet, coap_endpoint_t *target) |
| Populate the coap_endpoint_t *target from the incoming packet's destination data. More...
|
|
void | coap_packet_copy_source (coap_packet_t *packet, coap_address_t *target) |
| Given an incoming packet, copy its source address into an address struct. More...
|
|
void | coap_packet_get_memmapped (coap_packet_t *packet, unsigned char **address, size_t *length) |
| Given a packet, set msg and msg_len to an address and length of the packet's data in memory. More...
|
|
static int | is_local_if (const coap_address_t *local, const coap_address_t *dst) |
| Checks if a message with destination address dst matches the local interface with address local . More...
|
|
ssize_t | coap_network_read (coap_endpoint_t *ep, coap_packet_t **packet) |
| Function interface for reading data. More...
|
|
§ INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 40 |
§ SIN6
#define SIN6 |
( |
|
A | ) |
((struct sockaddr_in6 *)(A)) |
§ SOL_IP
#define SOL_IP IPPROTO_IP |
§ UNUSED_PARAM
§ coap_free_endpoint()
§ coap_free_packet()
Releases the storage allocated for packet
.
Definition at line 372 of file coap_io.c.
§ coap_free_posix_endpoint()
§ coap_get_max_packetlength()
static size_t coap_get_max_packetlength |
( |
const coap_packet_t *packet |
UNUSED_PARAM | ) |
|
|
inlinestatic |
§ coap_malloc_packet()
§ coap_malloc_posix_endpoint()
§ coap_network_read()
Function interface for reading data.
This function returns the number of bytes that have been read, or a value less than zero on error. In case of an error, *packet
is set to NULL.
- Parameters
-
ep | The endpoint that is used for reading data from the network. |
packet | A result parameter where a pointer to the received packet structure is stored. The caller must call coap_free_packet to release the storage used by this packet. |
- Returns
- The number of bytes received on success, or a value less than zero on error.
Definition at line 425 of file coap_io.c.
§ coap_network_send()
§ coap_new_endpoint()
§ coap_packet_copy_source()
Given an incoming packet, copy its source address into an address struct.
Definition at line 402 of file coap_io.c.
§ coap_packet_get_memmapped()
void coap_packet_get_memmapped |
( |
coap_packet_t * |
packet, |
|
|
unsigned char ** |
address, |
|
|
size_t * |
length |
|
) |
| |
Given a packet, set msg and msg_len to an address and length of the packet's data in memory.
Definition at line 407 of file coap_io.c.
§ coap_packet_populate_endpoint()
Populate the coap_endpoint_t *target from the incoming packet's destination data.
This is usually used to copy a packet's data into a node's local_if member.
Definition at line 394 of file coap_io.c.
§ is_local_if()
Checks if a message with destination address dst
matches the local interface with address local
.
This function returns 1
if dst
is a valid match, and 0
otherwise.
Definition at line 419 of file coap_io.c.