Skip to content

Commit

Permalink
coap_libcoap_build.h: Add in specific library build header
Browse files Browse the repository at this point in the history
Gives the ability to add in additional library build checks through
the use of #define etc. that is not available to applications or
other host o/s support.

Preparatory work for further locking checks.
  • Loading branch information
mrdeep1 committed May 20, 2024
1 parent 485a7c4 commit cbfb491
Show file tree
Hide file tree
Showing 44 changed files with 77 additions and 42 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ EXTRA_DIST = \
examples/riot/tests_pkg_libcoap/tests/01-run.py \
examples/riot/README \
Makefile.libcoap \
include/coap$(LIBCOAP_API_VERSION)/coap_libcoap_build.h \
include/coap$(LIBCOAP_API_VERSION)/coap_internal.h \
include/coap$(LIBCOAP_API_VERSION)/coap_riot.h \
include/coap$(LIBCOAP_API_VERSION)/coap_asn1_internal.h \
Expand Down
34 changes: 34 additions & 0 deletions include/coap3/coap_libcoap_build.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* coap_libcoap_build.h -- libcoap library build specifics
*
* Copyright (C) 2019-2024 Jon Shallow <supjps-libcoap@jpshallow.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/

/*
* All libcoap library files should include this file which then pulls in all
* of the other appropriate header files.
*
* Here can be added in specific checks to make sure that the libcoap library
* is built as expected.
*
* Note: This file should never be included in application code.
*/

/**
* @file coap_libcoap_build.h
* @brief Library specific build wrapper for coap_internal.h
*/

#ifndef COAP_LIBCOAP_BUILD_H_
#define COAP_LIBCOAP_BUILD_H_

#include "coap_config.h"

#include "coap_internal.h"

#endif /* COAP_LIBCOAP_BUILD_H_ */
2 changes: 1 addition & 1 deletion src/coap_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Handling of network addresses
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if !defined(WITH_CONTIKI) && !defined(WITH_LWIP) && !defined(RIOT_VERSION)
#ifdef HAVE_ARPA_INET_H
Expand Down
2 changes: 1 addition & 1 deletion src/coap_asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief CoAP specific ASN.1 handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

size_t
asn1_len(const uint8_t **ptr) {
Expand Down
2 changes: 1 addition & 1 deletion src/coap_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief State handling for asynchronous messages
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_ASYNC_SUPPORT
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief CoAP Block handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
Expand Down
2 changes: 1 addition & 1 deletion src/coap_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief CoAP Cache handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_SERVER_SUPPORT
/* Determines if the given option_type denotes an option type that can
Expand Down
2 changes: 1 addition & 1 deletion src/coap_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Debug utilities
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if defined(HAVE_STRNLEN) && defined(__GNUC__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE 1
Expand Down
2 changes: 1 addition & 1 deletion src/coap_dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief CoAP (D)TLS handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef _WIN32
#define strcasecmp _stricmp
Expand Down
2 changes: 1 addition & 1 deletion src/coap_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Encoding and decoding Coap data types functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

/* Carsten suggested this when fls() is not available: */
#ifndef HAVE_FLS
Expand Down
2 changes: 1 addition & 1 deletion src/coap_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief Event handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

/*
* This replaces coap_set_event_handler() so that handler registration is
Expand Down
2 changes: 1 addition & 1 deletion src/coap_gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* 3.6.6 or later is required to support Raw Public Key(RPK)
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef COAP_WITH_LIBGNUTLS

Expand Down
2 changes: 1 addition & 1 deletion src/coap_hashkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Hashkey functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

void
coap_hash_impl(const unsigned char *s, size_t len, coap_key_t h) {
Expand Down
2 changes: 1 addition & 1 deletion src/coap_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Network I/O functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef HAVE_STDIO_H
# include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_io_contiki.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief Contiki-NG-specific functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"
#include "contiki-net.h"

static void prepare_io(coap_context_t *ctx);
Expand Down
2 changes: 1 addition & 1 deletion src/coap_io_lwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief LwIP specific functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"
#include <lwip/udp.h>
#include <lwip/timeouts.h>
#include <lwip/tcpip.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_io_riot.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief RIOT specific I/O functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#include "net/gnrc.h"
#include "net/gnrc/ipv6.h"
Expand Down
2 changes: 1 addition & 1 deletion src/coap_layers.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Layer Handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

/*
* Layer index table. A whole protocol chunk gets copied into coap_socket_t.
Expand Down
2 changes: 1 addition & 1 deletion src/coap_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef COAP_WITH_LIBMBEDTLS

Expand Down
2 changes: 1 addition & 1 deletion src/coap_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Memory handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifndef WITH_LWIP
#if COAP_MEMORY_TYPE_TRACK
Expand Down
2 changes: 1 addition & 1 deletion src/coap_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief CoAP context functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"
#include "coap3/coap_mutex_internal.h"

#include <ctype.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief CoAP Netif handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"
#include "coap3/coap_session_internal.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion src/coap_notls.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief NoTLS specific interface functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if !defined(COAP_WITH_LIBOPENSSL)
int
Expand Down
2 changes: 1 addition & 1 deletion src/coap_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief OpenSSL specific interface functions.
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef COAP_WITH_LIBOPENSSL

Expand Down
2 changes: 1 addition & 1 deletion src/coap_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief CoAP option handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#include <stdio.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_oscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @brief CoAP OSCORE handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_OSCORE_SUPPORT
#include <ctype.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief CoAP PDU handling
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if defined(HAVE_LIMITS_H)
#include <limits.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief Pseudo Random Number functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef HAVE_GETRANDOM
#include <sys/random.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Server resource handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_SERVER_SUPPORT
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief Session handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifndef COAP_SESSION_C_
#define COAP_SESSION_C_
Expand Down
2 changes: 1 addition & 1 deletion src/coap_sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Reformatted as appropriate.
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_WS_SUPPORT && !defined(COAP_WITH_LIBOPENSSL) && !defined(COAP_WITH_LIBGNUTLS) && !defined(COAP_WITH_LIBMBEDTLS) && !defined(COAP_WITH_LIBWOLFSSL)
/*
Expand Down
2 changes: 1 addition & 1 deletion src/coap_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief String handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#include <stdio.h>

Expand Down
2 changes: 1 addition & 1 deletion src/coap_subscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief Subscription handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
Expand Down
2 changes: 1 addition & 1 deletion src/coap_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief CoAP TCP handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

int
coap_tcp_is_supported(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/coap_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief Clock handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef HAVE_TIME_H
#include <time.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_tinydtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief TinyDTLS specific handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef COAP_WITH_LIBTINYDTLS

Expand Down
2 changes: 1 addition & 1 deletion src/coap_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @brief URI handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if defined(HAVE_LIMITS_H)
#include <limits.h>
Expand Down
2 changes: 1 addition & 1 deletion src/coap_wolfssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @brief wolfSSL specific interface functions.
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#ifdef COAP_WITH_LIBWOLFSSL

Expand Down
2 changes: 1 addition & 1 deletion src/coap_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief CoAP WebSocket handling functions
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

#if COAP_WS_SUPPORT
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/oscore/oscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"

/* oscore_cs_params
* returns cbor array [[param_type], [paramtype, param]]
Expand Down
2 changes: 1 addition & 1 deletion src/oscore/oscore_cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
*/

#include "coap3/coap_internal.h"
#include "coap3/coap_libcoap_build.h"
#include <string.h>

static void
Expand Down
Loading

0 comments on commit cbfb491

Please sign in to comment.