1/*
2 * coap_internal.h -- Structures, Enums & Functions that are not exposed to
3 * application programming
4 *
5 * Copyright (C) 2019-2023 Jon Shallow <supjps-libcoap@jpshallow.com>
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * This file is part of the CoAP library libcoap. Please see README for terms
10 * of use.
11 */
12
13/*
14 * All libcoap library files should include this file which then pulls in all
15 * of the other appropriate header files.
16 *
17 * Note: This file should never be included in application code (with the
18 * possible exception of internal test suites).
19 */
20
21/**
22 * @file coap_internal.h
23 * @brief Pulls together all the internal only header files
24 */
25
26#ifndef COAP_INTERNAL_H_
27#define COAP_INTERNAL_H_
28
29#include "coap_config.h"
30
31/*
32 * Correctly set up assert() based on NDEBUG for libcoap
33 */
34#if defined(HAVE_ASSERT_H) && !defined(assert)
35# include <assert.h>
36#endif
37
38#ifdef HAVE_INTTYPES_H
39#include <inttypes.h>
40#else /* ! HAVE_INTTYPES_H */
41#ifndef PRIx32
42#define PRIx32 "x"
43#endif /* ! PRIx32 */
44#ifndef PRIu32
45#define PRIu32 "u"
46#endif /* ! PRIu32 */
47#ifndef PRIx64
48#define PRIx64 "lx"
49#endif /* ! PRIx64 */
50#ifndef PRIu64
51#define PRIu64 "lu"
52#endif /* ! PRIu64 */
53#endif /* ! HAVE_INTTYPES_H */
54
55#if defined(HAVE_ERRNO_H)
56# include <errno.h>
57#endif
58
59/* By default without either configured, these need to be set */
60#ifndef COAP_SERVER_SUPPORT
61#ifndef COAP_CLIENT_SUPPORT
62#define COAP_SERVER_SUPPORT 1
63#define COAP_CLIENT_SUPPORT 1
64#endif /* ! COAP_CLIENT_SUPPORT */
65#endif /* ! COAP_SERVER_SUPPORT */
66
67/* By default without either configured, these need to be set */
68#ifndef COAP_IPV4_SUPPORT
69#ifndef COAP_IPV6_SUPPORT
70#define COAP_IPV4_SUPPORT 1
71#define COAP_IPV6_SUPPORT 1
72#endif /* ! COAP_IPV6_SUPPORT */
73#endif /* ! COAP_IPV4_SUPPORT */
74
75#if ! COAP_SERVER_SUPPORT
76#if COAP_ASYNC_SUPPORT
77/* ASYNC is only there for Server code */
78#undef COAP_ASYNC_SUPPORT
79#define COAP_ASYNC_SUPPORT 0
80#endif /* COAP_ASYNC_SUPPORT */
81#endif /* ! COAP_SERVER_SUPPORT */
82
83#ifdef COAP_SUPPORT_SOCKET_BROADCAST
84#define COAP_INTERFACE_MAX 16
85#endif
86
87#include "coap3/coap.h"
88
89/*
90 * Include all the header files that are for internal use only.
91 */
92
93#if defined(COAP_OSCORE_SUPPORT) || defined(COAP_WS_SUPPORT)
94/* Specific OSCORE general .h files */
95typedef struct oscore_ctx_t oscore_ctx_t;
96#include "oscore/oscore.h"
97#include "oscore/oscore_cbor.h"
98#include "oscore/oscore_cose.h"
99#include "oscore/oscore_context.h"
100#include "oscore/oscore_crypto.h"
101#endif /* COAP_OSCORE_SUPPORT || COAP_WS_SUPPORT */
102
103/* Specifically defined internal .h files */
104#include "coap_asn1_internal.h"
105#include "coap_async_internal.h"
106#include "coap_block_internal.h"
107#include "coap_cache_internal.h"
108#if defined(COAP_OSCORE_SUPPORT) || defined(COAP_WS_SUPPORT)
109#include "coap_crypto_internal.h"
110#endif /* COAP_OSCORE_SUPPORT || COAP_WS_SUPPORT */
111#include "coap_debug_internal.h"
112#include "coap_dtls_internal.h"
113#include "coap_hashkey_internal.h"
114#include "coap_io_internal.h"
115#include "coap_layers_internal.h"
116#include "coap_mutex_internal.h"
117#include "coap_net_internal.h"
118#include "coap_netif_internal.h"
119#if COAP_OSCORE_SUPPORT
120#include "coap_oscore_internal.h"
121#endif /* COAP_OSCORE_SUPPORT */
122#include "coap_pdu_internal.h"
123#include "coap_resource_internal.h"
124#include "coap_session_internal.h"
125#include "coap_subscribe_internal.h"
126#include "coap_tcp_internal.h"
127#include "coap_uri_internal.h"
128#include "coap_utlist_internal.h"
129#include "coap_uthash_internal.h"
130#include "coap_ws_internal.h"
131
132#endif /* COAP_INTERNAL_H_ */
133