]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
Use stdint types everywhere
authorFelix Janda <felix.janda@posteo.de>
Wed, 24 Jun 2015 17:53:34 +0000 (19:53 +0200)
committerEric Leblond <eric@regit.org>
Fri, 26 Jun 2015 07:12:55 +0000 (09:12 +0200)
Signed-off-by: Felix Janda <felix.janda@posteo.de>
19 files changed:
filter/raw2packet/ulogd_raw2packet_BASE.c
filter/ulogd_filter_HWHDR.c
filter/ulogd_filter_IP2HBIN.c
filter/ulogd_filter_IP2STR.c
filter/ulogd_filter_MARK.c
filter/ulogd_filter_PWSNIFF.c
include/libipulog/libipulog.h
include/ulogd/addr.h
include/ulogd/conffile.h
include/ulogd/ipfix_protocol.h
include/ulogd/ulogd.h
input/packet/ulogd_inppkt_NFLOG.c
input/packet/ulogd_inppkt_UNIXSOCK.c
libipulog/libipulog.c
output/mysql/ulogd_output_MYSQL.c
output/ulogd_output_IPFIX.c
src/addr.c
util/db.c
util/printpkt.c

index ad894fc8822457b490f76ccb7be772c7daa49028..8a6180c935022c9c0b7e35b3006ba0e9d54c4993 100644 (file)
@@ -44,6 +44,7 @@
 #include <ulogd/ipfix_protocol.h>
 #include <netinet/if_ether.h>
 #include <string.h>
+#include <linux/types.h>
 
 enum input_keys {
        INKEY_RAW_PCKT,
@@ -538,7 +539,7 @@ static struct ulogd_key iphdr_rets[] = {
  ***********************************************************************/
 
 static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
-                      u_int32_t len)
+                      uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
 
@@ -573,7 +574,7 @@ static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
  ***********************************************************************/
 
 static int _interp_udp(struct ulogd_pluginstance *pi, struct udphdr *udph,
-                      u_int32_t len)
+                      uint32_t len)
                
 {
        struct ulogd_key *ret = pi->output.keys;
@@ -602,7 +603,7 @@ typedef struct sctphdr {
 } __attribute__((packed)) sctp_sctphdr_t;
 
 static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
-                      u_int32_t len)
+                      uint32_t len)
                
 {
        struct ulogd_key *ret = pi->output.keys;
@@ -625,7 +626,7 @@ static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
  ***********************************************************************/
 
 static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
-                       u_int32_t len)
+                       uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
 
@@ -663,7 +664,7 @@ static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
  ***********************************************************************/
 
 static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph,
-                         u_int32_t len)
+                         uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
 
@@ -691,7 +692,7 @@ static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph
  *                     IPSEC HEADER 
  ***********************************************************************/
 static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
-                        u_int32_t len)
+                        uint32_t len)
 {
 #if 0
        struct ulogd_key *ret = pi->output.keys;
@@ -711,14 +712,14 @@ static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
  *                     IP HEADER
  ***********************************************************************/
 
-static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_iphdr(struct ulogd_pluginstance *pi, uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
        struct iphdr *iph =
                ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
-       void *nexthdr = (u_int32_t *)iph + iph->ihl;
+       void *nexthdr = (uint32_t *)iph + iph->ihl;
 
-       if (len < sizeof(struct iphdr) || len <= (u_int32_t)(iph->ihl * 4))
+       if (len < sizeof(struct iphdr) || len <= (uint32_t)(iph->ihl * 4))
                return ULOGD_IRET_OK;
        len -= iph->ihl * 4;
 
@@ -759,7 +760,7 @@ static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
  *                     IPv6 HEADER
  ***********************************************************************/
 
-static int ip6_ext_hdr(u_int8_t nexthdr)
+static int ip6_ext_hdr(uint8_t nexthdr)
 {
        switch (nexthdr) {
        case IPPROTO_HOPOPTS:
@@ -774,12 +775,12 @@ static int ip6_ext_hdr(u_int8_t nexthdr)
        }
 }
 
-static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
        struct ip6_hdr *ipv6h = ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
        unsigned int ptr, hdrlen = 0;
-       u_int8_t curhdr;
+       uint8_t curhdr;
        int fragment = 0;
 
        if (len < sizeof(struct ip6_hdr))
@@ -889,7 +890,7 @@ out:
 /***********************************************************************
  *                     ARP HEADER
  ***********************************************************************/
-static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_arp(struct ulogd_pluginstance *pi, uint32_t len)
 {
        struct ulogd_key *ret = pi->output.keys;
        const struct ether_arp *arph =
@@ -914,9 +915,9 @@ static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
  *                     ETHER HEADER
  ***********************************************************************/
 
-static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_bridge(struct ulogd_pluginstance *pi, uint32_t len)
 {
-       const u_int16_t proto =
+       const uint16_t proto =
                ikey_get_u16(&pi->input.keys[INKEY_OOB_PROTOCOL]);
 
        switch (proto) {
@@ -938,8 +939,8 @@ static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
 
 static int _interp_pkt(struct ulogd_pluginstance *pi)
 {
-       u_int32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
-       u_int8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
+       uint32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
+       uint8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
        struct ulogd_key *ret = pi->output.keys;
 
        okey_set_u16(&ret[KEY_OOB_PROTOCOL],
index 3b095c938bd94e554b989dcabd0ff7647b6b2535..10c95c4e9bb0eef22ad03ebd0916ba5c2df13fca 100644 (file)
@@ -143,10 +143,10 @@ static void *hwhdr_get_daddr(struct ulogd_key *inp)
        return ikey_get_ptr(&inp[KEY_RAW_MAC]);
 }
 
-static u_int16_t hwhdr_get_len(struct ulogd_key *inp)
+static uint16_t hwhdr_get_len(struct ulogd_key *inp)
 {
        void *len = ikey_get_ptr(&inp[KEY_RAW_MAC]) + 2 * ETH_ALEN;
-       return ntohs(*(u_int16_t *) len);
+       return ntohs(*(uint16_t *) len);
 }
 static int parse_ethernet(struct ulogd_key *ret, struct ulogd_key *inp)
 {
@@ -171,7 +171,7 @@ static int interp_mac2str(struct ulogd_pluginstance *pi)
 {
        struct ulogd_key *ret = pi->output.keys;
        struct ulogd_key *inp = pi->input.keys;
-       u_int16_t type = 0;
+       uint16_t type = 0;
 
        if (pp_is_valid(inp, KEY_OOB_PROTOCOL))
                okey_set_u16(&ret[KEY_MAC_PROTOCOL],
index 4fd3ff1e6a5d289dd66102746df27562f7e96d61..087e824ae94b72825847865eab4a066166461d54 100644 (file)
@@ -116,8 +116,8 @@ static int interp_ip2hbin(struct ulogd_pluginstance *pi)
 {
        struct ulogd_key *ret = pi->output.keys;
        struct ulogd_key *inp = pi->input.keys;
-       u_int8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
-       u_int8_t convfamily = family;
+       uint8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
+       uint8_t convfamily = family;
        int i;
 
        switch (family) {
index 732e1ef08524e40a069710944775ed75f6a95689..66324b0b3b22442597b65e499f796f44a6d651d1 100644 (file)
@@ -168,7 +168,7 @@ static int ip2str(struct ulogd_key *inp, int index, int oindex)
        }
 
        switch (convfamily) {
-               u_int32_t ip;
+               uint32_t ip;
        case AF_INET6:
                inet_ntop(AF_INET6,
                          ikey_get_u128(&inp[index]),
index 7807f63620f9dea376f56ab340bc3360e718ce3a..149725d9257467d10d1a4d1d193f9654e4da5de9 100644 (file)
@@ -73,14 +73,14 @@ static int interp_mark(struct ulogd_pluginstance *pi)
        if (pp_is_valid(inp, KEY_CT_MARK)) {
                if ((ikey_get_u32(&inp[KEY_CT_MARK]) &
                        pi->config_kset->ces[MARK_MASK].u.value) !=
-                       (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
+                       (uint32_t) pi->config_kset->ces[MARK_MARK].u.value
                   ) {
                        return ULOGD_IRET_STOP;
                }
        } else if (pp_is_valid(inp, KEY_OOB_MARK)) {
                if ((ikey_get_u32(&inp[KEY_OOB_MARK]) &
                        pi->config_kset->ces[MARK_MASK].u.value) !=
-                       (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
+                       (uint32_t) pi->config_kset->ces[MARK_MARK].u.value
                   ) {
                        return ULOGD_IRET_STOP;
                }
index a3e2b42bb9be3f7a45b0015d1c54599d4136e118..934ff0e09c4fe84c1c2374264e4b9371c83f7fbc 100644 (file)
@@ -39,7 +39,7 @@
 #define PORT_POP3      110
 #define PORT_FTP       21
 
-static u_int16_t pwsniff_ports[] = {
+static uint16_t pwsniff_ports[] = {
        PORT_POP3,
        PORT_FTP,
        /* feel free to include any other ports here, provided that their
@@ -72,7 +72,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi)
                return ULOGD_IRET_STOP;
        
        iph = (struct iphdr *) pi->input.keys[0].u.value.ptr;
-       protoh = (u_int32_t *)iph + iph->ihl;
+       protoh = (uint32_t *)iph + iph->ihl;
        tcph = protoh;
        tcplen = ntohs(iph->tot_len) - iph->ihl * 4;
 
index b3c9616f63e10082b547568d984d780497dfd554..21b4315427159577b41bc663c9dcf2c8c664a38b 100644 (file)
@@ -4,10 +4,9 @@
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
-#include <asm/types.h>
+#include <stdint.h>
 #include <linux/netlink.h>
 #include <net/if.h>
 #include <linux/netfilter_ipv4/ipt_ULOG.h>
@@ -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);
 
index b4432e3f24a7de4a6c2018e66f1768f9ae2f1b7b..2259b6c5ef105a8f91ceab255a21946a01df7165 100644 (file)
@@ -8,7 +8,9 @@
 #ifndef _ADDR_H
 #define _ADDR_H
 
-u_int32_t ulogd_bits2netmask(int bits);
+#include <stdint.h>
+
+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);
 
index 69a6f7072aa9f562a977b0447b93c875e885a908..1f3d563fb3cd625add92247c4c5af4af1b9c80e8 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef _CONFFILE_H
 #define _CONFFILE_H
 
-#include <sys/types.h>
+#include <stdint.h>
 
 /* 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;
index 5d7e46aab5d3199f4fb6532a4d5654d5b013016b..aef47f0a37fa6536c802d7a973c204adfd4ae5fd 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _IPFIX_PROTOCOL_H
 #define _IPFIX_PROTOCOL_H
 
+#include <stdint.h>
+
 /* This header file defines structures for the IPFIX protocol in accordance with
  * draft-ietf-ipfix-protocol-19.txt */
 
 
 /* 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
index cf26a15e350c6f411b909908959b9cef780daf0c..2e38195ecb63d7562353da8b606beb558714c093 100644 (file)
@@ -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, ...);
index 61966267fbc34e7b00354de9d48fe1eeb07f2276..a3679591658ad8eda395d70511766839c11a198f 100644 (file)
@@ -315,7 +315,7 @@ static struct ulogd_key output_keys[] = {
 };
 
 static inline int
-interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
+interp_packet(struct ulogd_pluginstance *upi, uint8_t pf_family,
              struct nflog_data *ldata)
 {
        struct ulogd_key *ret = upi->output.keys;
@@ -326,12 +326,12 @@ interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
        int payload_len = nflog_get_payload(ldata, &payload);
        char *prefix = nflog_get_prefix(ldata);
        struct timeval ts;
-       u_int32_t mark = nflog_get_nfmark(ldata);
-       u_int32_t indev = nflog_get_indev(ldata);
-       u_int32_t outdev = nflog_get_outdev(ldata);
-       u_int32_t seq;
-       u_int32_t uid;
-       u_int32_t gid;
+       uint32_t mark = nflog_get_nfmark(ldata);
+       uint32_t indev = nflog_get_indev(ldata);
+       uint32_t outdev = nflog_get_outdev(ldata);
+       uint32_t seq;
+       uint32_t uid;
+       uint32_t gid;
 
        okey_set_u8(&ret[NFLOG_KEY_OOB_FAMILY], 
                    pf_family);
@@ -493,7 +493,7 @@ static int configure(struct ulogd_pluginstance *upi,
        return 0;
 }
 
-static int become_system_logging(struct ulogd_pluginstance *upi, u_int8_t pf)
+static int become_system_logging(struct ulogd_pluginstance *upi, uint8_t pf)
 {
        struct nflog_input *ui = (struct nflog_input *) upi->private;
 
index e4009f33de57703e075bd5673a5981edfa48bb72..39944bf5cdb151de81b2d27d1e6babb0a28a2670 100644 (file)
@@ -336,10 +336,10 @@ enum ulogd2_option_type {
        ULOGD2_OPT_PREFIX,      /* log prefix (string) */
        ULOGD2_OPT_OOB_IN,      /* input device (string) */
        ULOGD2_OPT_OOB_OUT,     /* output device (string) */
-       ULOGD2_OPT_OOB_TIME_SEC,        /* packet arrival time (u_int32_t) */
+       ULOGD2_OPT_OOB_TIME_SEC,        /* packet arrival time (uint32_t) */
 
        ULOGD2_OPT_USER=200,    /* user name (string) */
-       ULOGD2_OPT_USERID,      /* user id (u_int32_t) */
+       ULOGD2_OPT_USERID,      /* user id (uint32_t) */
        ULOGD2_OPT_OSNAME,      /* OS name (string) */
        ULOGD2_OPT_OSREL,       /* OS release (string) */
        ULOGD2_OPT_OSVERS,      /* OS version (string) */
@@ -367,15 +367,15 @@ struct ulogd_unixsock_option_t  {
 #define USOCK_ALIGNTO 8
 #define USOCK_ALIGN(len) ( ((len)+USOCK_ALIGNTO-1) & ~(USOCK_ALIGNTO-1) )
 
-static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, u_int16_t total_len)
+static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, uint16_t total_len)
 {
        char *data = NULL;
        struct iphdr *ip;
        struct ulogd_key *ret = upi->output.keys;
-       u_int8_t oob_family;
-       u_int16_t payload_len;
-       u_int32_t option_number;
-       u_int32_t option_length;
+       uint8_t oob_family;
+       uint16_t payload_len;
+       uint32_t option_number;
+       uint32_t option_length;
        char *buf;
        struct ulogd_unixsock_option_t *option;
        int new_offset;
@@ -398,7 +398,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
        okey_set_u32(&ret[UNIXSOCK_KEY_RAW_PCKTLEN], payload_len);
 
        /* options */
-       if (total_len > payload_len + sizeof(u_int16_t)) {
+       if (total_len > payload_len + sizeof(uint16_t)) {
                /* option starts at the next aligned address after the payload */
                new_offset = USOCK_ALIGN(payload_len);
                options_start = (void*)ip + new_offset;
@@ -431,13 +431,13 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
                                okey_set_ptr(&ret[UNIXSOCK_KEY_OOB_OUT], buf);
                                break;
                        case ULOGD2_OPT_OOB_TIME_SEC:
-                               okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(u_int32_t*)buf);
+                               okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(uint32_t*)buf);
                                break;
                        case ULOGD2_OPT_USER:
                                okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_USER_NAME], buf);
                                break;
                        case ULOGD2_OPT_USERID:
-                               okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(u_int32_t*)buf);
+                               okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(uint32_t*)buf);
                                break;
                        case ULOGD2_OPT_OSNAME:
                                okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_OS_NAME], buf);
@@ -452,7 +452,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
                                okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_APP_NAME], buf);
                                break;
                        case ULOGD2_OPT_STATE:
-                               okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(u_int8_t*)buf);
+                               okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(uint8_t*)buf);
                                break;
                        default:
                                ulogd_log(ULOGD_NOTICE,
@@ -595,8 +595,8 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
        struct ulogd_pluginstance *upi = param;
        struct unixsock_input *ui = (struct unixsock_input*)upi->private;
        int len;
-       u_int16_t needed_len;
-       u_int32_t packet_sig;
+       uint16_t needed_len;
+       uint32_t packet_sig;
        struct ulogd_unixsock_packet_t *unixsock_packet;
 
        char buf[4096];
@@ -642,7 +642,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 
                needed_len = ntohs(unixsock_packet->total_size);
 
-               if (ui->unixsock_buf_avail >= needed_len + sizeof(u_int32_t)) {
+               if (ui->unixsock_buf_avail >= needed_len + sizeof(uint32_t)) {
                        ulogd_log(ULOGD_DEBUG,
                        "  We have enough data (%d bytes required), handling packet\n",
                                        needed_len);
@@ -651,11 +651,11 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
                                return -1;
                        }
                        /* consume data */
-                       ui->unixsock_buf_avail -= (sizeof(u_int32_t) + needed_len);
+                       ui->unixsock_buf_avail -= (sizeof(uint32_t) + needed_len);
                        if (ui->unixsock_buf_avail > 0) {
                                /* we need to shift data .. */
                                memmove(ui->unixsock_buf,
-                                               ui->unixsock_buf + (sizeof(u_int32_t) + needed_len) ,
+                                               ui->unixsock_buf + (sizeof(uint32_t) + needed_len) ,
                                                ui->unixsock_buf_avail);
                        } else {
                                /* input buffer is empty, do not loop */
@@ -664,7 +664,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 
                } else {
                        ulogd_log(ULOGD_DEBUG, "  We have %d bytes, but need %d. Requesting more\n",
-                                       ui->unixsock_buf_avail, needed_len + sizeof(u_int32_t));
+                                       ui->unixsock_buf_avail, needed_len + sizeof(uint32_t));
                        return 0;
                }
 
index ab28bb4ebfaa46b4b52092ea2dbd46d8ccb9794f..b49f7f2cbd79a4371b93725032f392ec1c264a83 100644 (file)
@@ -33,7 +33,7 @@
 struct ipulog_handle
 {
        int fd;
-       u_int8_t blocking;
+       uint8_t blocking;
        struct sockaddr_nl local;
        struct sockaddr_nl peer;
        struct nlmsghdr* last_nlhdr;
@@ -112,7 +112,7 @@ char *ipulog_strerror(int errcode)
 }
 
 /* convert a netlink group (1-32) to a group_mask suitable for create_handle */
-u_int32_t ipulog_group2gmask(u_int32_t group)
+uint32_t ipulog_group2gmask(uint32_t group)
 {
        if (group < 1 || group > 32)
        {
@@ -123,8 +123,8 @@ u_int32_t ipulog_group2gmask(u_int32_t group)
 }
 
 /* create a ipulog handle for the reception of packets sent to gmask */
-struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, 
-                                          u_int32_t rcvbufsize)
+struct ipulog_handle *ipulog_create_handle(uint32_t gmask,
+                                          uint32_t rcvbufsize)
 {
        struct ipulog_handle *h;
        int status;
index 0a1ebfcd522d0dc1ebb2bb2badcc6b72b38883bd..643320ce724cb34c32e70c8b3af19679b6246bbc 100644 (file)
@@ -174,7 +174,7 @@ static int open_db_mysql(struct ulogd_pluginstance *upi)
        struct mysql_instance *mi = (struct mysql_instance *) upi->private;
        unsigned int connect_timeout = timeout_ce(upi->config_kset).u.value;
        char *server = host_ce(upi->config_kset).u.string;
-       u_int16_t port = port_ce(upi->config_kset).u.value;
+       uint16_t port = port_ce(upi->config_kset).u.value;
        char *user = user_ce(upi->config_kset).u.string;
        char *pass = pass_ce(upi->config_kset).u.string;
        char *db = db_ce(upi->config_kset).u.string;
index 761d2720603e333a9aa8699a96cae9f950e5c615..62f1d60e84dbc7442f6f036ad1f0ea9f5bd344a1 100644 (file)
 #endif
 
 #ifdef IPPROTO_SCTP
-typedef u_int32_t sctp_assoc_t;
+typedef uint32_t sctp_assoc_t;
 
 /* glibc doesn't yet have this, as defined by
  * draft-ietf-tsvwg-sctpsocket-11.txt */
 struct sctp_sndrcvinfo {
-       u_int16_t       sinfo_stream;
-       u_int16_t       sinfo_ssn;
-       u_int16_t       sinfo_flags;
-       u_int32_t       sinfo_ppid;
-       u_int32_t       sinfo_context;
-       u_int32_t       sinfo_timetolive;
-       u_int32_t       sinfo_tsn;
-       u_int32_t       sinfo_cumtsn;
+       uint16_t        sinfo_stream;
+       uint16_t        sinfo_ssn;
+       uint16_t        sinfo_flags;
+       uint32_t        sinfo_ppid;
+       uint32_t        sinfo_context;
+       uint32_t        sinfo_timetolive;
+       uint32_t        sinfo_tsn;
+       uint32_t        sinfo_cumtsn;
        sctp_assoc_t    sinfo_assoc_id;
 };
 #endif
@@ -207,7 +207,7 @@ struct ipfix_instance {
 };
 
 #define ULOGD_IPFIX_TEMPL_BASE 1024
-static u_int16_t next_template_id = ULOGD_IPFIX_TEMPL_BASE;
+static uint16_t next_template_id = ULOGD_IPFIX_TEMPL_BASE;
 
 /* Build the IPFIX template from the input keys */
 struct ulogd_ipfix_template *
index 2672faba85e581b89080f4791cf803981edbccdd..41435dc04db0411b385651a049ef4b73ebf5dce6 100644 (file)
@@ -22,9 +22,9 @@
 #include <ulogd/ulogd.h>
 #include <ulogd/addr.h>
 
-u_int32_t ulogd_bits2netmask(int bits)
+uint32_t ulogd_bits2netmask(int bits)
 {
-       u_int32_t netmask, bm;
+       uint32_t netmask, bm;
 
        if (bits >= 32 || bits < 0)
                return(~0);
index 24966a52e097cadcab400ded62b422681e36a6a3..c9aec418e9ed20e76a6a28987e0b0b5b8cd8c957 100644 (file)
--- a/util/db.c
+++ b/util/db.c
@@ -362,7 +362,7 @@ static void __format_query_db(struct ulogd_pluginstance *upi, char *start)
                        sprintf(stmt_ins, "%u,", res->u.value.ui16);
                        break;
                case ULOGD_RET_IPADDR:
-                       /* fallthrough when logging IP as u_int32_t */
+                       /* fallthrough when logging IP as uint32_t */
                case ULOGD_RET_UINT32:
                        sprintf(stmt_ins, "%u,", res->u.value.ui32);
                        break;
index eb6cfbf613ad6b8d4b153953067b14275282dc28..69a47cafc2f345b39803975b9a8d7cfaa760485d 100644 (file)
@@ -199,7 +199,7 @@ static int printpkt_ipv4(struct ulogd_key *res, char *buf)
 {
        char *buf_cur = buf;
        char tmp[INET_ADDRSTRLEN];
-       u_int32_t paddr;
+       uint32_t paddr;
 
        if (pp_is_valid(res, KEY_IP_SADDR))
                buf_cur += sprintf(buf_cur, "SRC=%s ",
@@ -363,8 +363,8 @@ static int printpkt_ipv6(struct ulogd_key *res, char *buf)
 int printpkt_arp(struct ulogd_key *res, char *buf)
 {
        char *buf_cur = buf;
-       u_int16_t code = 0;
-       u_int8_t *mac;
+       uint16_t code = 0;
+       uint8_t *mac;
 
        if (pp_is_valid(res, KEY_ARP_SPA))
                buf_cur += sprintf(buf_cur, "SRC=%s ",