diff options
Diffstat (limited to 'epan/dissectors/packet-c1222.c')
-rw-r--r-- | epan/dissectors/packet-c1222.c | 374 |
1 files changed, 172 insertions, 202 deletions
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c index 966ff413ed..b668ac659c 100644 --- a/epan/dissectors/packet-c1222.c +++ b/epan/dissectors/packet-c1222.c @@ -1,11 +1,8 @@ /* Do not modify this file. Changes will be overwritten. */ /* Generated automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-c1222.c */ -/* asn2wrs.py -b -p c1222 -c ./c1222.cnf -s ./packet-c1222-template -D . -O ../.. c1222.asn */ +/* asn2wrs.py -b -L -p c1222 -c ./c1222.cnf -s ./packet-c1222-template -D . -O ../.. c1222.asn */ -/* Input file: packet-c1222-template.c */ - -#line 1 "./asn1/c1222/packet-c1222-template.c" /* packet-c1222.c * Routines for ANSI C12.22 packet dissection * Copyright 2010, Edward J. Beroset, edward.beroset@elster.com @@ -45,8 +42,8 @@ #define C1222_EPSEM_FLAG_RESPONSE_CONTROL 0x03 #define C1222_PROCEDURE_RESPONSE 0xf000 -#define C1222_PROCEDURE_MFG 0x800 -#define C1222_PROCEDURE_NUMBER 0x7ff +#define C1222_PROCEDURE_MFG 0x0800 +#define C1222_PROCEDURE_NUMBER 0x07ff /* if the packet is encrypted, it can be * good, bad, or simply not checked @@ -78,48 +75,42 @@ static dissector_handle_t c1222_handle=NULL; static dissector_handle_t c1222_udp_handle=NULL; /* Initialize the protocol and registered fields */ -static int proto_c1222 = -1; - - -/*--- Included file: packet-c1222-hf.c ---*/ -#line 1 "./asn1/c1222/packet-c1222-hf.c" -static int hf_c1222_MESSAGE_PDU = -1; /* MESSAGE */ -static int hf_c1222_aSO_context = -1; /* ASO_qualifier */ -static int hf_c1222_called_AP_title = -1; /* Called_AP_title */ -static int hf_c1222_called_AP_invocation_id = -1; /* Called_AP_invocation_id */ -static int hf_c1222_calling_AP_title = -1; /* Calling_AP_title */ -static int hf_c1222_calling_AE_qualifier = -1; /* Calling_AE_qualifier */ -static int hf_c1222_calling_AP_invocation_id = -1; /* Calling_AP_invocation_id */ -static int hf_c1222_mechanism_name = -1; /* Mechanism_name */ -static int hf_c1222_calling_authentication_value = -1; /* Calling_authentication_value */ -static int hf_c1222_user_information = -1; /* User_information */ -static int hf_c1222_called_ap_title_abs = -1; /* OBJECT_IDENTIFIER */ -static int hf_c1222_called_ap_title_rel = -1; /* RELATIVE_OID */ -static int hf_c1222_calling_ap_title_abs = -1; /* OBJECT_IDENTIFIER */ -static int hf_c1222_calling_ap_title_rel = -1; /* RELATIVE_OID */ -static int hf_c1222_calling_authentication_value_indirect = -1; /* INTEGER */ -static int hf_c1222_calling_authentication_value_encoding = -1; /* Authentication_value_encoding */ -static int hf_c1222_calling_authentication_value_single_asn1 = -1; /* Calling_authentication_value_single_asn1 */ -static int hf_c1222_calling_authentication_value_octet_aligned = -1; /* OCTET_STRING */ -static int hf_c1222_calling_authentication_value_c1222 = -1; /* Calling_authentication_value_c1222 */ -static int hf_c1222_calling_authentication_value_c1221 = -1; /* Calling_authentication_value_c1221 */ -static int hf_c1222_key_id_element = -1; /* Key_id_element */ -static int hf_c1222_iv_element = -1; /* Iv_element */ -static int hf_c1222_c1221_auth_identification = -1; /* OCTET_STRING_SIZE_CONSTR001 */ -static int hf_c1222_c1221_auth_request = -1; /* OCTET_STRING_SIZE_1_255 */ -static int hf_c1222_c1221_auth_response = -1; /* OCTET_STRING_SIZE_CONSTR002 */ - -/*--- End of included file: packet-c1222-hf.c ---*/ -#line 76 "./asn1/c1222/packet-c1222-template.c" +static int proto_c1222; + +static int hf_c1222_MESSAGE_PDU; /* MESSAGE */ +static int hf_c1222_aSO_context; /* ASO_qualifier */ +static int hf_c1222_called_AP_title; /* Called_AP_title */ +static int hf_c1222_called_AP_invocation_id; /* Called_AP_invocation_id */ +static int hf_c1222_calling_AP_title; /* Calling_AP_title */ +static int hf_c1222_calling_AE_qualifier; /* Calling_AE_qualifier */ +static int hf_c1222_calling_AP_invocation_id; /* Calling_AP_invocation_id */ +static int hf_c1222_mechanism_name; /* Mechanism_name */ +static int hf_c1222_calling_authentication_value; /* Calling_authentication_value */ +static int hf_c1222_user_information; /* User_information */ +static int hf_c1222_called_ap_title_abs; /* OBJECT_IDENTIFIER */ +static int hf_c1222_called_ap_title_rel; /* RELATIVE_OID */ +static int hf_c1222_calling_ap_title_abs; /* OBJECT_IDENTIFIER */ +static int hf_c1222_calling_ap_title_rel; /* RELATIVE_OID */ +static int hf_c1222_calling_authentication_value_indirect; /* INTEGER */ +static int hf_c1222_calling_authentication_value_encoding; /* Authentication_value_encoding */ +static int hf_c1222_calling_authentication_value_single_asn1; /* Calling_authentication_value_single_asn1 */ +static int hf_c1222_calling_authentication_value_octet_aligned; /* OCTET_STRING */ +static int hf_c1222_calling_authentication_value_c1222; /* Calling_authentication_value_c1222 */ +static int hf_c1222_calling_authentication_value_c1221; /* Calling_authentication_value_c1221 */ +static int hf_c1222_key_id_element; /* Key_id_element */ +static int hf_c1222_iv_element; /* Iv_element */ +static int hf_c1222_c1221_auth_identification; /* OCTET_STRING_SIZE_CONSTR001 */ +static int hf_c1222_c1221_auth_request; /* OCTET_STRING_SIZE_1_255 */ +static int hf_c1222_c1221_auth_response; /* OCTET_STRING_SIZE_CONSTR002 */ /* These are the EPSEM pieces */ /* first, the flag components */ -static int hf_c1222_epsem_flags = -1; -static int hf_c1222_epsem_flags_reserved = -1; -static int hf_c1222_epsem_flags_recovery = -1; -static int hf_c1222_epsem_flags_proxy = -1; -static int hf_c1222_epsem_flags_ed_class = -1; -static int hf_c1222_epsem_flags_security_modes = -1; -static int hf_c1222_epsem_flags_response_control = -1; +static int hf_c1222_epsem_flags; +static int hf_c1222_epsem_flags_reserved; +static int hf_c1222_epsem_flags_recovery; +static int hf_c1222_epsem_flags_proxy; +static int hf_c1222_epsem_flags_ed_class; +static int hf_c1222_epsem_flags_security_modes; +static int hf_c1222_epsem_flags_response_control; /* and the structure of the flag components */ static int * const c1222_flags[] = { &hf_c1222_epsem_flags_reserved, @@ -131,53 +122,53 @@ static int * const c1222_flags[] = { NULL }; /* next the optional ed_class */ -static int hf_c1222_epsem_ed_class = -1; +static int hf_c1222_epsem_ed_class; /* now the aggregate epsem */ -static int hf_c1222_epsem_total = -1; +static int hf_c1222_epsem_total; /* generic command */ -static int hf_c1222_cmd = -1; -static int hf_c1222_err = -1; -static int hf_c1222_data = -1; +static int hf_c1222_cmd; +static int hf_c1222_err; +static int hf_c1222_data; /* individual epsem fields */ -static int hf_c1222_logon_id = -1; -static int hf_c1222_logon_user = -1; -static int hf_c1222_security_password = -1; -static int hf_c1222_auth_len = -1; -static int hf_c1222_auth_data = -1; -static int hf_c1222_read_table = -1; -static int hf_c1222_read_offset = -1; -static int hf_c1222_read_count = -1; -static int hf_c1222_write_table = -1; -static int hf_c1222_write_offset = -1; -static int hf_c1222_write_size = -1; -static int hf_c1222_write_data = -1; -static int hf_c1222_procedure_response = -1; -static int hf_c1222_procedure_mfg = -1; -static int hf_c1222_procedure_num = -1; -static int hf_c1222_procedure_sequence = -1; -static int hf_c1222_write_chksum = -1; -static int hf_c1222_write_chksum_status = -1; -static int hf_c1222_wait_secs = -1; -static int hf_c1222_neg_pkt_size = -1; -static int hf_c1222_neg_nbr_pkts = -1; -static int hf_c1222_timing_setup_traffic = -1; -static int hf_c1222_timing_setup_inter_char = -1; -static int hf_c1222_timing_setup_resp_to = -1; -static int hf_c1222_timing_setup_nbr_retries = -1; +static int hf_c1222_logon_id; +static int hf_c1222_logon_user; +static int hf_c1222_security_password; +static int hf_c1222_auth_len; +static int hf_c1222_auth_data; +static int hf_c1222_read_table; +static int hf_c1222_read_offset; +static int hf_c1222_read_count; +static int hf_c1222_write_table; +static int hf_c1222_write_offset; +static int hf_c1222_write_size; +static int hf_c1222_write_data; +static int hf_c1222_procedure_response; +static int hf_c1222_procedure_mfg; +static int hf_c1222_procedure_num; +static int hf_c1222_procedure_sequence; +static int hf_c1222_write_chksum; +static int hf_c1222_write_chksum_status; +static int hf_c1222_wait_secs; +static int hf_c1222_neg_pkt_size; +static int hf_c1222_neg_nbr_pkts; +static int hf_c1222_timing_setup_traffic; +static int hf_c1222_timing_setup_inter_char; +static int hf_c1222_timing_setup_resp_to; +static int hf_c1222_timing_setup_nbr_retries; /* the MAC */ -static int hf_c1222_epsem_mac = -1; +static int hf_c1222_epsem_mac; /* crypto result flags */ -static int hf_c1222_epsem_crypto_good = -1; -static int hf_c1222_epsem_crypto_bad = -1; +static int hf_c1222_epsem_crypto_good; +static int hf_c1222_epsem_crypto_bad; /* Initialize the subtree pointers */ -static int ett_c1222 = -1; -static int ett_c1222_epsem = -1; -static int ett_c1222_flags = -1; -static int ett_c1222_crypto = -1; -static int ett_c1222_cmd = -1; +static int ett_c1222; +static int ett_c1222_epsem; +static int ett_c1222_flags; +static int ett_c1222_crypto; +static int ett_c1222_cmd; /* these pointers are for the header elements that may be needed to verify the crypto */ static guint8 *aSO_context = NULL; @@ -205,30 +196,37 @@ static guint32 calling_AP_title_len = 0; static guint32 key_id_element_len = 0; static guint32 iv_element_len = 0; - -/*--- Included file: packet-c1222-ett.c ---*/ -#line 1 "./asn1/c1222/packet-c1222-ett.c" -static gint ett_c1222_MESSAGE_U = -1; -static gint ett_c1222_Called_AP_title = -1; -static gint ett_c1222_Calling_AP_title = -1; -static gint ett_c1222_Calling_authentication_value_U = -1; -static gint ett_c1222_Authentication_value_encoding = -1; -static gint ett_c1222_Calling_authentication_value_single_asn1 = -1; -static gint ett_c1222_Calling_authentication_value_c1222_U = -1; -static gint ett_c1222_Calling_authentication_value_c1221_U = -1; - -/*--- End of included file: packet-c1222-ett.c ---*/ -#line 171 "./asn1/c1222/packet-c1222-template.c" - -static expert_field ei_c1222_command_truncated = EI_INIT; -static expert_field ei_c1222_bad_checksum = EI_INIT; -static expert_field ei_c1222_epsem_missing = EI_INIT; -static expert_field ei_c1222_epsem_failed_authentication = EI_INIT; -static expert_field ei_c1222_epsem_not_decryped = EI_INIT; -static expert_field ei_c1222_ed_class_missing = EI_INIT; -static expert_field ei_c1222_epsem_ber_length_error = EI_INIT; -static expert_field ei_c1222_epsem_field_length_error = EI_INIT; -static expert_field ei_c1222_mac_missing = EI_INIT; +/* these are the related allocation sizes (which might be different from the lengths) */ +static guint32 aSO_context_allocated = 0; +static guint32 called_AP_title_allocated = 0; +static guint32 called_AP_invocation_id_allocated = 0; +static guint32 calling_AE_qualifier_allocated = 0; +static guint32 calling_AP_invocation_id_allocated = 0; +static guint32 mechanism_name_allocated = 0; +static guint32 calling_authentication_value_allocated = 0; +static guint32 user_information_allocated = 0; +static guint32 calling_AP_title_allocated = 0; +static guint32 key_id_element_allocated = 0; +static guint32 iv_element_allocated = 0; + +static gint ett_c1222_MESSAGE_U; +static gint ett_c1222_Called_AP_title; +static gint ett_c1222_Calling_AP_title; +static gint ett_c1222_Calling_authentication_value_U; +static gint ett_c1222_Authentication_value_encoding; +static gint ett_c1222_Calling_authentication_value_single_asn1; +static gint ett_c1222_Calling_authentication_value_c1222_U; +static gint ett_c1222_Calling_authentication_value_c1221_U; + +static expert_field ei_c1222_command_truncated; +static expert_field ei_c1222_bad_checksum; +static expert_field ei_c1222_epsem_missing; +static expert_field ei_c1222_epsem_failed_authentication; +static expert_field ei_c1222_epsem_not_decrypted; +static expert_field ei_c1222_ed_class_missing; +static expert_field ei_c1222_epsem_ber_length_error; +static expert_field ei_c1222_epsem_field_length_error; +static expert_field ei_c1222_mac_missing; /* Preferences */ static gboolean c1222_desegment = TRUE; @@ -351,11 +349,13 @@ static uat_t *c1222_uat; #define FILL_TABLE(fieldname) \ length = offset - start_offset; \ fieldname = (guint8 *)tvb_memdup(actx->pinfo->pool, tvb, start_offset, length); \ - fieldname##_len = length; + fieldname##_len = length; \ + fieldname##_allocated = length; #define FILL_TABLE_TRUNCATE(fieldname, len) \ length = 1 + 2*(offset - start_offset); \ fieldname = (guint8 *)tvb_memdup(actx->pinfo->pool, tvb, start_offset, length); \ - fieldname##_len = len; + fieldname##_len = len; \ + fieldname##_allocated = length; #define FILL_TABLE_APTITLE(fieldname) \ length = offset - start_offset; \ switch (tvb_get_guint8(tvb, start_offset)) { \ @@ -363,6 +363,7 @@ static uat_t *c1222_uat; tvb_ensure_bytes_exist(tvb, start_offset, length); \ fieldname##_len = length + c1222_baseoid_len; \ fieldname = (guint8 *)wmem_alloc(actx->pinfo->pool, fieldname##_len); \ + fieldname##_allocated = fieldname##_len; \ fieldname[0] = 0x06; /* create absolute OID tag */ \ fieldname[1] = (fieldname##_len - 2) & 0xff; \ memcpy(&(fieldname[2]), c1222_baseoid, c1222_baseoid_len); \ @@ -372,6 +373,7 @@ static uat_t *c1222_uat; default: \ fieldname = (guint8 *)tvb_memdup(actx->pinfo->pool, tvb, start_offset, length); \ fieldname##_len = length; \ + fieldname##_allocated = length; \ break; \ } @@ -692,21 +694,23 @@ typedef struct tagTOP_ELEMENT_CONTROL guint8 **element; /* pointer to element length */ guint32 *length; + /* pointer to element allocated size */ + guint32 *allocated; } TOP_ELEMENT_CONTROL; static const TOP_ELEMENT_CONTROL canonifyTable[] = { - { FALSE, FALSE, 0xA1, TRUE, &aSO_context, &aSO_context_len }, - { TRUE , FALSE, 0xA2, TRUE, &called_AP_title, &called_AP_title_len }, - { FALSE, FALSE, 0xA4, TRUE, &called_AP_invocation_id, &called_AP_invocation_id_len }, - { FALSE, FALSE, 0xA7, TRUE, &calling_AE_qualifier, &calling_AE_qualifier_len }, - { TRUE, FALSE, 0xA8, TRUE, &calling_AP_invocation_id, &calling_AP_invocation_id_len }, - { FALSE, FALSE, 0x8B, TRUE, &mechanism_name, &mechanism_name_len }, - { FALSE, FALSE, 0xAC, TRUE, &calling_authentication_value, &calling_authentication_value_len }, - { TRUE , TRUE , 0xBE, TRUE, &user_information, &user_information_len }, - { FALSE, FALSE, 0xA6, TRUE, &calling_AP_title, &calling_AP_title_len }, - { FALSE, FALSE, 0xAC, FALSE, &key_id_element, &key_id_element_len }, - { FALSE, FALSE, 0xAC, FALSE, &iv_element, &iv_element_len }, - { FALSE, FALSE, 0x0, TRUE, NULL, NULL } + { FALSE, FALSE, 0xA1, TRUE, &aSO_context, &aSO_context_len, &aSO_context_allocated }, + { TRUE , FALSE, 0xA2, TRUE, &called_AP_title, &called_AP_title_len, &called_AP_title_allocated }, + { FALSE, FALSE, 0xA4, TRUE, &called_AP_invocation_id, &called_AP_invocation_id_len, &called_AP_invocation_id_allocated }, + { FALSE, FALSE, 0xA7, TRUE, &calling_AE_qualifier, &calling_AE_qualifier_len, &calling_AE_qualifier_allocated }, + { TRUE, FALSE, 0xA8, TRUE, &calling_AP_invocation_id, &calling_AP_invocation_id_len, &calling_AP_invocation_id_allocated }, + { FALSE, FALSE, 0x8B, TRUE, &mechanism_name, &mechanism_name_len, &mechanism_name_allocated }, + { FALSE, FALSE, 0xAC, TRUE, &calling_authentication_value, &calling_authentication_value_len, &calling_authentication_value_allocated }, + { TRUE , TRUE , 0xBE, TRUE, &user_information, &user_information_len, &user_information_allocated }, + { FALSE, FALSE, 0xA6, TRUE, &calling_AP_title, &calling_AP_title_len, &calling_AP_title_allocated }, + { FALSE, FALSE, 0xAC, FALSE, &key_id_element, &key_id_element_len, &key_id_element_allocated }, + { FALSE, FALSE, 0xAC, FALSE, &iv_element, &iv_element_len, &iv_element_allocated }, + { FALSE, FALSE, 0x0, TRUE, NULL, NULL, NULL } }; static void @@ -780,7 +784,7 @@ c1222_uat_data_copy_cb(void *dest, const void *source, size_t len _U_) * \param err is updated to point to an error string if needed * \return FALSE if error; TRUE otherwise */ -static gboolean +static bool c1222_uat_data_update_cb(void* n, char** err) { c1222_uat_data_t* new_rec = (c1222_uat_data_t *)n; @@ -816,11 +820,12 @@ static gboolean canonify_unencrypted_header(guchar *buff, guint32 *offset, guint32 buffsize) { const TOP_ELEMENT_CONTROL *t = canonifyTable; - guint32 len; + guint32 len, allocated; for (t = canonifyTable; t->element != NULL; t++) { len = *(t->length); + allocated = *(t->allocated); if (t->required && *(t->element) == NULL) return FALSE; if (*(t->element) != NULL) { @@ -837,6 +842,11 @@ canonify_unencrypted_header(guchar *buff, guint32 *offset, guint32 buffsize) if (buffsize < *offset + len) { return FALSE; } + /* bail out if our we're trying to read past the end of our element */ + /* the network is always hostile */ + if (allocated < len) { + return FALSE; + } memcpy(&buff[*offset], *(t->element), len); (*offset) += len; if (t->addtag) { @@ -980,7 +990,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ int local_offset; gint len2; int cmd_err; - gboolean ind; + bool ind; guchar *buffer; tvbuff_t *epsem_buffer = NULL; gboolean crypto_good = FALSE; @@ -1041,7 +1051,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ /* it's only encrypted if we have an undecrypted payload */ if (encrypted) { proto_tree_add_item(tree, hf_c1222_epsem_total, tvb, offset, -1, ENC_NA); - expert_add_info(pinfo, tree, &ei_c1222_epsem_not_decryped); + expert_add_info(pinfo, tree, &ei_c1222_epsem_not_decrypted); local_offset = offset+len2-4; epsem_buffer = tvb; } else { /* it's not (now) encrypted */ @@ -1097,27 +1107,22 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ } -/*--- Included file: packet-c1222-fn.c ---*/ -#line 1 "./asn1/c1222/packet-c1222-fn.c" - static int -dissect_c1222_ASO_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 50 "./asn1/c1222/c1222.cnf" +dissect_c1222_ASO_qualifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); FILL_TABLE(aSO_context); - return offset; } static int -dissect_c1222_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_OBJECT_IDENTIFIER(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; @@ -1126,7 +1131,7 @@ dissect_c1222_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int -dissect_c1222_RELATIVE_OID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_RELATIVE_OID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_relative_oid(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; @@ -1146,8 +1151,7 @@ static const ber_choice_t Called_AP_title_choice[] = { }; static int -dissect_c1222_Called_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 55 "./asn1/c1222/c1222.cnf" +dissect_c1222_Called_AP_title(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_choice(actx, tree, tvb, offset, Called_AP_title_choice, hf_index, ett_c1222_Called_AP_title, @@ -1156,14 +1160,13 @@ dissect_c1222_Called_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int FILL_TABLE_APTITLE(called_AP_title); - return offset; } static int -dissect_c1222_AP_invocation_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_AP_invocation_id(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1173,15 +1176,13 @@ dissect_c1222_AP_invocation_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int static int -dissect_c1222_Called_AP_invocation_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 60 "./asn1/c1222/c1222.cnf" +dissect_c1222_Called_AP_invocation_id(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_c1222_AP_invocation_id(implicit_tag, tvb, offset, actx, tree, hf_index); FILL_TABLE(called_AP_invocation_id); - return offset; } @@ -1199,8 +1200,7 @@ static const ber_choice_t Calling_AP_title_choice[] = { }; static int -dissect_c1222_Calling_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 85 "./asn1/c1222/c1222.cnf" +dissect_c1222_Calling_AP_title(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_choice(actx, tree, tvb, offset, Calling_AP_title_choice, hf_index, ett_c1222_Calling_AP_title, @@ -1209,14 +1209,13 @@ dissect_c1222_Calling_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int FILL_TABLE_APTITLE(calling_AP_title); - return offset; } static int -dissect_c1222_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_AE_qualifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1226,52 +1225,46 @@ dissect_c1222_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int -dissect_c1222_Calling_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 65 "./asn1/c1222/c1222.cnf" +dissect_c1222_Calling_AE_qualifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_c1222_AE_qualifier(implicit_tag, tvb, offset, actx, tree, hf_index); FILL_TABLE(calling_AE_qualifier); - return offset; } static int -dissect_c1222_Calling_AP_invocation_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 70 "./asn1/c1222/c1222.cnf" +dissect_c1222_Calling_AP_invocation_id(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_c1222_AP_invocation_id(implicit_tag, tvb, offset, actx, tree, hf_index); FILL_TABLE(calling_AP_invocation_id); - return offset; } static int -dissect_c1222_Mechanism_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 75 "./asn1/c1222/c1222.cnf" +dissect_c1222_Mechanism_name(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); FILL_TABLE(mechanism_name); - return offset; } static int -dissect_c1222_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_INTEGER(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1281,8 +1274,7 @@ dissect_c1222_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ static int -dissect_c1222_Key_id_element(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 90 "./asn1/c1222/c1222.cnf" +dissect_c1222_Key_id_element(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1290,15 +1282,13 @@ dissect_c1222_Key_id_element(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o FILL_TABLE(key_id_element); - return offset; } static int -dissect_c1222_Iv_element(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 95 "./asn1/c1222/c1222.cnf" +dissect_c1222_Iv_element(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1306,7 +1296,6 @@ dissect_c1222_Iv_element(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse FILL_TABLE(iv_element); - return offset; } @@ -1318,7 +1307,7 @@ static const ber_sequence_t Calling_authentication_value_c1222_U_sequence[] = { }; static int -dissect_c1222_Calling_authentication_value_c1222_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_c1222_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Calling_authentication_value_c1222_U_sequence, hf_index, ett_c1222_Calling_authentication_value_c1222_U); @@ -1328,7 +1317,7 @@ dissect_c1222_Calling_authentication_value_c1222_U(gboolean implicit_tag _U_, tv static int -dissect_c1222_Calling_authentication_value_c1222(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_c1222(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_CON, 1, TRUE, dissect_c1222_Calling_authentication_value_c1222_U); @@ -1338,7 +1327,7 @@ dissect_c1222_Calling_authentication_value_c1222(gboolean implicit_tag _U_, tvbu static int -dissect_c1222_OCTET_STRING_SIZE_CONSTR001(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_OCTET_STRING_SIZE_CONSTR001(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1348,7 +1337,7 @@ dissect_c1222_OCTET_STRING_SIZE_CONSTR001(gboolean implicit_tag _U_, tvbuff_t *t static int -dissect_c1222_OCTET_STRING_SIZE_1_255(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_OCTET_STRING_SIZE_1_255(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1358,7 +1347,7 @@ dissect_c1222_OCTET_STRING_SIZE_1_255(gboolean implicit_tag _U_, tvbuff_t *tvb _ static int -dissect_c1222_OCTET_STRING_SIZE_CONSTR002(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_OCTET_STRING_SIZE_CONSTR002(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1381,7 +1370,7 @@ static const ber_choice_t Calling_authentication_value_c1221_U_choice[] = { }; static int -dissect_c1222_Calling_authentication_value_c1221_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_c1221_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Calling_authentication_value_c1221_U_choice, hf_index, ett_c1222_Calling_authentication_value_c1221_U, NULL); @@ -1392,7 +1381,7 @@ dissect_c1222_Calling_authentication_value_c1221_U(gboolean implicit_tag _U_, tv static int -dissect_c1222_Calling_authentication_value_c1221(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_c1221(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_CON, 0, TRUE, dissect_c1222_Calling_authentication_value_c1221_U); @@ -1413,7 +1402,7 @@ static const ber_choice_t Calling_authentication_value_single_asn1_choice[] = { }; static int -dissect_c1222_Calling_authentication_value_single_asn1(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_single_asn1(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Calling_authentication_value_single_asn1_choice, hf_index, ett_c1222_Calling_authentication_value_single_asn1, NULL); @@ -1424,7 +1413,7 @@ dissect_c1222_Calling_authentication_value_single_asn1(gboolean implicit_tag _U_ static int -dissect_c1222_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_OCTET_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); @@ -1445,7 +1434,7 @@ static const ber_choice_t Authentication_value_encoding_choice[] = { }; static int -dissect_c1222_Authentication_value_encoding(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Authentication_value_encoding(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Authentication_value_encoding_choice, hf_index, ett_c1222_Authentication_value_encoding, NULL); @@ -1461,7 +1450,7 @@ static const ber_sequence_t Calling_authentication_value_U_sequence[] = { }; static int -dissect_c1222_Calling_authentication_value_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_Calling_authentication_value_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Calling_authentication_value_U_sequence, hf_index, ett_c1222_Calling_authentication_value_U); @@ -1471,8 +1460,7 @@ dissect_c1222_Calling_authentication_value_U(gboolean implicit_tag _U_, tvbuff_t static int -dissect_c1222_Calling_authentication_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 80 "./asn1/c1222/c1222.cnf" +dissect_c1222_Calling_authentication_value(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { FILL_START; offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_CON, 2, TRUE, dissect_c1222_Calling_authentication_value_U); @@ -1480,17 +1468,15 @@ dissect_c1222_Calling_authentication_value(gboolean implicit_tag _U_, tvbuff_t * FILL_TABLE(calling_authentication_value); - return offset; } static int -dissect_c1222_User_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 26 "./asn1/c1222/c1222.cnf" +dissect_c1222_User_information(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { gint8 end_device_class; - gboolean pc, ind; + bool pc, ind; gint32 tag; guint32 len; proto_item *tf = NULL; @@ -1513,7 +1499,6 @@ dissect_c1222_User_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int } - return offset; } @@ -1532,7 +1517,7 @@ static const ber_sequence_t MESSAGE_U_sequence[] = { }; static int -dissect_c1222_MESSAGE_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +dissect_c1222_MESSAGE_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, MESSAGE_U_sequence, hf_index, ett_c1222_MESSAGE_U); @@ -1542,14 +1527,12 @@ dissect_c1222_MESSAGE_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int -dissect_c1222_MESSAGE(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 100 "./asn1/c1222/c1222.cnf" +dissect_c1222_MESSAGE(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { clear_canon(); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_APP, 0, TRUE, dissect_c1222_MESSAGE_U); - return offset; } @@ -1564,9 +1547,6 @@ static int dissect_MESSAGE_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_ } -/*--- End of included file: packet-c1222-fn.c ---*/ -#line 1049 "./asn1/c1222/packet-c1222-template.c" - /** * Dissects a a full (reassembled) C12.22 message. * @@ -1602,7 +1582,7 @@ get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data { int orig_offset; guint length; - gboolean ind; + bool ind; orig_offset = offset; /* note that this assumes a Tag length of 1 which is always valid for C12.22 */ @@ -1870,9 +1850,6 @@ void proto_register_c1222(void) { NULL, 0x0, "True: crypto bad; False: crypto ok or not checked", HFILL } }, - -/*--- Included file: packet-c1222-hfarr.c ---*/ -#line 1 "./asn1/c1222/packet-c1222-hfarr.c" { &hf_c1222_MESSAGE_PDU, { "MESSAGE", "c1222.MESSAGE_element", FT_NONE, BASE_NONE, NULL, 0, @@ -1973,9 +1950,6 @@ void proto_register_c1222(void) { { "c1221-auth-response", "c1222.c1221_auth_response", FT_BYTES, BASE_NONE, NULL, 0, "OCTET_STRING_SIZE_CONSTR002", HFILL }}, - -/*--- End of included file: packet-c1222-hfarr.c ---*/ -#line 1354 "./asn1/c1222/packet-c1222-template.c" }; /* List of subtrees */ @@ -1985,9 +1959,6 @@ void proto_register_c1222(void) { &ett_c1222_flags, &ett_c1222_crypto, &ett_c1222_cmd, - -/*--- Included file: packet-c1222-ettarr.c ---*/ -#line 1 "./asn1/c1222/packet-c1222-ettarr.c" &ett_c1222_MESSAGE_U, &ett_c1222_Called_AP_title, &ett_c1222_Calling_AP_title, @@ -1996,9 +1967,6 @@ void proto_register_c1222(void) { &ett_c1222_Calling_authentication_value_single_asn1, &ett_c1222_Calling_authentication_value_c1222_U, &ett_c1222_Calling_authentication_value_c1221_U, - -/*--- End of included file: packet-c1222-ettarr.c ---*/ -#line 1364 "./asn1/c1222/packet-c1222-template.c" }; static ei_register_info ei[] = { @@ -2006,7 +1974,7 @@ void proto_register_c1222(void) { { &ei_c1222_bad_checksum, { "c1222.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, { &ei_c1222_epsem_missing, { "c1222.epsem.missing", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM missing", EXPFILL }}, { &ei_c1222_epsem_failed_authentication, { "c1222.epsem.failed_authentication", PI_SECURITY, PI_ERROR, "C12.22 EPSEM failed authentication", EXPFILL }}, - { &ei_c1222_epsem_not_decryped, { "c1222.epsem.not_decryped", PI_UNDECODED, PI_WARN, "C12.22 EPSEM could not be decrypted", EXPFILL }}, + { &ei_c1222_epsem_not_decrypted, { "c1222.epsem.not_decrypted", PI_UNDECODED, PI_WARN, "C12.22 EPSEM could not be decrypted", EXPFILL }}, { &ei_c1222_ed_class_missing, { "c1222.ed_class_missing", PI_SECURITY, PI_ERROR, "C12.22 ED Class missing", EXPFILL }}, { &ei_c1222_epsem_ber_length_error, { "c1222.epsem.ber_length_error", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM BER length error", EXPFILL }}, { &ei_c1222_epsem_field_length_error, { "c1222.epsem.field_length_error", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM field length error", EXPFILL }}, @@ -2029,6 +1997,10 @@ void proto_register_c1222(void) { proto_register_subtree_array(ett, array_length(ett)); expert_c1222 = expert_register_protocol(proto_c1222); expert_register_field_array(expert_c1222, ei, array_length(ei)); + /* Register dissectors */ + c1222_handle = register_dissector("c1222.tcp", dissect_c1222, proto_c1222); + c1222_udp_handle = register_dissector("c1222.udp", dissect_c1222_common, proto_c1222); + /* Register dissection preferences */ c1222_module = prefs_register_protocol(proto_c1222, proto_reg_handoff_c1222); prefs_register_bool_preference(c1222_module, "desegment", "Reassemble all C12.22 messages spanning multiple TCP segments", @@ -2076,8 +2048,6 @@ proto_reg_handoff_c1222(void) guint8 *temp = NULL; if( !initialized ) { - c1222_handle = create_dissector_handle(dissect_c1222, proto_c1222); - c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222); dissector_add_uint_with_preference("tcp.port", C1222_PORT, c1222_handle); dissector_add_uint_with_preference("udp.port", C1222_PORT, c1222_udp_handle); initialized = TRUE; |