libcoap 4.3.3
|
Network I/O functions. More...
#include "coap3/coap_internal.h"
Go to the source code of this file.
Data Structures | |
struct | in6_pktinfo |
struct | in_pktinfo |
Macros | |
#define | MSG_NOSIGNAL 0 |
#define | SOL_IP IPPROTO_IP |
#define | COAP_SOL_IP SOL_IP |
#define | iov_len_t size_t |
#define | SIN6(A) ((struct sockaddr_in6 *)(A)) |
Functions | |
int | coap_socket_bind_udp (coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr) |
void | coap_socket_close (coap_socket_t *sock) |
Function interface to close off a socket. More... | |
ssize_t | coap_socket_write (coap_socket_t *sock, const uint8_t *data, size_t data_len) |
Function interface for data stream sending off a socket. More... | |
ssize_t | coap_socket_read (coap_socket_t *sock, uint8_t *data, size_t data_len) |
Function interface for data stream receiving off a socket. More... | |
ssize_t | coap_socket_send (coap_socket_t *sock, const coap_session_t *session, const uint8_t *data, size_t datalen) |
Function interface for data transmission. 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... | |
ssize_t | coap_socket_recv (coap_socket_t *sock, coap_packet_t *packet) |
Function interface for reading data. More... | |
unsigned int | coap_io_prepare_epoll (coap_context_t *ctx, coap_tick_t now) |
Any now timed out delayed packet is transmitted, along with any packets associated with requested observable response. More... | |
unsigned int | coap_io_prepare_io (coap_context_t *ctx, coap_socket_t *sockets[], unsigned int max_sockets, unsigned int *num_sockets, coap_tick_t now) |
Iterates through all the coap_socket_t structures embedded in endpoints or sessions associated with the ctx to determine which are wanting any read, write, accept or connect I/O (COAP_SOCKET_WANT_xxx is set). More... | |
int | coap_io_process (coap_context_t *ctx, uint32_t timeout_ms) |
The main I/O processing function. More... | |
int | coap_io_process_with_fds (coap_context_t *ctx, uint32_t timeout_ms, int enfds, fd_set *ereadfds, fd_set *ewritefds, fd_set *eexceptfds) |
The main message processing loop with additional fds for internal select. More... | |
int | coap_io_pending (coap_context_t *context) |
Check to see if there is any i/o pending for the context . More... | |
const char * | coap_socket_format_errno (int error) |
const char * | coap_socket_strerror (void) |
Network I/O functions.
Definition in file coap_io.c.
#define MSG_NOSIGNAL 0 |
void coap_packet_get_memmapped | ( | coap_packet_t * | packet, |
unsigned char ** | address, | ||
size_t * | length | ||
) |
int coap_socket_bind_udp | ( | coap_socket_t * | sock, |
const coap_address_t * | listen_addr, | ||
coap_address_t * | bound_addr | ||
) |
void coap_socket_close | ( | coap_socket_t * | sock | ) |
const char * coap_socket_format_errno | ( | int | error | ) |
ssize_t coap_socket_read | ( | coap_socket_t * | sock, |
uint8_t * | data, | ||
size_t | data_len | ||
) |
Function interface for data stream receiving off a socket.
sock | Socket to receive data on. |
data | The data to receive. |
data_len | The maximum length of data . |
Definition at line 692 of file coap_io.c.
ssize_t coap_socket_recv | ( | coap_socket_t * | sock, |
coap_packet_t * | packet | ||
) |
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.
sock | Socket to read data from. |
packet | Received packet metadata and payload. src and dst should be preset. |
Definition at line 991 of file coap_io.c.
ssize_t coap_socket_send | ( | coap_socket_t * | sock, |
const coap_session_t * | session, | ||
const uint8_t * | data, | ||
size_t | datalen | ||
) |
Function interface for data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error.
sock | Socket to send data over. |
session | Addressing information for unconnected sockets, or NULL |
data | The data to send. |
datalen | The actual length of data . |
Definition at line 798 of file coap_io.c.
const char * coap_socket_strerror | ( | void | ) |
ssize_t coap_socket_write | ( | coap_socket_t * | sock, |
const uint8_t * | data, | ||
size_t | data_len | ||
) |
Function interface for data stream sending off a socket.
sock | Socket to send data over. |
data | The data to send. |
data_len | The length of data . |
Definition at line 633 of file coap_io.c.