# ain.cnf # ain conformation file #.EXPORTS #.NO_EMIT ONLY_VALS ROS #.OMIT_ASSIGNMENT # Removed as they are giving 'defined but not used' warnings currently. Priority RejectProblem #.END #.TYPE_RENAME #.FIELD_RENAME DisplayInformation/notificationIndicator displayInformation_notificationIndicator Reject/problem/invoke invokeproblem Action8/invoke action8_invoke #.OMIT_ASSIGNMENT Remote-Operations-Information-Objects Bind Unbind #.END #.PDU ERROR.&ParameterType OPERATION.&ArgumentType OPERATION.&ResultType # This table creates the value_string to name AIN operation codes and errors # in file packet-ain-table.c which is included in the template file # #.TABLE_HDR /* AIN OPERATIONS */ static const value_string ain_opr_code_strings[] = { #.TABLE_BODY OPERATION.&operationCode { %(&operationCode)-40s, "%(_ident)s" }, #.TABLE_FTR { 0, NULL } }; #.END #.TABLE_HDR /* AIN ERRORS */ static const value_string ain_err_code_string_vals[] = { #.TABLE_BODY ERROR.&errorCode { %(&errorCode)-40s, "%(_ident)s" }, #.TABLE_FTR { 0, NULL } }; #.END # This table creates the switch() to branch on AIN operation codes and errors # in file packet-ain-table2.c which is included in the template file # #.TABLE2_HDR static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { switch(opcode){ #.TABLE2_BODY OPERATION.&ArgumentType case %(&operationCode)s: /* %(_ident)s */ offset= %(_argument_pdu)s(tvb, actx->pinfo , tree , NULL); break; #.TABLE2_FTR default: proto_tree_add_expert_format(tree, actx->pinfo, &ei_ain_unknown_invokeData, tvb, offset, -1, "Unknown invokeData %d", opcode); /* todo call the asn.1 dissector */ break; } return offset; } #.END #.TABLE2_HDR static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { switch(opcode){ #.TABLE2_BODY OPERATION.&ResultType case %(&operationCode)s: /* %(_ident)s */ offset= %(_result_pdu)s(tvb, actx->pinfo , tree , NULL); break; #.TABLE2_FTR default: proto_tree_add_expert_format(tree, actx->pinfo, &ei_ain_unknown_returnResultData, tvb, offset, -1, "Unknown returnResultData %d", opcode); } return offset; } #.END #.TABLE2_HDR static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { switch(errorCode) { #.TABLE2_BODY ERROR.&ParameterType case %(&errorCode)s: /* %(_ident)s */ offset= %(_parameter_pdu)s(tvb, actx->pinfo , tree , NULL); break; #.TABLE2_FTR default: proto_tree_add_expert_format(tree, actx->pinfo, &ei_ain_unknown_returnErrorData, tvb, offset, -1, "Unknown returnErrorData %d", opcode); } return offset; } #.END # Create a table of opcode and corresponding args and res #.TABLE11_HDR typedef struct _ain_op_t { int32_t opcode; dissector_t arg_pdu; dissector_t res_pdu; } ain_op_t; static const ain_op_t ain_op_tab[] = { #.TABLE11_BODY OPERATION.&operationCode /* %(_name)-31s */ { %(&operationCode)-40s, %(_argument_pdu)-45s, %(_result_pdu)s }, #.TABLE11_FTR }; #.END #.TABLE11_HDR typedef struct _ain_err_t { int32_t errcode; dissector_t err_pdu; } ain_err_t; static const ain_err_t ain_err_tab[] = { #.TABLE11_BODY ERROR.&errorCode /* %(_name)-30s */ { %(&errorCode)4s, %(_parameter_pdu)s }, #.TABLE11_FTR }; #.END # ROS stuff here XXX change when TCAP is redone. #.FN_BODY Code/local VAL_PTR = &opcode %(DEFAULT_BODY)s if (ain_opcode_type == AIN_OPCODE_RETURN_ERROR){ errorCode = opcode; col_append_str(actx->pinfo->cinfo, COL_INFO, val_to_str(errorCode, ain_err_code_string_vals, "Unknown AIN error (%%u)")); col_append_str(actx->pinfo->cinfo, COL_INFO, " "); col_set_fence(actx->pinfo->cinfo, COL_INFO); }else{ col_append_str(actx->pinfo->cinfo, COL_INFO, val_to_str(opcode, ain_opr_code_strings, "Unknown AIN (%%u)")); col_append_str(actx->pinfo->cinfo, COL_INFO, " "); col_set_fence(actx->pinfo->cinfo, COL_INFO); } #.FN_HDR Invoke ain_opcode_type=AIN_OPCODE_INVOKE; #.FN_HDR ReturnResult ain_opcode_type=AIN_OPCODE_RETURN_RESULT; #.FN_HDR ReturnError ain_opcode_type=AIN_OPCODE_RETURN_ERROR; #.FN_HDR Reject ain_opcode_type=AIN_OPCODE_REJECT; #.FN_BODY Invoke/argument offset = dissect_invokeData(tree, tvb, offset, actx); #.FN_BODY ReturnResult/result/result offset = dissect_returnResultData(tree, tvb, offset, actx); #.FN_BODY ReturnError/parameter offset = dissect_returnErrorData(tree, tvb, offset, actx); # END ROS #.FN_PARS ExtensionParameter/assignmentAuthority FN_VARIANT = _str HF_INDEX = hf_ain_ext_type_oid VAL_PTR = &actx->external.direct_reference #.FN_BODY ExtensionParameter/parameters offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); #.FN_BODY AINDigits VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_ain_digits); proto_tree_add_item(subtree, hf_ain_odd_even_indicator, parameter_tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ain_nature_of_address, parameter_tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ain_numbering_plan, parameter_tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ain_bcd_digits, parameter_tvb, 2, tvb_reported_length_remaining(parameter_tvb, 2), ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN); #.FN_BODY CarrierFormat VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_ain_carrierformat); /* Carrier Selection */ proto_tree_add_item(subtree, hf_ain_carrier_selection, parameter_tvb, 0, 1, ENC_BIG_ENDIAN); /* Nature of Carrier Number of Digits (always 4 )*/ proto_tree_add_item(subtree, hf_ain_nature_of_carrier, parameter_tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ain_nr_digits, parameter_tvb, 1, 1, ENC_BIG_ENDIAN); /* 2nd Digit 1st Digit .. */ proto_tree_add_item(subtree, hf_ain_carrier_bcd_digits, parameter_tvb, 2, tvb_reported_length_remaining(parameter_tvb, 2), ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN); #.FN_BODY AMAslpID VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_ain_amaslpid); proto_tree_add_item(subtree, hf_ain_amaslpid, parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb, 0), ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN); #.FIELD_ATTR DisplayInformation/notificationIndicator ABBREV=displayInformation.notificationIndicator Reject/problem/invoke ABBREV=invokeproblem Action8/invoke ABBREV=action8.invoke #.END # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 2 # tab-width: 8 # indent-tabs-mode: nil # End: # # vi: set shiftwidth=2 tabstop=8 expandtab: # :indentSize=2:tabSize=8:noTabs=true: #