Remove "text2pcap-scanner.obj" and "tools\lemon\lemon.obj" when a "nmake
[obnox/wireshark/wip.git] / packet-msproxy.c
index 0beb3257589f6d3c54b324ce40a7a172f97b9d20..65b80c0bdcd01cd7d85e9d1254dd208fe15280b4 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Microsoft Proxy packet dissection
  * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
  *
- * $Id: packet-msproxy.c,v 1.20 2001/06/08 08:36:40 guy Exp $
+ * $Id: packet-msproxy.c,v 1.22 2001/09/03 10:33:05 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -221,7 +221,8 @@ static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo,
 
        g_assert( conversation);        /* should always find a conversation */
 
-       redirect_info = (redirect_entry_t*)conversation->data;
+       redirect_info = conversation_get_proto_data(conversation,
+               proto_msproxy);
 
        if (check_col(pinfo->fd, COL_PROTOCOL))
                col_set_str(pinfo->fd, COL_PROTOCOL, "MS Proxy");
@@ -280,30 +281,38 @@ static void add_msproxy_conversation( packet_info *pinfo,
 /*     and pinfo->dst will not be correct and this routine will have   */
 /*     to change.                                                      */
 
+       conversation_t *conversation;
        redirect_entry_t *new_conv_info;
        
-       conversation_t *conversation = find_conversation( &pinfo->src,
+       if (pinfo->fd->flags.visited) {
+               /*
+                * We've already processed this frame once, so we
+                * should already have done this.
+                */
+               return;
+       }
+
+       conversation = find_conversation( &pinfo->src,
                &pinfo->dst, hash_info->proto, hash_info->server_int_port,
                hash_info->clnt_port, 0);
 
-       if ( conversation)
-               return;
+       if ( !conversation) {
+               conversation = conversation_new( &pinfo->src, &pinfo->dst,
+                       hash_info->proto, hash_info->server_int_port,
+                       hash_info->clnt_port, 0);
+       }
+       conversation_set_dissector(conversation, msproxy_sub_dissector);
 
        new_conv_info = g_mem_chunk_alloc(redirect_vals);
-       conversation = conversation_new( &pinfo->src, &pinfo->dst,
-               hash_info->proto, hash_info->server_int_port,
-               hash_info->clnt_port, new_conv_info, 0);
-
-       g_assert( new_conv_info);
-       g_assert( conversation);
 
        new_conv_info->remote_addr = hash_info->dst_addr;
        new_conv_info->clnt_port = hash_info->clnt_port;
        new_conv_info->remote_port = hash_info->dst_port;
        new_conv_info->server_int_port = hash_info->server_int_port;
        new_conv_info->proto = hash_info->proto;
-       
-       conversation_set_dissector(conversation, msproxy_sub_dissector);
+
+       conversation_add_proto_data(conversation, proto_msproxy,
+               new_conv_info);
 }
 
 
@@ -1109,15 +1118,15 @@ static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        conversation = find_conversation( &pinfo->src, &pinfo->dst,
                pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
 
-       if ( conversation)                      /* conversation found */
-               hash_info = conversation->data;
-
-                       /* new conversation create local data structure */
-       else {                          
+       if ( !conversation) {
+               conversation = conversation_new( &pinfo->src, &pinfo->dst,
+                       pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
+       }
+       hash_info = conversation_get_proto_data(conversation, proto_msproxy);
+       if ( !hash_info) {
                hash_info = g_mem_chunk_alloc(vals);
-
-               conversation_new( &pinfo->src, &pinfo->dst, pinfo->ptype,
-                       pinfo->srcport, pinfo->destport, hash_info, 0);
+               conversation_add_proto_data(conversation, proto_msproxy,
+                       hash_info);
        }
 
        if (check_col(pinfo->fd, COL_INFO)){
@@ -1186,87 +1195,87 @@ proto_register_msproxy( void){
     
                 { &hf_msproxy_cmd,
                        { "Command", "msproxy.command", FT_UINT16, BASE_DEC,
-                                NULL, 0x0, ""
+                                NULL, 0x0, "", HFILL
                        }
                },
                        
                { &hf_msproxy_dstaddr,
                        { "Destination Address", "msproxy.dstaddr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                },
 
                { &hf_msproxy_srcport,
                        { "Source Port", "msproxy.srcport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_dstport,
                        { "Destination Port", "msproxy.dstport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_clntport,
                        { "Client Port",        "msproxy.clntport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_server_ext_addr,
                        { "Server External Address", "msproxy.server_ext_addr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                },
                
                { &hf_msproxy_server_ext_port,
                        { "Server External Port",       "msproxy.server_ext_port", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
 
                { &hf_msproxy_server_int_addr,
                        { "Server Internal Address", "msproxy.server_int_addr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                },
                
                { &hf_msproxy_server_int_port,
                        { "Server Internal Port",       "msproxy.server_int_port", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_serverport,
                        { "Server Port",        "msproxy.serverport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_bindport,
                        { "Bind Port",  "msproxy.bindport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_boundport,
                        { "Bound Port", "msproxy.boundport", FT_UINT16,
-                               BASE_DEC, NULL, 0x0, ""
+                               BASE_DEC, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_serveraddr,
                        { "Server Address", "msproxy.serveraddr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                },
                { &hf_msproxy_bindaddr,
                        { "Destination", "msproxy.bindaddr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                },
                { &hf_msproxy_bind_id,
                        { "Bound Port Id",      "msproxy.bindid", FT_UINT32,
-                               BASE_HEX, NULL, 0x0, ""
+                               BASE_HEX, NULL, 0x0, "", HFILL
                        }
                },
                { &hf_msproxy_resolvaddr,
                        { "Address", "msproxy.resolvaddr", FT_IPv4, BASE_NONE, NULL,
-                               0x0, ""
+                               0x0, "", HFILL
                        }
                }