aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2010-03-08 20:45:13 +0000
committerAnders Broman <anders.broman@ericsson.com>2010-03-08 20:45:13 +0000
commit25af78517ec4f15d11864f7785f5cf4856821a80 (patch)
tree3219dd0f933a6450e80401c9dcd2f481a425e112 /epan/dissectors
parent990454aa93f83fcdfb3bef4c02d34052ee5335c2 (diff)
Make tvb_pbrk_guint8() return the found needle.
svn path=/trunk/; revision=32144
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-cups.c3
-rw-r--r--epan/dissectors/packet-sdp.c4
-rw-r--r--epan/dissectors/packet-sip.c52
3 files changed, 29 insertions, 30 deletions
diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c
index 8611be0955..4e8e8ade42 100644
--- a/epan/dissectors/packet-cups.c
+++ b/epan/dissectors/packet-cups.c
@@ -337,8 +337,9 @@ get_unquoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len)
const guint8* s = NULL;
guint l = 0;
gint o;
+ guchar found_needle = 0;
- o = tvb_pbrk_guint8(tvb, offset, -1, (const guint8*)" \t\r\n");
+ o = tvb_pbrk_guint8(tvb, offset, -1, (const guint8*)" \t\r\n", NULL);
if (o != -1) {
l = o - offset;
s = tvb_get_ptr(tvb, offset, l);
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index 37ecc38c2b..1454b75a82 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -989,7 +989,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr
offset = next_offset + 1;
if (strcmp((char*)field_name, "ipbcp") == 0) {
- offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"0123456789");
+ offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"0123456789", NULL);
if (offset == -1)
return;
@@ -1003,7 +1003,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr
proto_tree_add_item(sdp_session_attribute_tree,hf_ipbcp_version,tvb,offset,tokenlen,FALSE);
- offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL);
if (offset == -1)
return;
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 62efd1f502..4b920e9d25 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -679,7 +679,7 @@ static gboolean sip_is_known_request(tvbuff_t *tvb, int meth_offset,
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,
- guint meth_len);
+ 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);
static guint sip_is_packet_resend(packet_info *pinfo,
@@ -1967,7 +1967,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);
+ dfilter_sip_request_line(tvb, reqresp_tree, token_1_len, linelen);
break;
case STATUS_LINE:
@@ -2789,34 +2789,34 @@ separator_found:
offset, next_offset-offset,
FALSE);
PROTO_ITEM_SET_HIDDEN(ti_c);
- }
-
- /* Parse each individual parameter in the line */
- comma_offset = tvb_pbrk_guint8(tvb, value_offset, line_end_offset - value_offset, " \t\r\n");
- /* Authentication-Info does not begin with the scheme name */
- if (hf_index != POS_AUTHENTICATION_INFO)
- {
- proto_tree_add_item(sip_element_tree, hf_sip_auth_scheme,
- tvb, value_offset, comma_offset - value_offset,
- FALSE);
- }
+ /* Parse each individual parameter in the line */
+ comma_offset = tvb_pbrk_guint8(tvb, value_offset, line_end_offset - value_offset, " \t\r\n", NULL);
- while ((comma_offset = dissect_sip_authorization_item(tvb, sip_element_tree, comma_offset, line_end_offset)) != -1)
- {
- if(comma_offset == line_end_offset)
+ /* Authentication-Info does not begin with the scheme name */
+ if (hf_index != POS_AUTHENTICATION_INFO)
{
- /* Line End reached: Stop Parsing */
- break;
+ proto_tree_add_item(sip_element_tree, hf_sip_auth_scheme,
+ tvb, value_offset, comma_offset - value_offset,
+ FALSE);
}
- if(tvb_get_guint8(tvb, comma_offset) != ',')
+ while ((comma_offset = dissect_sip_authorization_item(tvb, sip_element_tree, comma_offset, line_end_offset)) != -1)
{
- /* Undefined value reached: Stop Parsing */
- break;
+ if(comma_offset == line_end_offset)
+ {
+ /* Line End reached: Stop Parsing */
+ break;
+ }
+
+ if(tvb_get_guint8(tvb, comma_offset) != ',')
+ {
+ /* Undefined value reached: Stop Parsing */
+ break;
+ }
+ comma_offset++; /* skip comma */
}
- comma_offset++; /* skip comma */
- }
+ }/*hdr_tree*/
break;
case POS_VIA:
@@ -3023,11 +3023,11 @@ separator_found:
/* Display filter for SIP Request-Line */
static void
-dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, guint meth_len)
+dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, guint meth_len, gint linelen)
{
char *value;
- gint next_offset, linelen, parameter_end_offset;
+ gint parameter_end_offset;
guint offset = 0;
guint parameter_len = meth_len;
guchar c= '\0';
@@ -3048,8 +3048,6 @@ dfilter_sip_request_line(tvbuff_t *tvb, proto_tree *tree, guint meth_len)
/* Copy request method for telling tap */
stat_info->request_method = value;
- linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
-
if (tree) {
proto_tree_add_string(tree, hf_Method, tvb, offset, parameter_len, value);