From c9337b31f756cae85299c8275b21088ce02885e2 Mon Sep 17 00:00:00 2001 From: Felix Janda Date: Wed, 24 Jun 2015 19:53:34 +0200 Subject: Use stdint types everywhere Signed-off-by: Felix Janda --- include/libipulog/libipulog.h | 7 +++---- include/ulogd/addr.h | 4 +++- include/ulogd/conffile.h | 10 +++++----- include/ulogd/ipfix_protocol.h | 38 ++++++++++++++++++++------------------ include/ulogd/ulogd.h | 42 +++++++++++++++++++++--------------------- 5 files changed, 52 insertions(+), 49 deletions(-) (limited to 'include') diff --git a/include/libipulog/libipulog.h b/include/libipulog/libipulog.h index b3c9616..21b4315 100644 --- a/include/libipulog/libipulog.h +++ b/include/libipulog/libipulog.h @@ -4,10 +4,9 @@ #include #include #include -#include #include #include -#include +#include #include #include #include @@ -20,9 +19,9 @@ struct ipulog_handle; extern int ipulog_errno; -u_int32_t ipulog_group2gmask(u_int32_t group); +uint32_t ipulog_group2gmask(uint32_t group); -struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, u_int32_t rmem); +struct ipulog_handle *ipulog_create_handle(uint32_t gmask, uint32_t rmem); void ipulog_destroy_handle(struct ipulog_handle *h); diff --git a/include/ulogd/addr.h b/include/ulogd/addr.h index b4432e3..2259b6c 100644 --- a/include/ulogd/addr.h +++ b/include/ulogd/addr.h @@ -8,7 +8,9 @@ #ifndef _ADDR_H #define _ADDR_H -u_int32_t ulogd_bits2netmask(int bits); +#include + +uint32_t ulogd_bits2netmask(int bits); void ulogd_ipv6_cidr2mask_host(uint8_t cidr, uint32_t *res); void ulogd_ipv6_addr2addr_host(uint32_t *addr, uint32_t *res); diff --git a/include/ulogd/conffile.h b/include/ulogd/conffile.h index 69a6f70..1f3d563 100644 --- a/include/ulogd/conffile.h +++ b/include/ulogd/conffile.h @@ -7,7 +7,7 @@ #ifndef _CONFFILE_H #define _CONFFILE_H -#include +#include /* errors returned by config functions */ enum { @@ -45,10 +45,10 @@ enum { struct config_entry { char key[CONFIG_KEY_LEN]; /* name of config directive */ - u_int8_t type; /* type; see above */ - u_int8_t options; /* options; see above */ - u_int8_t hit; /* found? */ - u_int8_t flag; /* tune setup of option */ + uint8_t type; /* type; see above */ + uint8_t options; /* options; see above */ + uint8_t hit; /* found? */ + uint8_t flag; /* tune setup of option */ union { char string[CONFIG_VAL_STRING_LEN]; int value; diff --git a/include/ulogd/ipfix_protocol.h b/include/ulogd/ipfix_protocol.h index 5d7e46a..aef47f0 100644 --- a/include/ulogd/ipfix_protocol.h +++ b/include/ulogd/ipfix_protocol.h @@ -1,6 +1,8 @@ #ifndef _IPFIX_PROTOCOL_H #define _IPFIX_PROTOCOL_H +#include + /* This header file defines structures for the IPFIX protocol in accordance with * draft-ietf-ipfix-protocol-19.txt */ @@ -11,29 +13,29 @@ /* Section 3.1 */ struct ipfix_msg_hdr { - u_int16_t version; - u_int16_t length; - u_int32_t export_time; - u_int32_t seq; - u_int32_t source_id; + uint16_t version; + uint16_t length; + uint32_t export_time; + uint32_t seq; + uint32_t source_id; }; /* Section 3.4.1 */ struct ipfix_templ_rec_hdr { - u_int16_t templ_id; - u_int16_t field_count; + uint16_t templ_id; + uint16_t field_count; }; /* Section 3.2 */ struct ipfix_ietf_field { - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; }; struct ipfix_vendor_field { - u_int16_t type; - u_int16_t length; - u_int32_t enterprise_num; + uint16_t type; + uint16_t length; + uint32_t enterprise_num; }; /* Information Element Identifiers as of draft-ietf-ipfix-info-11.txt */ @@ -219,13 +221,13 @@ enum { /* Information elements of the netfilter vendor id */ enum { IPFIX_NF_rawpacket = 1, /* pointer */ - IPFIX_NF_rawpacket_length = 2, /* u_int32_t */ + IPFIX_NF_rawpacket_length = 2, /* uint32_t */ IPFIX_NF_prefix = 3, /* string */ - IPFIX_NF_mark = 4, /* u_int32_t */ - IPFIX_NF_hook = 5, /* u_int8_t */ - IPFIX_NF_conntrack_id = 6, /* u_int32_t */ - IPFIX_NF_seq_local = 7, /* u_int32_t */ - IPFIX_NF_seq_global = 8, /* u_int32_t */ + IPFIX_NF_mark = 4, /* uint32_t */ + IPFIX_NF_hook = 5, /* uint8_t */ + IPFIX_NF_conntrack_id = 6, /* uint32_t */ + IPFIX_NF_seq_local = 7, /* uint32_t */ + IPFIX_NF_seq_global = 8, /* uint32_t */ }; #endif diff --git a/include/ulogd/ulogd.h b/include/ulogd/ulogd.h index cf26a15..2e38195 100644 --- a/include/ulogd/ulogd.h +++ b/include/ulogd/ulogd.h @@ -85,17 +85,17 @@ enum ulogd_dtype { /* structure describing an input / output parameter of a plugin */ struct ulogd_key { /* length of the returned value (only for lengthed types */ - u_int32_t len; + uint32_t len; /* type of the returned value (ULOGD_DTYPE_...) */ - u_int16_t type; + uint16_t type; /* flags (i.e. free, ...) */ - u_int16_t flags; + uint16_t flags; /* name of this key */ char name[ULOGD_MAX_KEYLEN+1]; /* IETF IPFIX attribute ID */ struct { - u_int32_t vendor; - u_int16_t field_id; + uint32_t vendor; + uint16_t field_id; } ipfix; /* Store field name for Common Information Model */ @@ -104,12 +104,12 @@ struct ulogd_key { union { /* and finally the returned value */ union { - u_int8_t b; - u_int8_t ui8; - u_int16_t ui16; - u_int32_t ui32; - u_int64_t ui64; - u_int32_t ui128[4]; + uint8_t b; + uint8_t ui8; + uint16_t ui16; + uint32_t ui32; + uint64_t ui64; + uint32_t ui128[4]; int8_t i8; int16_t i16; int32_t i32; @@ -130,31 +130,31 @@ struct ulogd_keyset { unsigned int type; }; -static inline void okey_set_b(struct ulogd_key *key, u_int8_t value) +static inline void okey_set_b(struct ulogd_key *key, uint8_t value) { key->u.value.b = value; key->flags |= ULOGD_RETF_VALID; } -static inline void okey_set_u8(struct ulogd_key *key, u_int8_t value) +static inline void okey_set_u8(struct ulogd_key *key, uint8_t value) { key->u.value.ui8 = value; key->flags |= ULOGD_RETF_VALID; } -static inline void okey_set_u16(struct ulogd_key *key, u_int16_t value) +static inline void okey_set_u16(struct ulogd_key *key, uint16_t value) { key->u.value.ui16 = value; key->flags |= ULOGD_RETF_VALID; } -static inline void okey_set_u32(struct ulogd_key *key, u_int32_t value) +static inline void okey_set_u32(struct ulogd_key *key, uint32_t value) { key->u.value.ui32 = value; key->flags |= ULOGD_RETF_VALID; } -static inline void okey_set_u64(struct ulogd_key *key, u_int64_t value) +static inline void okey_set_u64(struct ulogd_key *key, uint64_t value) { key->u.value.ui64 = value; key->flags |= ULOGD_RETF_VALID; @@ -172,22 +172,22 @@ static inline void okey_set_ptr(struct ulogd_key *key, void *value) key->flags |= ULOGD_RETF_VALID; } -static inline u_int8_t ikey_get_u8(struct ulogd_key *key) +static inline uint8_t ikey_get_u8(struct ulogd_key *key) { return key->u.source->u.value.ui8; } -static inline u_int16_t ikey_get_u16(struct ulogd_key *key) +static inline uint16_t ikey_get_u16(struct ulogd_key *key) { return key->u.source->u.value.ui16; } -static inline u_int32_t ikey_get_u32(struct ulogd_key *key) +static inline uint32_t ikey_get_u32(struct ulogd_key *key) { return key->u.source->u.value.ui32; } -static inline u_int64_t ikey_get_u64(struct ulogd_key *key) +static inline uint64_t ikey_get_u64(struct ulogd_key *key) { return key->u.source->u.value.ui64; } @@ -292,7 +292,7 @@ void ulogd_propagate_results(struct ulogd_pluginstance *pi); void ulogd_register_plugin(struct ulogd_plugin *me); /* allocate a new ulogd_key */ -struct ulogd_key *alloc_ret(const u_int16_t type, const char*); +struct ulogd_key *alloc_ret(const uint16_t type, const char*); /* write a message to the daemons' logfile */ void __ulogd_log(int level, char *file, int line, const char *message, ...); -- cgit v1.2.3