summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/tcap/tcap.cnf
blob: 3b8abe511c95f57b67feaef8b28614035dadeff2 (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
# tcap.cnf
# tcap conformation file

#.OMIT_ASSIGNMENT
RLRQ-apdu
RLRE-apdu
Release-request-reason
Release-response-reason
ERROR
#.END

#.MODULE_IMPORT

#.EXPORTS
DialoguePDU
UniDialoguePDU

#.REGISTER
DialoguePDU    B "0.0.17.773.1.1.1"  "id-as-dialogue"
UniDialoguePDU B "0.0.17.773.1.2.1"  "id-as-uniDialogue"

#.PDU


#.NO_EMIT ONLY_VALS
TCMessage

#.NO_EMIT

#.TYPE_RENAME
AUDT-apdu/_untag/protocol-version AUDT_protocol_version
AARQ-apdu/_untag/protocol-version AARQ_protocol_version
AARE-apdu/_untag/protocol-version AARE_protocol_version

AARE-apdu/_untag/application-context-name AARE_application_context_name
AARQ-apdu/_untag/application-context-name AARQ_application_context_name
AUDT-apdu/_untag/application-context-name AUDT_application_context_name

AARQ-apdu/_untag/user-information AARQ_user_information
AARE-apdu/_untag/user-information AARE_user_information
ABRT-apdu/_untag/user-information ABRT_user_information
AUDT-apdu/_untag/user-information AUDT_user_information

#.FIELD_RENAME
AUDT-apdu/_untag/protocol-version audt_protocol_version
AARQ-apdu/_untag/protocol-version aarq_protocol_version
AARE-apdu/_untag/protocol-version aare_protocol_version

AARQ-apdu/_untag/application-context-name aarq_application_context_name
AARE-apdu/_untag/application-context-name aare_application_context_name
AUDT-apdu/_untag/application-context-name audt_application_context_name

AARQ-apdu/_untag/user-information aarq_user_information
AARE-apdu/_untag/user-information aare_user_information
AUDT-apdu/_untag/user-information audt_user_information
ABRT-apdu/_untag/user-information abrt_user_information
#.END


#----------------------------------------------------------------------------------------
#.FN_BODY DialogueOC

  offset = dissect_tcap_ExternalPDU(false /*implicit_tag*/, tvb, offset, actx, tree, -1);

#----------------------------------------------------------------------------------------
#.FN_BODY ExternalPDU

%(DEFAULT_BODY)s

#----------------------------------------------------------------------------------------
#.FN_BODY Dialog1

  offset = dissect_tcap_DialoguePDU(true, tvb, offset, actx, tree, -1);

#----------------------------------------------------------------------------------------
#.FN_BODY Parameter

  offset = dissect_tcap_param(actx,tree,tvb,offset);

#----------------------------------------------------------------------------------------
#.FN_BODY Component
  tvbuff_t *next_tvb;
  int8_t ber_class;
  bool pc;
  int tag;
  uint32_t len, comp_offset;
  volatile uint32_t _offset;
  bool ind_field;

  comp_offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag);
  comp_offset = dissect_ber_length(actx->pinfo, tree, tvb, comp_offset, &len, &ind_field);
  /* we can believe the length now */
  next_tvb = tvb_new_subset_length(tvb, offset, len+comp_offset-offset);

  if (!next_tvb)
    return comp_offset;
  if(dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index)){
    return comp_offset;
  }

  _offset = offset;
  TRY {
    _offset = dissect_ber_choice(actx, tree, tvb, _offset,
                                 Component_choice, hf_index, ett_tcap_Component,
                                 NULL);
  }
  CATCH_NONFATAL_ERRORS {
    show_exception(tvb, actx->pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
  }
  ENDTRY;
  offset = _offset;

/* return comp_offset+len; or return offset (will be automatically added) */

#----------------------------------------------------------------------------------------
#.FN_BODY AUDT-apdu/_untag/application-context-name  FN_VARIANT = _str  VAL_PTR = &cur_oid
  struct tcap_private_t *p_tcap_private = (struct tcap_private_t*)actx->value_ptr;
%(DEFAULT_BODY)s
  if (p_tcap_private) {
    p_tcap_private->oid= (const void*) cur_oid;
    p_tcap_private->acv=true;
  }
#----------------------------------------------------------------------------------------
#.FN_BODY AARQ-apdu/_untag/application-context-name  FN_VARIANT = _str  VAL_PTR = &cur_oid
  struct tcap_private_t *p_tcap_private = (struct tcap_private_t*)actx->value_ptr;
%(DEFAULT_BODY)s
  if (p_tcap_private) {
    p_tcap_private->oid= (const void*) cur_oid;
    p_tcap_private->acv=true;
  }
#----------------------------------------------------------------------------------------
#.FN_BODY AARE-apdu/_untag/application-context-name  FN_VARIANT = _str  VAL_PTR = &cur_oid
  struct tcap_private_t *p_tcap_private = (struct tcap_private_t*)actx->value_ptr;
%(DEFAULT_BODY)s
  if (p_tcap_private) {
    p_tcap_private->oid= (const void*) cur_oid;
    p_tcap_private->acv=true;
  }
#----------------------------------------------------------------------------------------
#.FN_BODY OrigTransactionID
  tvbuff_t *parameter_tvb;
  uint8_t len, i;
  proto_tree *subtree;
  int saved_offset;
  struct tcap_private_t *p_tcap_private = (struct tcap_private_t*)actx->value_ptr;

  hf_index = hf_tcap_tid;
  saved_offset = offset;
%(DEFAULT_BODY)s
  proto_item_set_generated(actx->created_item);
  offset = saved_offset;

  subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_otid, NULL, "Source Transaction ID");
  offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_otid,
                                    &parameter_tvb);

  if (parameter_tvb) {
    len = tvb_reported_length_remaining(parameter_tvb, 0);
    switch(len) {
    case 1:
      gp_tcapsrt_info->src_tid=tvb_get_uint8(parameter_tvb, 0);
      break;
    case 2:
      gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0);
      break;
    case 3:
      gp_tcapsrt_info->src_tid=tvb_get_ntoh24(parameter_tvb, 0);
      break;
    case 4:
      gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0);
      break;
    default:
      gp_tcapsrt_info->src_tid=0;
      break;
    }
    if (p_tcap_private)
      p_tcap_private->src_tid = gp_tcapsrt_info->src_tid;

    if (len) {
      col_append_str(actx->pinfo->cinfo, COL_INFO, "otid(");
      for (i = 0; i < len; i++) {
        col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%02x",tvb_get_uint8(parameter_tvb,i));
      }
      col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
    }
  }

#----------------------------------------------------------------------------------------
#.FN_BODY DestTransactionID
  tvbuff_t *parameter_tvb;
  uint8_t len , i;
  proto_tree *subtree;
  int saved_offset;
  struct tcap_private_t *p_tcap_private = (struct tcap_private_t*)actx->value_ptr;

  hf_index = hf_tcap_tid;
  saved_offset = offset;
%(DEFAULT_BODY)s
  proto_item_set_generated(actx->created_item);
  offset = saved_offset;

  subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dtid, NULL, "Destination Transaction ID");
  offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_dtid,
                                    &parameter_tvb);

  if (parameter_tvb) {
    len = tvb_reported_length_remaining(parameter_tvb, 0);
    switch(len) {
    case 1:
      gp_tcapsrt_info->dst_tid=tvb_get_uint8(parameter_tvb, 0);
      break;
    case 2:
      gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0);
      break;
    case 3:
      gp_tcapsrt_info->dst_tid=tvb_get_ntoh24(parameter_tvb, 0);
      break;
    case 4:
      gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0);
      break;
    default:
      gp_tcapsrt_info->dst_tid=0;
      break;
    }
    if (p_tcap_private)
      p_tcap_private->dst_tid = gp_tcapsrt_info->dst_tid;

    if (len) {
      col_append_str(actx->pinfo->cinfo, COL_INFO, "dtid(");
      for(i = 0; i < len; i++) {
        col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%02x",tvb_get_uint8(parameter_tvb,i));
      }
      col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
    }
  }
#.FN_HDR Begin
gp_tcapsrt_info->ope=TC_BEGIN;

/*  Do not change col_add_str() to col_append_str() here: we _want_ this call
 *  to overwrite whatever's currently in the INFO column (e.g., "UDT" from
 *  the SCCP dissector).
 *
 *  If there's something there that should not be overwritten, whoever
 *  put that info there should call col_set_fence() to protect it.
 */
  col_set_str(actx->pinfo->cinfo, COL_INFO, "Begin ");
#.END


#.FN_HDR End
gp_tcapsrt_info->ope=TC_END;

  col_set_str(actx->pinfo->cinfo, COL_INFO, "End ");
#.END


#.FN_HDR Continue
gp_tcapsrt_info->ope=TC_CONT;

  col_set_str(actx->pinfo->cinfo, COL_INFO, "Continue ");
#.END


#.FN_HDR Abort
gp_tcapsrt_info->ope=TC_ABORT;

  col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort ");
#.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:
#