X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=glue.h;h=1f8aa62cc0fd878d3316702343028b3ec9770925;hb=fd71c20d7328b71ac47493f9f27925de690980ed;hp=d3571a4b8aafca0953b44a172f63b3074da9b393;hpb=2395d8ca6a6f18acc76e328b6cb43af6786dbcaf;p=ipfw.git diff --git a/glue.h b/glue.h index d3571a4..1f8aa62 100644 --- a/glue.h +++ b/glue.h @@ -23,8 +23,7 @@ * SUCH DAMAGE. */ /* - * - * $Id$ + * $Id: glue.h 4436 2009-12-10 18:31:49Z luigi $ * * glue code to adapt the FreeBSD version to linux and windows, * userland and kernel. @@ -56,6 +55,7 @@ enum sopt_dir { SOPT_GET, SOPT_SET }; #include /* for size_t */ #include #include +#include #include @@ -86,7 +86,7 @@ enum sopt_dir { SOPT_GET, SOPT_SET }; * so early include this file (to be solved) */ #include #include /* struct in_addr */ -#include /* struct in_addr */ +#include /* struct in6_addr */ #include /* * LIST_HEAD in queue.h conflict with linux/list.h @@ -206,11 +206,27 @@ struct clockinfo { int profhz; /* profiling clock frequency */ }; - /* - * linux does not have heapsort + * linux does not have a reentrant version of qsort, + * so we the FreeBSD stdlib version. */ -#define heapsort(_a, _b, _c, _d) qsort(_a, _b, _c, _d) +void +qsort_r(void *a, size_t n, size_t es, void *thunk, + int cmp_t(void *, const void *, const void *)); + +/* prototypes from libutil */ +/* humanize_number(3) */ +#define HN_DECIMAL 0x01 +#define HN_NOSPACE 0x02 +#define HN_B 0x04 +#define HN_DIVISOR_1000 0x08 + +#define HN_GETSCALE 0x10 +#define HN_AUTOSCALE 0x20 + +int humanize_number(char *_buf, size_t _len, int64_t _number, + const char *_suffix, int _scale, int _flags); +int expand_number(const char *_buf, int64_t *_num); #define setprogname(x) /* not present in linux */ @@ -240,6 +256,15 @@ struct route_in6 { }; #endif /* KERNEL_MODULE */ +/* missing in netinet/in.h */ + +#define INET_ADDRSTRLEN 16 + +#ifdef linux +/* linux does not have sin_len in sockaddr */ +#define sin_len sin_zero[0] +#endif /* linux */ + /* * List of values used for set/getsockopt options. * The base value on FreeBSD is defined as a macro, @@ -254,6 +279,11 @@ enum ipfw_msg_type { IP_FW_TABLE_FLUSH, IP_FW_TABLE_GETSIZE, IP_FW_TABLE_LIST, + IP_FW_DYN_GET, /* new addition */ + + /* IP_FW3 and IP_DUMMYNET3 are the new API */ + IP_FW3 = _IPFW_SOCKOPT_BASE + 8, + IP_DUMMYNET3, IP_FW_ADD = _IPFW_SOCKOPT_BASE + 10, IP_FW_DEL,