(Trivial): add editor modelines. use consistent indentation & do whirespace re-format...
authorBill Meier <wmeier@newsguy.com>
Sat, 15 Mar 2014 17:49:05 +0000 (13:49 -0400)
committerBill Meier <wmeier@newsguy.com>
Sat, 15 Mar 2014 18:00:10 +0000 (18:00 +0000)
Change-Id: Ic8378bf398bcabfe1f50f7f6ccbe10e2e84884d5
Reviewed-on: https://code.wireshark.org/review/682
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
epan/dissectors/packet-pktgen.c
epan/dissectors/packet-redbackli.c
epan/dissectors/packet-waveagent.c

index f8ca345092eae8310c661539b35ed950237b7918..675fe27a161a980d5163cac1ab8e57cdb5033e0f 100644 (file)
@@ -58,21 +58,21 @@ static dissector_handle_t data_handle;
 /* entry point */
 static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    proto_item *ti = NULL;
-    proto_item *tmp = NULL;
+    proto_item *ti          = NULL;
+    proto_item *tmp         = NULL;
     proto_tree *pktgen_tree = NULL;
-    guint32 offset = 0;
-    nstime_t tstamp;
-    guint32 magic;
+    guint32     offset      = 0;
+    nstime_t    tstamp;
+    guint32     magic;
 
     /* check for min size */
-    if(tvb_length(tvb) < 16) {         /* Not a PKTGEN packet. */
+    if (tvb_length(tvb) < 16) {  /* Not a PKTGEN packet. */
     return FALSE;
     }
 
     /* check for magic number */
     magic = tvb_get_ntohl(tvb,0);
-    if(magic != PKTGEN_MAGIC){
+    if (magic != PKTGEN_MAGIC) {
         /* Not a PKTGEN packet. */
         return FALSE;
     }
@@ -84,7 +84,7 @@ static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
 
     col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 4));
 
-    if(tree) {
+    if (tree) {
 
         /* create display subtree for the protocol */
 
@@ -95,29 +95,29 @@ static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
         /* add items to the subtree */
 
         proto_tree_add_item(pktgen_tree, hf_pktgen_magic, tvb, offset, 4, ENC_BIG_ENDIAN);
-        offset+=4;
+        offset += 4;
 
         proto_tree_add_item(pktgen_tree, hf_pktgen_seqnum, tvb, offset, 4, ENC_BIG_ENDIAN);
-        offset+=4;
+        offset += 4;
 
         tstamp.secs = tvb_get_ntohl(tvb, offset);
         tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvsec, tvb, offset, 4, ENC_BIG_ENDIAN);
         PROTO_ITEM_SET_GENERATED(tmp);
-        offset+=4;
+        offset += 4;
 
         tstamp.nsecs = tvb_get_ntohl(tvb, offset) /* microsecond on the wire so... */ * 1000;
         tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvusec, tvb, offset, 4, ENC_BIG_ENDIAN);
         PROTO_ITEM_SET_GENERATED(tmp);
-        offset+=4;
+        offset += 4;
 
         proto_tree_add_time(pktgen_tree, hf_pktgen_timestamp, tvb, offset - 8, 8, &tstamp);
 
 #if 0
-        if(tvb_length_remaining(tvb, offset)) /* random data */
+        if (tvb_length_remaining(tvb, offset)) /* random data */
             proto_tree_add_text(pktgen_tree, tvb, offset, -1, "Data (%u bytes)",
             tvb_length_remaining(tvb, offset));
 #else
-        if(tvb_length_remaining(tvb, offset)) /* random data */
+        if (tvb_length_remaining(tvb, offset)) /* random data */
             call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo,
             pktgen_tree);
 #endif
@@ -134,51 +134,51 @@ void proto_register_pktgen(void)
 
     static hf_register_info hf[] = {
 
-       { &hf_pktgen_magic,
-         {
-             "Magic number", "pktgen.magic",
-             FT_UINT32, BASE_HEX, NULL, 0x0,
-             "The pktgen magic number", HFILL
-         }
-       },
-
-       { &hf_pktgen_seqnum,
-         {
-             "Sequence number", "pktgen.seqnum",
-             FT_UINT32, BASE_DEC, NULL, 0x0,
-             NULL, HFILL
-         }
-       },
-
-       { &hf_pktgen_tvsec,
-         {
-             "Timestamp tvsec", "pktgen.tvsec",
-             FT_UINT32, BASE_DEC, NULL, 0x0,
-             "Timestamp tvsec part", HFILL
-         }
-       },
-
-       { &hf_pktgen_tvusec,
-         {
-             "Timestamp tvusec", "pktgen.tvusec",
-             FT_UINT32, BASE_DEC, NULL, 0x0,
-             "Timestamp tvusec part", HFILL
-         }
-       },
-
-       { &hf_pktgen_timestamp,
-         {
-             "Timestamp", "pktgen.timestamp",
-             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
-             NULL, HFILL
-         }
-       }
+        { &hf_pktgen_magic,
+          {
+              "Magic number", "pktgen.magic",
+              FT_UINT32, BASE_HEX, NULL, 0x0,
+              "The pktgen magic number", HFILL
+          }
+        },
+
+        { &hf_pktgen_seqnum,
+          {
+              "Sequence number", "pktgen.seqnum",
+              FT_UINT32, BASE_DEC, NULL, 0x0,
+              NULL, HFILL
+          }
+        },
+
+        { &hf_pktgen_tvsec,
+          {
+              "Timestamp tvsec", "pktgen.tvsec",
+              FT_UINT32, BASE_DEC, NULL, 0x0,
+              "Timestamp tvsec part", HFILL
+          }
+        },
+
+        { &hf_pktgen_tvusec,
+          {
+              "Timestamp tvusec", "pktgen.tvusec",
+              FT_UINT32, BASE_DEC, NULL, 0x0,
+              "Timestamp tvusec part", HFILL
+          }
+        },
+
+        { &hf_pktgen_timestamp,
+          {
+              "Timestamp", "pktgen.timestamp",
+              FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
+              NULL, HFILL
+          }
+        }
     };
 
     /* Setup protocol subtree array */
 
     static gint *ett[] = {
-       &ett_pktgen
+        &ett_pktgen
     };
 
     /* Register the protocol name and description */
@@ -200,3 +200,17 @@ void proto_reg_handoff_pktgen(void)
     /* Find data dissector handle */
     data_handle = find_dissector("data");
 }
+
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
index b38b76575b86be83f921c2b6bee2fcf5eb2c688f..b1f6eec744afb2b49042dc66016d2e1747adffe9 100644 (file)
@@ -72,9 +72,9 @@ static void
 redbackli_dissect_avp(guint8 avptype, guint8 avplen, tvbuff_t *tvb, gint offset, proto_tree *tree)
 {
        const char      *avpname;
-       proto_tree      *ti, *st=NULL;
+       proto_tree      *ti, *st = NULL;
 
-       avpname=val_to_str_const(avptype, avp_names, "Unknown");
+       avpname = val_to_str_const(avptype, avp_names, "Unknown");
 
        ti = proto_tree_add_text(tree, tvb, offset, avplen+2, "%s AVP", avpname);
        st = proto_item_add_subtree(ti, ett_redbackli);
@@ -85,13 +85,13 @@ redbackli_dissect_avp(guint8 avptype, guint8 avplen, tvbuff_t *tvb, gint offset,
        if (!avplen)
                return;
 
-        /* XXX: ToDo: Validate the length (avplen) of the fixed length fields
-                before calling proto_tree_add_item().
-                Note that the field lengths have been validated when
-                dissect_avp() is called from redbackli_dissect_heur().
-         */
+       /* XXX: ToDo: Validate the length (avplen) of the fixed length fields
+          before calling proto_tree_add_item().
+          Note that the field lengths have been validated when
+          dissect_avp() is called from redbackli_dissect_heur().
+       */
 
-       switch(avptype) {
+       switch (avptype) {
                case(RB_AVP_SEQNO):
                        proto_tree_add_item(st, hf_redbackli_seqno, tvb,
                                            offset+2, avplen, ENC_BIG_ENDIAN);
@@ -133,12 +133,12 @@ static void
 redbackli_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        guint8          avptype, avplen;
-       gint            len, offset=0;
+       gint            len, offset = 0;
        gboolean        eoh;
-       proto_tree      *ti, *redbackli_tree=NULL;
+       proto_tree      *ti, *redbackli_tree = NULL;
        tvbuff_t        *next_tvb;
 
-       col_set_str(pinfo->cinfo,COL_PROTOCOL,"RBLI");
+       col_set_str(pinfo->cinfo, COL_PROTOCOL, "RBLI");
 
        if (tree) {
                ti = proto_tree_add_item(tree, proto_redbackli,
@@ -146,10 +146,10 @@ redbackli_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                redbackli_tree = proto_item_add_subtree(ti, ett_redbackli);
        }
 
-       len=tvb_length(tvb);
-       offset=0;
-       eoh=FALSE;
-       while(!eoh && (len > 2)) {
+       len = tvb_length(tvb);
+       offset = 0;
+       eoh = FALSE;
+       while (!eoh && (len > 2)) {
                avptype = tvb_get_guint8(tvb, offset+0);
                avplen = tvb_get_guint8(tvb, offset+1);
 
@@ -160,10 +160,10 @@ redbackli_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        redbackli_dissect_avp(avptype, avplen, tvb, offset, redbackli_tree);
 
                if (avptype == RB_AVP_EOH)
-                       eoh=TRUE;
+                       eoh = TRUE;
 
-               offset+=2+avplen;
-               len-=2+avplen;
+               offset += 2 + avplen;
+               len    -= 2 + avplen;
        }
 
        next_tvb = tvb_new_subset_remaining(tvb, offset);
@@ -178,12 +178,12 @@ redbackli_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 static gboolean
 redbackli_dissect_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-       gint            len, offset=0;
-       gboolean        eoh=FALSE;
+       gint            len, offset = 0;
+       gboolean        eoh = FALSE;
        guint8          avptype, avplen;
-       guint32         avpfound=0;
+       guint32         avpfound = 0;
 
-       len=tvb_length(tvb);
+       len = tvb_length(tvb);
        if (len < MIN_REDBACKLI_SIZE)
                return FALSE;
 
@@ -193,22 +193,22 @@ redbackli_dissect_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
         * long .. Unknown AVPs also mean not for us ...
         *
         */
-       while((len > 2) && !eoh) {
+       while ((len > 2) && !eoh) {
                avptype = tvb_get_guint8(tvb, offset+0);
                avplen = tvb_get_guint8(tvb, offset+1);
 
-               switch(avptype) {
+               switch (avptype) {
                        case(RB_AVP_SEQNO):
                        case(RB_AVP_LIID):
                        case(RB_AVP_SESSID):
                                if (avplen != 4)
                                        return FALSE;
-                               avpfound|=1<<avptype;
+                               avpfound |= 1<<avptype;
                                break;
                        case(RB_AVP_EOH):
                                if (avplen > 1 || offset == 0)
                                        return FALSE;
-                               eoh=TRUE;
+                               eoh = TRUE;
                                break;
                        case(RB_AVP_LABEL):
                        case(RB_AVP_DIR):   /* Is this correct? the hf_ originally had FT_UINT8 for DIR */
@@ -217,8 +217,8 @@ redbackli_dissect_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
                        default:
                                return FALSE;
                }
-               offset+=2+avplen;
-               len-=2+avplen;
+               offset += 2 + avplen;
+               len    -= 2 + avplen;
        }
 
        if (!(avpfound & (1<<RB_AVP_SEQNO)))
@@ -244,8 +244,8 @@ void proto_register_redbackli(void) {
                        { "Session Id", "redbackli.sessid", FT_UINT32, BASE_DEC, NULL, 0x0,
                        "Session Identifier", HFILL }},
 #if 0 /* XXX: If one goes by the heuristic then this field can be variable length ??
-         In the absence of any documentation We'll assume that's the case
-         (even though 'direction' sounds like a fixed length field */
+        In the absence of any documentation We'll assume that's the case
+        (even though 'direction' sounds like a fixed length field */
                { &hf_redbackli_dir,
                        { "Direction", "redbackli.dir", FT_UINT8, BASE_DEC, NULL, 0x0,
                        NULL, HFILL }},
@@ -273,10 +273,10 @@ void proto_register_redbackli(void) {
        };
 
        proto_redbackli = proto_register_protocol("Redback Lawful Intercept",
-                                                 "RedbackLI","redbackli");
+                                                 "RedbackLI", "redbackli");
 
-       proto_register_field_array(proto_redbackli,hf,array_length(hf));
-       proto_register_subtree_array(ett,array_length(ett));
+       proto_register_field_array(proto_redbackli, hf, array_length(hf));
+       proto_register_subtree_array(ett, array_length(ett));
 
        register_dissector("redbackli", redbackli_dissect, proto_redbackli);
 }
@@ -291,3 +291,17 @@ void proto_reg_handoff_redbackli(void) {
 
        heur_dissector_add("udp", redbackli_dissect_heur, proto_redbackli);
 }
+
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
index 384c87d71114040245388af79bfdeadea772776b..a90ec9306420e39e0d9493e802bca53707d99afc 100644 (file)
@@ -1011,11 +1011,11 @@ static int dissect_waveagent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
         return 0;
 
     magic_number    = tvb_get_ntohl(tvb, 16) & 0x0FFFFFFF;  /* Mask magic number off */
-       if(magic_number != 0x0F87C3A5){
-               return 0;
-       }
+    if(magic_number != 0x0F87C3A5){
+        return 0;
+    }
 
-       signature_start = tvb_get_guint8(tvb, 0);
+    signature_start = tvb_get_guint8(tvb, 0);
     signature_end   = tvb_get_guint8(tvb, 15);
 
     if ( ((signature_start != 0xcc) && (signature_start !=0xdd)) ||
@@ -1027,7 +1027,7 @@ static int dissect_waveagent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
 
     version         = ((tvb_get_ntohl(tvb, 16) & 0xF0000000) >> 28 == 1) ? 3 : 2;       /* Mask version bit off */
 
-       col_set_str(pinfo->cinfo, COL_PROTOCOL, "WA");
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "WA");
     col_clear(pinfo->cinfo, COL_INFO);
 
     /* Grab the control word, parse the WaveAgent payload accordingly */
@@ -1098,133 +1098,133 @@ static const value_string status_values[] = {
 void proto_register_waveagent(void)
 {
     static const value_string tcp_states[] = {
-        { 0, "Closed" },
-        { 1, "Listen" },
-        { 2, "SYN Sent" },
-        { 3, "SYN received" },
-        { 4, "Established" },
-        { 5, "FIN Wait 1" },
-        { 6, "FIN Wait 2" },
-        { 7, "Close Wait" },
-        { 8, "Closing" },
-        { 9, "Last ACK" },
+        {  0, "Closed" },
+        {  1, "Listen" },
+        {  2, "SYN Sent" },
+        {  3, "SYN received" },
+        {  4, "Established" },
+        {  5, "FIN Wait 1" },
+        {  6, "FIN Wait 2" },
+        {  7, "Close Wait" },
+        {  8, "Closing" },
+        {  9, "Last ACK" },
         { 10, "Time Wait" },
-        { 0, NULL },
+        {  0, NULL },
     };
 
     static const value_string app_states[] = {
-        { 0, "IDLE" },
-        { 1, "READY" },
-        { 0, NULL },
+        {  0, "IDLE" },
+        {  1, "READY" },
+        {  0, NULL },
     };
 
     static const value_string wa_modes[] = {
-        { 0, "In-band" },
-        { 1, "Source" },
-        { 2, "Sink" },
-        { 3, "Loopback" },
-        { 0, NULL },
+        {  0, "In-band" },
+        {  1, "Source" },
+        {  2, "Sink" },
+        {  3, "Loopback" },
+        {  0, NULL },
     };
 
     static const value_string wa_endpointtypes[] = {
-        { 0, "Undefined" },
-        { 1, "Server" },
-        { 2, "Client" },
-        { 0, NULL },
+        {  0, "Undefined" },
+        {  1, "Server" },
+        {  2, "Client" },
+        {  0, NULL },
     };
 
     static const value_string binding_levels[] = {
-        { 0, "WLAN" },
-        { 1, "Ethernet" },
-        { 2, "IP" },
-        { 3, "UDP" },
-        { 4, "TCP" },
-        { 5, "FIN Wait 1" },
-        { 6, "FIN Wait 2" },
-        { 7, "Close Wait" },
-        { 8, "Closing" },
-        { 9, "Last ACK" },
+        {  0, "WLAN" },
+        {  1, "Ethernet" },
+        {  2, "IP" },
+        {  3, "UDP" },
+        {  4, "TCP" },
+        {  5, "FIN Wait 1" },
+        {  6, "FIN Wait 2" },
+        {  7, "Close Wait" },
+        {  8, "Closing" },
+        {  9, "Last ACK" },
         { 10, "Time Wait" },
-        { 0, NULL },
+        {  0, NULL },
     };
 
     static const value_string if_types[] = {
-        { ETHERNET_INTERFACE, "Ethernet" },
-        { WLAN_INTERFACE, "WLAN" },
-        { 0, NULL },
+        {  ETHERNET_INTERFACE, "Ethernet" },
+        {  WLAN_INTERFACE, "WLAN" },
+        {  0, NULL },
     };
 
     static const value_string no_yes[] = {
-        { 0, "No" },
-        { 1, "Yes" },
-        { 0, NULL },
+        {  0, "No" },
+        {  1, "Yes" },
+        {  0, NULL },
     };
 
     static const value_string ip_types[] = {
-        { 0,  "Unspecified" },
-        { IPV4_TYPE,  "IPv4" },
-        { IPV6_TYPE, "IPv6" },
-        { 0, NULL },
+        {  0,  "Unspecified" },
+        {  IPV4_TYPE,  "IPv4" },
+        {  IPV6_TYPE, "IPv6" },
+        {  0, NULL },
     };
 
     static const value_string if_l3_states[] = {
-        { 0, "Uninitialized" },
-        { 1, "Disconnected" },
-        { 2, "Connected" },
-        { 3, "Error" },
-        { 0, NULL },
+        {  0, "Uninitialized" },
+        {  1, "Disconnected" },
+        {  2, "Connected" },
+        {  3, "Error" },
+        {  0, NULL },
     };
 
     static const value_string if_wlan_states[] = {
-        { 0, "Uninitialized" },
-        { 1, "Not ready" },
-        { 2, "Connected" },
-        { 3, "Ad Hoc network formed" },
-        { 4, "Disconnecting" },
-        { 5, "Disconnected" },
-        { 6, "Associating" },
-        { 7, "Discovering" },
-        { 8, "Authenticating" },
-        { 0, NULL },
+        {  0, "Uninitialized" },
+        {  1, "Not ready" },
+        {  2, "Connected" },
+        {  3, "Ad Hoc network formed" },
+        {  4, "Disconnecting" },
+        {  5, "Disconnected" },
+        {  6, "Associating" },
+        {  7, "Discovering" },
+        {  8, "Authenticating" },
+        {  0, NULL },
     };
 
     static const value_string if_eth_states[] = {
-        { 0, "Uninitialized" },
-        { 1, "Not Operational" },
-        { 2, "Unreachable" },
-        { 3, "Disconnected" },
-        { 4, "Connecting" },
-        { 5, "Connected" },
-        { 6, "Operational" },
-        { 7, "Error" },
-        { 0, NULL },
+        {  0, "Uninitialized" },
+        {  1, "Not Operational" },
+        {  2, "Unreachable" },
+        {  3, "Disconnected" },
+        {  4, "Connecting" },
+        {  5, "Connected" },
+        {  6, "Operational" },
+        {  7, "Error" },
+        {  0, NULL },
     };
 
     static const value_string bss_modes[] = {
-        { 0, "Infrastructure" },
-        { 1, "IBSS" },
-        { 2, "Unknown" },
-        { 0, NULL },
+        {  0, "Infrastructure" },
+        {  1, "IBSS" },
+        {  2, "Unknown" },
+        {  0, NULL },
     };
 
     static const value_string auth_algs[] = {
-        { 0,  "Open" },
-        { 1,  "Shared Key" },
-        { 2,  "WPA" },
-        { 4,  "WPA PSK" },
-        { 8,  "WPA2" },
+        {  0,  "Open" },
+        {  1,  "Shared Key" },
+        {  2,  "WPA" },
+        {  4,  "WPA PSK" },
+        {  8,  "WPA2" },
         { 16, "WPA2 PSK" },
-        { 0, NULL },
+        {  0, NULL },
     };
 
     static const value_string cipher_algs[] = {
-        { 0,  "None" },
-        { 1,  "WEP 40" },
-        { 2,  "WEP 104" },
-        { 4,  "WEP" },
-        { 8,  "TKIP" },
+        {  0,  "None" },
+        {  1,  "WEP 40" },
+        {  2,  "WEP 104" },
+        {  4,  "WEP" },
+        {  8,  "TKIP" },
         { 16, "CCMP" },
-        { 0, NULL },
+        {  0, NULL },
     };
 
     /* Setup list of header fields  See Section 1.6.1 for details*/
@@ -1912,3 +1912,17 @@ void proto_reg_handoff_waveagent(void)
 {
     heur_dissector_add("udp", dissect_waveagent_heur, proto_waveagent);
 }
+
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */