from tomas k

updates to the asn2eth compiler and a new regenerated h235 dissector

svn path=/trunk/; revision=11231
This commit is contained in:
Ronnie Sahlberg 2004-06-24 21:50:05 +00:00
parent 9b96b86efb
commit 9c880121eb
7 changed files with 446 additions and 343 deletions

View File

@ -2,7 +2,7 @@
# H235-SECURITY-MESSAGES conformation file
# 2004 Tomas Kukosa
# $Id: h235.cnf,v 1.3 2004/06/04 11:28:04 sahlberg Exp $
# $Id: h235.cnf,v 1.4 2004/06/24 21:50:04 sahlberg Exp $
#.EXPORTS
@ -33,6 +33,14 @@ CryptoToken/cryptoEncryptedToken/token encryptedToken
#.END
#.TYPE_ATTR
TimeStamp TYPE = FT_ABSOLUTE_TIME DISPLAY = BASE_NONE
#.END
#.FIELD_ATTR
NonStandardParameter/data TYPE = FT_UINT32 DISPLAY = BASE_DEC
#.END
#.FN_HDR SIGNEDxxx
proto_tree_add_item_hidden(tree, proto_h235, tvb, offset, 0, FALSE);
#.END

View File

@ -1,7 +1,7 @@
/* ftypes.h
* Definitions for field types
*
* $Id: ftypes.h,v 1.32 2004/05/09 10:03:40 guy Exp $
* $Id: ftypes.h,v 1.33 2004/06/24 21:50:05 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -63,6 +63,11 @@ enum ftenum {
FT_NUM_TYPES /* last item number plus one */
};
#define IS_FT_INT(ft) ((ft)==FT_INT8||(ft)==FT_INT16||(ft)==FT_INT24||(ft)==FT_INT32)
#define IS_FT_UINT(ft) ((ft)==FT_UINT8||(ft)==FT_UINT16||(ft)==FT_UINT24||(ft)==FT_UINT32||(ft)==FT_FRAMENUM)
#define IS_FT_TIME(ft) ((ft)==FT_ABSOLUTE_TIME||(ft)==FT_RELATIVE_TIME)
#define IS_FT_STRING(ft) ((ft)==FT_STRING||(ft)==FT_STRINGZ)
typedef enum ftenum ftenum_t;
typedef struct _ftype_t ftype_t;

View File

@ -4,7 +4,7 @@
*
* Maintained by Andreas Sikkema (h323@ramdyne.nl)
*
* $Id: packet-h225.c,v 1.46 2004/06/24 20:58:46 sahlberg Exp $
* $Id: packet-h225.c,v 1.47 2004/06/24 21:50:03 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -10166,7 +10166,7 @@ proto_register_h225(void)
"CryptoH323Token/cryptoEPPwdHash", HFILL }},
{ &hf_h225_timeStamp,
{ "timeStamp", "h225.timeStamp",
FT_UINT32, BASE_DEC, NULL, 0,
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_h225_token,
{ "token", "h225.token",

View File

@ -4,13 +4,13 @@
/* ../../tools/asn2eth.py -X -p h235 -c h235.cnf -s packet-h235-template H235-SECURITY-MESSAGES.asn */
/* Input file: packet-h235-template.c */
/* Include files: packet-h235-hf.c, packet-h235-ett.c, packet-h235-fn.c, packet-h235-hfarr.c, packet-h235-ettarr.c */
/* Include files: packet-h235-hf.c, packet-h235-ett.c, packet-h235-fn.c, packet-h235-hfarr.c, packet-h235-ettarr.c, packet-h235-val.h */
/* packet-h235.c
* Routines for H.235 packet dissection
* 2004 Tomas Kukosa
*
* $Id: packet-h235.c,v 1.5 2004/06/04 11:30:35 sahlberg Exp $
* $Id: packet-h235.c,v 1.6 2004/06/24 21:50:04 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -176,7 +176,7 @@ PER_NOT_DECODED_YET("ToBeSigned");
/* packet-h235-fn.c */
/* ../../tools/asn2eth.py -X -p h235 -c h235.cnf -s packet-h235-template H235-SECURITY-MESSAGES.asn */
static int dissect_hf_h235_toBeSigned(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_toBeSigned(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_xxx_ToBeSigned(tvb, offset, pinfo, tree, hf_h235_toBeSigned);
}
@ -188,7 +188,7 @@ dissect_h235_ChallengeString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
return offset;
}
static int dissect_hf_h235_challenge(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_challenge(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ChallengeString(tvb, offset, pinfo, tree, hf_h235_challenge);
}
@ -201,7 +201,7 @@ dissect_h235_TimeStamp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_
return offset;
}
static int dissect_hf_h235_timeStamp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_timeStamp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_TimeStamp(tvb, offset, pinfo, tree, hf_h235_timeStamp);
}
@ -214,7 +214,7 @@ dissect_h235_RandomVal(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_
return offset;
}
static int dissect_hf_h235_random(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_random(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_RandomVal(tvb, offset, pinfo, tree, hf_h235_random);
}
@ -226,7 +226,7 @@ dissect_h235_Password(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_t
return offset;
}
static int dissect_hf_h235_password(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_password(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_Password(tvb, offset, pinfo, tree, hf_h235_password);
}
@ -238,10 +238,10 @@ dissect_h235_Identifier(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
return offset;
}
static int dissect_hf_h235_generalID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_generalID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_Identifier(tvb, offset, pinfo, tree, hf_h235_generalID);
}
static int dissect_hf_h235_sendersID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_sendersID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_Identifier(tvb, offset, pinfo, tree, hf_h235_sendersID);
}
@ -253,7 +253,7 @@ dissect_h235_KeyMaterial(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
return offset;
}
static int dissect_hf_h235_secureChannel(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_secureChannel(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_KeyMaterial(tvb, offset, pinfo, tree, hf_h235_secureChannel);
}
@ -265,19 +265,19 @@ dissect_h235_OBJECT_IDENTIFIER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
return offset;
}
static int dissect_hf_h235_nonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_nonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OBJECT_IDENTIFIER(tvb, offset, pinfo, tree, hf_h235_nonStandardIdentifier);
}
static int dissect_hf_h235_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OBJECT_IDENTIFIER(tvb, offset, pinfo, tree, hf_h235_type);
}
static int dissect_hf_h235_tokenOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_tokenOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OBJECT_IDENTIFIER(tvb, offset, pinfo, tree, hf_h235_tokenOID);
}
static int dissect_hf_h235_algorithmOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_algorithmOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OBJECT_IDENTIFIER(tvb, offset, pinfo, tree, hf_h235_algorithmOID);
}
static int dissect_hf_h235_keyDerivationOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_keyDerivationOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OBJECT_IDENTIFIER(tvb, offset, pinfo, tree, hf_h235_keyDerivationOID);
}
@ -290,34 +290,34 @@ dissect_h235_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pro
return offset;
}
static int dissect_hf_h235_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_data);
}
static int dissect_hf_h235_certificatedata(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_certificatedata(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_certificatedata);
}
static int dissect_hf_h235_encryptedData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_encryptedData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_encryptedData);
}
static int dissect_hf_h235_iv(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_iv(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_iv);
}
static int dissect_hf_h235_clearSalt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_clearSalt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_clearSalt);
}
static int dissect_hf_h235_encryptedSessionKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_encryptedSessionKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_encryptedSessionKey);
}
static int dissect_hf_h235_encryptedSaltingKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_encryptedSaltingKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_encryptedSaltingKey);
}
static int dissect_hf_h235_clearSaltingKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_clearSaltingKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_OCTET_STRING(tvb, offset, pinfo, tree, hf_h235_clearSaltingKey);
}
static per_sequence_t NonStandardParameter_sequence[] = {
{ "nonStandardIdentifier" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_nonStandardIdentifier },
{ "data" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_data },
{ "nonStandardIdentifier" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_nonStandardIdentifier },
{ "data" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_data },
{ NULL, 0, 0, NULL }
};
@ -328,7 +328,7 @@ dissect_h235_NonStandardParameter(tvbuff_t *tvb, int offset, packet_info *pinfo
return offset;
}
static int dissect_hf_h235_nonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_nonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NonStandardParameter(tvb, offset, pinfo, tree, hf_h235_nonStandard);
}
@ -340,20 +340,20 @@ dissect_h235_BIT_STRING_SIZE_0_2048(tvbuff_t *tvb, int offset, packet_info *pinf
return offset;
}
static int dissect_hf_h235_halfkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_halfkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_2048(tvb, offset, pinfo, tree, hf_h235_halfkey);
}
static int dissect_hf_h235_modSize(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_modSize(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_2048(tvb, offset, pinfo, tree, hf_h235_modSize);
}
static int dissect_hf_h235_generator(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_generator(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_2048(tvb, offset, pinfo, tree, hf_h235_generator);
}
static per_sequence_t DHset_sequence[] = {
{ "halfkey" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_halfkey },
{ "modSize" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_modSize },
{ "generator" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_generator },
{ "halfkey" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_halfkey },
{ "modSize" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_modSize },
{ "generator" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_generator },
{ NULL, 0, 0, NULL }
};
@ -364,7 +364,7 @@ dissect_h235_DHset(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree
return offset;
}
static int dissect_hf_h235_dhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_dhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_DHset(tvb, offset, pinfo, tree, hf_h235_dhkey);
}
@ -376,28 +376,28 @@ dissect_h235_BIT_STRING_SIZE_0_511(tvbuff_t *tvb, int offset, packet_info *pinfo
return offset;
}
static int dissect_hf_h235_x(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_x(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_x);
}
static int dissect_hf_h235_y(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_y(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_y);
}
static int dissect_hf_h235_modulus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_modulus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_modulus);
}
static int dissect_hf_h235_weierstrassA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_weierstrassA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_weierstrassA);
}
static int dissect_hf_h235_weierstrassB(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_weierstrassB(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_weierstrassB);
}
static int dissect_hf_h235_fieldSize(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_fieldSize(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING_SIZE_0_511(tvb, offset, pinfo, tree, hf_h235_fieldSize);
}
static per_sequence_t ECpoint_sequence[] = {
{ "x" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_x },
{ "y" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_y },
{ "x" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_x },
{ "y" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_y },
{ NULL, 0, 0, NULL }
};
@ -408,19 +408,19 @@ dissect_h235_ECpoint(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
return offset;
}
static int dissect_hf_h235_public_key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_public_key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ECpoint(tvb, offset, pinfo, tree, hf_h235_public_key);
}
static int dissect_hf_h235_base(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_base(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ECpoint(tvb, offset, pinfo, tree, hf_h235_base);
}
static per_sequence_t T_eckasdhp_sequence[] = {
{ "public-key" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_public_key },
{ "modulus" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_modulus },
{ "base" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_base },
{ "weierstrassA" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_weierstrassA },
{ "weierstrassB" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_weierstrassB },
{ "public-key" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_public_key },
{ "modulus" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_modulus },
{ "base" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_base },
{ "weierstrassA" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_weierstrassA },
{ "weierstrassB" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_weierstrassB },
{ NULL, 0, 0, NULL }
};
@ -431,16 +431,16 @@ dissect_h235_T_eckasdhp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
return offset;
}
static int dissect_hf_h235_eckasdhp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_eckasdhp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_T_eckasdhp(tvb, offset, pinfo, tree, hf_h235_eckasdhp);
}
static per_sequence_t T_eckasdh2_sequence[] = {
{ "public-key" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_public_key },
{ "fieldSize" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_fieldSize },
{ "base" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_base },
{ "weierstrassA" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_weierstrassA },
{ "weierstrassB" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_weierstrassB },
{ "public-key" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_public_key },
{ "fieldSize" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_fieldSize },
{ "base" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_base },
{ "weierstrassA" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_weierstrassA },
{ "weierstrassB" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_weierstrassB },
{ NULL, 0, 0, NULL }
};
@ -451,7 +451,7 @@ dissect_h235_T_eckasdh2(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
return offset;
}
static int dissect_hf_h235_eckasdh2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_eckasdh2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_T_eckasdh2(tvb, offset, pinfo, tree, hf_h235_eckasdh2);
}
@ -463,8 +463,8 @@ static const value_string ECKASDH_vals[] = {
};
static per_choice_t ECKASDH_choice[] = {
{ 0, "eckasdhp" , ASN1_EXTENSION_ROOT , dissect_hf_h235_eckasdhp },
{ 1, "eckasdh2" , ASN1_EXTENSION_ROOT , dissect_hf_h235_eckasdh2 },
{ 0, "eckasdhp" , ASN1_EXTENSION_ROOT , dissect_eckasdhp },
{ 1, "eckasdh2" , ASN1_EXTENSION_ROOT , dissect_eckasdh2 },
{ 0, NULL, 0, NULL }
};
@ -476,13 +476,13 @@ dissect_h235_ECKASDH(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
return offset;
}
static int dissect_hf_h235_eckasdhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_eckasdhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ECKASDH(tvb, offset, pinfo, tree, hf_h235_eckasdhkey);
}
static per_sequence_t TypedCertificate_sequence[] = {
{ "type" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_type },
{ "certificate" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_certificatedata },
{ "type" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_type },
{ "certificate" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_certificatedata },
{ NULL, 0, 0, NULL }
};
@ -493,7 +493,7 @@ dissect_h235_TypedCertificate(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
return offset;
}
static int dissect_hf_h235_certificate(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_certificate(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_TypedCertificate(tvb, offset, pinfo, tree, hf_h235_certificate);
}
@ -507,28 +507,28 @@ dissect_h235_NULL(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree
return offset;
}
static int dissect_hf_h235_default(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_default(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_default);
}
static int dissect_hf_h235_radius(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_radius(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_radius);
}
static int dissect_hf_h235_dhExch(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_dhExch(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_dhExch);
}
static int dissect_hf_h235_pwdSymEnc(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_pwdSymEnc(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_pwdSymEnc);
}
static int dissect_hf_h235_pwdHash(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_pwdHash(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_pwdHash);
}
static int dissect_hf_h235_certSign(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_certSign(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_certSign);
}
static int dissect_hf_h235_ipsec(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_ipsec(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_ipsec);
}
static int dissect_hf_h235_tls(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_tls(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_NULL(tvb, offset, pinfo, tree, hf_h235_tls);
}
@ -540,8 +540,8 @@ static const value_string AuthenticationBES_vals[] = {
};
static per_choice_t AuthenticationBES_choice[] = {
{ 0, "default" , ASN1_EXTENSION_ROOT , dissect_hf_h235_default },
{ 1, "radius" , ASN1_EXTENSION_ROOT , dissect_hf_h235_radius },
{ 0, "default" , ASN1_EXTENSION_ROOT , dissect_default },
{ 1, "radius" , ASN1_EXTENSION_ROOT , dissect_radius },
{ 0, NULL, 0, NULL }
};
@ -553,7 +553,7 @@ dissect_h235_AuthenticationBES(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
return offset;
}
static int dissect_hf_h235_authenticationBES(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_authenticationBES(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_AuthenticationBES(tvb, offset, pinfo, tree, hf_h235_authenticationBES);
}
@ -571,14 +571,14 @@ const value_string AuthenticationMechanism_vals[] = {
};
static per_choice_t AuthenticationMechanism_choice[] = {
{ 0, "dhExch" , ASN1_EXTENSION_ROOT , dissect_hf_h235_dhExch },
{ 1, "pwdSymEnc" , ASN1_EXTENSION_ROOT , dissect_hf_h235_pwdSymEnc },
{ 2, "pwdHash" , ASN1_EXTENSION_ROOT , dissect_hf_h235_pwdHash },
{ 3, "certSign" , ASN1_EXTENSION_ROOT , dissect_hf_h235_certSign },
{ 4, "ipsec" , ASN1_EXTENSION_ROOT , dissect_hf_h235_ipsec },
{ 5, "tls" , ASN1_EXTENSION_ROOT , dissect_hf_h235_tls },
{ 6, "nonStandard" , ASN1_EXTENSION_ROOT , dissect_hf_h235_nonStandard },
{ 7, "authenticationBES" , ASN1_NOT_EXTENSION_ROOT, dissect_hf_h235_authenticationBES },
{ 0, "dhExch" , ASN1_EXTENSION_ROOT , dissect_dhExch },
{ 1, "pwdSymEnc" , ASN1_EXTENSION_ROOT , dissect_pwdSymEnc },
{ 2, "pwdHash" , ASN1_EXTENSION_ROOT , dissect_pwdHash },
{ 3, "certSign" , ASN1_EXTENSION_ROOT , dissect_certSign },
{ 4, "ipsec" , ASN1_EXTENSION_ROOT , dissect_ipsec },
{ 5, "tls" , ASN1_EXTENSION_ROOT , dissect_tls },
{ 6, "nonStandard" , ASN1_EXTENSION_ROOT , dissect_nonStandard },
{ 7, "authenticationBES" , ASN1_NOT_EXTENSION_ROOT, dissect_authenticationBES },
{ 0, NULL, 0, NULL }
};
@ -600,7 +600,7 @@ dissect_h235_INTEGER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
return offset;
}
static int dissect_hf_h235_ranInt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_ranInt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_INTEGER(tvb, offset, pinfo, tree, hf_h235_ranInt);
}
@ -613,7 +613,7 @@ dissect_h235_IV8(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *
return offset;
}
static int dissect_hf_h235_iv8(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_iv8(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_IV8(tvb, offset, pinfo, tree, hf_h235_iv8);
}
@ -626,16 +626,16 @@ dissect_h235_IV16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree
return offset;
}
static int dissect_hf_h235_iv16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_iv16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_IV16(tvb, offset, pinfo, tree, hf_h235_iv16);
}
static per_sequence_t Params_sequence[] = {
{ "ranInt" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_ranInt },
{ "iv8" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_iv8 },
{ "iv16" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_iv16 },
{ "iv" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_iv },
{ "clearSalt" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_clearSalt },
{ "ranInt" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_ranInt },
{ "iv8" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_iv8 },
{ "iv16" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_iv16 },
{ "iv" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_iv },
{ "clearSalt" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_clearSalt },
{ NULL, 0, 0, NULL }
};
@ -646,17 +646,17 @@ dissect_h235_Params(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
return offset;
}
static int dissect_hf_h235_paramS(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_paramS(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_Params(tvb, offset, pinfo, tree, hf_h235_paramS);
}
static int dissect_hf_h235_paramSsalt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_paramSsalt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_Params(tvb, offset, pinfo, tree, hf_h235_paramSsalt);
}
static per_sequence_t ENCRYPTEDxxx_sequence[] = {
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_paramS },
{ "encryptedData" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_encryptedData },
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_paramS },
{ "encryptedData" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_encryptedData },
{ NULL, 0, 0, NULL }
};
@ -668,13 +668,13 @@ dissect_h235_ENCRYPTEDxxx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pro
return offset;
}
static int dissect_hf_h235_encryptedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_encryptedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ENCRYPTEDxxx(tvb, offset, pinfo, tree, hf_h235_encryptedToken);
}
static int dissect_hf_h235_cryptoPwdEncr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_cryptoPwdEncr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ENCRYPTEDxxx(tvb, offset, pinfo, tree, hf_h235_cryptoPwdEncr);
}
static int dissect_hf_h235_sharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_sharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ENCRYPTEDxxx(tvb, offset, pinfo, tree, hf_h235_sharedSecret);
}
@ -686,18 +686,18 @@ dissect_h235_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
return offset;
}
static int dissect_hf_h235_signaturedata(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_signaturedata(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING(tvb, offset, pinfo, tree, hf_h235_signaturedata);
}
static int dissect_hf_h235_hash(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_hash(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_BIT_STRING(tvb, offset, pinfo, tree, hf_h235_hash);
}
static per_sequence_t SIGNEDxxx_sequence[] = {
{ "toBeSigned" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_toBeSigned },
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_paramS },
{ "signature" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_signaturedata },
{ "toBeSigned" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_toBeSigned },
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_paramS },
{ "signature" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_signaturedata },
{ NULL, 0, 0, NULL }
};
@ -709,22 +709,22 @@ dissect_h235_SIGNEDxxx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_
return offset;
}
static int dissect_hf_h235_signedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_signedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_SIGNEDxxx(tvb, offset, pinfo, tree, hf_h235_signedToken);
}
static int dissect_hf_h235_certProtectedKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_certProtectedKey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_SIGNEDxxx(tvb, offset, pinfo, tree, hf_h235_certProtectedKey);
}
static per_sequence_t V3KeySyncMaterial_sequence[] = {
{ "generalID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_generalID },
{ "algorithmOID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_algorithmOID },
{ "paramS" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_paramS },
{ "encryptedSessionKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_encryptedSessionKey },
{ "encryptedSaltingKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_encryptedSaltingKey },
{ "clearSaltingKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_clearSaltingKey },
{ "paramSsalt" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_paramSsalt },
{ "keyDerivationOID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_keyDerivationOID },
{ "generalID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_generalID },
{ "algorithmOID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_algorithmOID },
{ "paramS" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_paramS },
{ "encryptedSessionKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_encryptedSessionKey },
{ "encryptedSaltingKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_encryptedSaltingKey },
{ "clearSaltingKey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_clearSaltingKey },
{ "paramSsalt" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_paramSsalt },
{ "keyDerivationOID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_keyDerivationOID },
{ NULL, 0, 0, NULL }
};
@ -735,7 +735,7 @@ dissect_h235_V3KeySyncMaterial(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
return offset;
}
static int dissect_hf_h235_secureSharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_secureSharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_V3KeySyncMaterial(tvb, offset, pinfo, tree, hf_h235_secureSharedSecret);
}
@ -749,10 +749,10 @@ static const value_string H235Key_vals[] = {
};
static per_choice_t H235Key_choice[] = {
{ 0, "secureChannel" , ASN1_EXTENSION_ROOT , dissect_hf_h235_secureChannel },
{ 1, "sharedSecret" , ASN1_EXTENSION_ROOT , dissect_hf_h235_sharedSecret },
{ 2, "certProtectedKey" , ASN1_EXTENSION_ROOT , dissect_hf_h235_certProtectedKey },
{ 3, "secureSharedSecret" , ASN1_NOT_EXTENSION_ROOT, dissect_hf_h235_secureSharedSecret },
{ 0, "secureChannel" , ASN1_EXTENSION_ROOT , dissect_secureChannel },
{ 1, "sharedSecret" , ASN1_EXTENSION_ROOT , dissect_sharedSecret },
{ 2, "certProtectedKey" , ASN1_EXTENSION_ROOT , dissect_certProtectedKey },
{ 3, "secureSharedSecret" , ASN1_NOT_EXTENSION_ROOT, dissect_secureSharedSecret },
{ 0, NULL, 0, NULL }
};
@ -764,23 +764,23 @@ dissect_h235_H235Key(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
return offset;
}
static int dissect_hf_h235_h235Key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_h235Key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_H235Key(tvb, offset, pinfo, tree, hf_h235_h235Key);
}
static per_sequence_t ClearToken_sequence[] = {
{ "tokenOID" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_hf_h235_tokenOID },
{ "timeStamp" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_timeStamp },
{ "password" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_password },
{ "dhkey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_dhkey },
{ "challenge" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_challenge },
{ "random" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_random },
{ "certificate" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_certificate },
{ "generalID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_generalID },
{ "nonStandard" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_hf_h235_nonStandard },
{ "eckasdhkey" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_eckasdhkey },
{ "sendersID" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_sendersID },
{ "h235Key" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_hf_h235_h235Key },
{ "tokenOID" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_tokenOID },
{ "timeStamp" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_timeStamp },
{ "password" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_password },
{ "dhkey" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_dhkey },
{ "challenge" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_challenge },
{ "random" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_random },
{ "certificate" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_certificate },
{ "generalID" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_generalID },
{ "nonStandard" , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_nonStandard },
{ "eckasdhkey" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_eckasdhkey },
{ "sendersID" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_sendersID },
{ "h235Key" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_h235Key },
{ NULL, 0, 0, NULL }
};
@ -792,14 +792,14 @@ dissect_h235_ClearToken(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
return offset;
}
static int dissect_hf_h235_hashedVals(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_hashedVals(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_ClearToken(tvb, offset, pinfo, tree, hf_h235_hashedVals);
}
static per_sequence_t HASHEDxxx_sequence[] = {
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_paramS },
{ "hash" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_hash },
{ "algorithmOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_algorithmOID },
{ "paramS" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_paramS },
{ "hash" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hash },
{ NULL, 0, 0, NULL }
};
@ -811,13 +811,13 @@ dissect_h235_HASHEDxxx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_
return offset;
}
static int dissect_hf_h235_hashedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_hashedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_HASHEDxxx(tvb, offset, pinfo, tree, hf_h235_hashedToken);
}
static per_sequence_t T_cryptoEncryptedToken_sequence[] = {
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_tokenOID },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_encryptedToken },
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_tokenOID },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_encryptedToken },
{ NULL, 0, 0, NULL }
};
@ -828,13 +828,13 @@ dissect_h235_T_cryptoEncryptedToken(tvbuff_t *tvb, int offset, packet_info *pinf
return offset;
}
static int dissect_hf_h235_cryptoEncryptedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_cryptoEncryptedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_T_cryptoEncryptedToken(tvb, offset, pinfo, tree, hf_h235_cryptoEncryptedToken);
}
static per_sequence_t T_cryptoSignedToken_sequence[] = {
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_tokenOID },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_signedToken },
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_tokenOID },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_signedToken },
{ NULL, 0, 0, NULL }
};
@ -845,14 +845,14 @@ dissect_h235_T_cryptoSignedToken(tvbuff_t *tvb, int offset, packet_info *pinfo _
return offset;
}
static int dissect_hf_h235_cryptoSignedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_cryptoSignedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_T_cryptoSignedToken(tvb, offset, pinfo, tree, hf_h235_cryptoSignedToken);
}
static per_sequence_t T_cryptoHashedToken_sequence[] = {
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_tokenOID },
{ "hashedVals" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_hashedVals },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hf_h235_hashedToken },
{ "tokenOID" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_tokenOID },
{ "hashedVals" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hashedVals },
{ "token" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_hashedToken },
{ NULL, 0, 0, NULL }
};
@ -863,7 +863,7 @@ dissect_h235_T_cryptoHashedToken(tvbuff_t *tvb, int offset, packet_info *pinfo _
return offset;
}
static int dissect_hf_h235_cryptoHashedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
static int dissect_cryptoHashedToken(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
return dissect_h235_T_cryptoHashedToken(tvb, offset, pinfo, tree, hf_h235_cryptoHashedToken);
}
@ -877,10 +877,10 @@ const value_string CryptoToken_vals[] = {
};
static per_choice_t CryptoToken_choice[] = {
{ 0, "cryptoEncryptedToken" , ASN1_EXTENSION_ROOT , dissect_hf_h235_cryptoEncryptedToken },
{ 1, "cryptoSignedToken" , ASN1_EXTENSION_ROOT , dissect_hf_h235_cryptoSignedToken },
{ 2, "cryptoHashedToken" , ASN1_EXTENSION_ROOT , dissect_hf_h235_cryptoHashedToken },
{ 3, "cryptoPwdEncr" , ASN1_EXTENSION_ROOT , dissect_hf_h235_cryptoPwdEncr },
{ 0, "cryptoEncryptedToken" , ASN1_EXTENSION_ROOT , dissect_cryptoEncryptedToken },
{ 1, "cryptoSignedToken" , ASN1_EXTENSION_ROOT , dissect_cryptoSignedToken },
{ 2, "cryptoHashedToken" , ASN1_EXTENSION_ROOT , dissect_cryptoHashedToken },
{ 3, "cryptoPwdEncr" , ASN1_EXTENSION_ROOT , dissect_cryptoPwdEncr },
{ 0, NULL, 0, NULL }
};
@ -918,7 +918,7 @@ void proto_register_h235(void) {
"NonStandardParameter/nonStandardIdentifier", HFILL }},
{ &hf_h235_data,
{ "data", "h235.data",
FT_BYTES, BASE_HEX, NULL, 0,
FT_UINT32, BASE_DEC, NULL, 0,
"NonStandardParameter/data", HFILL }},
{ &hf_h235_halfkey,
{ "halfkey", "h235.halfkey",
@ -1026,7 +1026,7 @@ void proto_register_h235(void) {
"", HFILL }},
{ &hf_h235_timeStamp,
{ "timeStamp", "h235.timeStamp",
FT_UINT32, BASE_DEC, NULL, 0,
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0,
"ClearToken/timeStamp", HFILL }},
{ &hf_h235_password,
{ "password", "h235.password",

View File

@ -4,13 +4,13 @@
/* ../../tools/asn2eth.py -X -p h235 -c h235.cnf -s packet-h235-template H235-SECURITY-MESSAGES.asn */
/* Input file: packet-h235-template.h */
/* Include files: packet-h235-exp.h */
/* Include files: packet-h235-exp.h, packet-h235-valexp.h */
/* packet-h235.h
* Routines for H.235 packet dissection
* 2004 Tomas Kukosa
*
* $Id: packet-h235.h,v 1.5 2004/06/04 11:30:35 sahlberg Exp $
* $Id: packet-h235.h,v 1.6 2004/06/24 21:50:04 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>

View File

@ -7,7 +7,7 @@ proper helper routines
* Routines for dissection of ASN.1 Aligned PER
* 2003 Ronnie Sahlberg
*
* $Id: packet-per.c,v 1.28 2004/05/17 20:03:36 sahlberg Exp $
* $Id: packet-per.c,v 1.29 2004/06/24 21:50:04 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -707,6 +707,8 @@ dissect_per_constrained_integer(tvbuff_t *tvb, guint32 offset, packet_info *pinf
{
proto_item *it=NULL;
guint32 range, val;
gint val_start, val_length;
nstime_t timeval;
header_field_info *hfi;
int num_bits;
int pad;
@ -738,20 +740,12 @@ DEBUG_ENTRY("dissect_per_constrained_integer");
num_bits=0;
pad=0;
val=0;
timeval.secs=val; timeval.nsecs=0;
/* 10.5.4 */
if(range==1){
it=proto_tree_add_uint_format(tree, hf_index, tvb, offset>>3, 0, min, "%s: %d", hfi->name, min);
if(item){
*item=it;
}
if(value){
*value=val;
}
return offset;
}
/* 10.5.7 */
if(range<=255){
val_start = offset>>3; val_length = 0;
val = min;
} else if(range<=255) {
/* 10.5.7.1 */
char str[256];
int i, bit, length;
@ -807,19 +801,8 @@ DEBUG_ENTRY("dissect_per_constrained_integer");
}
strcat(str,".");
}
val_start = (offset-num_bits)>>3; val_length = length;
val+=min;
if(hfi->strings){
it=proto_tree_add_uint_format(tree, hf_index, tvb, (offset-num_bits)>>3, length, val, "%s : %s (%d)", str, val_to_str(val, hfi->strings, "Unknown(%d)"),val);
} else {
it=proto_tree_add_uint(tree, hf_index, tvb, (offset-num_bits)>>3, length, val);
}
if(item){
*item=it;
}
if(value){
*value=val;
}
return offset;
} else if(range==256){
/* 10.5.7.2 */
num_bits=8;
@ -832,15 +815,8 @@ DEBUG_ENTRY("dissect_per_constrained_integer");
val=tvb_get_guint8(tvb, offset>>3);
offset+=8;
val_start = (offset>>3)-1; val_length = 1;
val+=min;
it=proto_tree_add_uint(tree, hf_index, tvb, (offset>>3)-1, 1, val);
if(item){
*item=it;
}
if(value){
*value=val;
}
return offset;
} else if(range<=65536){
/* 10.5.7.3 */
num_bits=16;
@ -856,15 +832,8 @@ DEBUG_ENTRY("dissect_per_constrained_integer");
val|=tvb_get_guint8(tvb, offset>>3);
offset+=8;
val_start = (offset>>3)-2; val_length = 2;
val+=min;
it=proto_tree_add_uint(tree, hf_index, tvb, (offset>>3)-2, 2, val);
if(item){
*item=it;
}
if(value){
*value=val;
}
return offset;
} else {
int i,num_bytes;
gboolean bit;
@ -887,20 +856,23 @@ DEBUG_ENTRY("dissect_per_constrained_integer");
val=(val<<8)|tvb_get_guint8(tvb,offset>>3);
offset+=8;
}
val_start = (offset>>3)-(num_bytes+1); val_length = num_bytes+1;
val+=min;
it=proto_tree_add_uint(tree, hf_index, tvb, (offset>>3)-(num_bytes+1), num_bytes+1, val);
if(item){
*item=it;
}
if(value){
*value=val;
}
return offset;
}
PER_NOT_DECODED_YET("10.5");
return offset;
}
timeval.secs = val;
if (IS_FT_UINT(hfi->type)) {
it = proto_tree_add_uint(tree, hf_index, tvb, val_start, val_length, val);
} else if (IS_FT_INT(hfi->type)) {
it = proto_tree_add_int(tree, hf_index, tvb, val_start, val_length, val);
} else if (IS_FT_TIME(hfi->type)) {
it = proto_tree_add_time(tree, hf_index, tvb, val_start, val_length, &timeval);
} else {
g_assert_not_reached();
}
if (item) *item = it;
if (value) *value = val;
return offset;}
/* this functions decodes a CHOICE
it can only handle CHOICE INDEX values that fits inside a 32 bit integer.
@ -1402,25 +1374,30 @@ DEBUG_ENTRY("dissect_per_bit_string");
guint32
dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, guint32 *value_offset, guint32 *value_len)
{
proto_tree *etr = NULL;
proto_item *it = NULL;
gint val_start, val_length;
guint32 length;
header_field_info *hfi;
static char bytes[4];
char *pbytes = NULL;
hfi = (hf_index==-1) ? NULL : proto_registrar_get_nth(hf_index);
DEBUG_ENTRY("dissect_per_octet_string");
/* 16.5 if the length is 0 bytes there will be no encoding */
if(max_len==0){
return offset;
if (display_internal_per_fields) {
etr = tree;
}
DEBUG_ENTRY("dissect_per_octet_string");
if(min_len==-1){
min_len=0;
}
if (max_len==0) { /* 16.5 if the length is 0 bytes there will be no encoding */
val_start = offset>>3;
val_length = 0;
/* 16.6 if length is fixed and less than or equal to two bytes*/
if((min_len==max_len)&&(max_len<=2)){
static char bytes[4];
} else if((min_len==max_len)&&(max_len<=2)) { /* 16.6 if length is fixed and less than or equal to two bytes*/
guint32 i, old_offset=offset;
gboolean bit;
@ -1435,72 +1412,63 @@ DEBUG_ENTRY("dissect_per_octet_string");
}
}
bytes[min_len]=0;
if (hfi) {
if(hfi->type==FT_STRING){
proto_tree_add_string(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes);
} else {
proto_tree_add_bytes(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes);
pbytes = bytes;
val_start = old_offset>>3;
val_length = min_len+(offset&0x07)?1:0;
} else if ((min_len==max_len)&&(min_len<65536)) { /* 16.7 if length is fixed and less than to 64k*/
/* align to byte */
if(offset&0x07){
offset=(offset&0xfffffff8)+8;
}
val_start = offset>>3;
val_length = min_len;
offset+=min_len*8;
} else { /* 16.8 */
if(max_len>0) {
offset = dissect_per_constrained_integer(tvb, offset, pinfo, etr,
hf_per_octet_string_length, min_len, max_len,
&length, NULL, FALSE);
} else {
offset = dissect_per_length_determinant(tvb, offset, pinfo, etr,
hf_per_octet_string_length, &length);
}
if(length){
/* align to byte */
if(offset&0x07){
offset=(offset&0xfffffff8)+8;
}
}
if (value_offset) {
*value_offset = old_offset>>3;
}
if (value_len) {
*value_len = min_len+(offset&0x07)?1:0;
}
return offset;
val_start = offset>>3;
val_length = length;
offset+=length*8;
}
/* 16.7 if length is fixed and less than to 64k*/
if((min_len==max_len)&&(min_len<65536)){
/* align to byte */
if(offset&0x07){
offset=(offset&0xfffffff8)+8;
}
if (hfi) {
proto_tree_add_item(tree, hf_index, tvb, offset>>3, min_len, FALSE);
}
if (value_offset) {
*value_offset = offset>>3;
}
if (value_len) {
*value_len = min_len;
}
offset+=min_len*8;
return offset;
}
/* 16.8 */
if(max_len>0){
proto_tree *etr = NULL;
if(display_internal_per_fields){
etr=tree;
}
offset=dissect_per_constrained_integer(tvb, offset, pinfo,
etr, hf_per_octet_string_length, min_len, max_len,
&length, NULL, FALSE);
} else {
offset=dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_octet_string_length, &length);
}
if(length){
/* align to byte */
if(offset&0x07){
offset=(offset&0xfffffff8)+8;
}
if (hfi) {
proto_tree_add_item(tree, hf_index, tvb, offset>>3, length, FALSE);
if (hfi) {
if (IS_FT_UINT(hfi->type)||IS_FT_INT(hfi->type)) {
if (IS_FT_UINT(hfi->type))
it = proto_tree_add_uint(tree, hf_index, tvb, val_start, val_length, val_length);
else
it = proto_tree_add_int(tree, hf_index, tvb, val_start, val_length, val_length);
proto_item_append_text(it, (val_length == 1) ? " octet" : " octets");
} else {
if (pbytes) {
if(IS_FT_STRING(hfi->type)){
proto_tree_add_string(tree, hf_index, tvb, val_start, val_length, pbytes);
} else if (hfi->type==FT_BYTES) {
proto_tree_add_bytes(tree, hf_index, tvb, val_start, val_length, pbytes);
} else {
g_assert_not_reached();
}
} else {
proto_tree_add_item(tree, hf_index, tvb, val_start, val_length, FALSE);
}
}
}
if (value_offset) {
*value_offset = offset>>3;
}
if (value_len) {
*value_len = length;
}
offset+=length*8;
if (value_offset) *value_offset = val_start;
if (value_len) *value_len = val_length;
return offset;
}

View File

@ -5,13 +5,13 @@
# ASN.1 to Ethereal dissector compiler
# 2004 Tomas Kukosa
#
# $Id: asn2eth.py,v 1.10 2004/06/24 05:13:59 sahlberg Exp $
# $Id: asn2eth.py,v 1.11 2004/06/24 21:50:05 sahlberg Exp $
#
"""ASN.1 to Ethereal dissector compiler"""
#
# Compiler from ASN.1 specification to the Ethereal PER dissector
# Compiler from ASN.1 specification to the Ethereal dissector
#
# Based on ASN.1 to Python compiler from Aaron S. Lav's PyZ3950 package licensed under the X Consortium license
# http://www.pobox.com/~asl2/software/PyZ3950/
@ -411,9 +411,10 @@ class EthCtx:
if self.type.has_key(ident):
raise "Duplicate type for " + ident
self.type[ident] = {'import' : mod, 'proto' : proto,
'ethname' : '',
'ftype' : 'FT_NONE', 'display' : 'BASE_NONE',
'strings' : 'NULL'}
'ethname' : '' }
self.type[ident]['attr'] = { 'TYPE' : 'FT_NONE', 'DISPLAY' : 'BASE_NONE',
'STRINGS' : 'NULL', 'BITMASK' : '0' }
self.type[ident]['attr'].update(self.conform.use_item('TYPE_ATTR', ident))
self.type_imp.append(ident)
#--- eth_import_value -------------------------------------------------------
@ -447,6 +448,13 @@ class EthCtx:
self.type[ident]['no_emit'] = self.conform.use_item('NO_EMIT', ident)
self.type[ident]['tname'] = self.conform.use_item('TYPE_RENAME', ident, val_dflt=self.type[ident]['tname'])
self.type[ident]['ethname'] = ''
if val.type == 'Type_Ref':
self.type[ident]['attr'] = {}
else:
(ftype, display) = val.eth_ftype()
self.type[ident]['attr'] = { 'TYPE' : ftype, 'DISPLAY' : display,
'STRINGS' : val.eth_strings(), 'BITMASK' : '0' }
self.type[ident]['attr'].update(self.conform.use_item('TYPE_ATTR', ident))
self.type_ord.append(ident)
#--- eth_reg_value ----------------------------------------------------------
@ -464,7 +472,11 @@ class EthCtx:
#print "eth_reg_field(ident='%s', type='%s')" % (ident, type)
if self.field.has_key(ident):
raise "Duplicate field for " + ident
self.field[ident] = {'type' : type, 'idx' : idx, 'impl' : impl}
self.field[ident] = {'type' : type, 'idx' : idx, 'impl' : impl,
'modified' : '', 'attr' : {} }
if self.conform.check_item('FIELD_ATTR', ident):
self.field[ident]['modified'] = '#' + str(id(self))
self.field[ident]['attr'].update(self.conform.use_item('FIELD_ATTR', ident))
self.field_ord.append(ident)
if parent: self.eth_dep_add(parent, type)
@ -479,7 +491,8 @@ class EthCtx:
for t in self.type_imp:
nm = t
self.eth_type[nm] = { 'import' : self.type[t]['import'], 'proto' : self.type[t]['proto'], 'ref' : []}
self.eth_type[nm] = { 'import' : self.type[t]['import'], 'proto' : self.type[t]['proto'],
'attr' : {}, 'ref' : []}
self.type[t]['ethname'] = nm
for t in self.type_ord:
nm = self.type[t]['tname']
@ -504,7 +517,12 @@ class EthCtx:
self.eth_type_ord.append(nm)
self.eth_type[nm] = { 'import' : None, 'proto' : self.proto, 'export' : 0,
'user_def' : 0x03, 'no_emit' : 0x03,
'val' : self.type[t]['val'], 'ref' : [t]}
'val' : self.type[t]['val'],
'attr' : {},
'ref' : [t]}
self.eth_type[nm]['attr'].update(self.conform.use_item('ETYPE_ATTR', nm))
if self.type[t]['attr'].get('STRINGS') == '$$':
self.eth_type[nm]['attr']['STRINGS'] = 'VALS(%s_vals)' % (nm)
self.type[t]['ethname'] = nm
if (not self.eth_type[nm]['export'] and self.type[t]['export']): # new export
self.eth_export_ord.append(nm)
@ -589,7 +607,7 @@ class EthCtx:
name += self.field[f]['idx']
abbrev = nm.replace('-', '_')
nm = self.conform.use_item('FIELD_RENAME', f, val_dflt=nm)
nm = "hf_%s_%s" % (self.proto, nm.replace('-', '_'))
nm = nm.replace('-', '_')
t = self.field[f]['type']
if self.type.has_key(t):
ethtype = self.type[t]['ethname']
@ -597,15 +615,16 @@ class EthCtx:
# dummy imported
print "Dummy imported: ", t
self.type[t] = {'import' : 'xxx', 'proto' : 'xxx',
'ethname' : t,
'ftype' : 'FT_NONE', 'display' : 'BASE_NONE',
'strings' : 'NULL'}
self.eth_type[t] = { 'import' : 'xxx', 'proto' : 'xxx' , 'ref' : []}
'ethname' : t }
self.type[t]['attr'] = { 'TYPE' : 'FT_NONE', 'DISPLAY' : 'BASE_NONE',
'STRINGS' : 'NULL', 'BITMASK' : '0' }
self.eth_type[t] = { 'import' : 'xxx', 'proto' : 'xxx' , 'attr' : {}, 'ref' : []}
ethtype = t
ethtypemod = ethtype + self.field[f]['modified']
if self.eth_hf.has_key(nm):
if self.eth_hf_dupl.has_key(nm):
if self.eth_hf_dupl[nm].has_key(ethtype):
nm = self.eth_hf_dupl[nm][ethtype]
if self.eth_hf_dupl[nm].has_key(ethtypemod):
nm = self.eth_hf_dupl[nm][ethtypemod]
self.eth_hf[nm]['ref'].append(f)
self.field[f]['ethname'] = nm
continue
@ -614,35 +633,35 @@ class EthCtx:
self.eth_hf_dupl[nm][ethtype] = nmx
nm = nmx
else:
if self.eth_hf[nm]['ethtype'] == ethtype:
if (self.eth_hf[nm]['ethtype']+self.eth_hf[nm]['modified']) == ethtypemod:
self.eth_hf[nm]['ref'].append(f)
self.field[f]['ethname'] = nm
continue
else:
self.eth_hf_dupl[nm] = {self.eth_hf[nm]['ethtype'] : nm, \
ethtype : nm+'1'}
self.eth_hf_dupl[nm] = {self.eth_hf[nm]['ethtype']+self.eth_hf[nm]['modified'] : nm, \
ethtypemod : nm+'1'}
nm += '1'
self.eth_hf_ord.append(nm)
fullname = "hf_%s_%s" % (self.proto, nm)
type = self.field[f]['type']
types = [type]
while (not self.type[type]['import']
and self.type[type]['val'].type == 'Type_Ref'):
type = self.type[type]['val'].val
types.append(type)
#print self.field[f]['type'], ' -> ', type
if (self.type[type]['import']):
ftype = self.type[type]['ftype']
display = self.type[type]['display']
strings = self.type[type]['strings']
else:
(ftype, display) = self.type[type]['val'].eth_ftype()
strings = self.type[type]['val'].eth_strings()
if strings == '$$':
strings = 'VALS(%s_vals)' % (self.type[type]['ethname'])
self.eth_hf[nm] = {'ethtype' : ethtype, 'ref' : [f],
'name' : name, 'abbrev' : abbrev,
'type' : ftype,
'display' : display,
'strings' : strings,
'bitmask' : '0'}
attr = {}
while len(types):
t = types.pop()
attr.update(self.type[t]['attr'])
attr.update(self.eth_type[self.type[t]['ethname']]['attr'])
attr.update(self.field[f]['attr'])
attr['NAME'] = '"%s"' % name
attr['ABBREV'] = abbrev
attr.update(self.conform.use_item('EFIELD_ATTR', nm))
self.eth_hf[nm] = {'fullname' : fullname,
'ethtype' : ethtype, 'modified' : self.field[f]['modified'],
'attr' : attr.copy(), 'ref' : [f]}
self.field[f]['ethname'] = nm
#--- type dependencies -------------------
self.eth_type_ord1 = []
@ -789,7 +808,7 @@ class EthCtx:
fx = file(fn, 'w')
fx.write(eth_fhdr(fn))
for f in self.eth_hf_ord:
fx.write("%-50s/* %s */\n" % ("static int %s = -1; " % (f), self.eth_hf[f]['ethtype']))
fx.write("%-50s/* %s */\n" % ("static int %s = -1; " % (self.eth_hf[f]['fullname']), self.eth_hf[f]['ethtype']))
if (self.named_bit):
fx.write('/* named bits */\n')
for nb in self.named_bit:
@ -804,13 +823,17 @@ class EthCtx:
fx.write(eth_fhdr(fn))
for f in self.eth_hf_ord:
if len(self.eth_hf[f]['ref']) == 1:
blurb = self.eth_hf[f]['ref'][0]
blurb = '"' + self.eth_hf[f]['ref'][0] + '"'
else:
blurb = ''
fx.write(' { &%s,\n' % (f))
fx.write(' { "%s", "%s.%s",\n' % (self.eth_hf[f]['name'], self.proto, self.eth_hf[f]['abbrev']))
fx.write(' %s, %s, %s, %s,\n' % (self.eth_hf[f]['type'], self.eth_hf[f]['display'], self.eth_hf[f]['strings'], self.eth_hf[f]['bitmask']))
fx.write(' "%s", HFILL }},\n' % (blurb))
blurb = '""'
attr = self.eth_hf[f]['attr'].copy()
attr['ABBREV'] = '"%s.%s"' % (self.proto, attr['ABBREV'])
if not attr.has_key('BLURB'):
attr['BLURB'] = blurb
fx.write(' { &%s,\n' % (self.eth_hf[f]['fullname']))
fx.write(' { %(NAME)s, %(ABBREV)s,\n' % attr)
fx.write(' %(TYPE)s, %(DISPLAY)s, %(STRINGS)s, %(BITMASK)s,\n' % attr)
fx.write(' %(BLURB)s, HFILL }},\n' % attr)
for nb in self.named_bit:
blurb = ''
fx.write(' { &%s,\n' % (nb['ethname']))
@ -861,6 +884,29 @@ class EthCtx:
fx.write(self.eth_type_fn_h(t))
fx.close()
#--- eth_output_expcnf ------------------------------------------------------
def eth_output_expcnf(self):
if (not len(self.eth_export_ord)): return
fn = self.eth_output_fname('exp', ext='cnf')
fx = file(fn, 'w')
fx.write(eth_fhdr(fn, comment = '#'))
if self.Ber():
fx.write('#.IMPORT_TAG\n')
for t in self.eth_export_ord: # functions
if (self.eth_type[t]['export'] & 0x01):
fx.write('%-24s ' % (t))
fx.write('%s %s\n' % self.eth_type[t]['val'].GetTag(self))
fx.write('#.END\n\n')
fx.write('#.TYPE_ATTR\n')
for t in self.eth_export_ord: # functions
if (self.eth_type[t]['export'] & 0x01):
fx.write('%-24s ' % (t))
attr = self.type[self.eth_type[t]['ref'][0]]['attr'].copy()
attr.update(self.eth_type[t]['attr'])
fx.write('TYPE = %(TYPE)-9s DISPLAY = %(DISPLAY)-9s STRINGS = %(STRINGS)s BITMASK = %(BITMASK)s\n' % attr)
fx.write('#.END\n\n')
fx.close()
#--- eth_output_val ------------------------------------------------------
def eth_output_val(self):
if (not len(self.eth_value_ord1)): return
@ -904,10 +950,10 @@ class EthCtx:
if (i): postfix = '_impl'; impl = 'TRUE'
else: postfix = ''; impl = 'FALSE'
out = 'static int dissect_'+f+postfix+'(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {\n'
par=((impl, 'tvb', 'offset', 'pinfo', 'tree', f),)
par=((impl, 'tvb', 'offset', 'pinfo', 'tree', self.eth_hf[f]['fullname']),)
else:
out = 'static int dissect_'+f+'(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {\n'
par=(('tvb', 'offset', 'pinfo', 'tree', f),)
par=(('tvb', 'offset', 'pinfo', 'tree', self.eth_hf[f]['fullname']),)
out += self.eth_fn_call('dissect_%s_%s' % (self.eth_type[t]['proto'], t), ret='return',
par=par)
out += '}\n'
@ -957,7 +1003,7 @@ class EthCtx:
tmplist = self.eth_type_dupl.keys()
tmplist.sort()
for t in tmplist:
msg = "The same type names for different types. Explicit renaming is recommended.\n"
msg = "The same type names for different types. Explicit type renaming is recommended.\n"
msg += t + "\n"
x = ''
for tt in self.eth_type_dupl[t]:
@ -969,7 +1015,7 @@ class EthCtx:
tmplist = self.eth_hf_dupl.keys()
tmplist.sort()
for f in tmplist:
msg = "The same field names for different types. Explicit renaming is recommended.\n"
msg = "The same field names for different types. Explicit field renaming is recommended.\n"
msg += f + "\n"
for tt in self.eth_hf_dupl[f].keys():
msg += " %-20s %-20s " % (self.eth_hf_dupl[f][tt], tt)
@ -993,6 +1039,12 @@ class EthCnf:
self.tblcfg['TYPE_RENAME'] = { 'val_nm' : 'eth_name', 'val_dflt' : None, 'chk_dup' : True, 'chk_use' : True }
self.tblcfg['FIELD_RENAME'] = { 'val_nm' : 'eth_name', 'val_dflt' : None, 'chk_dup' : True, 'chk_use' : True }
self.tblcfg['IMPORT_TAG'] = { 'val_nm' : 'ttag', 'val_dflt' : (), 'chk_dup' : True, 'chk_use' : False }
self.tblcfg['FN_PARS'] = { 'val_nm' : 'pars', 'val_dflt' : {}, 'chk_dup' : True, 'chk_use' : True }
self.tblcfg['TYPE_ATTR'] = { 'val_nm' : 'attr', 'val_dflt' : {}, 'chk_dup' : True, 'chk_use' : False }
self.tblcfg['ETYPE_ATTR'] = { 'val_nm' : 'attr', 'val_dflt' : {}, 'chk_dup' : True, 'chk_use' : False }
self.tblcfg['FIELD_ATTR'] = { 'val_nm' : 'attr', 'val_dflt' : {}, 'chk_dup' : True, 'chk_use' : True }
self.tblcfg['EFIELD_ATTR'] = { 'val_nm' : 'attr', 'val_dflt' : {}, 'chk_dup' : True, 'chk_use' : True }
for k in self.tblcfg.keys() :
self.table[k] = {}
@ -1055,12 +1107,48 @@ class EthCnf:
return par[0:pmax]
return par
def get_par_nm(line, pnum, fn, lineno):
if pnum:
par = line.split(None, 1)
else:
par = [line,]
for i in range(len(par)):
if par[i][0] == '#':
par[i:] = []
break
if len(par) < pnum:
warnings.warn_explicit("Too few parameters.", UserWarning, fn, lineno)
return None
if len(par) > pnum:
nmpar = par[pnum]
else:
nmpar = ''
nmpars = {}
nmpar_first = re.compile(r'^\s*(?P<attr>[_A-Z][_A-Z0-9]*)\s*=\s*')
nmpar_next = re.compile(r'\s+(?P<attr>[_A-Z][_A-Z0-9]*)\s*=\s*')
nmpar_end = re.compile(r'\s*$')
result = nmpar_first.search(nmpar)
pos = 0
while result:
k = result.group('attr')
pos = result.end()
result = nmpar_next.search(nmpar, pos)
p1 = pos
if result:
p2 = result.start()
else:
p2 = nmpar_end.search(nmpar, pos).start()
v = nmpar[p1:p2]
nmpars[k] = v
par[pnum] = nmpars
return par
f = open(fn, "r")
directive = re.compile(r'^\s*#\.(?P<name>[A-Z_]+)\s+')
comment = re.compile(r'^\s*#[^.]')
empty = re.compile(r'^\s*$')
lineno = 0
ctx = ''
ctx = None
name = ''
stack = []
while 1:
@ -1077,13 +1165,21 @@ class EthCnf:
if comment.search(line): continue
result = directive.search(line)
if result: # directive
if result.group('name') in ('EXPORTS', 'USER_DEFINED', 'NO_EMIT', 'MODULE_IMPORT', 'OMIT_ASSIGNMENT', 'TYPE_RENAME', 'FIELD_RENAME', 'IMPORT_TAG'):
if result.group('name') in ('EXPORTS', 'USER_DEFINED', 'NO_EMIT', 'MODULE_IMPORT', 'OMIT_ASSIGNMENT', 'TYPE_RENAME', 'FIELD_RENAME', 'IMPORT_TAG',
'TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR'):
ctx = result.group('name')
elif result.group('name') in ('FN_HDR', 'FN_FTR', 'FN_BODY'):
par = get_par(line[result.end():], 1, 1, fn=fn, lineno=lineno)
if not par: continue
ctx = result.group('name')
name = par[0]
elif result.group('name') == 'FN_PARS':
par = get_par(line[result.end():], 0, 1, fn=fn, lineno=lineno)
ctx = result.group('name')
if not par:
name = None
else:
name = par[0]
elif result.group('name') == 'INCLUDE':
par = get_par(line[result.end():], 1, 1, fn=fn, lineno=lineno)
if not par: continue
@ -1091,15 +1187,15 @@ class EthCnf:
stack.append({'fn' : fn, 'f' : f, 'lineno' : lineno})
fn, f, lineno = par[0], fnew, 0
elif result.group('name') == 'END':
ctx = ''
ctx = None
else:
warnings.warn_explicit("Unknown directive '%s'" % (result.group('name')), UserWarning, fn, lineno)
continue
if not ctx:
if not empty.search(line):
if not empty.match(line):
warnings.warn_explicit("Non-empty line in empty context", UserWarning, fn, lineno)
elif ctx in ('EXPORTS', 'USER_DEFINED', 'NO_EMIT'):
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 1, 2, fn=fn, lineno=lineno)
if not par: continue
flag = 0x03
@ -1114,30 +1210,35 @@ class EthCnf:
warnings.warn_explicit("Unknown parameter value '%s'" % (par[1]), UserWarning, fn, lineno)
self.add_item(ctx, par[0], flag=flag, fn=fn, lineno=lineno)
elif ctx == 'MODULE_IMPORT':
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 2, 2, fn=fn, lineno=lineno)
if not par: continue
self.add_item('MODULE_IMPORT', par[0], proto=par[1], fn=fn, lineno=lineno)
elif ctx == 'IMPORT_TAG':
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 3, 3, fn=fn, lineno=lineno)
if not par: continue
self.add_item('IMPORT_TAG', par[0], ttag=(par[1], par[2]), fn=fn, lineno=lineno)
elif ctx == 'OMIT_ASSIGNMENT':
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 1, 1, fn=fn, lineno=lineno)
if not par: continue
self.add_item('OMIT_ASSIGNMENT', par[0], omit=True, fn=fn, lineno=lineno)
elif ctx == 'TYPE_RENAME':
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 2, 2, fn=fn, lineno=lineno)
if not par: continue
self.add_item('TYPE_RENAME', par[0], eth_name=par[1], fn=fn, lineno=lineno)
elif ctx == 'FIELD_RENAME':
if empty.search(line): continue
if empty.match(line): continue
par = get_par(line, 2, 2, fn=fn, lineno=lineno)
if not par: continue
self.add_item('FIELD_RENAME', par[0], eth_name=par[1], fn=fn, lineno=lineno)
elif ctx in ('TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR'):
if empty.match(line): continue
par = get_par_nm(line, 1, fn=fn, lineno=lineno)
if not par: continue
self.add_item(ctx, par[0], attr=par[1], fn=fn, lineno=lineno)
elif ctx in ('FN_HDR', 'FN_FTR', 'FN_BODY'):
self.add_fn_line(name, ctx, line, fn=fn, lineno=lineno)
@ -1866,7 +1967,16 @@ class ChoiceType (Type):
return True
def GetTTag(self, ectx):
return (-1, -1)
lst = self.elt_list
cls = '-1/*choice*/'
if hasattr(self, 'ext_list'):
lst.extend(self.ext_list)
if (len(lst) > 0):
cls = lst[0].GetTag(ectx)[0]
for e in (lst):
if (e.GetTag(ectx)[0] != cls):
cls = '-1/*choice*/'
return (cls, '-1/*choice*/')
def IndetermTag(self, ectx):
#print "Choice IndetermTag()=%s" % (str(not self.HasOwnTag()))
@ -2223,7 +2333,7 @@ class RestrictedCharacterStringType (CharacterStringType):
(minv, maxv, ext) = self.eth_get_size_constr()
if (ectx.Ber()):
body = ectx.eth_fn_call('dissect_ber_restricted_string' + ectx.pvp(), ret='offset',
par=(('implicit_tag', self.GetTTag(ectx)[1]),
par=(('implicit_tag', self.GetTag(ectx)[1]),
('pinfo', 'tree', 'tvb', 'offset', 'hf_index'),
('NULL',)))
elif (ectx.NPer()):
@ -3692,7 +3802,7 @@ def p_ActualParameter (t):
def p_error(t):
raise ParseError(str(t))
yacc.yacc ()
yacc.yacc(method='SLR')
def testlex (s):
lexer.input (s)
@ -3715,11 +3825,12 @@ def eth_do_module (ast, ectx):
if ectx.dbg('s'): print ast.str_depth(0)
ast.to_eth(ectx)
ectx.eth_prepare()
if ectx.dbg('t'):
if ectx.dbg('a'):
print "\n# Assignments"
print "\n".join(ectx.assign_ord)
print "\n# Value assignments"
print "\n".join(ectx.vassign_ord)
if ectx.dbg('t'):
print "\n# Imported Types"
print "%-40s %-24s %-24s" % ("ASN.1 name", "Module", "Protocol")
print "-" * 100
@ -3786,13 +3897,15 @@ def eth_do_module (ast, ectx):
ectx.eth_output_hf_arr()
ectx.eth_output_ett_arr()
ectx.eth_output_export()
if ectx.expcnf:
ectx.eth_output_expcnf()
ectx.eth_output_val()
ectx.eth_output_valexp()
ectx.conform.unused_report()
import time
def testyacc (s, fn, defined_dict):
ast = yacc.parse (s, debug=0)
def testyacc(s, fn, defined_dict):
ast = yacc.parse(s, debug=0)
time_str = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
print """#!/usr/bin/env python
# Auto-generated from %s at %s
@ -3809,16 +3922,18 @@ def eth_usage():
print """
competh [-h|?] [-d dbg] [-p proto] [-c conform_file] input_file
-h|? : usage
-d dbg : debug output, dbg = [l][y][s][t]
-d dbg : debug output, dbg = [l][y][s][a][t]
l - lex
y - yacc
s - internal ASN structure
s - internal ASN.1 structure
a - list of assignments
t - tables
-b : BER (default is PER)
-X : original dissector API (see Note)
-p proto : protocol name (default is basenam of <input_file> without extension)
-o name : output files name (default is <proto>)
-c conform_file : conformation file
-e : create conformation file for exported types
-s template : single file output (templete is input file without .c/.h extension)
input_file : input ASN.1 file
@ -3826,9 +3941,12 @@ Note: It can create output for an original or a new PER/BER dissectors API,
but the new PER/BER dissectors API is not implemented now.
"""
def eth_fhdr(fn):
def eth_fhdr(fn, comment = None):
def outln(ln):
return '/* ' + ('%-74s' % (ln)) + ' */\n'
if comment:
return '# %s\n' % (ln)
else:
return '/* %-74s */\n' % (ln)
out = ''
out += outln('Do not modify this file.')
out += outln('It is created automatically by the ASN.1 to Ethereal dissector compiler')
@ -3873,7 +3991,7 @@ def make_include(out_nm, in_nm, inc_nms, remove_inc=False):
def eth_main():
print "ASN.1 to Ethereal dissector compiler";
try:
opts, args = getopt.getopt(sys.argv[1:], "h?bXd:p:o:c:s:");
opts, args = getopt.getopt(sys.argv[1:], "h?bXd:p:o:c:es:");
except getopt.GetoptError:
eth_usage(); sys.exit(2)
if len(args) != 1:
@ -3887,6 +4005,8 @@ def eth_main():
ectx.outnm = ectx.proto
ectx.new = True
ectx.dbgopt = ''
ectx.new = True
ectx.expcnf = False
single_file = None
for o, a in opts:
if o in ("-h", "-?"):
@ -3904,6 +4024,8 @@ def eth_main():
ectx.new = False
if o in ("-d",):
ectx.dbgopt = a
if o in ("-e",):
ectx.expcnf = True
if o in ("-s",):
single_file = a
@ -3911,7 +4033,7 @@ def eth_main():
s = f.read();
f.close()
lexer.debug=ectx.dbg('l')
ast = yacc.parse (s, debug=ectx.dbg('y'))
ast = yacc.parse(s, debug=ectx.dbg('y'))
for module in ast:
eth_do_module(module, ectx)