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 12 /** 13 * @file libcoap.h 14 * @brief Platform specific header file for CoAP stack 15 */ 16 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 33 typedef SSIZE_T ssize_t; 34 #define _SSIZE_T_DECLARED 35 #endif 36 #ifndef _IN_PORT_T_DECLARED 37 typedef USHORT in_port_t; 38 #define _IN_PORT_T_DECLARED 39 #endif 40 #endif /* !defined(__MINGW32__) */ 41 #elif !defined (CONTIKI) && !defined (WITH_LWIP) 42 #include <netinet/in.h> 43 #include <sys/socket.h> 44 #endif /* ! CONTIKI && ! WITH_LWIP */ 45 46 #ifndef COAP_STATIC_INLINE 47 # if defined(__cplusplus) 48 # define COAP_STATIC_INLINE inline 49 # else 50 # if defined(_MSC_VER) 51 # define COAP_STATIC_INLINE static __inline 52 # else 53 # define COAP_STATIC_INLINE static inline 54 # endif 55 # endif 56 #endif 57 #ifndef COAP_DEPRECATED 58 # if defined(_MSC_VER) 59 # define COAP_DEPRECATED __declspec(deprecated) 60 # else 61 # define COAP_DEPRECATED __attribute__ ((deprecated)) 62 # endif 63 #endif 64 #ifndef COAP_UNUSED 65 # ifdef __GNUC__ 66 # define COAP_UNUSED __attribute__((unused)) 67 # else /* __GNUC__ */ 68 # define COAP_UNUSED 69 # endif /* __GNUC__ */ 70 #endif /* COAP_UNUSED */ 71 72 void coap_startup(void); 73 74 void coap_cleanup(void); 75 76 #endif /* COAP_LIBCOAP_H_ */ 77