libcoap 4.3.5-develop-4fa3dfa
Loading...
Searching...
No Matches
libcoap.h
Go to the documentation of this file.
1/*
2 * libcoap.h -- platform specific header file for CoAP stack
3 *
4 * Copyright (C) 2015 Carsten Schoenert <c.schoenert@t-online.de>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_LIBCOAP_H_
18#define COAP_LIBCOAP_H_
19
20/* The non posix embedded platforms like Contiki-NG, TinyOS, RIOT, ... don't have
21 * a POSIX compatible header structure so we have to slightly do some platform
22 * related things. Currently there is only Contiki-NG available so we check for a
23 * CONTIKI environment and do *not* include the POSIX related network stuff. If
24 * there are other platforms in future there need to be analogous environments.
25 *
26 * The CONTIKI variable is within the Contiki-NG build environment! */
27
28#if defined(_WIN32)
29#include <ws2tcpip.h>
30#if !defined(__MINGW32__)
31#pragma comment(lib,"Ws2_32.lib")
32#ifndef _SSIZE_T_DECLARED
33typedef SSIZE_T ssize_t;
34#define _SSIZE_T_DECLARED
35#endif
36#ifndef _IN_PORT_T_DECLARED
37typedef USHORT in_port_t;
38#define _IN_PORT_T_DECLARED
39#endif
40#endif /* !defined(__MINGW32__) */
41#elif defined(__ZEPHYR__)
42#include <zephyr/net/socket.h>
43#elif !defined (CONTIKI) && !defined (WITH_LWIP) && !defined (RIOT_VERSION)
44#include <netinet/in.h>
45#include <sys/socket.h>
46#endif /* ! CONTIKI && ! WITH_LWIP && ! RIOT_VERSION */
47
48#ifndef COAP_STATIC_INLINE
49# if defined(__cplusplus)
50# define COAP_STATIC_INLINE inline
51# else
52# if defined(_MSC_VER)
53# define COAP_STATIC_INLINE static __inline
54# else
55# define COAP_STATIC_INLINE static inline
56# endif
57# endif
58#endif
59
60#ifndef COAP_DEPRECATED
61# if defined(_MSC_VER)
62# define COAP_DEPRECATED __declspec(deprecated)
63# else
64# define COAP_DEPRECATED __attribute__ ((deprecated))
65# endif
66#endif
67
68#ifndef COAP_UNUSED
69# ifdef __GNUC__
70# define COAP_UNUSED __attribute__((unused))
71# else /* __GNUC__ */
72# define COAP_UNUSED
73# endif /* __GNUC__ */
74#endif /* COAP_UNUSED */
75
76#ifndef COAP_THREAD_LOCAL_VAR
77# ifdef __GNUC__
78# define COAP_THREAD_LOCAL_VAR __thread
79# elif defined(_MSC_VER)
80# define COAP_THREAD_LOCAL_VAR __declspec(thread)
81# else /* ! __GNUC__ && ! _MSC_VER */
82# define COAP_THREAD_LOCAL_VAR
83# endif
84#endif
85
86#ifndef COAP_API
87#define COAP_API
88#endif
89
90void coap_startup(void);
91
92void coap_cleanup(void);
93
94#endif /* COAP_LIBCOAP_H_ */
void coap_cleanup(void)
Definition coap_net.c:5075
void coap_startup(void)
Definition coap_net.c:5026