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 #ifndef COAP_LIBCOAP_H_ 13 #define COAP_LIBCOAP_H_ 14 15 /* The non posix embedded platforms like Contiki, TinyOS, RIOT, ... doesn't have 16 * a POSIX compatible header structure so we have to slightly do some platform 17 * related things. Currently there is only Contiki available so we check for a 18 * CONTIKI environment and do *not* include the POSIX related network stuff. If 19 * there are other platforms in future there need to be analogous environments. 20 * 21 * The CONTIKI variable is within the Contiki build environment! */ 22 23 #if defined(_WIN32) 24 #pragma comment(lib,"Ws2_32.lib") 25 #include <ws2tcpip.h> 26 typedef SSIZE_T ssize_t; 27 typedef USHORT in_port_t; 28 #elif !defined (CONTIKI) 29 #include <netinet/in.h> 30 #include <sys/socket.h> 31 #endif /* CONTIKI */ 32 33 #ifndef COAP_STATIC_INLINE 34 # if defined(__cplusplus) 35 # define COAP_STATIC_INLINE inline 36 # else 37 # if defined(_MSC_VER) 38 # define COAP_STATIC_INLINE static __inline 39 # else 40 # define COAP_STATIC_INLINE static inline 41 # endif 42 # endif 43 #endif 44 #ifndef COAP_DEPRECATED 45 # if defined(_MSC_VER) 46 # define COAP_DEPRECATED __declspec(deprecated) 47 # else 48 # define COAP_DEPRECATED __attribute__ ((deprecated)) 49 # endif 50 #endif 51 #ifndef COAP_UNUSED 52 # ifdef __GNUC__ 53 # define COAP_UNUSED __attribute__((unused)) 54 # else /* __GNUC__ */ 55 # define COAP_UNUSED 56 # endif /* __GNUC__ */ 57 #endif /* COAP_UNUSED */ 58 59 void coap_startup(void); 60 61 void coap_cleanup(void); 62 63 #endif /* COAP_LIBCOAP_H_ */ 64