diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 16:56:50 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 16:56:50 +0000 |
commit | a8f06005be7e61f0562d8c36d953f688922edf01 (patch) | |
tree | a31a44f5788cc5f8677ad696216b8d9416bc53e6 /include | |
parent | f248d75e65247a39c29052bc3b4fbcc043a4967c (diff) | |
download | conntrack-tools-a8f06005be7e61f0562d8c36d953f688922edf01.tar.gz conntrack-tools-a8f06005be7e61f0562d8c36d953f688922edf01.zip |
Max Kellermann <max@duempel.org>:
use C99 integers (uint32_t instead of u_int32_t)
Diffstat (limited to 'include')
-rw-r--r-- | include/cache.h | 5 | ||||
-rw-r--r-- | include/conntrack.h | 3 | ||||
-rw-r--r-- | include/conntrackd.h | 21 | ||||
-rw-r--r-- | include/hash.h | 17 | ||||
-rw-r--r-- | include/ignore.h | 4 | ||||
-rw-r--r-- | include/mcast.h | 7 | ||||
-rw-r--r-- | include/network.h | 34 | ||||
-rw-r--r-- | include/state_helper.h | 4 |
8 files changed, 52 insertions, 43 deletions
diff --git a/include/cache.h b/include/cache.h index e4fb945..0743d3f 100644 --- a/include/cache.h +++ b/include/cache.h @@ -1,7 +1,8 @@ #ifndef _CACHE_H_ #define _CACHE_H_ -#include <sys/types.h> +#include <stdint.h> +#include <stddef.h> #include <time.h> /* cache features */ @@ -75,7 +76,7 @@ struct cache_extra { struct nf_conntrack; -struct cache *cache_create(const char *name, unsigned int features, u_int8_t proto, struct cache_extra *extra); +struct cache *cache_create(const char *name, unsigned int features, uint8_t proto, struct cache_extra *extra); void cache_destroy(struct cache *e); struct us_conntrack *cache_add(struct cache *c, struct nf_conntrack *ct); diff --git a/include/conntrack.h b/include/conntrack.h index 8f2b6a2..d6b6150 100644 --- a/include/conntrack.h +++ b/include/conntrack.h @@ -3,6 +3,7 @@ #include "linux_list.h" #include <getopt.h> +#include <stdint.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #define PROGNAME "conntrack" @@ -149,7 +150,7 @@ struct ctproto_handler { struct list_head head; const char *name; - u_int16_t protonum; + uint16_t protonum; const char *version; enum ctattr_protoinfo protoinfo_attr; diff --git a/include/conntrackd.h b/include/conntrackd.h index d3f66ba..418f4b7 100644 --- a/include/conntrackd.h +++ b/include/conntrackd.h @@ -4,6 +4,7 @@ #include "mcast.h" #include "local.h" +#include <stdint.h> #include <stdio.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include "cache.h" @@ -63,9 +64,9 @@ enum { #endif union inet_address { - u_int32_t ipv4; - u_int32_t ipv6[4]; - u_int32_t all[4]; + uint32_t ipv4; + uint32_t ipv6[4]; + uint32_t all[4]; }; #define CONFIG(x) conf.x @@ -112,9 +113,9 @@ struct ct_general_state { struct nfct_handle *dump; /* dump handler */ /* statistics */ - u_int64_t malformed; - u_int64_t bytes[NFCT_DIR_MAX]; - u_int64_t packets[NFCT_DIR_MAX]; + uint64_t malformed; + uint64_t bytes[NFCT_DIR_MAX]; + uint64_t packets[NFCT_DIR_MAX]; }; #define STATE_SYNC(x) state.sync->x @@ -128,10 +129,10 @@ struct ct_sync_state { struct sync_mode *sync; /* sync mode */ - u_int32_t last_seq_sent; /* last sequence number sent */ - u_int32_t last_seq_recv; /* last sequence number recv */ - u_int64_t packets_replayed; /* number of replayed packets */ - u_int64_t packets_lost; /* lost packets: sequence tracking */ + uint32_t last_seq_sent; /* last sequence number sent */ + uint32_t last_seq_recv; /* last sequence number recv */ + uint64_t packets_replayed; /* number of replayed packets */ + uint64_t packets_lost; /* lost packets: sequence tracking */ }; #define STATE_STATS(x) state.stats->x diff --git a/include/hash.h b/include/hash.h index c9460fa..caad412 100644 --- a/include/hash.h +++ b/include/hash.h @@ -2,21 +2,22 @@ #define _NF_SET_HASH_H_ #include <unistd.h> -#include <sys/types.h> #include "slist.h" #include "linux_list.h" +#include <stdint.h> + struct hashtable; struct hashtable_node; struct hashtable { - u_int32_t hashsize; - u_int32_t limit; - u_int32_t count; - u_int32_t initval; - u_int32_t datasize; + uint32_t hashsize; + uint32_t limit; + uint32_t count; + uint32_t initval; + uint32_t datasize; - u_int32_t (*hash)(const void *data, struct hashtable *table); + uint32_t (*hash)(const void *data, struct hashtable *table); int (*compare)(const void *data1, const void *data2); struct slist_head members[0]; @@ -32,7 +33,7 @@ void hashtable_destroy_node(struct hashtable_node *h); struct hashtable * hashtable_create(int hashsize, int limit, int datasize, - u_int32_t (*hash)(const void *data, struct hashtable *table), + uint32_t (*hash)(const void *data, struct hashtable *table), int (*compare)(const void *data1, const void *data2)); void hashtable_destroy(struct hashtable *h); diff --git a/include/ignore.h b/include/ignore.h index 96deb93..f1c2846 100644 --- a/include/ignore.h +++ b/include/ignore.h @@ -1,11 +1,13 @@ #ifndef _IGNORE_H_ #define _IGNORE_H_ +#include <stdint.h> + struct ignore_pool { struct hashtable *h; }; -struct ignore_pool *ignore_pool_create(u_int8_t family); +struct ignore_pool *ignore_pool_create(uint8_t family); void ignore_pool_destroy(struct ignore_pool *ip); int ignore_pool_add(struct ignore_pool *ip, void *data); int ignore_pool_test(struct ignore_pool *ip, struct nf_conntrack *ct); diff --git a/include/mcast.h b/include/mcast.h index d4fd335..e3cdb38 100644 --- a/include/mcast.h +++ b/include/mcast.h @@ -1,6 +1,7 @@ #ifndef _MCAST_H_ #define _MCAST_H_ +#include <stdint.h> #include <netinet/in.h> #include <net/if.h> @@ -22,9 +23,9 @@ struct mcast_conf { }; struct mcast_stats { - u_int64_t bytes; - u_int64_t messages; - u_int64_t error; + uint64_t bytes; + uint64_t messages; + uint64_t error; }; struct mcast_sock { diff --git a/include/network.h b/include/network.h index d0b639b..f9976dd 100644 --- a/include/network.h +++ b/include/network.h @@ -1,12 +1,12 @@ #ifndef _NETWORK_H_ #define _NETWORK_H_ -#include <sys/types.h> +#include <stdint.h> struct nethdr { - u_int16_t flags; - u_int16_t len; - u_int32_t seq; + uint16_t flags; + uint16_t len; + uint32_t seq; }; #define NETHDR_SIZ sizeof(struct nethdr) @@ -14,11 +14,11 @@ struct nethdr { (struct netpld *)(((char *)x) + sizeof(struct nethdr)) struct nethdr_ack { - u_int16_t flags; - u_int16_t len; - u_int32_t seq; - u_int32_t from; - u_int32_t to; + uint16_t flags; + uint16_t len; + uint32_t seq; + uint32_t from; + uint32_t to; }; #define NETHDR_ACK_SIZ sizeof(struct nethdr_ack) @@ -55,7 +55,7 @@ int prepare_send_netmsg(struct mcast_sock *m, void *data); int mcast_send_netmsg(struct mcast_sock *m, void *data); int mcast_recv_netmsg(struct mcast_sock *m, void *data, int len); int handle_netmsg(struct nethdr *net); -int mcast_track_seq(u_int32_t seq, u_int32_t *exp_seq); +int mcast_track_seq(uint32_t seq, uint32_t *exp_seq); struct mcast_conf; @@ -103,21 +103,21 @@ int mcast_buffered_pending_netmsg(struct mcast_sock *m); * and worry about wraparound (automatic with unsigned arithmetic). */ -static inline int before(__u32 seq1, __u32 seq2) +static inline int before(uint32_t seq1, uint32_t seq2) { - return (__s32)(seq1-seq2) < 0; + return (int32_t)(seq1-seq2) < 0; } #define after(seq2, seq1) before(seq1, seq2) /* is s2<=s1<=s3 ? */ -static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) +static inline int between(uint32_t seq1, uint32_t seq2, uint32_t seq3) { return seq3 - seq2 >= seq1 - seq2; } struct netpld { - u_int16_t len; - u_int16_t query; + uint16_t len; + uint16_t query; }; #define NETPLD_SIZ sizeof(struct netpld) @@ -134,8 +134,8 @@ struct netpld { }) struct netattr { - u_int16_t nta_len; - u_int16_t nta_attr; + uint16_t nta_len; + uint16_t nta_attr; }; #define ATTR_NETWORK2HOST(x) \ diff --git a/include/state_helper.h b/include/state_helper.h index 1ed0b79..0015890 100644 --- a/include/state_helper.h +++ b/include/state_helper.h @@ -1,13 +1,15 @@ #ifndef _STATE_HELPER_H_ #define _STATE_HELPER_H_ +#include <stdint.h> + enum { ST_H_SKIP, ST_H_REPLICATE }; struct state_replication_helper { - u_int8_t proto; + uint8_t proto; unsigned int state; int (*verdict)(const struct state_replication_helper *h, |