diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-11-13 07:19:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-11-13 07:19:37 +0000 |
commit | 99c98f9e74d8d812e0e87c960970116bf149434b (patch) | |
tree | d3b2949261e9970321c2a8fac4be3d2baaeb63c1 /packet-q931.c | |
parent | 796997a538eede8129af9fbb938b3b1cc8bc719d (diff) |
Move "bytes_to_str()" to "strutil.c" from "packet.c" - it's just a
string formatter, like "format_text()", and, as "tvbuff.c" now calls it
(*vide infra*), we don't want to have to make "tvbuff.c" drag "packet.h"
in just to declare "bytes_to_str()". It's now declared in "strutil.h",
so include it in modules that use "bytes_to_str()" and weren't already
including it.
Add a "tvb_bytes_to_str()" wrapper that calls "tvb_get_ptr()" to get a
pointer to a chunk of N bytes at a given offset in a tvbuff and then
hands that chunk to "bytes_to_str()". Convert the code that was doing
that to use "tvb_bytes_to_str()" instead (which caught what I suspect is
a bug in the Q.2931 dissector, where it was handing an offset of 0 to
"tvb_get_ptr()" - a cut-and-pasteo, I think).
Tvbuffify the ARP dissector.
svn path=/trunk/; revision=2634
Diffstat (limited to 'packet-q931.c')
-rw-r--r-- | packet-q931.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/packet-q931.c b/packet-q931.c index aabd1c19da..7f940d100c 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris <guy@alum.mit.edu> * - * $Id: packet-q931.c,v 1.19 2000/10/19 07:01:32 guy Exp $ + * $Id: packet-q931.c,v 1.20 2000/11/13 07:18:56 guy Exp $ * * Modified by Andreas Sikkema for possible use with H.323 * @@ -38,6 +38,7 @@ #include <glib.h> #include <string.h> #include "packet.h" +#include "strutil.h" #include "nlpid.h" #include "packet-q931.h" @@ -581,7 +582,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } proto_tree_add_text(tree, tvb, offset, 1, @@ -1036,7 +1037,7 @@ dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } proto_tree_add_text(tree, tvb, offset, 1, @@ -1072,7 +1073,7 @@ dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len, return; proto_tree_add_text(tree, tvb, offset, len, "Diagnostics: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); } /* @@ -1129,7 +1130,7 @@ dissect_q931_call_state_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } proto_tree_add_text(tree, tvb, offset, 1, @@ -1249,7 +1250,7 @@ dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } proto_tree_add_text(tree, tvb, offset, 1, @@ -1301,7 +1302,7 @@ dissect_q931_progress_indicator_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } proto_tree_add_text(tree, tvb, offset, 1, @@ -1391,7 +1392,7 @@ dissect_q931_ns_facilities_ie(tvbuff_t *tvb, int offset, int len, return; proto_tree_add_text(tree, tvb, offset, len, "Network-specific facility specification: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); } /* @@ -1913,7 +1914,7 @@ dissect_q931_party_subaddr_ie(tvbuff_t *tvb, int offset, int len, if (len == 0) return; proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); } /* @@ -1995,7 +1996,7 @@ dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len, */ proto_tree_add_text(tree, tvb, offset, len, "Data: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); return; } @@ -2074,7 +2075,7 @@ dissect_q931_user_user_ie(tvbuff_t *tvb, int offset, int len, default: proto_tree_add_text(tree, tvb, offset, len, "User information: %s", - bytes_to_str(tvb_get_ptr(tvb, offset, len), len)); + tvb_bytes_to_str(tvb, offset, len)); break; } } |