#include <assert.h>
#include <sys/types.h>
#include "address.h"
Go to the source code of this file.
|
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, const coap_endpoint_t *local_interface, const coap_address_t *dst, unsigned char *data, size_t datalen) |
| Function interface for data transmission. More...
|
|
ssize_t | coap_network_read (coap_endpoint_t *ep, coap_packet_t **packet) |
| Function interface for reading data. More...
|
|
void | coap_free_packet (coap_packet_t *packet) |
| Releases the storage allocated for packet . More...
|
|
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...
|
|
§ COAP_ENDPOINT_DTLS
#define COAP_ENDPOINT_DTLS 0x01 |
§ COAP_ENDPOINT_NOSEC
#define COAP_ENDPOINT_NOSEC 0x00 |
§ COAP_IF_INVALID
#define COAP_IF_INVALID -1 |
Invalid interface handle.
Definition at line 24 of file coap_io.h.
§ coap_mcast_interface
#define coap_mcast_interface |
( |
|
Local | ) |
0 |
§ coap_endpoint_t
Abstraction of virtual endpoint that can be attached to coap_context_t.
The tuple (handle, addr) must uniquely identify this endpoint.
§ coap_if_handle_t
Abstract handle that is used to identify a local network interface.
Definition at line 21 of file coap_io.h.
§ coap_packet_t
§ coap_free_endpoint()
§ coap_free_packet()
Releases the storage allocated for packet
.
Definition at line 372 of file coap_io.c.
§ 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()
Function interface for data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error.
- Parameters
-
context | The calling CoAP context. |
local_interface | The local interface to send the data. |
dst | The address of the receiver. |
data | The data to send. |
datalen | The actual length of data . |
- Returns
- The number of bytes written on success, or a value less than zero on error.
§ 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.