summaryrefslogtreecommitdiffstats
path: root/input/packet
diff options
context:
space:
mode:
authorFelix Janda <felix.janda@posteo.de>2015-06-24 19:53:34 +0200
committerEric Leblond <eric@regit.org>2015-06-26 09:12:55 +0200
commitc9337b31f756cae85299c8275b21088ce02885e2 (patch)
tree21a2161706fd42a7ba3c330e9ec0485f40ecd42b /input/packet
parent8a6ddd1cb2b55c234f1a97f7e5d996f24f46b6f8 (diff)
Use stdint types everywhere
Signed-off-by: Felix Janda <felix.janda@posteo.de>
Diffstat (limited to 'input/packet')
-rw-r--r--input/packet/ulogd_inppkt_NFLOG.c16
-rw-r--r--input/packet/ulogd_inppkt_UNIXSOCK.c34
2 files changed, 25 insertions, 25 deletions
diff --git a/input/packet/ulogd_inppkt_NFLOG.c b/input/packet/ulogd_inppkt_NFLOG.c
index 6196626..a367959 100644
--- a/input/packet/ulogd_inppkt_NFLOG.c
+++ b/input/packet/ulogd_inppkt_NFLOG.c
@@ -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;
diff --git a/input/packet/ulogd_inppkt_UNIXSOCK.c b/input/packet/ulogd_inppkt_UNIXSOCK.c
index e4009f3..39944bf 100644
--- a/input/packet/ulogd_inppkt_UNIXSOCK.c
+++ b/input/packet/ulogd_inppkt_UNIXSOCK.c
@@ -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;
}