Fix some compiler warnings, clean up indentation a bit.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 16 Mar 2010 03:31:44 +0000 (03:31 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 16 Mar 2010 03:31:44 +0000 (03:31 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32201 f5534014-38df-0310-8fa8-9805f1628bb7

epan/CMakeLists.txt
epan/dissectors/Makefile.common
epan/dissectors/packet-gvcp.c [new file with mode: 0644]
epan/dissectors/packet-sip.c
plugins/unistim/packet-unistim.c

index 4440df3e53b5e66bd6051a1bbb367d2652bed8e3..e23150b77191582c6ff23e4029d7a4a0321f06f2 100644 (file)
@@ -584,6 +584,7 @@ set(DISSECTOR_SRC
        dissectors/packet-gssapi.c
        dissectors/packet-gtp.c
        dissectors/packet-gtpv2.c
+       dissectors/packet-gvcp.c
        dissectors/packet-gvrp.c
        dissectors/packet-h1.c
        dissectors/packet-h221_nonstd.c
index d52052c4458b51f1aee6c8744800b12c3eac31fe..5b75034c3becf2b6020973d96776ba667653add2 100644 (file)
@@ -488,6 +488,7 @@ DISSECTOR_SRC = \
        packet-gssapi.c         \
        packet-gtp.c            \
        packet-gtpv2.c          \
+       packet-gvcp.c           \
        packet-gvrp.c           \
        packet-h1.c             \
        packet-h221_nonstd.c    \
diff --git a/epan/dissectors/packet-gvcp.c b/epan/dissectors/packet-gvcp.c
new file mode 100644 (file)
index 0000000..441c32a
--- /dev/null
@@ -0,0 +1,465 @@
+/* packet-gvcp.c
+ * Routines for gvcp (GigEVision Control Protocol) dissection
+ * Copyright 2010, Adrian Daerr <adrian.daerr@gmx.de>
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+/*
+ * Credits to Falco Hirschenberger for his description of GVCP
+ * ( http://gitorious.org/opengigevision )
+ *
+ * GVCP is part of the GigE-Vision interface (a closed standard) to
+ * so-called industrial cameras.
+ *
+ * see also: http://en.wikipedia.org/wiki/GigE_vision
+ *
+ * This dissector is based on traffic analysis alone, as the
+ * description of the GVCP is accessible only to members of the
+ * Automated Imaging Association. The resulting packet description is
+ * therefore likely to be incomplete or inaccurate.
+ *
+ * TODO:
+ * - fill holes (missing opcodes / field meanings / ...)
+ * - conversation level:
+ *   . validity of anwers (is CMD packet properly ACK'ed by follow-up packet?)
+ *   . reassemble, unzip, store and parse XML file, so that addresses
+ *     may be translated back into register names
+ *
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <epan/packet.h>
+
+#define GVCP_PORT 3956
+
+static int proto_gvcp = -1;
+static int hf_gvcp_type = -1;
+static int hf_gvcp_opcode = -1;
+static int hf_gvcp_payloadsize = -1;
+static int hf_gvcp_sequenceno = -1;
+static int hf_gvcp_address = -1;
+static int hf_gvcp_value = -1;
+static int hf_gvcp_address2 = -1;
+static int hf_gvcp_value2 = -1;
+static int hf_gvcp_remainder = -1;
+static int hf_gvcp_nwritten = -1;
+static int hf_gvcp_nbytes = -1;
+static int hf_gvcp_unknown16 = -1;
+static int hf_gvcp_data = -1;
+static int hf_gvcp_ip = -1;
+static int hf_gvcp_ether = -1;
+static int hf_gvcp_netmask = -1;
+static gint ett_gvcp = -1;
+
+static const value_string opcode_names[] = {
+  { 0x02, "Discovery ping" },
+  { 0x03, "Discovery pong" },
+  { 0x04, "Assign IP" },
+  { 0x05, "Ack IP change" },
+  { 0x40, "Resend request" },
+  { 0x80, "Register read request" },
+  { 0x81, "Register read answer" },
+  { 0x82, "Register write request" },
+  { 0x83, "Register write answer" },
+  { 0x84, "MemBlock read request" },
+  { 0x85, "MemBlock read answer" },
+  { 0x86, "MemBlock write request" },
+  { 0x87, "MemBlock write answer" },
+  { 0, NULL }
+};
+
+static const value_string opcode_short_names[] = {
+  { 0x02, "Disc_Ping" },
+  { 0x03, "Disc_Pong" },
+  { 0x04, "Assign IP" },
+  { 0x05, "Ack IP" },
+  { 0x40, "Res_Req" },
+  { 0x80, "Reg_Rd_Req" },
+  { 0x81, "Reg_Rd_Ans" },
+  { 0x82, "Reg_Wr_Req" },
+  { 0x83, "Reg_Wr_Ans" },
+  { 0x84, "Blk_Rd_Req" },
+  { 0x85, "Blk_Rd_Ans" },
+  { 0x86, "Blk_Wr_Req" },
+  { 0x87, "Blk_Wr_Ans" },
+  { 0, NULL }
+};
+
+static int
+dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+  guint16 packet_type, packet_opcode, packet_plsize, packet_seqn;
+  emem_strbuf_t *info;
+
+  /* Check that there's enough data */
+  if (tvb_length(tvb) < 8)
+    return 0;
+
+  /* Do some tests on what seems to be PDU field to determine if we
+     really have a GVCP packet here, otherwise return 0 to give
+     another dissector a chance to dissect it. */
+  packet_type = tvb_get_ntohs(tvb, 0);
+
+  /* packets from the PC to the camera on GVCP_PORT seem to always
+     start with 0x4201 or 0x4200 */
+  if ( pinfo->destport == GVCP_PORT && 
+       (packet_type != 0x4200 && packet_type != 0x4201) )
+    return 0;
+
+  /* packets from the camera GVCP_PORT to the PC seem to start 
+     with 0x0000, but can be different on error condition (e.g. 0x8005) */
+#if 0
+  if ( pinfo->srcport == GVCP_PORT && tvb_get_ntohs(tvb, 0) != 0x0 )
+    return 0;
+#endif
+
+  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GVCP");
+  /* Clear out stuff in the info column */
+  col_clear(pinfo->cinfo,COL_INFO);
+
+  /* dissect 8 byte header */
+  packet_opcode = tvb_get_ntohs(tvb, 2);
+  packet_plsize = tvb_get_ntohs(tvb, 4);
+  packet_seqn = tvb_get_ntohs(tvb, 6);
+
+  /* allocate growable info string */
+  info = ep_strbuf_new(val_to_str(packet_opcode, opcode_names, "Unknown opcode (0x%04x)"));
+
+  /* check that GVCP header+payload match total packet size */
+  if (tvb_reported_length(tvb) < 8+(guint32)packet_plsize) {
+    ep_strbuf_append_printf(info, " (truncated? %u bytes missing)", 
+                            (8 + packet_plsize) - tvb_reported_length(tvb));
+    col_add_str(pinfo->cinfo, COL_INFO, info->str);
+    return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
+  }
+  if (tvb_reported_length(tvb) > 8+(guint32)packet_plsize) {
+    ep_strbuf_append_printf(info, " (%u excess bytes)", 
+                            tvb_reported_length(tvb) - (8 + packet_plsize));
+    col_add_str(pinfo->cinfo, COL_INFO, info->str);
+    return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
+  }
+  if (packet_plsize & 3) {/* payload is always a multiple of 4 bytes */
+    ep_strbuf_append(info, " (payload is not multiple of 4 bytes)");
+    col_add_str(pinfo->cinfo, COL_INFO, info->str);
+    return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
+  }
+
+  /* switch just concerned with building a meaningfull Info column string */
+
+  switch (packet_opcode) {
+  case 0x04: /* Assign new temporary IP */
+    if (packet_plsize < 24) {/* 56 bytes seem to be normal */ 
+      ep_strbuf_append(info, " <missing args>");
+    } else { /* packet contain new network configuration */
+      ep_strbuf_append_printf(info, "%d.%d.%d.%d to %s",
+                              tvb_get_guint8(tvb, 28), tvb_get_guint8(tvb, 29),
+                              tvb_get_guint8(tvb, 30), tvb_get_guint8(tvb, 31),
+                              tvb_bytes_to_str_punct(tvb, 10, 6, ':'));
+    }
+    break;
+  case 0x80: /* Register Read Request */
+  case 0x81: /* Register Read Answer */
+    if (packet_plsize == 0) {
+      ep_strbuf_append(info, " <missing arg(s)>");
+    } else { /* packet contains adress(es) to read from */
+      ep_strbuf_append_printf(info, " 0x%08x", tvb_get_ntohl(tvb, 8));
+      if (packet_plsize >= 8) {
+        ep_strbuf_append_printf(info, ", 0x%08x", tvb_get_ntohl(tvb, 12));
+        if (packet_plsize >= 12)
+          ep_strbuf_append(info, ", ...");
+      }
+    }
+    break;
+  case 0x82: /* Register Write Request */
+    if (packet_plsize < 8) {
+      ep_strbuf_append(info, " <missing arg(s)>");
+    } else { /* packet contains adress/value pairs to read from */
+      ep_strbuf_append_printf(info, " *0x%08x = 0x%08x", tvb_get_ntohl(tvb, 8),
+                              tvb_get_ntohl(tvb, 12));
+      if (packet_plsize >= 16) {
+        ep_strbuf_append_printf(info, ", *0x%08x = 0x%08x", 
+                                tvb_get_ntohl(tvb, 16), tvb_get_ntohl(tvb, 20));
+        if (packet_plsize >= 24)
+          ep_strbuf_append(info, ", ...");
+      }
+    }
+    break;
+  case 0x83: /* Register Write Answer */
+    if (packet_plsize < 4) {
+      ep_strbuf_append(info, " <missing arg>");
+    } else {
+      ep_strbuf_append_printf(info, " %d register%s written", 
+                              tvb_get_ntohl(tvb, 8), 
+                              tvb_get_ntohl(tvb, 8)==1?"":"s");
+    }
+    break;
+  case 0x84: /* Block Read Request */
+    if (packet_plsize < 8) {
+      ep_strbuf_append(info, " <missing args>");
+    } else { /* packet contains adress/size pair to read from */
+      ep_strbuf_append_printf(info, " 0x%08x (%d bytes, X=0x%04x)", 
+                              tvb_get_ntohl(tvb, 8), tvb_get_ntohs(tvb, 14),
+                              tvb_get_ntohs(tvb, 12));
+      if (packet_plsize > 8) {
+        ep_strbuf_append(info, "; excess payload");
+      }
+    }
+    break;
+  case 0x85: /* Block Read Answer */
+    if (packet_plsize < 8) {
+      ep_strbuf_append(info, " <missing args>");
+    } else { /* packet contains desired data */
+      ep_strbuf_append_printf(info, " %d bytes from 0x%08x", packet_plsize - 4,
+                              tvb_get_ntohl(tvb, 8));
+    }
+    break;
+  case 0x86: /* Block Write Request */
+    if (packet_plsize < 8) {
+      ep_strbuf_append(info, " <missing args>");
+    } else { /* packet contains desired data */
+      ep_strbuf_append_printf(info, " *0x%08x = <%d bytes>", 
+                              tvb_get_ntohl(tvb, 8), packet_plsize - 4);
+    }
+    break;
+  case 0x87: /* Block Write Answer */
+    if (packet_plsize < 4) {
+      ep_strbuf_append(info, " <missing arg>");
+    } else {
+      ep_strbuf_append_printf(info, " %d bytes written", tvb_get_ntohl(tvb, 8));
+    }
+    break;
+  }
+
+  col_add_str(pinfo->cinfo, COL_INFO, info->str);
+
+  if (tree) { /* we are being asked for details */
+    proto_item *ti = NULL;
+    proto_tree *gvcp_tree = NULL;
+    
+    ti = proto_tree_add_item(tree, proto_gvcp, tvb, 0, -1, FALSE);
+    gvcp_tree = proto_item_add_subtree(ti, ett_gvcp);
+    proto_tree_add_item(gvcp_tree, hf_gvcp_type, tvb, 0, 2, FALSE);
+    proto_tree_add_item(gvcp_tree, hf_gvcp_opcode, tvb, 2, 2, FALSE);
+    proto_tree_add_item(gvcp_tree, hf_gvcp_payloadsize, tvb, 4, 2, FALSE);
+    proto_tree_add_item(gvcp_tree, hf_gvcp_sequenceno, tvb, 6, 2, FALSE);
+
+    /* opcode specific fields */
+    switch (packet_opcode) {
+    case 0x04: /* Assign new temporary network configuration */
+      if (packet_plsize >= 48) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_ether, tvb, 10, 6, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_ip, tvb, 28, 4, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_netmask, tvb, 44, 4, FALSE);
+      }
+      break;
+    case 0x80: /* Register Read Request */
+      if (packet_plsize >= 4) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_address, tvb, 8, 4, FALSE);
+        if (packet_plsize >= 8) {
+          proto_tree_add_item(gvcp_tree, hf_gvcp_address2, tvb, 12, 4, FALSE);
+          if (packet_plsize >= 12)
+            proto_tree_add_item(gvcp_tree, hf_gvcp_remainder, tvb, 16, -1, FALSE);
+        }
+      }
+      break;
+    case 0x81: /* Register Read Answer */
+      if (packet_plsize >= 4) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_value, tvb, 8, 4, FALSE);
+        if (packet_plsize >= 8) {
+          proto_tree_add_item(gvcp_tree, hf_gvcp_value2, tvb, 12, 4, FALSE);
+          if (packet_plsize >= 12)
+            proto_tree_add_item(gvcp_tree, hf_gvcp_remainder, tvb, 16, -1, FALSE);
+        }
+      }
+      break;
+    case 0x82: /* Register Write Request */
+      if (packet_plsize >= 8) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_address, tvb, 8, 4, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_value, tvb, 12, 4, FALSE);
+        if (packet_plsize >= 16) {
+          proto_tree_add_item(gvcp_tree, hf_gvcp_address2, tvb, 16, 4, FALSE);
+          proto_tree_add_item(gvcp_tree, hf_gvcp_value2, tvb, 20, 4, FALSE);
+          if (packet_plsize >= 24)
+            proto_tree_add_item(gvcp_tree, hf_gvcp_remainder, tvb, 24, -1, FALSE);
+        }
+      }
+      break;
+    case 0x83: /* Register Write Answer */
+      if (packet_plsize >= 4)
+        proto_tree_add_item(gvcp_tree, hf_gvcp_nwritten, tvb, 8, 4, FALSE);
+      break;
+    case 0x84: /* Block Read Request */
+      if (packet_plsize >= 8) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_address, tvb, 8, 4, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_unknown16, tvb, 12, 2, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_nbytes, tvb, 14, 2, FALSE);
+      }
+      break;
+    case 0x85: /* Block Read Answer */
+    case 0x86: /* Block Write Request */
+      if (packet_plsize >= 8) {
+        proto_tree_add_item(gvcp_tree, hf_gvcp_address, tvb, 8, 4, FALSE);
+        proto_tree_add_item(gvcp_tree, hf_gvcp_data, tvb, 12, -1, FALSE);
+      }
+      break;
+    case 0x87: /* Block Write Answer */
+      if (packet_plsize >= 4)
+        proto_tree_add_item(gvcp_tree, hf_gvcp_nbytes, tvb, 10, 2, FALSE);
+      break;
+    default:
+      if (packet_plsize > 0)
+        proto_tree_add_item(gvcp_tree, hf_gvcp_data, tvb, 8, -1, FALSE);
+      break;
+    }
+    
+  }
+
+  return tvb_length(tvb);
+}
+
+void
+proto_register_gvcp(void)
+{
+  static hf_register_info hf[] = {
+    { &hf_gvcp_type,
+      { "GVCP Type", "gvcp.type",
+        FT_UINT16, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_opcode,
+      { "GVCP Opcode", "gvcp.opcode",
+        FT_UINT16, BASE_HEX,
+        VALS(opcode_names), 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_payloadsize,
+      { "GVCP Payload bytes", "gvcp.size",
+        FT_UINT16, BASE_DEC,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_sequenceno,
+      { "GVCP Sequence number", "gvcp.seqn",
+        FT_UINT16, BASE_DEC,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_address,
+      { "Address", "gvcp.address",
+        FT_UINT32, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_value,
+      { "Value", "gvcp.value",
+        FT_UINT32, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_address2,
+      { "Address 2", "gvcp.address2",
+        FT_UINT32, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_value2,
+      { "Value 2", "gvcp.value2",
+        FT_UINT32, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_remainder,
+      { "Remaining arguments", "gvcp.remainder",
+        FT_BYTES, BASE_NONE,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_nwritten,
+      { "Number of registers written", "gvcp.nwritten",
+        FT_UINT32, BASE_DEC,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_nbytes,
+      { "Number of bytes", "gvcp.nbytes",
+        FT_UINT32, BASE_DEC,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_unknown16,
+      { "2-byte unknown meaning", "gvcp.unkown16",
+        FT_UINT16, BASE_HEX,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_data,
+      { "Data", "gvcp.data",
+        FT_BYTES, BASE_NONE,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_ether,
+      { "Link layer address (ethernet)", "gvcp.ether",
+        FT_ETHER, BASE_NONE,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_ip,
+      { "IPv4 address", "gvcp.ip",
+        FT_IPv4, BASE_NONE,
+        NULL, 0x0,
+        NULL, HFILL }
+    },
+    { &hf_gvcp_netmask,
+      { "Netmask", "gvcp.netmask",
+        FT_IPv4, BASE_NONE,
+        NULL, 0x0,
+        NULL, HFILL }
+    }
+  };
+
+  /* Setup protocol subtree array */
+  static gint *ett[] = {
+    &ett_gvcp
+  };
+
+  proto_gvcp = proto_register_protocol ("GigE Vision Control Protocol",        /*name*/
+                                        "GVCP",                /* short name */
+                                        "gvcp"         /* abbrev     */);
+
+  proto_register_field_array(proto_gvcp, hf, array_length(hf));
+  proto_register_subtree_array(ett, array_length(ett));
+
+}
+
+void
+proto_reg_handoff_gvcp(void)
+{
+  dissector_handle_t gvcp_handle;
+
+  gvcp_handle = new_create_dissector_handle(dissect_gvcp, proto_gvcp);
+  dissector_add("udp.port", GVCP_PORT, gvcp_handle);
+}
+
index 571c9dda4eba60bf08320275e9d702e29add4526..9cb027a224b4a44143d05c7f862c30d273b0d93f 100644 (file)
@@ -641,6 +641,14 @@ static hf_sip_uri_t sip_from_uri = {
        &hf_sip_from_port,
        &ett_sip_from_uri
 };
+
+static hf_sip_uri_t sip_req_uri = {
+       &hf_sip_ruri,
+       &hf_sip_ruri_user,
+       &hf_sip_ruri_host,
+       &hf_sip_ruri_port,
+       &ett_sip_ruri
+};
 /*
  * Type of line.  It's either a SIP Request-Line, a SIP Status-Line, or
  * another type of line.
@@ -692,7 +700,7 @@ static gboolean sip_is_known_request(tvbuff_t *tvb, int meth_offset,
     guint meth_len, guint *meth_idx);
 static gint sip_is_known_sip_header(tvbuff_t *tvb, int offset,
     guint header_len);
-static void dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree,
+static void dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
     guint meth_len, gint linelen);
 static void dfilter_sip_status_line(tvbuff_t *tvb, proto_tree *tree);
 static void tvb_raw_text_add(tvbuff_t *tvb, int offset, int length, proto_tree *tree);
@@ -858,7 +866,7 @@ sip_init_protocol(void)
 
        /* Now create them over */
        sip_hash = g_hash_table_new(g_str_hash , sip_equal);
-       /* Create a hastable with the SIP headers it will be used to find the related hf entry (POS_x)
+       /* Create a hastable with the SIP headers it will be used to find the related hf entry (POS_x) 
         * this is faster than the previously used for loop
         * There is no g_hash_table_destroy as the liftime is the same as the lifetime of Wireshark
         */
@@ -915,10 +923,10 @@ sip_uri_offset_init(uri_offset_info *uri_offsets){
  * - sip_uri_offset_init() must have been called first.
  */
 static gint
-dissect_sip_uri2(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset,
+dissect_sip_uri(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset,
                 gint line_end_offset, uri_offset_info *uri_offsets)
 {
-       gchar c;
+       gchar c = '\0';
        gint current_offset;
        gint queried_offset;
        gint comma_offset;
@@ -933,6 +941,8 @@ dissect_sip_uri2(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset,
                /* Nothing to parse */
                return -1;
        }
+       /* Set uri start offset in case this was caled directly */
+       uri_offsets->uri_start = current_offset;
 
        /* Check if it's realy a sip uri ( it might be a tel uri, parse that?) */
        queried_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, ':');
@@ -1194,320 +1204,9 @@ dissect_sip_name_addr_or_addr_spec(tvbuff_t *tvb, packet_info *pinfo _U_, gint s
                uri_offsets->name_addr_end = queried_offset;
                uri_offsets->uri_end = queried_offset - 1;
        }
-       return dissect_sip_uri2(tvb, pinfo, current_offset, line_end_offset, uri_offsets);
+       return dissect_sip_uri(tvb, pinfo, current_offset, line_end_offset, uri_offsets);
 }
 
-/* Code to parse a sip uri.
- * Returns Offset end off parsing or -1 for unsuccessful parsing
- * - sip_uri_offset_init() must have been called first.
- */
-static gint
-dissect_sip_uri(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset,
-                gint line_end_offset, uri_offset_info *uri_offsets)
-{
-       gchar c;
-       gint i;
-       gint current_offset;
-       gint queried_offset;
-       gint colon_offset;
-       gint comma_offset;
-       gint semicolon_offset;
-       gint question_mark_offset;
-       gint parameter_end_offset;
-       gboolean uri_without_angle_quotes = FALSE;
-       gboolean in_ipv6 = FALSE;
-
-       /* skip Spaces and Tabs */
-       current_offset = tvb_skip_wsp(tvb, start_offset, line_end_offset - start_offset);
-
-       if(current_offset >= line_end_offset) {
-               /* Nothing to parse */
-               return -1;
-       }
-
-       uri_offsets->name_addr_start = current_offset;
-
-       /* First look, if we have a display name */
-       c=tvb_get_guint8(tvb, current_offset);
-       switch(c)
-       {
-               case '"':
-                       /* We have a display name, look for the next unescaped '"' */
-                       uri_offsets->display_name_start = current_offset;
-                       do
-                       {
-                               queried_offset = tvb_find_guint8(tvb, current_offset + 1, line_end_offset - (current_offset + 1), '"');
-                               if(queried_offset == -1)
-                               {
-                                       /* malformed URI */
-                                       return -1;
-                               }
-                               current_offset = queried_offset;
-
-                               /* Is it escaped? */
-                               /* count back slashes before '"' */
-                               for(i=1;tvb_get_guint8(tvb, queried_offset - i) == '\\';i++);
-                               i--;
-
-                               if(i % 2 == 0)
-                               {
-                                       /* not escaped */
-                                       break;
-                               }
-                       } while (current_offset < line_end_offset);
-                       if(current_offset >= line_end_offset)
-                       {
-                               /* malformed URI */
-                               return -1;
-                       }
-
-                       uri_offsets->display_name_end = current_offset;
-
-                       /* find start of the URI */
-                       queried_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, '<');
-                       if(queried_offset == -1)
-                       {
-                               /* malformed Uri */
-                               return -1;
-                       }
-                       current_offset = queried_offset + 1;
-                       break;
-
-               case '<':
-                       /* We don't have a display name */
-                       current_offset++;
-                       break;
-
-               default:
-                       /* We have either an URI without angles or a display name with a limited character set */
-                       /* Look for the right angle quote or colon */
-                       queried_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, '<');
-                       colon_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, ':');
-                       if(queried_offset != -1 && colon_offset != -1)
-                       {
-                               if(queried_offset < colon_offset)
-                               {
-                                       /* we have an URI with angle quotes */
-                                       uri_offsets->display_name_start = current_offset;
-                                       uri_offsets->display_name_end = queried_offset - 1;
-                                       current_offset = queried_offset + 1;
-                               }
-                               else
-                               {
-                                       /* we have an URI without angle quotes */
-                                       uri_without_angle_quotes = TRUE;
-                               }
-                       }
-                       else
-                       {
-                               if(queried_offset != -1)
-                               {
-                                       /* we have an URI with angle quotes */
-                                       uri_offsets->display_name_start = current_offset;
-                                       uri_offsets->display_name_end = queried_offset - 1;
-                                       current_offset = queried_offset + 1;
-                                       break;
-                               }
-                               if(colon_offset != -1)
-                               {
-                                       /* we have an URI without angle quotes */
-                                       uri_without_angle_quotes = TRUE;
-                                       break;
-                               }
-                               /* If this point is reached, we can't parse the URI */
-                               return -1;
-                       }
-                       break;
-       }
-
-       /* Start parsing of URI */
-       uri_offsets->uri_start = current_offset;
-       /* Check if it's realy a sip uri ( it might be a tel uri, parse that?) */
-       queried_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, ':');
-       if (tvb_strneql(tvb, current_offset, "sip", 3) != 0)
-               return -1;
-
-       if(uri_without_angle_quotes == TRUE)
-       {
-               /* look for the first ',' or ';' which will mark the end of this URI
-                * In this case a semicolon indicates a header field parameter, and not an uri parameter.
-                */
-               comma_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, ',');
-               semicolon_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, ';');
-
-               if (semicolon_offset != -1 && comma_offset != -1)
-               {
-                       if(semicolon_offset < comma_offset)
-                       {
-                               uri_offsets->uri_end = semicolon_offset - 1;
-                       }
-                       else
-                       {
-                               uri_offsets->uri_end = comma_offset - 1;
-                       }
-               }
-               else
-               {
-                       if (semicolon_offset != -1)
-                       {
-                               uri_offsets->uri_end = semicolon_offset - 1;
-                       }
-                       else if (comma_offset != -1)
-                       {
-                               uri_offsets->uri_end = comma_offset - 1;
-                       } else {
-
-                               /* If both offsets are equal to -1, we don't have a semicolon or a comma.
-                               * In that case, we assume that the end of the URI is at the line end
-                                */
-                               uri_offsets->uri_end = line_end_offset - 3; /* remove '\r\n' */
-                       }
-               }
-               uri_offsets->name_addr_end = uri_offsets->uri_end;
-               current_offset = uri_offsets->uri_end + 1; /* Now save current_offset, as it is the value to be returned now */
-       }
-       else
-       {
-               /* look for closing angle quote */
-               queried_offset = tvb_find_guint8(tvb, current_offset, line_end_offset - current_offset, '>');
-               if(queried_offset == -1)
-               {
-                       /* malformed Uri */
-                       return -1;
-               }
-               uri_offsets->name_addr_end = queried_offset;
-               uri_offsets->uri_end = queried_offset - 1;
-               current_offset = queried_offset; /* Now save current_offset. It contains the value we have to return */
-
-               /* Look for '@' within URI */
-               queried_offset = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, '@');
-               if(queried_offset == -1)
-               {
-                       /* no '@': look for the first ';' or '?' in the URI */
-                       question_mark_offset = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, '?');
-                       semicolon_offset = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, ';');
-               }
-               else
-               {
-                       /* with '@': look for the first ';' or '?' behind the '@' */
-                       question_mark_offset = tvb_find_guint8(tvb, queried_offset, uri_offsets->uri_end - queried_offset, '?');
-                       semicolon_offset = tvb_find_guint8(tvb, queried_offset, uri_offsets->uri_end - queried_offset, ';');
-               }
-
-               /* Set Parameter*/
-               if (semicolon_offset != -1 && question_mark_offset != -1)
-               {
-                       if(semicolon_offset < question_mark_offset)
-                       {
-                               uri_offsets->uri_parameters_start = semicolon_offset;
-                       }
-                       else
-                       {
-                               uri_offsets->uri_parameters_start = question_mark_offset;
-                       }
-                       uri_offsets->uri_parameters_end = uri_offsets->uri_end;
-                       uri_offsets->uri_end = uri_offsets->uri_parameters_start - 1;
-               }
-               else
-               {
-                       if (semicolon_offset != -1)
-                       {
-                               uri_offsets->uri_parameters_start = semicolon_offset;
-                               uri_offsets->uri_parameters_end = uri_offsets->uri_end;
-                               uri_offsets->uri_end = uri_offsets->uri_parameters_start - 1;
-                       }
-                       if (question_mark_offset != -1)
-                       {
-                               uri_offsets->uri_parameters_start = question_mark_offset;
-                               uri_offsets->uri_parameters_end = uri_offsets->uri_end;
-                               uri_offsets->uri_end = uri_offsets->uri_parameters_start - 1;
-                       }
-                       /* If both offsets are equal to -1, we don't have a semicolon or a question mark.
-                        * In that case, we don't have to save any offsets.
-                        */
-               }
-
-       }
-
-       /* Look for URI address parts (user, host, host-port) */
-
-       /* Look for '@' within URI */
-       queried_offset = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, '@');
-       if(queried_offset == -1)
-       {
-       /* no '@' = no user part */
-       uri_offsets->uri_host_start = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, ':')+1;
-       }
-       else
-       {
-       /* with '@' = with user part */
-       uri_offsets->uri_user_start = tvb_find_guint8(tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start, ':')+1;
-       uri_offsets->uri_user_end = tvb_find_guint8(tvb, uri_offsets->uri_user_start, uri_offsets->uri_end - uri_offsets->uri_start, '@')-1;
-       uri_offsets->uri_host_start = uri_offsets->uri_user_end + 2;
-       }
-
-       /* find URI-Host end*/
-       parameter_end_offset = uri_offsets->uri_host_start;
-
-       in_ipv6 = (tvb_get_guint8(tvb, parameter_end_offset) == '[');
-       while (parameter_end_offset < line_end_offset)
-       {
-                       parameter_end_offset++;
-                       c = tvb_get_guint8(tvb, parameter_end_offset);
-                       switch (c) {
-                               case '>':
-                               case ',':
-                               case ';':
-                               case '?':
-                               case ' ':
-                               case '\r':
-                                       goto uri_host_end_found;
-                               case ':':
-                                       if (!in_ipv6)
-                                               goto uri_host_end_found;
-                                       break;
-                               case '[':
-                                       in_ipv6 = TRUE;
-                                       break;
-                               case ']':
-                                       in_ipv6 = FALSE;
-                                       break;
-                               default :
-                               break;
-                               }
-       }
-
-       uri_host_end_found:
-
-               uri_offsets->uri_host_end = parameter_end_offset - 1;
-
-               if (c == ':')
-               {
-                       uri_offsets->uri_host_port_start = parameter_end_offset + 1;
-                       parameter_end_offset = uri_offsets->uri_host_port_start;
-                               while (parameter_end_offset < line_end_offset)
-                               {
-                                               parameter_end_offset++;
-                                               c = tvb_get_guint8(tvb, parameter_end_offset);
-                                               switch (c) {
-                                                       case '>':
-                                                       case ',':
-                                                       case ';':
-                                                       case '?':
-                                                       case ' ':
-                                                       case '\r':
-                                                               goto uri_host_port_end_found;
-                                                       default :
-                                                       break;
-                                               }
-                               }
-
-                       uri_host_port_end_found:
-
-                       uri_offsets->uri_host_port_end = parameter_end_offset -1;
-               }
-               return current_offset;
-}
 
 /*
 * Code to add dissected SIP URI Information to proto tree
@@ -1528,7 +1227,7 @@ display_sip_uri (tvbuff_t *tvb, proto_tree *sip_element_tree, uri_offset_info* u
        ti = proto_tree_add_item(sip_element_tree, *(uri->hf_sip_addr), tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start + 1, FALSE);
        uri_item_tree = proto_item_add_subtree(ti, *(uri->ett_uri));
 
-       if(uri_offsets->uri_user_end >= uri_offsets->uri_user_start) {
+       if(uri_offsets->uri_user_end > uri_offsets->uri_user_start) {
                proto_tree_add_item(uri_item_tree, *(uri->hf_sip_user), tvb, uri_offsets->uri_user_start,
                                    uri_offsets->uri_user_end - uri_offsets->uri_user_start + 1, FALSE);
        }
@@ -2266,7 +1965,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                   tvb_format_text(tvb, offset, linelen));
                        reqresp_tree = proto_item_add_subtree(ti_a, ett_sip_reqresp);
                }
-               dfilter_sip_request_line(tvb, reqresp_tree, token_1_len, linelen);
+               dfilter_sip_request_line(tvb, reqresp_tree, pinfo, token_1_len, linelen);
                break;
 
        case STATUS_LINE:
@@ -2333,6 +2032,8 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
 
 
 
+
+
                linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
                if (linelen == 0) {
                        /*
@@ -2418,15 +2119,15 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                                           tvb_format_text(tvb, offset, linelen));
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item,
                                                                           ett_sip_element);
+                                                       /* To        =  ( "To" / "t" ) HCOLON ( name-addr
+                                                        *               / addr-spec ) *( SEMI to-param )
+                                                        */
                                                }
-                                               /* To        =  ( "To" / "t" ) HCOLON ( name-addr
-                                                *               / addr-spec ) *( SEMI to-param )
-                                                */
                                                sip_uri_offset_init(&uri_offsets);
                                                if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1){
                                                        display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_to_uri);
                                                        if((uri_offsets.name_addr_start != -1) && (uri_offsets.name_addr_end != -1)){
-                                                               stat_info->tap_to_addr=tvb_get_ephemeral_string(tvb, uri_offsets.name_addr_start,
+                                                               stat_info->tap_to_addr=tvb_get_ephemeral_string(tvb, uri_offsets.name_addr_start, 
                                                                        uri_offsets.name_addr_end - uri_offsets.name_addr_start);
                                                        }
                                                        offset = uri_offsets.name_addr_end +1;
@@ -2474,22 +2175,21 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                                           tvb_format_text(tvb, offset, linelen));
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item, ett_sip_element);
                                                }
-                                               /*
-                                                * From        =  ( "From" / "f" ) HCOLON from-spec
-                                                * from-spec   =  ( name-addr / addr-spec )
-                                                *                *( SEMI from-param )
-                                                */
+                                                       /*
+                                                        * From        =  ( "From" / "f" ) HCOLON from-spec
+                                                        * from-spec   =  ( name-addr / addr-spec )
+                                                        *                *( SEMI from-param )
+                                                        */
 
                                                sip_uri_offset_init(&uri_offsets);
                                                if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1){
                                                        display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_from_uri);
                                                        if((uri_offsets.name_addr_start != -1) && (uri_offsets.name_addr_end != -1)){
-                                                               stat_info->tap_from_addr=tvb_get_ephemeral_string(tvb, uri_offsets.name_addr_start,
+                                                               stat_info->tap_from_addr=tvb_get_ephemeral_string(tvb, uri_offsets.name_addr_start, 
                                                                        uri_offsets.name_addr_end - uri_offsets.name_addr_start);
                                                        }
                                                        offset = uri_offsets.name_addr_end +1;
                                                }
-
                                                if(hdr_tree) {
                                                        /* Find parameter tag if present.
                                                         * TODO make this generic to find any interesting parameter
@@ -2525,9 +2225,15 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item,
                                                                           ett_sip_element);
 
-                                                       /* Initialize the uri_offsets */
+                                                       /*
+                                                        * PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value
+                                                        *                *(COMMA PAssertedID-value)
+                                                        * PAssertedID-value = name-addr / addr-spec
+                                                        *
+                                                        * Initialize the uri_offsets
+                                                        */
                                                        sip_uri_offset_init(&uri_offsets);
-                                                       if((dissect_sip_uri(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
+                                                       if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
                                                                 pai_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pai_uri);
                                                }
                                                break;
@@ -2555,10 +2261,15 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                                           tvb_format_text(tvb, offset, linelen));
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item,
                                                                           ett_sip_element);
-
-                                                       /* Initialize the uri_offsets */
+                                                       /*
+                                                        * PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value
+                                                        *                   *(COMMA PPreferredID-value)
+                                                        * PPreferredID-value = name-addr / addr-spec
+                                                        * 
+                                                        * Initialize the uri_offsets
+                                                        */
                                                        sip_uri_offset_init(&uri_offsets);
-                                                       if((dissect_sip_uri(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
+                                                       if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
                                                                 ppi_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_ppi_uri);
                                                }
                                                break;
@@ -2574,9 +2285,15 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
 
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item,
                                                                                                                           ett_sip_element);
-                                                       /* Initialize the uri_offsets */
+                                                       /* 
+                                                        * Permission-Missing  =  "Permission-Missing" HCOLON per-miss-spec
+                                                        *                        *( COMMA per-miss-spec )
+                                                        * per-miss-spec       =  ( name-addr / addr-spec )
+                                                        *                       *( SEMI generic-param )
+                                                        * Initialize the uri_offsets
+                                                        */
                                                        sip_uri_offset_init(&uri_offsets);
-                                                       if((dissect_sip_uri(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
+                                                       if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1)
                                                                 pmiss_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pmiss_uri);
                                                }
                                                break;
@@ -2594,8 +2311,16 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                                                        sip_element_tree = proto_item_add_subtree( sip_element_item,
                                                                                                                                                ett_sip_element);
                                                }
-
-                                               /* Initialize the uri_offsets */
+                                               /* 
+                                                * Trigger-Consent     =  "Trigger-Consent" HCOLON trigger-cons-spec
+                                                *                        *( COMMA trigger-cons-spec )
+                                                * trigger-cons-spec   =  ( SIP-URI / SIPS-URI )
+                                                *                        *( SEMI trigger-param )
+                                                * trigger-param       =  target-uri / generic-param
+                                                * target-uri          =  "target-uri" EQUAL
+                                                *                            LDQUOT *( qdtext / quoted-pair ) RDQUOT
+                                                * Initialize the uri_offsets
+                                                */
                                                sip_uri_offset_init(&uri_offsets);
                                                if((dissect_sip_uri(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1) {
 
@@ -3159,23 +2884,20 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
 
 /* Display filter for SIP Request-Line */
 static void
-dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, guint meth_len, gint linelen)
+dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint meth_len, gint linelen)
 {
        char    *value;
 
-       gint    parameter_end_offset;
        guint   offset = 0;
        guint   parameter_len = meth_len;
-       guchar  c= '\0';
-       gboolean in_ipv6=FALSE;
-       proto_tree *ruri_item_tree = NULL;
-       proto_item *ti;
+       uri_offset_info uri_offsets;
 
        /*
         * We know we have the entire method; otherwise, "sip_parse_line()"
         * would have returned OTHER_LINE.
         * Request-Line  =  Method SP Request-URI SP SIP-Version CRLF
         * SP = single space
+        * Request-URI    =  SIP-URI / SIPS-URI / absoluteURI
         */
 
        /* get method string*/
@@ -3188,74 +2910,11 @@ dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, guint meth_len, gint l
                proto_tree_add_string(tree, hf_Method, tvb, offset, parameter_len, value);
 
                /* build Request-URI tree*/
-               offset=parameter_len+1;
-               parameter_len = (tvb_find_guint8(tvb, offset, linelen, ' '))-offset; /* calc R-URI len*/
-               ti = proto_tree_add_item(tree, hf_sip_ruri, tvb, offset, parameter_len, FALSE);
-               ruri_item_tree = proto_item_add_subtree(ti, ett_sip_ruri);
-
-               offset = (tvb_find_guint8(tvb, offset, linelen, ':'))+1; /* calc R-URI User/Host begin*/
-               if ((tvb_find_guint8(tvb, offset, linelen, '@')) != -1){
-                       /* R-URI: User Part found*/
-                       parameter_len = (tvb_find_guint8(tvb, offset, linelen, '@'))-offset; /* calc R-URI User len*/
-                       if (parameter_len > 0) {
-                               proto_tree_add_item(ruri_item_tree, hf_sip_ruri_user, tvb, offset,
-                               parameter_len, FALSE);
-                       }
-                       offset = offset + parameter_len + 1;
-               }
-               parameter_end_offset=offset;
-
-               in_ipv6 = (tvb_get_guint8(tvb, parameter_end_offset) == '[');
-               while (parameter_end_offset < linelen){
-                       parameter_end_offset++;
-                       c = tvb_get_guint8(tvb, parameter_end_offset);
-                       switch (c) {
-                               case ',':
-                               case ';':
-                               case '?':
-                               case ' ':
-                                       goto host_end_found;
-                               case ':':
-                                       if (!in_ipv6)
-                                               goto host_end_found;
-                                       break;
-                               case '[':
-                                       in_ipv6 = TRUE;
-                                       break;
-                               case ']':
-                                       in_ipv6 = FALSE;
-                                       break;
-                               default :
-                               break;
-                       }
-               }
-               host_end_found:
-               parameter_len = parameter_end_offset-offset; /* calc R-URI host len*/
-               proto_tree_add_item(ruri_item_tree, hf_sip_ruri_host, tvb, offset, parameter_len, FALSE);
-
-               offset = offset + parameter_len + 1;
-
-               if (c == ':'){
-                       /* R-URI: Host Port found */
-                       parameter_end_offset = offset;
-                       while (parameter_end_offset < linelen){
-                               parameter_end_offset++;
-                               c = tvb_get_guint8(tvb, parameter_end_offset);
-                               switch (c) {
-                                       case ',':
-                                       case ';':
-                                       case '?':
-                                       case ' ':
-                                               goto host_port_end_found;
-                                       default :
-                                       break;
-                               }
-                       }
-                       host_port_end_found:
-                       parameter_len = parameter_end_offset-offset; /* calc R-URI Host Port len*/
-                       proto_tree_add_item(ruri_item_tree, hf_sip_ruri_port, tvb, offset, parameter_len, FALSE);
-               }
-               /* end of Request-URI tree*/
+               offset=offset + parameter_len+1;
+               sip_uri_offset_init(&uri_offsets);
+               uri_offsets.uri_end = tvb_find_guint8(tvb, offset, linelen, ' ')-1; /* calc R-URI len*/
+               dissect_sip_uri(tvb, pinfo, offset, linelen, &uri_offsets);
+               display_sip_uri(tvb, tree, &uri_offsets, &sip_req_uri);
        }
 }
 
index ecd9b7ce89e7adfb6c9a58d3e09cc7deb1726f80..c1264eceade9cba1554f453893ef5367ca63eda1 100644 (file)
@@ -93,7 +93,8 @@ static gint dissect_uftp_message(proto_tree *unistim_tree, packet_info *pinfo,
 static void set_ascii_item(proto_tree *unistim_tree, tvbuff_t *tvb,
                            gint offset,guint msg_len);
 static void set_ascii_null_term_item(proto_tree *msg_tree,tvbuff_t *tvb, 
-                                     gint offset,guint msg_len, char *label);
+                                     gint offset,guint msg_len,
+                                     const char *label);
 
 
 static int proto_unistim = -1;
@@ -167,15 +168,15 @@ static const value_string command_address[]={
 
 static int
 dissect_unistim(tvbuff_t *tvb,packet_info *pinfo,proto_tree *tree){
-   gint offset=0;
-   proto_item *ti= NULL;
-   proto_item *ti1= NULL;
-   proto_tree *overall_unistim_tree = NULL;
-   proto_tree *rudpm_tree=NULL;
-   gint size;
-
-   /* heuristic*/
-   switch(tvb_get_guint8(tvb,offset+4)) {/*rudp packet type 0,1,2 only */
+    gint offset=0;
+    proto_item *ti= NULL;
+    proto_item *ti1= NULL;
+    proto_tree *overall_unistim_tree = NULL;
+    proto_tree *rudpm_tree=NULL;
+    gint size;
+
+    /* heuristic*/
+    switch(tvb_get_guint8(tvb,offset+4)) {/*rudp packet type 0,1,2 only */
       case 0x0:/*NAK*/
       case 0x1:/*ACK*/
          break;
@@ -193,13 +194,13 @@ dissect_unistim(tvbuff_t *tvb,packet_info *pinfo,proto_tree *tree){
          break;
       default:
          return 0;
-   }
+    }
 
 
-   size=tvb_length_remaining(tvb, offset);
-   col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNISTIM");
+    size=tvb_length_remaining(tvb, offset);
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNISTIM");
       /* Clear out stuff in the info column */
-   col_clear(pinfo->cinfo, COL_INFO);
+    col_clear(pinfo->cinfo, COL_INFO);
     ti = proto_tree_add_item(tree,proto_unistim,tvb,offset,-1,FALSE);
     overall_unistim_tree = proto_item_add_subtree(ti,ett_unistim);
     ti1=proto_tree_add_text(overall_unistim_tree,tvb,offset,5,"Reliable UDP");
@@ -208,7 +209,7 @@ dissect_unistim(tvbuff_t *tvb,packet_info *pinfo,proto_tree *tree){
     proto_tree_add_item(rudpm_tree,hf_unistim_seq_nu,tvb,offset,4,FALSE);
 
     /* Allocate new mem for queueing */
-    uinfo = se_alloc(sizeof(unistim_info_t));
+    uinfo = (unistim_info_t *)se_alloc(sizeof(unistim_info_t));
 
     /* Clear tap struct */
     uinfo->rudp_type = 0;
@@ -2555,9 +2556,9 @@ set_ascii_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len){
    gsize buffer_index=0;
    guint16 msg_index=0;
    guint8 character;
-   char *label="DATA: ";
+   const char *label="DATA: ";
    #define MAX_BUFFER 1024
-   buffer=ep_alloc(MAX_BUFFER);
+   buffer=(char *)ep_alloc(MAX_BUFFER);
 
    buffer_index=g_strlcpy(buffer,label,MAX_BUFFER);
    while((buffer_index<MAX_BUFFER-2)&&(msg_index<msg_len)){
@@ -2583,13 +2584,13 @@ set_ascii_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len){
 }
 
 static void
-set_ascii_null_term_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len,char *label){
+set_ascii_null_term_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len,const char *label){
    char *buffer=NULL;
    gsize buffer_index=0;
    guint16 msg_index=0;
    guint8 character;
    #define MAX_BUFFER 1024
-   buffer=ep_alloc(MAX_BUFFER);
+   buffer=(char *)ep_alloc(MAX_BUFFER);
 
    buffer_index=g_strlcpy(buffer,label,MAX_BUFFER);
    while((buffer_index<MAX_BUFFER-2)&&(msg_index<msg_len)){