aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/inap/inap.cnf
blob: 70ad1ac479f78b75e3ec99e0496adbd20183a11d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# inap.cnf
# inap conformation file

#.IMPORT ../dap/dap-exp.cnf
#.IMPORT ../dsp/dsp-exp.cnf

#.EXPORTS
BothwayThroughConnectionInd
CallingPartysCategory
CriticalityType
Duration
HighLayerCompatibility
Integer4
Interval
LegID
MiscCallInfo
RedirectionInformation
ServiceKey

#.NO_EMIT ONLY_VALS
ROS

#.OMIT_ASSIGNMENT
# Removed as they are giving 'defined but not used' warnings currently.
Priority
RejectProblem
#.END

#.TYPE_RENAME
ReturnResult/result/result		ResultArgument

#.FIELD_RENAME
Invoke/linkedId/present			linkedIdPresent
Reject/problem/invoke			invokeProblem
Reject/problem/returnError		returnErrorProblem
ReturnResult/result/result		resultArgument
Reject/problem/returnResult		problemReturnResult

#.OMIT_ASSIGNMENT Remote-Operations-Information-Objects
Bind
Unbind
#.END

#.PDU
ERROR.&ParameterType
OPERATION.&ArgumentType
OPERATION.&ResultType

# This table creates the value_sting to name Inap operation codes and errors
# in file packet-inap-table.c which is included in the template file
#
#.TABLE_HDR
/* INAP OPERATIONS */
const value_string inap_opr_code_strings[] = {
#.TABLE_BODY OPERATION.&operationCode
  { %(&operationCode)-40s, "%(_ident)s" },
#.TABLE_FTR
  { 0, NULL }
};
#.END

#.TABLE_HDR
/* INAP ERRORS */
static const value_string inap_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 Camel operation codes and errors
# in file packet-inap-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_inap_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_inap_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_inap_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 _inap_op_t {
  gint32 opcode;
  dissector_t arg_pdu;
  dissector_t res_pdu;
} inap_op_t;

static const inap_op_t inap_op_tab[] = {
#.TABLE11_BODY OPERATION.&operationCode
  /* %(_name)-31s */ { %(&operationCode)-40s, %(_argument_pdu)-45s, %(_result_pdu)s },
#.TABLE11_FTR
};
#.END

#.TABLE11_HDR
typedef struct _inap_err_t {
  gint32 errcode;
  dissector_t err_pdu;
} inap_err_t;

static const inap_err_t inap_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 (inap_opcode_type == INAP_OPCODE_RETURN_ERROR){
      errorCode = opcode;
      col_append_str(actx->pinfo->cinfo, COL_INFO, val_to_str(errorCode, inap_err_code_string_vals, "Unknown INAP 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, inap_opr_code_strings, "Unknown INAP (%%u)"));
      col_append_str(actx->pinfo->cinfo, COL_INFO, " ");
      col_set_fence(actx->pinfo->cinfo, COL_INFO);
    }

#.FN_HDR Invoke

  inap_opcode_type=INAP_OPCODE_INVOKE;

#.FN_HDR ReturnResult

  inap_opcode_type=INAP_OPCODE_RETURN_RESULT;

#.FN_HDR ReturnError

  inap_opcode_type=INAP_OPCODE_RETURN_ERROR;

#.FN_HDR Reject

  inap_opcode_type=INAP_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_BODY TriggerData/triggerPar
/* FIX ME */

#.FN_BODY ScriptEventArg/uIScriptResult
/* FIX ME */

#.FN_BODY ScriptCloseArg/uIScriptSpecificInfo
/* FIX ME */

#.FN_BODY ScriptInformationArg/uIScriptSpecificInfo
/* FIX ME */
#.FN_BODY ScriptRunArg/uIScriptSpecificInfo
/* FIX ME */

#.FN_HDR ExtensionField
  obj_id = NULL;

#.FN_PARS Code/global FN_VARIANT = _str  VAL_PTR = &obj_id

#.FN_BODY ExtensionField/value
  proto_tree *ext_tree;
  ext_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_inap_extension_data, NULL, "Extension Data");
  if (obj_id){
    offset=call_ber_oid_callback(obj_id, tvb, offset, actx->pinfo, ext_tree, NULL);
  }else{
    call_data_dissector(tvb, actx->pinfo, ext_tree);
    offset = tvb_reported_length_remaining(tvb,offset);
  }



#.FN_BODY CalledPartyNumber VAL_PTR = &parameter_tvb
  tvbuff_t *parameter_tvb;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
  return offset;

dissect_isup_called_party_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);

#.FN_BODY CallingPartyNumber VAL_PTR = &parameter_tvb
  tvbuff_t *parameter_tvb;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  dissect_isup_calling_party_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);


#.FN_BODY BearerCapability/bearerCap VAL_PTR = &parameter_tvb

  tvbuff_t *parameter_tvb;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), tree);

#.FN_BODY RedirectionInformation VAL_PTR = &parameter_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_inap_RedirectionInformation);
 dissect_isup_redirection_information_parameter(parameter_tvb, subtree, NULL);

#.FN_BODY OriginalCalledPartyID VAL_PTR = &parameter_tvb

  tvbuff_t *parameter_tvb;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  dissect_isup_original_called_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);

#.FN_BODY RedirectingPartyID VAL_PTR = &parameter_tvb

  tvbuff_t *parameter_tvb;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

   dissect_isup_redirecting_number_parameter(parameter_tvb, actx->pinfo, tree, NULL);

#.FN_BODY HighLayerCompatibility VAL_PTR = &parameter_tvb
/*
 * -- Indicates the teleservice. For encoding, DSS1 (Q.931) is used.
 */
 tvbuff_t       *parameter_tvb;
 proto_tree     *subtree;
%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  subtree = proto_item_add_subtree(actx->created_item, ett_inap_HighLayerCompatibility);
  dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), subtree);

  #.FN_BODY Cause VAL_PTR = &parameter_tvb
  /*
   * -- Indicates the cause for interface related information. Refer to the Q.763 Cause  parameter for encoding
   * -- For the use of cause and location values refer to Q.850.
   */
  tvbuff_t *parameter_tvb;
  guint8 Cause_value;
  proto_tree *subtree;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_inap_cause);

  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);

#.FN_BODY Digits VAL_PTR = &parameter_tvb
  /*
   *-- Indicates the address signalling digits. Refer to the Q.763 Generic Number and Generic Digits parameter
   *-- for encoding. The coding of the subfield's 'NumberQualifier' in Generic Number and 'TypeOfDigits' in
   *-- Generic Digits are irrelevant to the INAP, the ASN.1 tags are sufficient to identify the parameter.
   *-- The ISUP format does not allow to exclude these subfields, therefore the value is network operator specific.
   *-- The following parameters should use Generic Number
   *-- Additional Calling Number, CorrelationID for AssistRequestInstructions, AssistingSSPIPRoutingAddress
   *--  for EstablishTemporaryConnection
   *-- calledAddressValue for all occurrences,callingAddressValue for all occurrences
   *-- The following parameters should use Generic Digits: prefix, all
   *-- other CorrelationID occurrences, dialledNumber filtering criteria, callingLineID filtering criteria, lineID for
   *-- ResourceID type, digitResponse for ReceivedInformationArg, iNServiceControlLow / iNServiceControlHigh for
   *--MidCallInfoType,, iNServiceControlCode for MidCallInfo.
   */
  tvbuff_t *parameter_tvb;
  proto_tree *subtree;
  gint ett = -1;
  gboolean digits = FALSE;

  %(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  if (hf_index == hf_inap_additionalCallingPartyNumber) {
    ett = ett_inap_additionalCallingPartyNumber;
  } else if (hf_index == hf_inap_assistingSSPIPRoutingAddress) {
    ett = ett_inap_assistingSSPIPRoutingAddress;
  } else if (hf_index == hf_inap_correlationID) {
    ett = ett_inap_correlationID;
    digits = (opcode != opcode_assistRequestInstructions) ? TRUE : FALSE;
  } else if (hf_index == hf_inap_calledAddressValue) {
    ett = ett_inap_calledAddressValue;
  } else if (hf_index == hf_inap_callingAddressValue) {
    ett = ett_inap_callingAddressValue;
  } else if (hf_index == hf_inap_number) {
    ett = ett_inap_number;
  } else if (hf_index == hf_inap_dialledNumber) {
    ett = ett_inap_dialledNumber;
    digits = TRUE;
  } else if (hf_index == hf_inap_callingLineID) {
    ett = ett_inap_callingLineID;
    digits = TRUE;
  } else if (hf_index == hf_inap_iNServiceControlCode) {
    ett = ett_inap_iNServiceControlCode;
    digits = TRUE;
  } else if (hf_index == hf_inap_iNServiceControlCodeLow) {
    ett = ett_inap_iNServiceControlCodeLow;
    digits = TRUE;
  } else if (hf_index == hf_inap_iNServiceControlCodeHigh) {
    ett = ett_inap_iNServiceControlCodeHigh;
    digits = TRUE;
  } else if (hf_index == hf_inap_lineID) {
    ett = ett_inap_lineID;
    digits = TRUE;
  } else if (hf_index == hf_inap_prefix) {
    ett = ett_inap_prefix;
    digits = TRUE;
  } else if (hf_index == hf_inap_iPAddressValue) {
    ett = ett_inap_iPAddressValue;
  } else if (hf_index == hf_inap_digitsResponse) {
    ett = ett_inap_digitsResponse;
    digits = TRUE;
  }

  subtree = proto_item_add_subtree(actx->created_item, ett);
  if (digits) {
    dissect_isup_generic_digits_parameter(parameter_tvb, subtree, NULL);
  } else {
    dissect_isup_generic_number_parameter(parameter_tvb, actx->pinfo, subtree, NULL);
  }
#.END

#.TYPE_ATTR
CallingPartysCategory TYPE = FT_UINT16  DISPLAY = BASE_DEC|BASE_EXT_STRING  STRINGS = &isup_calling_partys_category_value_ext

#.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:
#