* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
- * $Id: packet-rpc.c,v 1.1 1999/10/29 01:11:22 guy Exp $
+ * $Id: packet-rpc.c,v 1.2 1999/10/29 02:25:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
"XID: 0x%x (%d)", xid, xid);
}
- if (check_col(fd, COL_INFO)) {
- col_add_fstr(fd, COL_INFO, "XID 0x%x", xid);
- }
-
/* we should better compare this with the argument?! */
msg_type = EXTRACT_UINT(pd,offset+4);
msg_type_name = val_to_str(msg_type,rpc_msg_type,"%d");
msg_type_name, msg_type);
}
- if (check_col(fd, COL_PROTOCOL)) {
- col_add_fstr(fd, COL_PROTOCOL, "RPC %s",
- val_to_str(msg_type,rpc_msg_type,"%d"));
- }
-
offset += 8;
if (msg_type==RPC_CALL) {
}
if (check_col(fd, COL_PROTOCOL)) {
- col_add_fstr(fd, COL_PROTOCOL,"%s %s",
- progname,
- msg_type_name);
+ /* Set the protocol name to the underlying
+ program name. */
+ col_add_fstr(fd, COL_PROTOCOL, "%s", progname);
}
if (!BYTES_ARE_IN_FRAME(offset+8,4)) return;
vers = EXTRACT_UINT(pd,offset+8);
if (rpc_tree) {
proto_tree_add_text(rpc_tree,offset+8,4,
- "Program Version: %d",vers);
+ "Program Version: %u",vers);
}
if (!BYTES_ARE_IN_FRAME(offset+12,4)) return;
"Procedure: %s (%d)", procname, proc);
}
- if (check_col(fd, COL_PROTOCOL)) {
- col_add_fstr(fd, COL_PROTOCOL,"%s %s %s",
- progname,
+ if (check_col(fd, COL_INFO)) {
+ col_add_fstr(fd, COL_INFO,"V%u %s %s XID 0x%x",
+ vers,
procname,
- msg_type_name);
+ msg_type_name,
+ xid);
}
conversation = find_conversation(&pi.src, &pi.dst, pi.ptype,
if (rpc_call_lookup(&rpc_call_msg)) {
/* duplicate request */
if (check_col(fd, COL_INFO)) {
- col_add_fstr(fd, COL_INFO, "dup XID 0x%x", xid);
+ col_append_fstr(fd, COL_INFO, " dup XID 0x%x", xid);
}
}
else {
proto = rpc_prog->proto;
ett = rpc_prog->ett;
progname = rpc_prog->progname;
+
+ if (check_col(fd, COL_PROTOCOL)) {
+ /* Set the protocol name to the underlying
+ program name. */
+ col_add_fstr(fd, COL_PROTOCOL, "%s",
+ progname);
+ }
}
- if (check_col(fd, COL_PROTOCOL)) {
- col_add_fstr(fd, COL_PROTOCOL,"%s %s %s",
- progname,
+ if (check_col(fd, COL_INFO)) {
+ col_add_fstr(fd, COL_INFO,"V%u %s %s XID 0x%x",
+ vers,
procname,
- msg_type_name);
+ msg_type_name,
+ xid);
}
if (rpc_tree) {
"Program: %s (%d)",
progname, prog);
proto_tree_add_text(rpc_tree,0,0,
- "Program Version: %d", vers);
+ "Program Version: %u", vers);
proto_tree_add_text(rpc_tree,0,0,
"Procedure: %s (%d)", procname, proc);
}
if (rpc_call->replies>1) {
if (check_col(fd, COL_INFO)) {
- col_add_fstr(fd, COL_INFO, "dup XID 0x%x", xid);
+ col_append_fstr(fd, COL_INFO, " dup XID 0x%x", xid);
}
}
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.51 1999/10/22 07:17:45 guy Exp $
+ * $Id: packet.c,v 1.52 1999/10/29 02:25:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
/* Adds a vararg list to a packet info string. */
void
col_add_fstr(frame_data *fd, gint el, gchar *format, ...) {
- va_list ap;
- int i;
+ va_list ap;
+ int i;
+ size_t max_len;
va_start(ap, format);
for (i = 0; i < fd->cinfo->num_cols; i++) {
- if (fd->cinfo->fmt_matx[i][el])
- vsnprintf(fd->cinfo->col_data[i], COL_MAX_LEN, format, ap);
+ if (fd->cinfo->fmt_matx[i][el]) {
+ if (el == COL_INFO)
+ max_len = COL_MAX_INFO_LEN;
+ else
+ max_len = COL_MAX_LEN;
+ vsnprintf(fd->cinfo->col_data[i], max_len, format, ap);
+ }
}
}
void
col_add_str(frame_data *fd, gint el, const gchar* str) {
- int i;
+ int i;
size_t max_len;
for (i = 0; i < fd->cinfo->num_cols; i++) {
}
}
+/* Appends a vararg list to a packet info string. */
+void
+col_append_fstr(frame_data *fd, gint el, gchar *format, ...) {
+ va_list ap;
+ int i;
+ size_t len, max_len;
+
+ va_start(ap, format);
+ for (i = 0; i < fd->cinfo->num_cols; i++) {
+ if (fd->cinfo->fmt_matx[i][el]) {
+ len = strlen(fd->cinfo->col_data[i]);
+ if (el == COL_INFO)
+ max_len = COL_MAX_INFO_LEN;
+ else
+ max_len = COL_MAX_LEN;
+ vsnprintf(&fd->cinfo->col_data[i][len], max_len - len, format, ap);
+ }
+ }
+}
+
void
col_append_str(frame_data *fd, gint el, gchar* str) {
- int i;
- size_t len, max_len;
+ int i;
+ size_t len, max_len;
- for (i = 0; i < fd->cinfo->num_cols; i++) {
- if (fd->cinfo->fmt_matx[i][el]) {
- len = strlen(fd->cinfo->col_data[i]);
- if (el == COL_INFO)
- max_len = COL_MAX_LEN;
- else
- max_len = COL_MAX_INFO_LEN;
- strncat(fd->cinfo->col_data[i], str, max_len - len);
- fd->cinfo->col_data[i][max_len - 1] = 0;
- }
+ for (i = 0; i < fd->cinfo->num_cols; i++) {
+ if (fd->cinfo->fmt_matx[i][el]) {
+ len = strlen(fd->cinfo->col_data[i]);
+ if (el == COL_INFO)
+ max_len = COL_MAX_LEN;
+ else
+ max_len = COL_MAX_INFO_LEN;
+ strncat(fd->cinfo->col_data[i], str, max_len - len);
+ fd->cinfo->col_data[i][max_len - 1] = 0;
}
+ }
}
void blank_packetinfo(void)