* Routines for who protocol (see man rwhod)
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-who.c,v 1.13 2001/01/06 06:18:54 guy Exp $
+ * $Id: packet-who.c,v 1.18 2001/09/14 07:10:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
proto_item *who_ti = NULL;
gchar server_name[33];
double loadav_5 = 0.0, loadav_10 = 0.0, loadav_15 = 0.0;
- struct timeval tv;
-
- CHECK_DISPLAY_AS_DATA(proto_who, tvb, pinfo, tree);
-
- pinfo->current_proto = "WHO";
+ nstime_t ts;
/* Summary information */
if (check_col(pinfo->fd, COL_PROTOCOL))
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
- tv.tv_usec = 0;
+ ts.nsecs = 0;
if (tree) {
who_ti = proto_tree_add_item(tree, proto_who, tvb, offset,
offset += 2;
if (tree) {
- tv.tv_sec = tvb_get_ntohl(tvb, offset);
+ ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_sendtime, tvb, offset, 4,
- &tv);
+ &ts);
}
offset += 4;
if (tree) {
- tv.tv_sec = tvb_get_ntohl(tvb, offset);
+ ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_recvtime, tvb, offset, 4,
- &tv);
+ &ts);
}
offset += 4;
server_name, loadav_5, loadav_10, loadav_15);
if (tree) {
- tv.tv_sec = tvb_get_ntohl(tvb, offset);
+ ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_boottime, tvb, offset, 4,
- &tv);
+ &ts);
offset += 4;
dissect_whoent(tvb, offset, who_tree);
int line_offset = offset;
gchar out_line[9];
gchar out_name[9];
- struct timeval tv;
+ nstime_t ts;
int whoent_num = 0;
guint32 idle_secs; /* say that out loud... */
- tv.tv_usec = 0;
+ ts.nsecs = 0;
while (tvb_reported_length_remaining(tvb, line_offset) > 0
&& whoent_num < MAX_NUM_WHOENTS) {
8, out_name);
line_offset += 8;
- tv.tv_sec = tvb_get_ntohl(tvb, line_offset);
+ ts.secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_time(whoent_tree, hf_who_timeon, tvb,
- line_offset, 4, &tv);
+ line_offset, 4, &ts);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);
static hf_register_info hf[] = {
{ &hf_who_vers,
{ "Version", "who.vers", FT_UINT8, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_type,
{ "Type", "who.type", FT_UINT8, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_sendtime,
{ "Send Time", "who.sendtime", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_recvtime,
{ "Receive Time", "who.recvtime", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_hostname,
{ "Hostname", "who.hostname", FT_STRING, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_loadav_5,
{ "Load Average Over Past 5 Minutes", "who.loadav_5", FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_loadav_10,
{ "Load Average Over Past 10 Minutes", "who.loadav_10", FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_loadav_15,
{ "Load Average Over Past 15 Minutes", "who.loadav_15", FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_boottime,
{ "Boot Time", "who.boottime", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_whoent,
{ "Who utmp Entry", "who.whoent", FT_NONE, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_tty,
{ "TTY Name", "who.tty", FT_STRING, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_uid,
{ "User ID", "who.uid", FT_STRING, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_timeon,
{ "Time On", "who.timeon", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_who_idle,
- { "Time Idle", "who.idle", FT_UINT32, BASE_NONE, NULL, 0x0,
- "" }},
+ { "Time Idle", "who.idle", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "", HFILL }},
};
static gint *ett[] = {
void
proto_reg_handoff_who(void)
{
- dissector_add("udp.port", UDP_PORT_WHO, dissect_who);
+ dissector_add("udp.port", UDP_PORT_WHO, dissect_who, proto_who);
}