2013-05-01 14:52:55 +02:00
|
|
|
#ifndef __CAPWAP_HEADER__
|
|
|
|
#define __CAPWAP_HEADER__
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <poll.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2013-06-16 12:09:57 +02:00
|
|
|
#include <sys/ioctl.h>
|
2013-05-01 14:52:55 +02:00
|
|
|
#include <netdb.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <net/if.h>
|
2013-06-16 12:09:57 +02:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-05-02 21:32:03 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* Endian */
|
2013-05-02 18:38:38 +02:00
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
#define CAPWAP_BIG_ENDIAN
|
2013-05-01 14:52:55 +02:00
|
|
|
#else
|
2013-05-02 18:38:38 +02:00
|
|
|
#define CAPWAP_LITTLE_ENDIAN
|
2013-05-01 14:52:55 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Min & Max */
|
|
|
|
#ifndef max
|
|
|
|
#define max(a,b) ((a) >= (b) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef min
|
|
|
|
#define min(a,b) ((a) <= (b) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
2014-04-21 23:16:56 +02:00
|
|
|
/* Opaque type */
|
|
|
|
#define DECLARE_OPAQUE_TYPE(name) struct name##__opaque__ { int unused; }; typedef struct name##__opaque__* name
|
|
|
|
|
2013-05-02 18:37:36 +02:00
|
|
|
/* UDPLite */
|
|
|
|
#ifdef HAVE_NETINET_UDPLITE_H
|
|
|
|
#include <netinet/udplite.h>
|
|
|
|
#else
|
|
|
|
#ifndef IPPROTO_UDPLITE
|
|
|
|
#define IPPROTO_UDPLITE 136
|
|
|
|
#endif
|
|
|
|
#ifndef SOL_UDPLITE
|
|
|
|
#define SOL_UDPLITE 136
|
|
|
|
#endif
|
|
|
|
#ifndef UDPLITE_SEND_CSCOV
|
|
|
|
#define UDPLITE_SEND_CSCOV 10
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* standard include */
|
2016-08-22 16:59:55 +02:00
|
|
|
#include "rfc.h"
|
|
|
|
#include "logging.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "error.h"
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* Helper exit */
|
|
|
|
void capwap_exit(int errorcode);
|
|
|
|
|
|
|
|
/* Random generator */
|
|
|
|
void capwap_init_rand(void);
|
|
|
|
int capwap_get_rand(int max);
|
|
|
|
|
2013-06-16 12:09:57 +02:00
|
|
|
/* */
|
|
|
|
void capwap_daemon(void);
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* */
|
2013-08-11 22:50:12 +02:00
|
|
|
#define capwap_outofmemory() do { \
|
2016-03-30 14:47:57 +02:00
|
|
|
log_printf(LOG_EMERG, "Out of memory %s(%d)", __FILE__, __LINE__); \
|
2013-08-11 22:50:12 +02:00
|
|
|
capwap_exit(CAPWAP_OUT_OF_MEMORY); \
|
|
|
|
} while(0)
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* Helper buffer copy */
|
|
|
|
char* capwap_duplicate_string(const char* source);
|
2014-01-18 19:10:27 +01:00
|
|
|
void* capwap_clone(const void* buffer, int buffersize);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-11-24 16:34:54 +01:00
|
|
|
/* */
|
|
|
|
char* capwap_itoa(int input, char* output);
|
|
|
|
char* capwap_ltoa(long input, char* output);
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
#endif /* __CAPWAP_HEADER__ */
|