1# inap.cnf
2# inap conformation file
3
4#.IMPORT ../dap/dap-exp.cnf
5#.IMPORT ../dsp/dsp-exp.cnf
6
7#.EXPORTS
8BothwayThroughConnectionInd
9CallingPartysCategory
10CriticalityType
11Duration
12HighLayerCompatibility
13Integer4
14Interval
15LegID
16MiscCallInfo
17RedirectionInformation
18ServiceKey
19
20#.NO_EMIT ONLY_VALS
21ROS
22
23#.OMIT_ASSIGNMENT
24# Removed as they are giving 'defined but not used' warnings currently.
25Priority
26RejectProblem
27#.END
28
29#.TYPE_RENAME
30ReturnResult/result/result          ResultArgument
31
32#.FIELD_RENAME
33Invoke/linkedId/present             inkedIdPresent
34Reject/problem/invoke               invokeProblem
35Reject/problem/returnError          returnErrorProblem
36ReturnResult/result/result          resultArgument
37Reject/problem/returnResult         problemReturnResult
38Trigger/tDPIdentifier               trigger_tDPIdentifier
39InbandInfo/duration                 inbandInfo_duration
40Tone/duration                       tone_duration
41FilteringCharacteristics/interval   filteringCharacteristics_interval
42InbandInfo/interval                 inbandInfo_interval
43ScfTaskRefusedParameter/reason      scfTaskRefusedParameter_reason
44Code/local                          code_local
45
46#.FIELD_ATTR
47Trigger/tDPIdentifier               ABBREV=trigger.tdpidentifier
48InbandInfo/duration                 ABBREV=inbandInfo.duration
49Tone/duration                       ABBREV=tone.duration
50FilteringCharacteristics/interval   ABBREV=filteringCharacteristics.interval
51InbandInfo/interval                 ABBREV=inbandInfo.interval
52ScfTaskRefusedParameter/reason      ABBREV=scfTaskRefusedParameter.reason
53Code/local                          ABBREV=code.local
54
55
56#.OMIT_ASSIGNMENT Remote-Operations-Information-Objects
57Bind
58Unbind
59#.END
60
61#.PDU
62ERROR.&ParameterType
63OPERATION.&ArgumentType
64OPERATION.&ResultType
65
66# This table creates the value_sting to name Inap operation codes and errors
67# in file packet-inap-table.c which is included in the template file
68#
69#.TABLE_HDR
70/* INAP OPERATIONS */
71const value_string inap_opr_code_strings[] = {
72#.TABLE_BODY OPERATION.&operationCode
73  { %(&operationCode)-40s, "%(_ident)s" },
74#.TABLE_FTR
75  { 0, NULL }
76};
77#.END
78
79#.TABLE_HDR
80/* INAP ERRORS */
81static const value_string inap_err_code_string_vals[] = {
82#.TABLE_BODY ERROR.&errorCode
83  { %(&errorCode)-40s, "%(_ident)s" },
84#.TABLE_FTR
85  { 0, NULL }
86};
87#.END
88
89# This table creates the switch() to branch on Camel operation codes and errors
90# in file packet-inap-table2.c which is included in the template file
91#
92#.TABLE2_HDR
93static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
94
95  switch(opcode){
96#.TABLE2_BODY OPERATION.&ArgumentType
97    case %(&operationCode)s:  /* %(_ident)s */
98      offset= %(_argument_pdu)s(tvb, actx->pinfo , tree , NULL);
99      break;
100#.TABLE2_FTR
101    default:
102      proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_invokeData,
103                                   tvb, offset, -1, "Unknown invokeData %d", opcode);
104      /* todo call the asn.1 dissector */
105      break;
106  }
107  return offset;
108}
109#.END
110#.TABLE2_HDR
111static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
112  switch(opcode){
113#.TABLE2_BODY OPERATION.&ResultType
114    case %(&operationCode)s:  /* %(_ident)s */
115      offset= %(_result_pdu)s(tvb, actx->pinfo , tree , NULL);
116      break;
117#.TABLE2_FTR
118  default:
119    proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_returnResultData,
120                                 tvb, offset, -1, "Unknown returnResultData %d", opcode);
121  }
122  return offset;
123}
124#.END
125#.TABLE2_HDR
126static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
127  switch(errorCode) {
128#.TABLE2_BODY ERROR.&ParameterType
129    case %(&errorCode)s:  /* %(_ident)s */
130      offset= %(_parameter_pdu)s(tvb, actx->pinfo , tree , NULL);
131      break;
132#.TABLE2_FTR
133  default:
134    proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_returnErrorData,
135                                 tvb, offset, -1, "Unknown returnErrorData %d", opcode);
136  }
137  return offset;
138}
139#.END
140
141# Create a table of opcode and corresponding args and res
142#.TABLE11_HDR
143typedef struct _inap_op_t {
144  gint32 opcode;
145  dissector_t arg_pdu;
146  dissector_t res_pdu;
147} inap_op_t;
148
149static const inap_op_t inap_op_tab[] = {
150#.TABLE11_BODY OPERATION.&operationCode
151  /* %(_name)-31s */ { %(&operationCode)-40s, %(_argument_pdu)-45s, %(_result_pdu)s },
152#.TABLE11_FTR
153};
154#.END
155
156#.TABLE11_HDR
157typedef struct _inap_err_t {
158  gint32 errcode;
159  dissector_t err_pdu;
160} inap_err_t;
161
162static const inap_err_t inap_err_tab[] = {
163#.TABLE11_BODY ERROR.&errorCode
164  /* %(_name)-30s */ { %(&errorCode)4s, %(_parameter_pdu)s },
165#.TABLE11_FTR
166};
167#.END
168
169# ROS stuff here XXX change when TCAP is redone.
170
171#.FN_BODY Code/local  VAL_PTR = &opcode
172  %(DEFAULT_BODY)s
173    if (inap_opcode_type == INAP_OPCODE_RETURN_ERROR){
174      errorCode = opcode;
175      col_append_str(actx->pinfo->cinfo, COL_INFO, val_to_str(errorCode, inap_err_code_string_vals, "Unknown INAP error (%%u)"));
176      col_append_str(actx->pinfo->cinfo, COL_INFO, " ");
177      col_set_fence(actx->pinfo->cinfo, COL_INFO);
178    }else{
179      col_append_str(actx->pinfo->cinfo, COL_INFO, val_to_str(opcode, inap_opr_code_strings, "Unknown INAP (%%u)"));
180      col_append_str(actx->pinfo->cinfo, COL_INFO, " ");
181      col_set_fence(actx->pinfo->cinfo, COL_INFO);
182    }
183
184#.FN_HDR Invoke
185
186  inap_opcode_type=INAP_OPCODE_INVOKE;
187
188#.FN_HDR ReturnResult
189
190  inap_opcode_type=INAP_OPCODE_RETURN_RESULT;
191
192#.FN_HDR ReturnError
193
194  inap_opcode_type=INAP_OPCODE_RETURN_ERROR;
195
196#.FN_HDR Reject
197
198  inap_opcode_type=INAP_OPCODE_REJECT;
199
200#.FN_BODY Invoke/argument
201
202  offset = dissect_invokeData(tree, tvb, offset, actx);
203
204#.FN_BODY ReturnResult/result/result
205
206  offset = dissect_returnResultData(tree, tvb, offset, actx);
207
208#.FN_BODY ReturnError/parameter
209
210  offset = dissect_returnErrorData(tree, tvb, offset, actx);
211
212# END ROS
213
214
215#.FN_BODY TriggerData/triggerPar
216/* FIX ME */
217
218#.FN_BODY ScriptEventArg/uIScriptResult
219/* FIX ME */
220
221#.FN_BODY ScriptCloseArg/uIScriptSpecificInfo
222/* FIX ME */
223
224#.FN_BODY ScriptInformationArg/uIScriptSpecificInfo
225/* FIX ME */
226#.FN_BODY ScriptRunArg/uIScriptSpecificInfo
227/* FIX ME */
228
229#.FN_HDR ExtensionField
230  obj_id = NULL;
231
232#.FN_PARS Code/global FN_VARIANT = _str  VAL_PTR = &obj_id
233
234#.FN_BODY ExtensionField/value
235  proto_tree *ext_tree;
236  ext_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_inap_extension_data, NULL, "Extension Data");
237  if (obj_id){
238    offset=call_ber_oid_callback(obj_id, tvb, offset, actx->pinfo, ext_tree, NULL);
239  }else{
240    call_data_dissector(tvb, actx->pinfo, ext_tree);
241    offset = tvb_reported_length_remaining(tvb,offset);
242  }
243
244
245
246#.FN_BODY CalledPartyNumber VAL_PTR = &parameter_tvb
247  tvbuff_t *parameter_tvb;
248
249%(DEFAULT_BODY)s
250
251  if (!parameter_tvb)
252  return offset;
253
254dissect_isup_called_party_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);
255
256#.FN_BODY CallingPartyNumber VAL_PTR = &parameter_tvb
257  tvbuff_t *parameter_tvb;
258
259%(DEFAULT_BODY)s
260
261  if (!parameter_tvb)
262    return offset;
263
264  dissect_isup_calling_party_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);
265
266
267#.FN_BODY BearerCapability/bearerCap VAL_PTR = &parameter_tvb
268
269  tvbuff_t *parameter_tvb;
270
271%(DEFAULT_BODY)s
272
273  if (!parameter_tvb)
274    return offset;
275
276  dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), tree);
277
278#.FN_BODY RedirectionInformation VAL_PTR = &parameter_tvb
279
280  tvbuff_t *parameter_tvb;
281  proto_tree *subtree;
282
283%(DEFAULT_BODY)s
284
285  if (!parameter_tvb)
286    return offset;
287
288 subtree = proto_item_add_subtree(actx->created_item, ett_inap_RedirectionInformation);
289 dissect_isup_redirection_information_parameter(parameter_tvb, subtree, NULL);
290
291#.FN_BODY OriginalCalledPartyID VAL_PTR = &parameter_tvb
292
293  tvbuff_t *parameter_tvb;
294
295%(DEFAULT_BODY)s
296
297  if (!parameter_tvb)
298    return offset;
299
300  dissect_isup_original_called_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);
301
302#.FN_BODY RedirectingPartyID VAL_PTR = &parameter_tvb
303
304  tvbuff_t *parameter_tvb;
305
306%(DEFAULT_BODY)s
307
308  if (!parameter_tvb)
309    return offset;
310
311   dissect_isup_redirecting_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);
312
313#.FN_BODY HighLayerCompatibility VAL_PTR = &parameter_tvb
314/*
315 * -- Indicates the teleservice. For encoding, DSS1 (Q.931) is used.
316 */
317 tvbuff_t       *parameter_tvb;
318 proto_tree     *subtree;
319%(DEFAULT_BODY)s
320
321  if (!parameter_tvb)
322    return offset;
323
324  subtree = proto_item_add_subtree(actx->created_item, ett_inap_HighLayerCompatibility);
325  dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), subtree);
326
327  #.FN_BODY Cause VAL_PTR = &parameter_tvb
328  /*
329   * -- Indicates the cause for interface related information. Refer to the Q.763 Cause  parameter for encoding
330   * -- For the use of cause and location values refer to Q.850.
331   */
332  tvbuff_t *parameter_tvb;
333  guint8 Cause_value;
334  proto_tree *subtree;
335
336%(DEFAULT_BODY)s
337
338  if (!parameter_tvb)
339    return offset;
340  subtree = proto_item_add_subtree(actx->created_item, ett_inap_cause);
341
342  dissect_q931_cause_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), subtree, hf_inap_cause_indicator, &Cause_value, isup_parameter_type_value);
343
344#.FN_BODY Digits VAL_PTR = &parameter_tvb
345  /*
346   *-- Indicates the address signalling digits. Refer to the Q.763 Generic Number and Generic Digits parameter
347   *-- for encoding. The coding of the subfield's 'NumberQualifier' in Generic Number and 'TypeOfDigits' in
348   *-- Generic Digits are irrelevant to the INAP, the ASN.1 tags are sufficient to identify the parameter.
349   *-- The ISUP format does not allow to exclude these subfields, therefore the value is network operator specific.
350   *-- The following parameters should use Generic Number
351   *-- Additional Calling Number, CorrelationID for AssistRequestInstructions, AssistingSSPIPRoutingAddress
352   *--  for EstablishTemporaryConnection
353   *-- calledAddressValue for all occurrences,callingAddressValue for all occurrences
354   *-- The following parameters should use Generic Digits: prefix, all
355   *-- other CorrelationID occurrences, dialledNumber filtering criteria, callingLineID filtering criteria, lineID for
356   *-- ResourceID type, digitResponse for ReceivedInformationArg, iNServiceControlLow / iNServiceControlHigh for
357   *--MidCallInfoType,, iNServiceControlCode for MidCallInfo.
358   */
359  tvbuff_t *parameter_tvb;
360  proto_tree *subtree;
361  gint ett = -1;
362  gboolean digits = FALSE;
363
364  %(DEFAULT_BODY)s
365
366  if (!parameter_tvb)
367    return offset;
368
369  if (hf_index == hf_inap_additionalCallingPartyNumber) {
370    ett = ett_inap_additionalCallingPartyNumber;
371  } else if (hf_index == hf_inap_assistingSSPIPRoutingAddress) {
372    ett = ett_inap_assistingSSPIPRoutingAddress;
373  } else if (hf_index == hf_inap_correlationID) {
374    ett = ett_inap_correlationID;
375    digits = (opcode != opcode_assistRequestInstructions) ? TRUE : FALSE;
376  } else if (hf_index == hf_inap_calledAddressValue) {
377    ett = ett_inap_calledAddressValue;
378  } else if (hf_index == hf_inap_callingAddressValue) {
379    ett = ett_inap_callingAddressValue;
380  } else if (hf_index == hf_inap_number) {
381    ett = ett_inap_number;
382  } else if (hf_index == hf_inap_dialledNumber) {
383    ett = ett_inap_dialledNumber;
384    digits = TRUE;
385  } else if (hf_index == hf_inap_callingLineID) {
386    ett = ett_inap_callingLineID;
387    digits = TRUE;
388  } else if (hf_index == hf_inap_iNServiceControlCode) {
389    ett = ett_inap_iNServiceControlCode;
390    digits = TRUE;
391  } else if (hf_index == hf_inap_iNServiceControlCodeLow) {
392    ett = ett_inap_iNServiceControlCodeLow;
393    digits = TRUE;
394  } else if (hf_index == hf_inap_iNServiceControlCodeHigh) {
395    ett = ett_inap_iNServiceControlCodeHigh;
396    digits = TRUE;
397  } else if (hf_index == hf_inap_lineID) {
398    ett = ett_inap_lineID;
399    digits = TRUE;
400  } else if (hf_index == hf_inap_prefix) {
401    ett = ett_inap_prefix;
402    digits = TRUE;
403  } else if (hf_index == hf_inap_iPAddressValue) {
404    ett = ett_inap_iPAddressValue;
405  } else if (hf_index == hf_inap_digitsResponse) {
406    ett = ett_inap_digitsResponse;
407    digits = TRUE;
408  }
409
410  subtree = proto_item_add_subtree(actx->created_item, ett);
411  if (digits) {
412    dissect_isup_generic_digits_parameter(parameter_tvb, subtree, NULL);
413  } else {
414    dissect_isup_generic_number_parameter(parameter_tvb, actx->pinfo, subtree, NULL);
415  }
416#.END
417
418#.TYPE_ATTR
419CallingPartysCategory TYPE = FT_UINT16  DISPLAY = BASE_DEC|BASE_EXT_STRING  STRINGS = &isup_calling_partys_category_value_ext
420
421#.END
422
423#
424# Editor modelines  -  https://www.wireshark.org/tools/modelines.html
425#
426# Local variables:
427# c-basic-offset: 2
428# tab-width: 8
429# indent-tabs-mode: nil
430# End:
431#
432# vi: set shiftwidth=2 tabstop=8 expandtab:
433# :indentSize=2:tabSize=8:noTabs=true:
434#
435