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