Added functionality proposed in bug 1233.
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 5 Jan 2007 13:42:08 +0000 (13:42 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 5 Jan 2007 13:42:08 +0000 (13:42 +0000)
Clean up of source code.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20329 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-ntp.c
epan/dissectors/packet-ntp.h

index 9bff5dcb5158020df751156181e6caf7f59d177e..178ccd6b877ddccb79d231dc19e7660bfed946aa 100644 (file)
@@ -22,7 +22,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -148,6 +148,18 @@ static const value_string mode_types[] = {
        { 0,            NULL}
 };
 
+static const value_string info_mode_types[] = {
+       { NTP_MODE_RSV,         "NTP reserved" },
+       { NTP_MODE_SYMACT,      "NTP symmetric active" },
+       { NTP_MODE_SYMPAS,      "NTP symmetric passive" },
+       { NTP_MODE_CLIENT,      "NTP client" },
+       { NTP_MODE_SERVER,      "NTP server" },
+       { NTP_MODE_BCAST,       "NTP broadcast" },
+       { NTP_MODE_CTRL,        "NTP control"},
+       { NTP_MODE_PRIV,        "NTP private" },
+       { 0,            NULL}
+};
+
 /* According to rfc, primary (stratum-0 and stratum-1) servers should set
  * their Reference Clock ID (4bytes field) according to following table:
  */
@@ -418,7 +430,6 @@ dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_tree      *ntp_tree;
        proto_item      *ti;
        guint8          flags;
-       const char *infostr;
        void (*dissector)(tvbuff_t *, proto_item *, guint8);
 
        if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -430,21 +441,19 @@ dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        flags = tvb_get_guint8(tvb, 0);
        switch (flags & NTP_MODE_MASK) {
        default:
-               infostr = "NTP";
                dissector = dissect_ntp_std;
                break;
        case NTP_MODE_CTRL:
-               infostr = "NTP control";
                dissector = dissect_ntp_ctrl;
                break;
        case NTP_MODE_PRIV:
-               infostr = "NTP private";
                dissector = dissect_ntp_priv;
                break;
        }
 
        if (check_col(pinfo->cinfo, COL_INFO))
-               col_set_str(pinfo->cinfo, COL_INFO, infostr);
+               col_set_str(pinfo->cinfo, COL_INFO, 
+                       val_to_str(flags & NTP_MODE_MASK, info_mode_types, "Unknown"));
 
        if (tree) {
                /* Adding NTP item and subtree */
@@ -949,7 +958,7 @@ proto_register_ntp(void)
                        VALS(priv_impl_types), 0, "Implementation", HFILL }},
                { &hf_ntppriv_reqcode, {
                        "Request code", "ntppriv.reqcode", FT_UINT8, BASE_DEC,
-                       VALS(priv_rc_types), 0, "Request code", HFILL }},
+                       VALS(priv_rc_types), 0, "Request code", HFILL }}
         };
        static gint *ett[] = {
                &ett_ntp,
@@ -957,7 +966,7 @@ proto_register_ntp(void)
                &ett_ntp_ext,
                &ett_ntp_ext_flags,
                &ett_ntpctrl_flags2,
-               &ett_ntppriv_auth_seq,
+               &ett_ntppriv_auth_seq
        };
 
        proto_ntp = proto_register_protocol("Network Time Protocol", "NTP",
index d23cffc50009c6e6726480ce4b9483ac236068e4..f52bba51c913f72fdd73b14ea1edefb9f18b7117 100644 (file)
@@ -1,13 +1,14 @@
 /* packet-ntp.h
  * Definitions for packet disassembly structures and routines
+ * Joerg Mayer <jmayer@loplof.de>
  *
  * $Id$
  *
  * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
- * Joerg Mayer <jmayer@loplof.de>
  *
+ * This is from yahoolib.h from gtkyahoo
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-/* This is from yahoolib.h from gtkyahoo */
-
 #ifndef PACKET_NTP_H
 #define PACKET_NTP_H