libcoap 4.3.5-develop-ea01661
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 (CONTIKI) && !defined (WITH_LWIP) && !defined (RIOT_VERSION)
42#include <netinet/in.h>
43#include <sys/socket.h>
44#endif /* ! CONTIKI && ! WITH_LWIP && ! RIOT_VERSION */
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50#ifndef COAP_STATIC_INLINE
51# if defined(__cplusplus)
52# define COAP_STATIC_INLINE inline
53# else
54# if defined(_MSC_VER)
55# define COAP_STATIC_INLINE static __inline
56# else
57# define COAP_STATIC_INLINE static inline
58# endif
59# endif
60#endif
61
62#ifndef COAP_DEPRECATED
63# if defined(_MSC_VER)
64# define COAP_DEPRECATED __declspec(deprecated)
65# else
66# define COAP_DEPRECATED __attribute__ ((deprecated))
67# endif
68#endif
69
70#ifndef COAP_UNUSED
71# ifdef __GNUC__
72# define COAP_UNUSED __attribute__((unused))
73# else /* __GNUC__ */
74# define COAP_UNUSED
75# endif /* __GNUC__ */
76#endif /* COAP_UNUSED */
77
78#ifndef COAP_THREAD_LOCAL_VAR
79# ifdef __GNUC__
80# define COAP_THREAD_LOCAL_VAR __thread
81# elif defined(_MSC_VER)
82# define COAP_THREAD_LOCAL_VAR __declspec(thread)
83# else /* ! __GNUC__ && ! _MSC_VER */
84# define COAP_THREAD_LOCAL_VAR
85# endif
86#endif
87
88#ifndef COAP_API
89#define COAP_API
90#endif
91
92void coap_startup(void);
93
94void coap_cleanup(void);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* COAP_LIBCOAP_H_ */
void coap_cleanup(void)
Definition coap_net.c:5129
void coap_startup(void)
Definition coap_net.c:5079