Loading...
Searching...
No Matches
coap_io.h
Go to the documentation of this file.
/*
* coap_io.h -- Default network I/O functions for libcoap
*
* Copyright (C) 2012-2013,2023 Olaf Bergmann <bergmann@tzi.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_IO_H_
#define COAP_IO_H_
#include <sys/types.h>
#include "coap_address.h"
#ifdef RIOT_VERSION
#include "net/gnrc.h"
#endif /* RIOT_VERSION */
#ifndef COAP_RXBUFFER_SIZE
#define COAP_RXBUFFER_SIZE 1472
#endif /* COAP_RXBUFFER_SIZE */
/*
* It may may make sense to define this larger on busy systems
* (lots of sessions, large number of which are active), by using
* -DCOAP_MAX_EPOLL_EVENTS=nn at compile time.
*/
#ifndef COAP_MAX_EPOLL_EVENTS
#define COAP_MAX_EPOLL_EVENTS 10
#endif /* COAP_MAX_EPOLL_EVENTS */
#ifdef _WIN32
typedef SOCKET coap_fd_t;
#define coap_closesocket closesocket
#define COAP_SOCKET_ERROR SOCKET_ERROR
#define COAP_INVALID_SOCKET INVALID_SOCKET
#else
typedef int coap_fd_t;
#define coap_closesocket close
#define COAP_SOCKET_ERROR (-1)
#define COAP_INVALID_SOCKET (-1)
#endif
typedef uint16_t coap_socket_flags_t;
typedef struct coap_addr_tuple_t {
coap_address_t remote;
coap_address_t local;
} coap_addr_tuple_t;
const char *coap_socket_strerror(void);
int coap_tcp_is_supported(void);
typedef enum {
COAP_NACK_TOO_MANY_RETRIES,
COAP_NACK_NOT_DELIVERABLE,
COAP_NACK_RST,
COAP_NACK_TLS_FAILED,
COAP_NACK_ICMP_ISSUE,
COAP_NACK_BAD_RESPONSE,
COAP_NACK_TLS_LAYER_FAILED,
COAP_NACK_WS_LAYER_FAILED,
COAP_NACK_WS_FAILED
} coap_nack_reason_t;
#endif /* COAP_IO_H_ */
coap_address.h
Representation of network addresses.
coap_socket_flags_t
uint16_t coap_socket_flags_t
Definition coap_io.h:53
coap_tcp_is_supported
int coap_tcp_is_supported(void)
Check whether TCP is available.
Definition coap_tcp.c:37
coap_socket_strerror
const char * coap_socket_strerror(void)
Definition coap_io.c:1768
coap_nack_reason_t
coap_nack_reason_t
Definition coap_io.h:69
COAP_NACK_NOT_DELIVERABLE
@ COAP_NACK_NOT_DELIVERABLE
Definition coap_io.h:71
COAP_NACK_WS_FAILED
@ COAP_NACK_WS_FAILED
Definition coap_io.h:78
COAP_NACK_TOO_MANY_RETRIES
@ COAP_NACK_TOO_MANY_RETRIES
Definition coap_io.h:70
COAP_NACK_TLS_FAILED
@ COAP_NACK_TLS_FAILED
Definition coap_io.h:73
COAP_NACK_TLS_LAYER_FAILED
@ COAP_NACK_TLS_LAYER_FAILED
Definition coap_io.h:76
COAP_NACK_ICMP_ISSUE
@ COAP_NACK_ICMP_ISSUE
Definition coap_io.h:74
COAP_NACK_WS_LAYER_FAILED
@ COAP_NACK_WS_LAYER_FAILED
Definition coap_io.h:77
COAP_NACK_RST
@ COAP_NACK_RST
Definition coap_io.h:72
COAP_NACK_BAD_RESPONSE
@ COAP_NACK_BAD_RESPONSE
Definition coap_io.h:75
coap_fd_t
int coap_fd_t
Definition coap_io.h:47
coap_addr_tuple_t
Definition coap_io.h:55
coap_addr_tuple_t::remote
coap_address_t remote
remote address and port
Definition coap_io.h:56
coap_addr_tuple_t::local
coap_address_t local
local address and port
Definition coap_io.h:57
coap_address_t
Multi-purpose address abstraction.
Definition coap_address.h:109