Revert "In get_unicode_or_ascii_string(), check if the length is odd/even, not the...
[wireshark-wip.git] / plugins / docsis / packet-sync.c
blob3e9053e00ca726034916640d805b1cd03ced047f
1 /* packet-sync.c
2 * $Id$
3 * Routines for Sync Message dissection
4 * Copyright 2007, Bruno Verstuyft <bruno.verstuyft@excentis.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <epan/packet.h>
31 /* Initialize the protocol and registered fields */
32 static int proto_docsis_sync = -1;
33 static int hf_docsis_sync_cmts_timestamp = -1;
36 /* Initialize the subtree pointers */
37 static gint ett_docsis_sync = -1;
39 static void
40 dissect_sync (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
42 proto_item *it;
43 proto_tree *sync_tree;
45 col_set_str(pinfo->cinfo, COL_INFO, "Sync Message:");
47 if (tree)
49 it = proto_tree_add_protocol_format (tree, proto_docsis_sync, tvb, 0, -1,"SYNC Message");
50 sync_tree = proto_item_add_subtree (it, ett_docsis_sync);
52 proto_tree_add_item (sync_tree, hf_docsis_sync_cmts_timestamp, tvb, 0, 4,
53 ENC_BIG_ENDIAN);
54 } /* if(tree) */
60 /* Register the protocol with Wireshark */
62 /* this format is require because a script is used to build the C function
63 that calls all the protocol registration.
67 void
68 proto_register_docsis_sync (void)
70 /* Setup list of header fields See Section 1.6.1 for details*/
71 static hf_register_info hf[] = {
72 {&hf_docsis_sync_cmts_timestamp,
73 {"CMTS Timestamp", "docsis_sync.cmts_timestamp",
74 FT_UINT32, BASE_DEC, NULL, 0x0,
75 "Sync CMTS Timestamp", HFILL}
79 /* Setup protocol subtree array */
80 static gint *ett[] = {
81 &ett_docsis_sync,
84 /* Register the protocol name and description */
85 proto_docsis_sync =
86 proto_register_protocol ("DOCSIS Synchronisation Message",
87 "DOCSIS Sync", "docsis_sync");
89 /* Required function calls to register the header fields and subtrees used */
90 proto_register_field_array (proto_docsis_sync, hf, array_length (hf));
91 proto_register_subtree_array (ett, array_length (ett));
93 register_dissector ("docsis_sync", dissect_sync, proto_docsis_sync);
97 /* If this dissector uses sub-dissector registration add a registration routine.
98 This format is required because a script is used to find these routines and
99 create the code that calls these routines.
101 void
102 proto_reg_handoff_docsis_sync (void)
104 dissector_handle_t docsis_sync_handle;
106 docsis_sync_handle = find_dissector ("docsis_sync");
107 dissector_add_uint ("docsis_mgmt", 1, docsis_sync_handle);