2 * Routines for time packet dissection
4 * Richard Sharpe <rsharpe@ns.aus.com>
5 * Craig Newell <CraigN@cheque.uq.edu.au>
6 * RFC2347 TIME Option Extension
8 * $Id: packet-time.c,v 1.2 2000/03/06 20:04:53 guy Exp $
10 * Ethereal - Network traffic analyzer
11 * By Gerald Combs <gerald@zing.org>
12 * Copyright 1998 Gerald Combs
14 * Copied from packet-tftp.c
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 static int proto_time = -1;
38 static int hf_time_time = -1;
40 static gint ett_time = -1;
43 dissect_time(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
45 proto_tree *time_tree;
48 if (check_col(fd, COL_PROTOCOL))
49 col_add_str(fd, COL_PROTOCOL, "TIME");
51 if (check_col(fd, COL_INFO)) {
52 col_add_fstr(fd, COL_INFO, "TIME %s", pi.srcport == 37? "Response":"Request");
57 ti = proto_tree_add_item(tree, proto_time, offset, END_OF_FRAME, NULL);
58 time_tree = proto_item_add_subtree(ti, ett_time);
60 proto_tree_add_text(time_tree, offset, 0,
61 pi.srcport==37? "Type: Response":"Type: Request");
62 if (pi.srcport == 37) {
63 guint32 delta_seconds = pntohl(pd+offset);
64 proto_tree_add_text(time_tree, offset, 4,
65 " %u seconds since midnight 1 January 1900 GMT",
72 proto_register_time(void)
75 static hf_register_info hf[] = {
78 FT_UINT32, BASE_DEC, NULL, 0x0,
79 "Seconds since 00:00 (midnight) 1 January 1900 GMT" }}
81 static gint *ett[] = {
85 proto_time = proto_register_protocol("Time Protocol", "time");
86 proto_register_field_array(proto_time, hf, array_length(hf));
87 proto_register_subtree_array(ett, array_length(ett));