diff options
author | Tomas Kukosa <tomas.kukosa@siemens.com> | 2005-08-18 14:32:49 +0000 |
---|---|---|
committer | Tomas Kukosa <tomas.kukosa@siemens.com> | 2005-08-18 14:32:49 +0000 |
commit | ec979a97fbb4852e81097bff634f6c517f12e0fd (patch) | |
tree | dd7e79efbb12749d604d988903f04fc27c25b848 /epan | |
parent | 6fdb97457029a88df0f01cea1ccb472490aec8a0 (diff) |
- dissect_per_restricted_character_string() returns value in tvbbuff_t instead of char
- asn2eth:
fixed CHOICE tag handling
#.FN_PARS support for BIT STRING and all string types
intersection of SIZE and FROM constraints for string is handled
- new asn2eth features used in h225 and h245
- PER dissectors regeneration
svn path=/trunk/; revision=15408
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-h225.c | 69 | ||||
-rw-r--r-- | epan/dissectors/packet-h235.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-h245.c | 37 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 35 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 2 |
5 files changed, 105 insertions, 56 deletions
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index 734db25cb5..804028d459 100644 --- a/epan/dissectors/packet-h225.c +++ b/epan/dissectors/packet-h225.c @@ -2231,14 +2231,24 @@ static int dissect_h245Address(tvbuff_t *tvb, int offset, packet_info *pinfo, pr } + static int dissect_h225_DialedDigits(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + tvbuff_t *value_tvb = NULL; + guint len = 0; + + offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, + 1, 128, "0123456789#*,", strlen("0123456789#*,"), + &value_tvb); + if (h225_pi->is_destinationInfo == TRUE) { - offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13, (char *)&h225_pi->dialedDigits , 64); + if (value_tvb) { + len = tvb_length(value_tvb); + tvb_memcpy(value_tvb, h225_pi->dialedDigits, 0, len); + } + h225_pi->dialedDigits[len] = '\0'; h225_pi->is_destinationInfo = FALSE; } - else - offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13, NULL, 0); return offset; } @@ -2247,10 +2257,11 @@ static int dissect_dialedDigits(tvbuff_t *tvb, int offset, packet_info *pinfo, p } + static int dissect_h225_BMPString_SIZE_1_256(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, 256); + 1, 256); return offset; } @@ -2259,10 +2270,11 @@ static int dissect_h323_ID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ } + static int dissect_h225_IA5String_SIZE_1_512(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, 512); + 1, 512); return offset; } @@ -2525,10 +2537,12 @@ static int dissect_publicTypeOfNumber(tvbuff_t *tvb, int offset, packet_info *pi } + static int dissect_h225_NumberDigits(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, 128, "#,*0123456789", 13, NULL, 0); + offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, + 1, 128, "0123456789#*,", strlen("0123456789#*,"), + NULL); return offset; } @@ -2661,11 +2675,12 @@ 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"), - NULL, 0); + -1, -1, "0123456789#*abc", strlen("0123456789#*abc"), + NULL); return offset; } @@ -3719,10 +3734,11 @@ static int dissect_almostOutOfResources(tvbuff_t *tvb, int offset, packet_info * } + static int dissect_h225_BIT_STRING_SIZE_32(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, - 32, 32); + 32, 32); return offset; } @@ -3744,10 +3760,11 @@ static int dissect_tunnelledProtocolObjectID(tvbuff_t *tvb, int offset, packet_i } + static int dissect_h225_IA5String_SIZE_1_64(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, 64); + 1, 64); return offset; } @@ -4227,10 +4244,11 @@ static int dissect_cryptoEPPwdHash(tvbuff_t *tvb, int offset, packet_info *pinfo } + static int dissect_h225_GatekeeperIdentifier(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, 128); + 1, 128); return offset; } @@ -4359,10 +4377,11 @@ static int dissect_fastStart(tvbuff_t *tvb, int offset, packet_info *pinfo, prot } + static int dissect_h225_EndpointIdentifier(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, 128); + 1, 128); return offset; } @@ -4458,10 +4477,11 @@ static int dissect_connectionParameters(tvbuff_t *tvb, int offset, packet_info * } + static int dissect_h225_IA5String_SIZE_1_32(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, 32); + 1, 32); return offset; } @@ -4553,10 +4573,11 @@ static int dissect_number8(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ } + static int dissect_h225_IA5String_SIZE_0_512(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, - 0, 512); + 0, 512); return offset; } @@ -4578,10 +4599,11 @@ static int dissect_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t } + static int dissect_h225_BMPString_SIZE_1_512(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, 512); + 1, 512); return offset; } @@ -4784,10 +4806,11 @@ static int dissect_number32(tvbuff_t *tvb, int offset, packet_info *pinfo, proto } + static int dissect_h225_IA5String_SIZE_1_128(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, 128); + 1, 128); return offset; } @@ -5155,10 +5178,11 @@ 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); + -1, -1); return offset; } @@ -5167,10 +5191,11 @@ 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); + -1, -1); return offset; } @@ -6808,10 +6833,11 @@ 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); + -1, -1); return offset; } @@ -7110,10 +7136,11 @@ 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); + -1, -1); return offset; } diff --git a/epan/dissectors/packet-h235.c b/epan/dissectors/packet-h235.c index 8b1e961484..e55e0e1e3d 100644 --- a/epan/dissectors/packet-h235.c +++ b/epan/dissectors/packet-h235.c @@ -206,10 +206,11 @@ static int dissect_random(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t } + static int dissect_h235_Password(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, 128); + 1, 128); return offset; } @@ -218,10 +219,11 @@ static int dissect_password(tvbuff_t *tvb, int offset, packet_info *pinfo, proto } + static int dissect_h235_Identifier(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, 128); + 1, 128); return offset; } @@ -233,10 +235,11 @@ static int dissect_sendersID(tvbuff_t *tvb, int offset, packet_info *pinfo, prot } + static int dissect_h235_KeyMaterial(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, 2048); + 1, 2048); return offset; } @@ -322,10 +325,11 @@ static int dissect_nonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, pr } + static int dissect_h235_BIT_STRING_SIZE_0_2048(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, - 0, 2048); + 0, 2048); return offset; } @@ -359,10 +363,11 @@ static int dissect_dhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr } + static int dissect_h235_BIT_STRING_SIZE_0_511(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, - 0, 511); + 0, 511); return offset; } @@ -673,10 +678,11 @@ 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); + -1, -1); return offset; } diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c index b541f4d431..411da62976 100644 --- a/epan/dissectors/packet-h245.c +++ b/epan/dissectors/packet-h245.c @@ -1555,7 +1555,7 @@ static int hf_h245_iv = -1; /* OCTET_STRING */ static int hf_h245_alphanumeric = -1; /* GeneralString */ static int hf_h245_userInputSupportIndication = -1; /* T_userInputSupportIndication */ static int hf_h245_signal = -1; /* T_signal */ -static int hf_h245_signalType = -1; /* IA5String_SIZE_1 */ +static int hf_h245_signalType = -1; /* T_signalType */ static int hf_h245_duration = -1; /* INTEGER_1_65535 */ static int hf_h245_rtp = -1; /* Rtp */ static int hf_h245_rtpPayloadIndication = -1; /* NULL */ @@ -3407,10 +3407,11 @@ static int dissect_availableBitRates(tvbuff_t *tvb, int offset, packet_info *pin } + static int dissect_h245_NumericString_SIZE_1_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_NumericString(tvb, offset, pinfo, tree, hf_index, - 1, 16); + 1, 16); return offset; } @@ -5256,10 +5257,11 @@ static int dissect_conferenceIdentifier(tvbuff_t *tvb, int offset, packet_info * } + static int dissect_h245_IA5String_SIZE_1_64(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, 64); + 1, 64); return offset; } @@ -7739,6 +7741,7 @@ static int dissect_vbd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree } + static int dissect_h245_GeneralString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_GeneralString(tvb, offset, pinfo, tree, hf_index); @@ -10239,10 +10242,12 @@ static int dissect_distribution(tvbuff_t *tvb, int offset, packet_info *pinfo, p } + static int dissect_h245_T_e164Address(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); + offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, + 1, 128, "0123456789#*,", strlen("0123456789#*,"), + NULL); return offset; } @@ -10358,10 +10363,11 @@ static int dissect_certificateResponse(tvbuff_t *tvb, int offset, packet_info *p } + static int dissect_h245_BIT_STRING_SIZE_1_65535(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, 65535); + 1, 65535); return offset; } @@ -12207,10 +12213,11 @@ static int dissect_callInformationReq(tvbuff_t *tvb, int offset, packet_info *pi } + static int dissect_h245_NumericString_SIZE_0_40(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_NumericString(tvb, offset, pinfo, tree, hf_index, - 0, 40); + 0, 40); return offset; } @@ -12219,10 +12226,11 @@ static int dissect_networkAddressNum(tvbuff_t *tvb, int offset, packet_info *pin } + static int dissect_h245_IA5String_SIZE_1_40(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, 40); + 1, 40); return offset; } @@ -13547,10 +13555,11 @@ static int dissect_maintenanceLoopReject(tvbuff_t *tvb, int offset, packet_info } + static int dissect_h245_BMPString_SIZE_1_128(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, 128); + 1, 128); return offset; } @@ -16174,15 +16183,17 @@ static int dissect_userInputSupportIndication(tvbuff_t *tvb, int offset, packet_ } + static int -dissect_h245_IA5String_SIZE_1(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); +dissect_h245_T_signalType(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#*ABCD!", strlen("0123456789#*ABCD!"), + NULL); return offset; } static int dissect_signalType(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_IA5String_SIZE_1(tvb, offset, pinfo, tree, hf_h245_signalType); + return dissect_h245_T_signalType(tvb, offset, pinfo, tree, hf_h245_signalType); } diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index f5007ddc9a..7b2b4d4228 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -288,11 +288,11 @@ dissect_per_IA5String(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_t /* XXX we dont do >64k length strings yet */ guint32 -dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, char *info_str, guint32 info_str_len) +dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb) { guint32 length; gboolean byte_aligned; - static char str[1024]; + guchar *buf; guint char_pos; int bits_per_char; guint32 old_offset; @@ -301,8 +301,9 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); /* xx.x if the length is 0 bytes there will be no encoding */ if(max_len==0){ - if (info_str != NULL) { - info_str[0] = '\0'; + if (value_tvb) { + *value_tvb = tvb_new_real_data(NULL, 0, 0); + tvb_set_child_real_data_tvbuff(tvb, value_tvb); } return offset; } @@ -393,6 +394,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); } + buf = g_malloc(length+1); old_offset=offset; for(char_pos=0;char_pos<length;char_pos++){ guchar val; @@ -408,41 +410,44 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); bitsperchar is 8 */ if(bits_per_char==8){ - str[char_pos]=val; + buf[char_pos]=val; } else { if (val < alphabet_length){ - str[char_pos]=alphabet[val]; + buf[char_pos]=alphabet[val]; } else { - str[char_pos] = '?'; /* XXX - how to mark this? */ + buf[char_pos] = '?'; /* XXX - how to mark this? */ } } } - str[char_pos]=0; - proto_tree_add_string(tree, hf_index, tvb, (old_offset>>3), (offset>>3)-(old_offset>>3), str); - if (info_str != NULL && info_str_len > 0) { - if (info_str_len<length) str[info_str_len-1] = '\0'; - strcpy(info_str, str); + buf[char_pos]=0; + proto_tree_add_string(tree, hf_index, tvb, (old_offset>>3), (offset>>3)-(old_offset>>3), buf); + if (value_tvb) { + *value_tvb = tvb_new_real_data(buf, length, length); + tvb_set_free_cb(value_tvb, g_free); + tvb_set_child_real_data_tvbuff(tvb, value_tvb); + } else { + g_free(buf); } return offset; } guint32 dissect_per_NumericString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) { - offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, " 0123456789", 11, NULL, 0); + offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, " 0123456789", 11, NULL); return offset; } guint32 dissect_per_PrintableString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) { - offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, " '()+,-.*0123456789:=?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 74, NULL, 0); + offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, " '()+,-.*0123456789:=?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 74, NULL); return offset; } guint32 dissect_per_VisibleString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) { offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, - " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", 95, NULL, 0); + " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", 95, NULL); return offset; } guint32 diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 4993982489..30f54114fc 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -104,6 +104,6 @@ extern guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_in extern guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len); -extern guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, char *info_str, guint32 info_str_len); +extern guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb); #endif /* __PACKET_PER_H__ */ |