Skip to contentSkip to conversation

Use stdint types everywhere

PATCH In review Felix Janda 1 participant 1 message May 16, 2015 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 Use stdint types everywhere

---
 include/libnetfilter_queue/libnetfilter_queue.h |  56 ++++++-------
 src/libnetfilter_queue.c                        | 102 ++++++++++++------------
 utils/nfqnl_test.c                              |   6 +-
 3 files changed, 82 insertions(+), 82 deletions(-)
include/libnetfilter_queue/libnetfilter_queue.h +28 -28
index 122cd10..8194a4f 100644
@@ -39,11 +39,11 @@ extern struct nfq_handle *nfq_open(void);
 extern struct nfq_handle *nfq_open_nfnl(struct nfnl_handle *nfnlh);
 extern int nfq_close(struct nfq_handle *h);
 
-extern int nfq_bind_pf(struct nfq_handle *h, u_int16_t pf);
-extern int nfq_unbind_pf(struct nfq_handle *h, u_int16_t pf);
+extern int nfq_bind_pf(struct nfq_handle *h, uint16_t pf);
+extern int nfq_unbind_pf(struct nfq_handle *h, uint16_t pf);
 
 extern struct nfq_q_handle *nfq_create_queue(struct nfq_handle *h,
-			      			 u_int16_t num,
+						 uint16_t num,
 						 nfq_callback *cb,
 						 void *data);
 extern int nfq_destroy_queue(struct nfq_q_handle *qh);
@@ -51,42 +51,42 @@ extern int nfq_destroy_queue(struct nfq_q_handle *qh);
 extern int nfq_handle_packet(struct nfq_handle *h, char *buf, int len);
 
 extern int nfq_set_mode(struct nfq_q_handle *qh,
-			  u_int8_t mode, unsigned int len);
+			  uint8_t mode, unsigned int len);
 
 int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
-			u_int32_t queuelen);
+			uint32_t queuelen);
 
 extern int nfq_set_queue_flags(struct nfq_q_handle *qh,
 			       uint32_t mask, uint32_t flags);
 
 extern int nfq_set_verdict(struct nfq_q_handle *qh,
-			     u_int32_t id,
-			     u_int32_t verdict,
-			     u_int32_t data_len,
+			     uint32_t id,
+			     uint32_t verdict,
+			     uint32_t data_len,
 			     const unsigned char *buf);
 
 extern int nfq_set_verdict2(struct nfq_q_handle *qh,
-			    u_int32_t id,
-			    u_int32_t verdict, 
-			    u_int32_t mark,
-			    u_int32_t datalen,
+			    uint32_t id,
+			    uint32_t verdict,
+			    uint32_t mark,
+			    uint32_t datalen,
 			    const unsigned char *buf);
 
 extern int nfq_set_verdict_batch(struct nfq_q_handle *qh,
-			    u_int32_t id,
-			    u_int32_t verdict);
+			    uint32_t id,
+			    uint32_t verdict);
 
 extern int nfq_set_verdict_batch2(struct nfq_q_handle *qh,
-			    u_int32_t id,
-			    u_int32_t verdict,
-			    u_int32_t mark);
+			    uint32_t id,
+			    uint32_t verdict,
+			    uint32_t mark);
 
 extern __attribute__((deprecated))
 int nfq_set_verdict_mark(struct nfq_q_handle *qh, 
-			 u_int32_t id,
-			 u_int32_t verdict, 
-			 u_int32_t mark,
-			 u_int32_t datalen,
+			 uint32_t id,
+			 uint32_t verdict,
+			 uint32_t mark,
+			 uint32_t datalen,
 			 const unsigned char *buf);
 
 /* message parsing function */
@@ -94,17 +94,17 @@ int nfq_set_verdict_mark(struct nfq_q_handle *qh,
 extern struct nfqnl_msg_packet_hdr *
 				nfq_get_msg_packet_hdr(struct nfq_data *nfad);
 
-extern u_int32_t nfq_get_nfmark(struct nfq_data *nfad);
+extern uint32_t nfq_get_nfmark(struct nfq_data *nfad);
 
 extern int nfq_get_timestamp(struct nfq_data *nfad, struct timeval *tv);
 
 /* return 0 if not set */
-extern u_int32_t nfq_get_indev(struct nfq_data *nfad);
-extern u_int32_t nfq_get_physindev(struct nfq_data *nfad);
-extern u_int32_t nfq_get_outdev(struct nfq_data *nfad);
-extern u_int32_t nfq_get_physoutdev(struct nfq_data *nfad);
-extern int nfq_get_uid(struct nfq_data *nfad, u_int32_t *uid);
-extern int nfq_get_gid(struct nfq_data *nfad, u_int32_t *gid);
+extern uint32_t nfq_get_indev(struct nfq_data *nfad);
+extern uint32_t nfq_get_physindev(struct nfq_data *nfad);
+extern uint32_t nfq_get_outdev(struct nfq_data *nfad);
+extern uint32_t nfq_get_physoutdev(struct nfq_data *nfad);
+extern int nfq_get_uid(struct nfq_data *nfad, uint32_t *uid);
+extern int nfq_get_gid(struct nfq_data *nfad, uint32_t *gid);
 
 extern int nfq_get_indev_name(struct nlif_handle *nlif_handle,
 			      struct nfq_data *nfad, char *name);
src/libnetfilter_queue.c +51 -51

294 lines not on this page · raw message

utils/nfqnl_test.c +3 -3
index 2176a61..b760cf0 100644
@@ -10,12 +10,12 @@
 #include <libnetfilter_queue/libnetfilter_queue.h>
 
 /* returns packet id */
-static u_int32_t print_pkt (struct nfq_data *tb)
+static uint32_t print_pkt (struct nfq_data *tb)
 {
 	int id = 0;
 	struct nfqnl_msg_packet_hdr *ph;
 	struct nfqnl_msg_packet_hw *hwph;
-	u_int32_t mark, ifi, uid, gid;
+	uint32_t mark, ifi, uid, gid;
 	int ret;
 	unsigned char *data;
 
@@ -74,7 +74,7 @@ static u_int32_t print_pkt (struct nfq_data *tb)
 static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
 	      struct nfq_data *nfa, void *data)
 {
-	u_int32_t id = print_pkt(nfa);
+	uint32_t id = print_pkt(nfa);
 	printf("entering callback\n");
 	return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
 }
Signature · 1 line
2.3.6