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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include <epan/packet.h>
37 /* Initialize the protocol and registered fields */
38 static int proto_docsis_sync = -1;
39 static int hf_docsis_sync = -1;
40 static int hf_docsis_sync_cmts_timestamp = -1;
43 /* Initialize the subtree pointers */
44 static gint ett_docsis_sync = -1;
47 dissect_sync (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
50 proto_tree *sync_tree;
52 if (check_col (pinfo->cinfo, COL_INFO))
54 col_clear (pinfo->cinfo, COL_INFO);
55 col_add_fstr (pinfo->cinfo, COL_INFO,
61 it = proto_tree_add_protocol_format (tree, proto_docsis_sync, tvb, 0, -1,"SYNC Message");
62 sync_tree = proto_item_add_subtree (it, ett_docsis_sync);
64 proto_tree_add_item (sync_tree, hf_docsis_sync_cmts_timestamp, tvb, 0, 4,
72 /* Register the protocol with Wireshark */
74 /* this format is require because a script is used to build the C function
75 that calls all the protocol registration.
80 proto_register_docsis_sync (void)
82 /* Setup list of header fields See Section 1.6.1 for details*/
83 static hf_register_info hf[] = {
85 {"SYNC Message", "docsis_sync",
86 FT_BYTES, BASE_NONE, NULL, 0x0,
89 {&hf_docsis_sync_cmts_timestamp,
90 {"CMTS Timestamp", "docsis_sync.cmts_timestamp",
91 FT_UINT32, BASE_DEC, NULL, 0x0,
92 "Sync CMTS Timestamp", HFILL}
96 /* Setup protocol subtree array */
97 static gint *ett[] = {
101 /* Register the protocol name and description */
103 proto_register_protocol ("DOCSIS Synchronisation Message",
104 "DOCSIS Sync", "docsis_sync");
106 /* Required function calls to register the header fields and subtrees used */
107 proto_register_field_array (proto_docsis_sync, hf, array_length (hf));
108 proto_register_subtree_array (ett, array_length (ett));
110 register_dissector ("docsis_sync", dissect_sync, proto_docsis_sync);
114 /* If this dissector uses sub-dissector registration add a registration routine.
115 This format is required because a script is used to find these routines and
116 create the code that calls these routines.
119 proto_reg_handoff_docsis_sync (void)
121 dissector_handle_t docsis_sync_handle;
123 docsis_sync_handle = find_dissector ("docsis_sync");
124 dissector_add ("docsis_mgmt", 1, docsis_sync_handle);