summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2015-03-05 10:33:43 +0000
committerDenis Ovsienko <denis@ovsienko.info>2015-03-05 10:35:03 +0000
commit60a835d80f4b6c12dbe2d38fe4ca2de16f3302dc (patch)
tree4c0142a37b3b6007826183ffc37b3e57f9237f12
parentbc183f0882ee2080e5888a428e5b0823380fc18a (diff)
downloadtcpdump-60a835d80f4b6c12dbe2d38fe4ca2de16f3302dc.tar.gz
clean K&R style up in function declarations a bit
The function body should have its opening brace on the next line.
-rw-r--r--print-ahcp.c28
-rw-r--r--print-atm.c4
-rw-r--r--print-babel.c9
-rw-r--r--print-bgp.c15
-rw-r--r--print-cfm.c11
-rw-r--r--print-chdlc.c3
-rw-r--r--print-eigrp.c4
-rw-r--r--print-fr.c8
-rw-r--r--print-icmp.c3
-rw-r--r--print-isoclns.c20
-rw-r--r--print-juniper.c16
-rw-r--r--print-ldp.c12
-rw-r--r--print-lldp.c12
-rw-r--r--print-lmp.c4
-rw-r--r--print-lspping.c4
-rw-r--r--print-lwapp.c8
-rw-r--r--print-mpcp.c4
-rw-r--r--print-openflow-1.0.c93
-rw-r--r--print-openflow.c12
-rw-r--r--print-ospf.c8
-rw-r--r--print-ppp.c4
-rw-r--r--print-rpki-rtr.c4
-rw-r--r--print-rsvp.c12
-rw-r--r--print-sflow.c65
-rw-r--r--print-slow.c12
-rw-r--r--print-zeromq.c12
26 files changed, 221 insertions, 166 deletions
diff --git a/print-ahcp.c b/print-ahcp.c
index 280372da..a9ae38a9 100644
--- a/print-ahcp.c
+++ b/print-ahcp.c
@@ -100,7 +100,8 @@ static const struct tok ahcp1_opt_str[] = {
};
static int
-ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
time_t t;
struct tm *tm;
char buf[BUFSIZE];
@@ -127,7 +128,8 @@ trunc:
}
static int
-ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
if (cp + 4 != ep)
goto corrupt;
ND_TCHECK2(*cp, 4);
@@ -144,7 +146,8 @@ trunc:
}
static int
-ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
const char *sep = ": ";
while (cp < ep) {
@@ -171,7 +174,8 @@ trunc:
}
static int
-ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
const char *sep = ": ";
while (cp < ep) {
@@ -194,7 +198,8 @@ trunc:
}
static int
-ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
const char *sep = ": ";
while (cp < ep) {
@@ -221,7 +226,8 @@ trunc:
}
static int
-ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
const char *sep = ": ";
while (cp < ep) {
@@ -263,7 +269,8 @@ static int
};
static void
-ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
uint8_t option_no, option_len;
while (cp < ep) {
@@ -303,7 +310,8 @@ trunc:
}
static void
-ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
uint8_t type, mbz;
uint16_t body_len;
@@ -347,7 +355,8 @@ trunc:
}
void
-ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) {
+ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
+{
const u_char *ep = cp + len;
uint8_t version;
@@ -410,4 +419,3 @@ corrupt:
trunc:
ND_PRINT((ndo, "%s", tstr));
}
-
diff --git a/print-atm.c b/print-atm.c
index 93610659..8faf715d 100644
--- a/print-atm.c
+++ b/print-atm.c
@@ -362,8 +362,8 @@ struct oam_fm_ais_rdi_t {
int
oam_print (netdissect_options *ndo,
- const u_char *p, u_int length, u_int hec) {
-
+ const u_char *p, u_int length, u_int hec)
+{
uint32_t cell_header;
uint16_t vpi, vci, cksum, cksum_shouldbe, idx;
uint8_t cell_type, func_type, payload, clp;
diff --git a/print-babel.c b/print-babel.c
index bb3401be..75cb32cf 100644
--- a/print-babel.c
+++ b/print-babel.c
@@ -46,7 +46,8 @@ static void babel_print_v2(netdissect_options *, const u_char *cp, u_int length)
void
babel_print(netdissect_options *ndo,
- const u_char *cp, u_int length) {
+ const u_char *cp, u_int length)
+{
ND_PRINT((ndo, "babel"));
ND_TCHECK2(*cp, 4);
@@ -270,7 +271,8 @@ network_address(int ae, const unsigned char *a, unsigned int len,
*/
static void
subtlvs_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const uint8_t tlv_type) {
+ const u_char *cp, const u_char *ep, const uint8_t tlv_type)
+{
uint8_t subtype, sublen;
const char *sep;
uint32_t t1, t2;
@@ -340,7 +342,8 @@ subtlvs_print(netdissect_options *ndo,
static void
babel_print_v2(netdissect_options *ndo,
- const u_char *cp, u_int length) {
+ const u_char *cp, u_int length)
+{
u_int i;
u_short bodylen;
u_char v4_prefix[16] =
diff --git a/print-bgp.c b/print-bgp.c
index f5739cd9..c617c3bb 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -574,7 +574,8 @@ badtlv:
*/
static char *
bgp_vpn_ip_print(netdissect_options *ndo,
- const u_char *pptr, u_int addr_length) {
+ const u_char *pptr, u_int addr_length)
+{
/* worst case string is s fully formatted v6 address */
static char addr[sizeof("1234:5678:89ab:cdef:1234:5678:89ab:cdef")];
@@ -622,8 +623,8 @@ trunc:
*/
static int
bgp_vpn_sg_print(netdissect_options *ndo,
- const u_char *pptr, char *buf, u_int buflen) {
-
+ const u_char *pptr, char *buf, u_int buflen)
+{
uint8_t addr_length;
u_int total_length, offset;
@@ -667,8 +668,8 @@ trunc:
* printing route targets inside a NLRI */
char *
bgp_vpn_rd_print(netdissect_options *ndo,
- const u_char *pptr) {
-
+ const u_char *pptr)
+{
/* allocate space for the largest possible string */
static char rd[sizeof("xxxxxxxxxx:xxxxx (xxx.xxx.xxx.xxx:xxxxx)")];
char *pos = rd;
@@ -2619,8 +2620,8 @@ trunc:
static void
bgp_route_refresh_print(netdissect_options *ndo,
- const u_char *pptr, int len) {
-
+ const u_char *pptr, int len)
+{
const struct bgp_route_refresh *bgp_route_refresh_header;
char tokbuf[TOKBUFSIZE];
char tokbuf2[TOKBUFSIZE];
diff --git a/print-cfm.c b/print-cfm.c
index e6aec0b9..a85eec09 100644
--- a/print-cfm.c
+++ b/print-cfm.c
@@ -227,8 +227,8 @@ static const struct tok cfm_tlv_senderid_chassisid_values[] = {
static int
cfm_mgmt_addr_print(netdissect_options *ndo,
- register const u_char *tptr) {
-
+ register const u_char *tptr)
+{
u_int mgmt_addr_type;
u_int hexdump = FALSE;
@@ -268,7 +268,8 @@ cfm_mgmt_addr_print(netdissect_options *ndo,
* The egress-ID string is a 16-Bit string plus a MAC address.
*/
static const char *
-cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr) {
+cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr)
+{
static char egress_id_buffer[80];
snprintf(egress_id_buffer, sizeof(egress_id_buffer),
@@ -281,8 +282,8 @@ cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr) {
void
cfm_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int length) {
-
+ register const u_char *pptr, register u_int length)
+{
const struct cfm_common_header_t *cfm_common_header;
const struct cfm_tlv_header_t *cfm_tlv_header;
const uint8_t *tptr, *tlv_ptr, *ma_name, *ma_nameformat, *ma_namelength;
diff --git a/print-chdlc.c b/print-chdlc.c
index 8230c87e..3951ef77 100644
--- a/print-chdlc.c
+++ b/print-chdlc.c
@@ -56,7 +56,8 @@ chdlc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register co
}
u_int
-chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length) {
+chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
+{
u_int proto;
proto = EXTRACT_16BITS(&p[2]);
diff --git a/print-eigrp.c b/print-eigrp.c
index a3feb8ef..cab77ba5 100644
--- a/print-eigrp.c
+++ b/print-eigrp.c
@@ -205,8 +205,8 @@ static const struct tok eigrp_ext_proto_id_values[] = {
};
void
-eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int len) {
-
+eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int len)
+{
const struct eigrp_common_header *eigrp_com_header;
const struct eigrp_tlv_header *eigrp_tlv_header;
const u_char *tptr,*tlv_tptr;
diff --git a/print-fr.c b/print-fr.c
index 6ff86cae..0832522c 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -143,7 +143,9 @@ static int parse_q922_addr(netdissect_options *ndo,
return 1;
}
-char *q922_string(netdissect_options *ndo, const u_char *p, u_int length) {
+char *
+q922_string(netdissect_options *ndo, const u_char *p, u_int length)
+{
static u_int dlci, addr_len;
static uint8_t flags[4];
@@ -591,8 +593,8 @@ mfr_print(netdissect_options *ndo,
static void
frf15_print(netdissect_options *ndo,
- const u_char *p, u_int length) {
-
+ const u_char *p, u_int length)
+{
uint16_t sequence_num, flags;
flags = p[0]&MFR_BEC_MASK;
diff --git a/print-icmp.c b/print-icmp.c
index 47ba5892..59eb0077 100644
--- a/print-icmp.c
+++ b/print-icmp.c
@@ -311,7 +311,8 @@ const char *icmp_tstamp_print(u_int);
/* print the milliseconds since midnight UTC */
const char *
-icmp_tstamp_print(u_int tstamp) {
+icmp_tstamp_print(u_int tstamp)
+{
u_int msec,sec,min,hrs;
static char buf[64];
diff --git a/print-isoclns.c b/print-isoclns.c
index 50227a71..bd109ab9 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -1658,8 +1658,8 @@ isis_print_tlv_ip_reach(netdissect_options *ndo,
static int
isis_print_ip_reach_subtlv(netdissect_options *ndo,
const uint8_t *tptr, int subt, int subl,
- const char *ident) {
-
+ const char *ident)
+{
/* first lets see if we know the subTLVs name*/
ND_PRINT((ndo, "%s%s subTLV #%u, length: %u",
ident, tok2str(isis_ext_ip_reach_subtlv_values, "unknown", subt),
@@ -1708,8 +1708,8 @@ trunctlv:
static int
isis_print_is_reach_subtlv(netdissect_options *ndo,
const uint8_t *tptr, u_int subt, u_int subl,
- const char *ident) {
-
+ const char *ident)
+{
u_int te_class,priority_level,gmpls_switch_cap;
union { /* int to float conversion buffer for several subTLVs */
float f;
@@ -1868,8 +1868,8 @@ trunctlv:
static int
isis_print_ext_is_reach(netdissect_options *ndo,
- const uint8_t *tptr, const char *ident, int tlv_type) {
-
+ const uint8_t *tptr, const char *ident, int tlv_type)
+{
char ident_buffer[20];
int subtlv_type,subtlv_len,subtlv_sum_len;
int proc_bytes = 0; /* how many bytes did we process ? */
@@ -1918,8 +1918,8 @@ isis_print_ext_is_reach(netdissect_options *ndo,
static int
isis_print_mtid(netdissect_options *ndo,
- const uint8_t *tptr, const char *ident) {
-
+ const uint8_t *tptr, const char *ident)
+{
if (!ND_TTEST2(*tptr, 2))
return(0);
@@ -1945,8 +1945,8 @@ isis_print_mtid(netdissect_options *ndo,
static int
isis_print_extd_ip_reach(netdissect_options *ndo,
- const uint8_t *tptr, const char *ident, uint16_t afi) {
-
+ const uint8_t *tptr, const char *ident, uint16_t afi)
+{
char ident_buffer[20];
#ifdef INET6
uint8_t prefix[sizeof(struct in6_addr)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
diff --git a/print-juniper.c b/print-juniper.c
index 31874b7d..e4bb77c9 100644
--- a/print-juniper.c
+++ b/print-juniper.c
@@ -1019,8 +1019,8 @@ juniper_atm2_print(netdissect_options *ndo,
* a juniper router if the payload data is encapsulated using PPP */
static int
juniper_ppp_heuristic_guess(netdissect_options *ndo,
- register const u_char *p, u_int length) {
-
+ register const u_char *p, u_int length)
+{
switch(EXTRACT_16BITS(p)) {
case PPP_IP :
case PPP_OSI :
@@ -1049,8 +1049,8 @@ juniper_ppp_heuristic_guess(netdissect_options *ndo,
static int
ip_heuristic_guess(netdissect_options *ndo,
- register const u_char *p, u_int length) {
-
+ register const u_char *p, u_int length)
+{
switch(p[0]) {
case 0x45:
case 0x46:
@@ -1091,8 +1091,8 @@ ip_heuristic_guess(netdissect_options *ndo,
}
static int
-juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) {
-
+juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len)
+{
int tlv_value;
/* TLVs < 128 are little endian encoded */
@@ -1139,8 +1139,8 @@ juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) {
static int
juniper_parse_header(netdissect_options *ndo,
- const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) {
-
+ const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info)
+{
const struct juniper_cookie_table_t *lp = juniper_cookie_table;
u_int idx, jnx_ext_len, jnx_header_len = 0;
uint8_t tlv_type,tlv_len;
diff --git a/print-ldp.c b/print-ldp.c
index f387affd..3f741d13 100644
--- a/print-ldp.c
+++ b/print-ldp.c
@@ -234,8 +234,8 @@ static int ldp_pdu_print(netdissect_options *, register const u_char *);
static int
ldp_tlv_print(netdissect_options *ndo,
register const u_char *tptr,
- u_short msg_tlen) {
-
+ u_short msg_tlen)
+{
struct ldp_tlv_header {
uint8_t type[2];
uint8_t length[2];
@@ -545,8 +545,8 @@ badtlv:
void
ldp_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
int processed;
while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) {
processed = ldp_pdu_print(ndo, pptr);
@@ -559,8 +559,8 @@ ldp_print(netdissect_options *ndo,
static int
ldp_pdu_print(netdissect_options *ndo,
- register const u_char *pptr) {
-
+ register const u_char *pptr)
+{
const struct ldp_common_header *ldp_com_header;
const struct ldp_msg_header *ldp_msg_header;
const u_char *tptr,*msg_tptr;
diff --git a/print-lldp.c b/print-lldp.c
index e499507b..ce3c0938 100644
--- a/print-lldp.c
+++ b/print-lldp.c
@@ -1265,8 +1265,8 @@ lldp_private_dcbx_print(netdissect_options *ndo,
}
static char *
-lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len) {
-
+lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
+{
uint8_t af;
static char buf[BUFSIZE];
const char * (*pfunc)(netdissect_options *, const u_char *);
@@ -1311,8 +1311,8 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
static int
lldp_mgmt_addr_tlv_print(netdissect_options *ndo,
- const u_char *pptr, u_int len) {
-
+ const u_char *pptr, u_int len)
+{
uint8_t mgmt_addr_len, intf_num_subtype, oid_len;
const u_char *tptr;
u_int tlen;
@@ -1373,8 +1373,8 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo,
void
lldp_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
uint8_t subtype;
uint16_t tlv, cap, ena_cap;
u_int oui, tlen, hexdump, tlv_type, tlv_len;
diff --git a/print-lmp.c b/print-lmp.c
index 8d68e858..904dd712 100644
--- a/print-lmp.c
+++ b/print-lmp.c
@@ -354,8 +354,8 @@ static const struct tok lmp_ctype_values[] = {
void
lmp_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
const struct lmp_common_header *lmp_com_header;
const struct lmp_object_header *lmp_obj_header;
const u_char *tptr,*obj_tptr;
diff --git a/print-lspping.c b/print-lspping.c
index 1786cd2c..888adfaf 100644
--- a/print-lspping.c
+++ b/print-lspping.c
@@ -458,8 +458,8 @@ static const struct tok lspping_tlv_downstream_addr_values[] = {
void
lspping_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
const struct lspping_common_header *lspping_com_header;
const struct lspping_tlv_header *lspping_tlv_header;
const struct lspping_tlv_header *lspping_subtlv_header;
diff --git a/print-lwapp.c b/print-lwapp.c
index 6e02cd48..39af0ec1 100644
--- a/print-lwapp.c
+++ b/print-lwapp.c
@@ -162,8 +162,8 @@ struct lwapp_message_header {
void
lwapp_control_print(netdissect_options *ndo,
- const u_char *pptr, u_int len, int has_ap_ident) {
-
+ const u_char *pptr, u_int len, int has_ap_ident)
+{
const struct lwapp_transport_header *lwapp_trans_header;
const struct lwapp_control_header *lwapp_control_header;
const u_char *tptr;
@@ -285,8 +285,8 @@ lwapp_control_print(netdissect_options *ndo,
void
lwapp_data_print(netdissect_options *ndo,
- const u_char *pptr, u_int len) {
-
+ const u_char *pptr, u_int len)
+{
const struct lwapp_transport_header *lwapp_trans_header;
const u_char *tptr;
int tlen;
diff --git a/print-mpcp.c b/print-mpcp.c
index 7ddfb1d1..9da3582d 100644
--- a/print-mpcp.c
+++ b/print-mpcp.c
@@ -122,8 +122,8 @@ static const struct tok mpcp_reg_ack_flag_values[] = {
};
void
-mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int length) {
-
+mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int length)
+{
union {
const struct mpcp_common_header_t *common_header;
const struct mpcp_grant_t *grant;
diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c
index f86a9412..a36c32f3 100644
--- a/print-openflow-1.0.c
+++ b/print-openflow-1.0.c
@@ -696,7 +696,8 @@ static const struct tok bsn_onoff_str[] = {
};
static const char *
-vlan_str(const uint16_t vid) {
+vlan_str(const uint16_t vid)
+{
static char buf[sizeof("65535 (bogus)")];
const char *fmt;
@@ -708,7 +709,8 @@ vlan_str(const uint16_t vid) {
}
static const char *
-pcp_str(const uint8_t pcp) {
+pcp_str(const uint8_t pcp)
+{
static char buf[sizeof("255 (bogus)")];
snprintf(buf, sizeof(buf), pcp <= 7 ? "%u" : "%u (bogus)", pcp);
return buf;
@@ -716,7 +718,8 @@ pcp_str(const uint8_t pcp) {
static void
of10_bitmap_print(netdissect_options *ndo,
- const struct tok *t, const uint32_t v, const uint32_t u) {
+ const struct tok *t, const uint32_t v, const uint32_t u)
+{
const char *sep = " (";
if (v == 0)
@@ -733,7 +736,8 @@ of10_bitmap_print(netdissect_options *ndo,
static const u_char *
of10_data_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
if (len == 0)
return cp;
/* data */
@@ -750,7 +754,8 @@ trunc:
static const u_char *
of10_bsn_message_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
const u_char *cp0 = cp;
uint32_t subtype;
@@ -954,7 +959,8 @@ trunc:
static const u_char *
of10_bsn_actions_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
const u_char *cp0 = cp;
uint32_t subtype, vlan_tag;
@@ -1027,7 +1033,8 @@ trunc:
static const u_char *
of10_vendor_action_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
uint32_t vendor;
const u_char *(*decoder)(netdissect_options *, const u_char *, const u_char *, const u_int);
@@ -1055,7 +1062,8 @@ trunc:
static const u_char *
of10_vendor_message_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
uint32_t vendor;
const u_char *(*decoder)(netdissect_options *, const u_char *, const u_char *, u_int);
@@ -1084,7 +1092,8 @@ trunc:
/* Vendor ID is mandatory, data is optional. */
static const u_char *
of10_vendor_data_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
uint32_t vendor;
if (len < 4)
@@ -1108,7 +1117,8 @@ trunc:
static const u_char *
of10_packet_data_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
if (len == 0)
return cp;
/* data */
@@ -1130,7 +1140,8 @@ trunc:
/* [OF10] Section 5.2.1 */
static const u_char *
of10_phy_ports_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
@@ -1204,7 +1215,8 @@ trunc:
/* [OF10] Section 5.2.2 */
static const u_char *
of10_queue_props_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t property, plen, rate;
@@ -1279,7 +1291,8 @@ trunc:
/* ibid */
static const u_char *
of10_queues_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t desclen;
@@ -1326,7 +1339,8 @@ trunc:
/* [OF10] Section 5.2.3 */
static const u_char *
of10_match_print(netdissect_options *ndo,
- const char *pfx, const u_char *cp, const u_char *ep) {
+ const char *pfx, const u_char *cp, const u_char *ep)
+{
uint32_t wildcards;
uint16_t dl_type;
uint8_t nw_proto;
@@ -1430,7 +1444,8 @@ trunc:
static const u_char *
of10_actions_print(netdissect_options *ndo,
const char *pfx, const u_char *cp, const u_char *ep,
- u_int len) {
+ u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t type, alen, output_port;
@@ -1595,7 +1610,8 @@ trunc:
/* [OF10] Section 5.3.1 */
static const u_char *
of10_features_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
/* datapath_id */
ND_TCHECK2(*cp, 8);
ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_64BITS(cp)));
@@ -1632,7 +1648,8 @@ trunc:
/* [OF10] Section 5.3.3 */
static const u_char *
of10_flow_mod_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
uint16_t command;
/* match */
@@ -1689,7 +1706,8 @@ trunc:
/* ibid */
static const u_char *
of10_port_mod_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep) {
+ const u_char *cp, const u_char *ep)
+{
/* port_no */
ND_TCHECK2(*cp, 2);
ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
@@ -1725,7 +1743,8 @@ trunc:
/* [OF10] Section 5.3.5 */
static const u_char *
of10_stats_request_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t type;
@@ -1808,7 +1827,8 @@ trunc:
/* ibid */
static const u_char *
of10_desc_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
if (len != OF_DESC_STATS_LEN)
goto corrupt;
/* mfr_desc */
@@ -1854,7 +1874,8 @@ trunc:
/* ibid */
static const u_char *
of10_flow_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t entry_len;
@@ -1935,7 +1956,8 @@ trunc:
static const u_char *
of10_aggregate_stats_reply_print(netdissect_options *ndo,
const u_char *cp, const u_char *ep,
- const u_int len) {
+ const u_int len)
+{
if (len != OF_AGGREGATE_STATS_REPLY_LEN)
goto corrupt;
/* packet_count */
@@ -1966,7 +1988,8 @@ trunc:
/* ibid */
static const u_char *
of10_table_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
@@ -2024,7 +2047,8 @@ trunc:
/* ibid */
static const u_char *
of10_port_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
@@ -2108,7 +2132,8 @@ trunc:
/* ibid */
static const u_char *
of10_queue_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, u_int len) {
+ const u_char *cp, const u_char *ep, u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
@@ -2155,7 +2180,8 @@ trunc:
/* ibid */
static const u_char *
of10_stats_reply_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
const u_char *cp0 = cp;
uint16_t type;
@@ -2194,7 +2220,8 @@ trunc:
/* [OF10] Section 5.3.6 */
static const u_char *
of10_packet_out_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
uint16_t actions_len;
@@ -2231,7 +2258,8 @@ trunc:
/* [OF10] Section 5.4.1 */
static const u_char *
of10_packet_in_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
/* buffer_id */
ND_TCHECK2(*cp, 4);
ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_32BITS(cp))));
@@ -2263,7 +2291,8 @@ trunc:
/* [OF10] Section 5.4.2 */
static const u_char *
of10_flow_removed_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep) {
+ const u_char *cp, const u_char *ep)
+{
/* match */
if (ep == (cp = of10_match_print(ndo, "\n\t ", cp, ep)))
return ep; /* end of snapshot */
@@ -2316,7 +2345,8 @@ trunc:
/* [OF10] Section 5.4.4 */
static const u_char *
of10_error_print(netdissect_options *ndo,
- const u_char *cp, const u_char *ep, const u_int len) {
+ const u_char *cp, const u_char *ep, const u_int len)
+{
uint16_t type;
const struct tok *code_str;
@@ -2348,7 +2378,8 @@ trunc:
const u_char *
of10_header_body_print(netdissect_options *ndo,
const u_char *cp, const u_char *ep, const uint8_t type,
- const uint16_t len, const uint32_t xid) {
+ const uint16_t len, const uint32_t xid)
+{
const u_char *cp0 = cp;
const u_int len0 = len;
/* Thus far message length is not less than the basic header size, but most
diff --git a/print-openflow.c b/print-openflow.c
index d7682a0e..8825ae3d 100644
--- a/print-openflow.c
+++ b/print-openflow.c
@@ -60,21 +60,24 @@ const struct tok onf_exp_str[] = {
};
const char *
-of_vendor_name(const uint32_t vendor) {
+of_vendor_name(const uint32_t vendor)
+{
const struct tok *table = (vendor & 0xff000000) == 0 ? oui_values : onf_exp_str;
return tok2str(table, "unknown", vendor);
}
static void
of_header_print(netdissect_options *ndo, const uint8_t version, const uint8_t type,
- const uint16_t length, const uint32_t xid) {
+ const uint16_t length, const uint32_t xid)
+{
ND_PRINT((ndo, "\n\tversion unknown (0x%02x), type 0x%02x, length %u, xid 0x%08x",
version, type, length, xid));
}
/* Print a single OpenFlow message. */
static const u_char *
-of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
uint8_t version, type;
uint16_t length;
uint32_t xid;
@@ -129,7 +132,8 @@ trunc:
/* Print a TCP segment worth of OpenFlow messages presuming the segment begins
* on a message boundary. */
void
-openflow_print(netdissect_options *ndo, const u_char *cp, const u_int len) {
+openflow_print(netdissect_options *ndo, const u_char *cp, const u_int len)
+{
const u_char *ep = cp + len;
ND_PRINT((ndo, ": OpenFlow"));
diff --git a/print-ospf.c b/print-ospf.c
index b64438fa..3583417a 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -181,8 +181,8 @@ static const struct tok ospf_lls_eo_options[] = {
int
ospf_print_grace_lsa(netdissect_options *ndo,
- const uint8_t *tptr, u_int ls_length) {
-
+ const uint8_t *tptr, u_int ls_length)
+{
u_int tlv_type, tlv_length;
@@ -264,8 +264,8 @@ trunc:
int
ospf_print_te_lsa(netdissect_options *ndo,
- const uint8_t *tptr, u_int ls_length) {
-
+ const uint8_t *tptr, u_int ls_length)
+{
u_int tlv_type, tlv_length, subtlv_type, subtlv_length;
u_int priority_level, te_class, count_srlg;
union { /* int to float conversion buffer for several subTLVs */
diff --git a/print-ppp.c b/print-ppp.c
index 9a983e61..edc03c02 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -805,8 +805,8 @@ static const struct tok ppp_ml_flag_values[] = {
static void
handle_mlppp(netdissect_options *ndo,
- const u_char *p, int length) {
-
+ const u_char *p, int length)
+{
if (!ndo->ndo_eflag)
ND_PRINT((ndo, "MLPPP, "));
diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c
index 6c743479..101e41da 100644
--- a/print-rpki-rtr.c
+++ b/print-rpki-rtr.c
@@ -309,8 +309,8 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
}
void
-rpki_rtr_print(netdissect_options *ndo, register const u_char *pptr, register u_int len) {
-
+rpki_rtr_print(netdissect_options *ndo, register const u_char *pptr, register u_int len)
+{
u_int tlen, pdu_type, pdu_len;
const u_char *tptr;
const rpki_rtr_pdu *pdu_header;
diff --git a/print-rsvp.c b/print-rsvp.c
index 51ab9f8a..263ef3d4 100644
--- a/print-rsvp.c
+++ b/print-rsvp.c
@@ -486,8 +486,8 @@ static const struct tok rsvp_obj_generalized_uni_values[] = {
*/
static int
rsvp_intserv_print(netdissect_options *ndo,
- const u_char *tptr, u_short obj_tlen) {
-
+ const u_char *tptr, u_short obj_tlen)
+{
int parameter_id,parameter_length;
union {
float f;
@@ -637,8 +637,8 @@ _U_
_U_
#endif
, const u_char *tptr,
- const char *ident, u_int tlen) {
-
+ const char *ident, u_int tlen)
+{
const struct rsvp_object_header *rsvp_obj_header;
const u_char *obj_tptr;
union {
@@ -1795,8 +1795,8 @@ trunc:
void
rsvp_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
struct rsvp_common_header *rsvp_com_header;
const u_char *tptr,*subtptr;
u_short plen, tlen, subtlen;
diff --git a/print-sflow.c b/print-sflow.c
index da72848d..24112f44 100644
--- a/print-sflow.c
+++ b/print-sflow.c
@@ -297,8 +297,8 @@ struct sflow_vlan_counter_t {
static int
print_sflow_counter_generic(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_generic_counter_t *sflow_gen_counter;
if (len < sizeof(struct sflow_generic_counter_t))
@@ -343,8 +343,8 @@ print_sflow_counter_generic(netdissect_options *ndo,
static int
print_sflow_counter_ethernet(netdissect_options *ndo,
- const u_char *pointer, u_int len){
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_ethernet_counter_t *sflow_eth_counter;
if (len < sizeof(struct sflow_ethernet_counter_t))
@@ -373,15 +373,15 @@ print_sflow_counter_ethernet(netdissect_options *ndo,
static int
print_sflow_counter_token_ring(netdissect_options *ndo _U_,
- const u_char *pointer _U_, u_int len _U_) {
-
+ const u_char *pointer _U_, u_int len _U_)
+{
return 0;
}
static int
print_sflow_counter_basevg(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_100basevg_counter_t *sflow_100basevg_counter;
if (len < sizeof(struct sflow_100basevg_counter_t))
@@ -416,8 +416,8 @@ print_sflow_counter_basevg(netdissect_options *ndo,
static int
print_sflow_counter_vlan(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_vlan_counter_t *sflow_vlan_counter;
if (len < sizeof(struct sflow_vlan_counter_t))
@@ -446,8 +446,8 @@ struct sflow_processor_counter_t {
static int
print_sflow_counter_processor(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_processor_counter_t *sflow_processor_counter;
if (len < sizeof(struct sflow_processor_counter_t))
@@ -467,8 +467,8 @@ print_sflow_counter_processor(netdissect_options *ndo,
static int
sflow_print_counter_records(netdissect_options *ndo,
- const u_char *pointer, u_int len, u_int records) {
-
+ const u_char *pointer, u_int len, u_int records)
+{
u_int nrecords;
const u_char *tptr;
u_int tlen;
@@ -543,11 +543,10 @@ sflow_print_counter_records(netdissect_options *ndo,
return 0;
}
-
static int
sflow_print_counter_sample(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_counter_sample_t *sflow_counter_sample;
u_int nrecords;
u_int typesource;
@@ -579,8 +578,8 @@ sflow_print_counter_sample(netdissect_options *ndo,
static int
sflow_print_expanded_counter_sample(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_expanded_counter_sample_t *sflow_expanded_counter_sample;
u_int nrecords;
@@ -606,8 +605,8 @@ sflow_print_expanded_counter_sample(netdissect_options *ndo,
static int
print_sflow_raw_packet(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_expanded_flow_raw_t *sflow_flow_raw;
if (len < sizeof(struct sflow_expanded_flow_raw_t))
@@ -629,8 +628,8 @@ print_sflow_raw_packet(netdissect_options *ndo,
static int
print_sflow_ethernet_frame(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_ethernet_frame_t *sflow_ethernet_frame;
if (len < sizeof(struct sflow_ethernet_frame_t))
@@ -647,8 +646,8 @@ print_sflow_ethernet_frame(netdissect_options *ndo,
static int
print_sflow_extended_switch_data(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_extended_switch_data_t *sflow_extended_sw_data;
if (len < sizeof(struct sflow_extended_switch_data_t))
@@ -666,8 +665,8 @@ print_sflow_extended_switch_data(netdissect_options *ndo,
static int
sflow_print_flow_records(netdissect_options *ndo,
- const u_char *pointer, u_int len, u_int records) {
-
+ const u_char *pointer, u_int len, u_int records)
+{
u_int nrecords;
const u_char *tptr;
u_int tlen;
@@ -752,8 +751,8 @@ sflow_print_flow_records(netdissect_options *ndo,
static int
sflow_print_flow_sample(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_flow_sample_t *sflow_flow_sample;
u_int nrecords;
u_int typesource;
@@ -789,8 +788,8 @@ sflow_print_flow_sample(netdissect_options *ndo,
static int
sflow_print_expanded_flow_sample(netdissect_options *ndo,
- const u_char *pointer, u_int len) {
-
+ const u_char *pointer, u_int len)
+{
const struct sflow_expanded_flow_sample_t *sflow_expanded_flow_sample;
u_int nrecords;
@@ -818,8 +817,8 @@ sflow_print_expanded_flow_sample(netdissect_options *ndo,
void
sflow_print(netdissect_options *ndo,
- const u_char *pptr, u_int len) {
-
+ const u_char *pptr, u_int len)
+{
const struct sflow_datagram_t *sflow_datagram;
const struct sflow_sample_header *sflow_sample;
diff --git a/print-slow.c b/print-slow.c
index fec76cab..2db3581e 100644
--- a/print-slow.c
+++ b/print-slow.c
@@ -249,8 +249,8 @@ const struct slow_common_header_t *slow_com_header;
void
slow_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int len) {
-
+ register const u_char *pptr, register u_int len)
+{
int print_version;
slow_com_header = (const struct slow_common_header_t *)pptr;
@@ -332,8 +332,8 @@ trunc:
static void
slow_marker_lacp_print(netdissect_options *ndo,
- register const u_char *tptr, register u_int tlen) {
-
+ register const u_char *tptr, register u_int tlen)
+{
const struct tlv_header_t *tlv_header;
const u_char *tlv_tptr;
u_int tlv_len, tlv_tlen;
@@ -450,8 +450,8 @@ trunc:
static void
slow_oam_print(netdissect_options *ndo,
- register const u_char *tptr, register u_int tlen) {
-
+ register const u_char *tptr, register u_int tlen)
+{
u_int hexdump;
struct slow_oam_common_header_t {
diff --git a/print-zeromq.c b/print-zeromq.c
index 0ef30517..ba22c96e 100644
--- a/print-zeromq.c
+++ b/print-zeromq.c
@@ -76,7 +76,8 @@ static const char tstr[] = " [|zmtp1]";
*/
static const u_char *
-zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep) {
+zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+{
uint64_t body_len_declared, body_len_captured, header_len;
uint8_t flags;
@@ -139,7 +140,8 @@ trunc:
}
void
-zmtp1_print(netdissect_options *ndo, const u_char *cp, u_int len) {
+zmtp1_print(netdissect_options *ndo, const u_char *cp, u_int len)
+{
const u_char *ep = min(ndo->ndo_snapend, cp + len);
ND_PRINT((ndo, ": ZMTP/1.0"));
@@ -164,7 +166,8 @@ zmtp1_print(netdissect_options *ndo, const u_char *cp, u_int len) {
*/
static const u_char *
-zmtp1_print_intermediate_part(netdissect_options *ndo, const u_char *cp, const u_int len) {
+zmtp1_print_intermediate_part(netdissect_options *ndo, const u_char *cp, const u_int len)
+{
u_int frame_offset;
uint64_t remaining_len;
@@ -206,7 +209,8 @@ trunc:
}
void
-zmtp1_print_datagram(netdissect_options *ndo, const u_char *cp, const u_int len) {
+zmtp1_print_datagram(netdissect_options *ndo, const u_char *cp, const u_int len)
+{
const u_char *ep = min(ndo->ndo_snapend, cp + len);
cp = zmtp1_print_intermediate_part(ndo, cp, len);