Ethereal-dev: [Ethereal-dev] Ethereal - smb.h + packet-smb.c changes

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Krishnan, Prabhakar" <Prabhakar.Krishnan@xxxxxxxxxx>
Date: Fri, 19 Jul 2002 13:18:23 -0700
Adding another item in the proto tree for SMB 
- Time between Request and Response for SMB cmds

Index: smb.h
===================================================================
RCS file: /cvsroot/ethereal/smb.h,v
retrieving revision 1.40
diff -c -r1.40 smb.h
*** smb.h	2002/05/26 01:30:05	1.40
--- smb.h	2002/07/19 20:13:12
***************
*** 233,238 ****
--- 233,240 ----
  #define SMB_SIF_TID_IS_IPC	0x0001
  typedef struct {
  	guint32 frame_req, frame_res;
+         nstime_t req_time;              
+         nstime_t elasped_time;
  	guint16 flags;
  	int cmd;
  	void *extra_info;
Index: packet-smb.c
===================================================================
RCS file: /cvsroot/ethereal/packet-smb.c,v
retrieving revision 1.271
diff -c -r1.271 packet-smb.c
*** packet-smb.c	2002/07/13 04:32:14	1.271
--- packet-smb.c	2002/07/19 20:13:25
***************
*** 582,587 ****
--- 582,588 ----
  static int hf_smb_segment_multiple_tails = -1;
  static int hf_smb_segment_too_long_fragment = -1;
  static int hf_smb_segment_error = -1;
+ static int hf_smb_time = -1;
  
  static gint ett_smb = -1;
  static gint ett_smb_hdr = -1;
***************
*** 15178,15184 ****
--- 15179,15187 ----
          guint16 errcode = 0;
  	guint32 pid_mid;
  	conversation_t *conversation;
+         nstime_t ns;
  
+ 
  	top_tree=parent_tree;
  
  	/* must check that this really is a smb packet */
***************
*** 15419,15424 ****
--- 15422,15436 ----
  					if(sip->frame_res==0){
  						/* ok it is the first response we have seen to this packet */
  						sip->frame_res = pinfo->fd->num;
+                                                 ns.secs= pinfo->fd->abs_secs-sip->req_time.secs;
+                                                 ns.nsecs=pinfo->fd->abs_usecs*1000-sip->req_time.nsecs;
+                                                 if(ns.nsecs<0){
+                                                 ns.nsecs+=1000000000;
+                                                 ns.secs--;
+                                                 }
+                                                 sip->elasped_time.secs=ns.secs;
+                                                 sip->elasped_time.nsecs=ns.nsecs;
+ 
  						new_key = g_mem_chunk_alloc(smb_saved_info_key_chunk);
  						new_key->frame = sip->frame_res;
  						new_key->pid_mid = pid_mid;
***************
*** 15438,15443 ****
--- 15450,15457 ----
  				sip = g_mem_chunk_alloc(smb_saved_info_chunk);
  				sip->frame_req = pinfo->fd->num;
  				sip->frame_res = 0;
+                                 sip->req_time.secs=pinfo->fd->abs_secs;         
+                                 sip->req_time.nsecs=pinfo->fd->abs_usecs*1000;
  				sip->flags = 0;
  				if(g_hash_table_lookup(si.ct->tid_service, (void *)si.tid)
  				    == (void *)TID_IPC) {
***************
*** 15642,15647 ****
--- 15656,15664 ----
  	{ &hf_smb_continuation_to,
  		{ "Continuation to", "smb.continuation_to", FT_UINT32, BASE_DEC,
  		NULL, 0, "This packet is a continuation to the packet in this frame", HFILL }},
+         { &hf_smb_time,
+                 { "Time from request", "smb.time", FT_RELATIVE_TIME, BASE_NONE,
+                 NULL, 0, "Time between Request and Response for SMB cmds", HFILL }},
  
  	{ &hf_smb_nt_status,
  		{ "NT Status", "smb.nt_status", FT_UINT32, BASE_HEX,