aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>2005-11-14 13:05:17 +0000
committerkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>2005-11-14 13:05:17 +0000
commitde9d9b40d68228c83013606722f8dd647cb54b8f (patch)
treeda1aa097c8ac572bced369fbd6e317d2bdd19346 /epan/dissectors
parent58545675f3169d34f96cf2c3468fc1bdb533b672 (diff)
improvements in value constraint support
- NO_BOUND is defined instead of usage -1 - negative bound is handled properly for INTEGER git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16505 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-h225.c28
-rw-r--r--epan/dissectors/packet-h235.c4
-rw-r--r--epan/dissectors/packet-h245.c8
-rw-r--r--epan/dissectors/packet-h450.c14
-rw-r--r--epan/dissectors/packet-per.c24
-rw-r--r--epan/dissectors/packet-per.h4
-rw-r--r--epan/dissectors/packet-t38.c2
7 files changed, 44 insertions, 40 deletions
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 0e2b447723..11bc54f53b 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -2193,7 +2193,7 @@ dissect_h225_T_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
if (next_tvb && tvb_length(next_tvb)) {
call_dissector((nsp_handle)?nsp_handle:data_handle, next_tvb, pinfo, tree);
@@ -2752,7 +2752,7 @@ static int dissect_routeCalltoSCN_item(tvbuff_t *tvb, int offset, packet_info *p
static int
dissect_h225_TBCD_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, "0123456789#*abc", strlen("0123456789#*abc"),
+ NO_BOUND, NO_BOUND, "0123456789#*abc", strlen("0123456789#*abc"),
NULL);
return offset;
@@ -4410,7 +4410,7 @@ dissect_h225_FastStart_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p
char codec_str[50];
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &value_tvb);
+ NO_BOUND, NO_BOUND, &value_tvb);
if (value_tvb && tvb_length(value_tvb)) {
dissect_h245_OpenLogicalChannelCodec(value_tvb, pinfo, tree, codec_str);
@@ -4658,7 +4658,7 @@ static int dissect_url(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h225_H248SignalsDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -5231,7 +5231,7 @@ static int dissect_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h225_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -5250,7 +5250,7 @@ static int dissect_messageNotUnderstood(tvbuff_t *tvb, int offset, packet_info *
static int
dissect_h225_IA5String(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_IA5String(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
@@ -5263,7 +5263,7 @@ static int dissect_text(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre
static int
dissect_h225_BMPString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_BMPString(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
@@ -5465,7 +5465,7 @@ dissect_h225_ParallelH245Control_item(tvbuff_t *tvb, int offset, packet_info *pi
tvbuff_t *h245_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h245_tvb);
+ NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
@@ -6255,7 +6255,7 @@ dissect_h225_T_h4501SupplementaryService_item(tvbuff_t *tvb, int offset, packet_
tvbuff_t *h4501_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h4501_tvb);
+ NO_BOUND, NO_BOUND, &h4501_tvb);
if (h4501_tvb && tvb_length(h4501_tvb)) {
call_dissector(h4501_handle, h4501_tvb, pinfo, tree);
@@ -6303,7 +6303,7 @@ dissect_h225_H245Control_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
tvbuff_t *h245_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h245_tvb);
+ NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
@@ -6376,7 +6376,7 @@ dissect_h225_T_messageContent_item(tvbuff_t *tvb, int offset, packet_info *pinfo
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
next_tvb_add(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
@@ -6800,7 +6800,7 @@ static int dissect_timeToLive(tvbuff_t *tvb, int offset, packet_info *pinfo, pro
static int
dissect_h225_H248PackagesDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -6899,7 +6899,7 @@ static int dissect_integrity_item(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_h225_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, FALSE);
+ NO_BOUND, NO_BOUND, FALSE);
return offset;
}
@@ -7202,7 +7202,7 @@ static int dissect_callCreditCapability(tvbuff_t *tvb, int offset, packet_info *
static int
dissect_h225_PrintableString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_PrintableString(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
diff --git a/epan/dissectors/packet-h235.c b/epan/dissectors/packet-h235.c
index cb9a36f03e..54e54267b9 100644
--- a/epan/dissectors/packet-h235.c
+++ b/epan/dissectors/packet-h235.c
@@ -276,7 +276,7 @@ static int dissect_keyDerivationOID(tvbuff_t *tvb, int offset, packet_info *pinf
static int
dissect_h235_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -681,7 +681,7 @@ static int dissect_sharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, p
static int
dissect_h235_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, FALSE);
+ NO_BOUND, NO_BOUND, FALSE);
return offset;
}
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index b3bf878401..631d95fcb9 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -2344,7 +2344,7 @@ dissect_h245_T_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
if (next_tvb && tvb_length(next_tvb)) {
call_dissector((nsp_handle)?nsp_handle:data_handle, next_tvb, pinfo, tree);
@@ -5077,7 +5077,7 @@ static int dissect_t84(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h245_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -18983,11 +18983,11 @@ void proto_register_h245(void) {
"TransparencyParameters/presentationOrder", HFILL }},
{ &hf_h245_offset_x,
{ "offset-x", "h245.offset_x",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_INT32, BASE_DEC, NULL, 0,
"TransparencyParameters/offset-x", HFILL }},
{ &hf_h245_offset_y,
{ "offset-y", "h245.offset_y",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_INT32, BASE_DEC, NULL, 0,
"TransparencyParameters/offset-y", HFILL }},
{ &hf_h245_scale_x,
{ "scale-x", "h245.scale_x",
diff --git a/epan/dissectors/packet-h450.c b/epan/dissectors/packet-h450.c
index 2885df4910..efb6a28441 100644
--- a/epan/dissectors/packet-h450.c
+++ b/epan/dissectors/packet-h450.c
@@ -987,7 +987,7 @@ dissect_h450_H4501SupplementaryService(tvbuff_t *tvb, int offset, packet_info *p
static int
dissect_h450_Notassignedlocalopcode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -1418,7 +1418,7 @@ static int dissect_extensionId(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
static int
dissect_h450_ExtensionArgument(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -1579,7 +1579,7 @@ static int dissect_nominatedInfo(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_h450_H225InformationElement(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -4179,7 +4179,7 @@ dissect_h4501_ReturnResult_result(tvbuff_t *tvb, int offset, packet_info *pinfo,
{
tvbuff_t *result_tvb = NULL;
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &result_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &result_tvb);
if(tvb_length(result_tvb)){
switch (localOpcode) {
@@ -4268,7 +4268,7 @@ static int
dissect_h4501_parameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
/* TODO - decode return error parameter based on localErrorCode */
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, -1, -1, NULL);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, NO_BOUND, NO_BOUND, NULL);
return offset;
}
static const value_string localErrorCode_vals[] = {
@@ -4481,13 +4481,13 @@ dissect_h4501_argument(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
/* TODO call oid dissector
* call_ber_oid_callback isn't realy apropriate ?
*/
- offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, -1, -1, NULL);
+ offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, NO_BOUND, NO_BOUND, NULL);
is_globalcode = FALSE;
return offset;
}
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &argument_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &argument_tvb);
if(tvb_length(argument_tvb)){
switch (localOpcode) {
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index 0e6b70f78a..a6ecb567cd 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -311,7 +311,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
}
- if(min_len==-1){
+ if (min_len == NO_BOUND) {
min_len=0;
}
@@ -352,13 +352,13 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
if((min_len==max_len)&&(max_len<=2)){
byte_aligned=FALSE;
}
- if((max_len!=-1)&&(max_len<2)){
+ if ((max_len != NO_BOUND) && (max_len < 2)) {
byte_aligned=FALSE;
}
/* xx.x */
length=max_len;
- if(max_len==-1){
+ if (max_len == NO_BOUND) {
offset = dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_octet_string_length, &length);
/* the unconstrained strings are always byte aligned (27.6.3)*/
byte_aligned=TRUE;
@@ -488,8 +488,8 @@ dissect_per_BMPString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_t
}
- if(min_len==-1){
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
@@ -1275,7 +1275,7 @@ DEBUG_ENTRY("dissect_per_sequence");
/* 15 Encoding the bitstring type
- max_len or min_len == -1 means there is no lower/upper constraint
+ max_len or min_len == NO_BOUND means there is no lower/upper constraint
*/
guint32
@@ -1292,8 +1292,8 @@ DEBUG_ENTRY("dissect_per_bit_string");
return offset;
}
- if(min_len==-1) {
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
/* 15.9 if length is fixed and less than or equal to sixteen bits*/
@@ -1339,7 +1339,7 @@ DEBUG_ENTRY("dissect_per_bit_string");
}
/* 15.11 */
- if(max_len>0){
+ if (max_len != NO_BOUND) {
proto_item *pi;
offset=dissect_per_constrained_integer(tvb, offset, pinfo,
@@ -1372,7 +1372,7 @@ DEBUG_ENTRY("dissect_per_bit_string");
16.7
16.8
- max_len or min_len == -1 means there is no lower/upper constraint
+ max_len or min_len == NO_BOUND means there is no lower/upper constraint
hf_index can either be a FT_BYTES or an FT_STRING
*/
@@ -1391,8 +1391,8 @@ dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, prot
DEBUG_ENTRY("dissect_per_octet_string");
- if(min_len==-1){
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
if (max_len==0) { /* 16.5 if the length is 0 bytes there will be no encoding */
val_start = offset>>3;
diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h
index a0856589a8..8deda0661d 100644
--- a/epan/dissectors/packet-per.h
+++ b/epan/dissectors/packet-per.h
@@ -40,6 +40,10 @@ typedef int (*per_callback)(tvbuff_t *, int, packet_info *, proto_tree *);
byteposition<<3 + bitposition
*/
+/* value for value and size constraints */
+#define NO_BOUND -1
+
+
/* values for extensions */
#define ASN1_NO_EXTENSIONS 0
#define ASN1_EXTENSION_ROOT 1
diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c
index f076c87670..39d78edf8f 100644
--- a/epan/dissectors/packet-t38.c
+++ b/epan/dissectors/packet-t38.c
@@ -699,7 +699,7 @@ static int
dissect_t38_fec_data_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
offset=dissect_per_octet_string(tvb, offset, pinfo,
- tree, hf_t38_fec_data_item, -1, -1,
+ tree, hf_t38_fec_data_item, NO_BOUND, NO_BOUND,
NULL);
return offset;
}