Revert out changes to make 1 byte enums

include/coap2/coap_dtls.h
include/coap2/coap_session.h
include/coap2/pdu.h
man/coap_encryption.txt.in
src/net.c

Revert out all the #define -> enum in #386 that require the enum to be
one byte long.
This commit is contained in:
Jon Shallow committed 2019-09-09 09:59:44 +01:00
1 parent 228a800f9d
commit 209c8a9267
5 files changed
+26 -65

No files matched your search

+2 -14
View File
@@ -185,25 +185,13 @@ typedef coap_dtls_key_t *(*coap_dtls_sni_callback_t)(const char *sni,
void* arg);
#if defined(_MSC_VER)
typedef enum
coap_dtls_pki_version_t : unsigned char
#else /* !_MSC_VER */
typedef enum
__attribute__ ((__packed__))
#endif /* !_MSC_VER */
{
COAP_DTLS_PKI_SETUP_VERSION_V1 = 1,
COAP_DTLS_PKI_SETUP_VERSION =
COAP_DTLS_PKI_SETUP_VERSION_V1, /**< Latest PKI setup version */
} coap_dtls_pki_version_t;
#define COAP_DTLS_PKI_SETUP_VERSION 1 /**< Latest PKI setup version */
/**
* The structure used for defining the PKI setup data to be used.
*/
typedef struct coap_dtls_pki_t {
coap_dtls_pki_version_t version; /** Set to COAP_DTLS_PKI_SETUP_VERSION to
support the version of the struct */
uint8_t version; /** Set to 1 to support this version of the struct */
/* Options to enable different TLS functionality in libcoap */
uint8_t verify_peer_cert; /**< 1 if peer cert is to be verified */
+16 -26
View File
@@ -37,33 +37,23 @@ typedef struct coap_fixed_point_t {
#define COAP_PROTO_NOT_RELIABLE(p) ((p)==COAP_PROTO_UDP || (p)==COAP_PROTO_DTLS)
#define COAP_PROTO_RELIABLE(p) ((p)==COAP_PROTO_TCP || (p)==COAP_PROTO_TLS)
#if defined(_MSC_VER)
typedef enum
coap_session_type_t : unsigned char
#else /* !_MSC_VER */
typedef enum
__attribute__ ((__packed__))
#endif /* !_MSC_VER */
{
COAP_SESSION_TYPE_CLIENT = 1, /**< client-side */
COAP_SESSION_TYPE_SERVER, /**< server-side */
COAP_SESSION_TYPE_HELLO, /**< server-side ephemeral session for responding to a client hello */
} coap_session_type_t;
typedef uint8_t coap_session_type_t;
/**
* coap_session_type_t values
*/
#define COAP_SESSION_TYPE_CLIENT 1 /**< client-side */
#define COAP_SESSION_TYPE_SERVER 2 /**< server-side */
#define COAP_SESSION_TYPE_HELLO 3 /**< server-side ephemeral session for responding to a client hello */
#if defined(_MSC_VER)
typedef enum
coap_session_state_t : unsigned char
#else /* !_MSC_VER */
typedef enum
__attribute__ ((__packed__))
#endif /* !_MSC_VER */
{
COAP_SESSION_STATE_NONE = 0,
COAP_SESSION_STATE_CONNECTING,
COAP_SESSION_STATE_HANDSHAKE,
COAP_SESSION_STATE_CSM,
COAP_SESSION_STATE_ESTABLISHED,
} coap_session_state_t;
typedef uint8_t coap_session_state_t;
/**
* coap_session_state_t values
*/
#define COAP_SESSION_STATE_NONE 0
#define COAP_SESSION_STATE_CONNECTING 1
#define COAP_SESSION_STATE_HANDSHAKE 2
#define COAP_SESSION_STATE_CSM 3
#define COAP_SESSION_STATE_ESTABLISHED 4
typedef struct coap_session_t {
coap_proto_t proto; /**< protocol used */
+6 -14
View File
@@ -336,23 +336,15 @@ typedef struct coap_pdu_t {
coap_pdu_t * coap_pdu_from_pbuf(struct pbuf *pbuf);
#endif
typedef uint8_t coap_proto_t;
/**
* coap_proto_t values
*/
#if defined(_MSC_VER)
typedef enum
coap_proto_t : unsigned char
#else /* !_MSC_VER */
typedef enum
__attribute__ ((__packed__))
#endif /* !_MSC_VER */
{
COAP_PROTO_NONE = 0,
COAP_PROTO_UDP,
COAP_PROTO_DTLS,
COAP_PROTO_TCP,
COAP_PROTO_TLS,
} coap_proto_t;
#define COAP_PROTO_NONE 0
#define COAP_PROTO_UDP 1
#define COAP_PROTO_DTLS 2
#define COAP_PROTO_TCP 3
#define COAP_PROTO_TLS 4
/**
* Creates a new CoAP PDU with at least enough storage space for the given