Coverage Report

Created: 2026-05-14 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-forces.c
Line
Count
Source
1
/* packet-forces.c
2
 * RFC 5810
3
 * Routines for dissecting IETF ForCES protocol layer messages.Now support the following TML types:TCP+UDP,SCTP.
4
 * Copyright 2009, NDSC & Zhejiang Gongshang University,Fenggen Jia <fgjia@mail.zjgsu.edu.cn or fenggen.jia@gmail.com>
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
#include "config.h"
14
15
#include <epan/packet.h>
16
#include <epan/prefs.h>
17
#include <epan/expert.h>
18
#include <epan/unit_strings.h>
19
20
void proto_register_forces(void);
21
void proto_reg_handoff_forces(void);
22
23
static dissector_handle_t  forces_handle_tcp, forces_handle;
24
25
static dissector_handle_t ip_handle;
26
27
/* Initialize the ForCES protocol and registered fields */
28
static int proto_forces;
29
30
/*Main header*/
31
static int hf_forces_version;
32
static int hf_forces_rsvd;
33
static int hf_forces_messagetype;
34
static int hf_forces_sid;
35
static int hf_forces_did;
36
static int hf_forces_correlator;
37
static int hf_forces_length;
38
/*Flags*/
39
static int hf_forces_flags;
40
static int hf_forces_flags_ack;
41
static int hf_forces_flags_pri;
42
static int hf_forces_flags_rsrvd;
43
static int hf_forces_flags_em;
44
static int hf_forces_flags_at;
45
static int hf_forces_flags_tp;
46
static int hf_forces_flags_reserved;
47
48
static int hf_forces_tlv_type;
49
static int hf_forces_tlv_length;
50
51
/*Initiation of LFBSelect TLV*/
52
static int hf_forces_lfbselect_tlv_type_lfb_classid;
53
static int hf_forces_lfbselect_tlv_type_lfb_instanceid;
54
55
/*Initiation of Operation TLV*/
56
static int hf_forces_lfbselect_tlv_type_operation_type;
57
static int hf_forces_lfbselect_tlv_type_operation_length;
58
static int hf_forces_lfbselect_tlv_type_operation_path_type;
59
static int hf_forces_lfbselect_tlv_type_operation_path_length;
60
static int hf_forces_lfbselect_tlv_type_operation_path_flags;
61
static int hf_forces_lfbselect_tlv_type_operation_path_flags_selector;
62
static int hf_forces_lfbselect_tlv_type_operation_path_flags_reserved;
63
static int hf_forces_lfbselect_tlv_type_operation_path_IDcount;
64
static int hf_forces_lfbselect_tlv_type_operation_path_IDs;
65
static int hf_forces_lfbselect_tlv_type_operation_path_data;
66
67
/*Initiation of Redirect TLV*/
68
static int hf_forces_redirect_tlv_meta_data_tlv_type;
69
static int hf_forces_redirect_tlv_meta_data_tlv_length;
70
static int hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv;
71
static int hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_id;
72
static int hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length;
73
static int hf_forces_redirect_tlv_redirect_data_tlv_type;
74
static int hf_forces_redirect_tlv_redirect_data_tlv_length;
75
76
/*Initiation of ASResult TLV*/
77
static int hf_forces_asresult_association_setup_result;
78
79
/*Initiation of ASTreason TLV*/
80
static int hf_forces_astreason_tlv_teardown_reason;
81
82
/*Main TLV may be unknown*/
83
static int hf_forces_unknown_tlv;
84
85
/*Message Types */
86
#define AssociationSetup            0x01
87
#define AssociationTeardown         0x02
88
#define Config                      0x03
89
#define Query                       0x04
90
#define EventNotification           0x05
91
#define PacketRedirect              0x06
92
#define Heartbeat                   0x0F
93
#define AssociationSetupResponse    0x11
94
#define ConfigResponse              0x13
95
#define QueryResponse               0x14
96
97
/*TLV Types*/
98
#define Reserved            0x0000
99
0
#define REDIRECT_TLV        0x0001
100
0
#define ASResult_TLV        0x0010
101
0
#define ASTreason_TLV       0x0011
102
0
#define LFBselect_TLV       0x1000
103
0
#define PATH_DATA_TLV       0x0110
104
#define KEYINFO_TLV         0x0111
105
#define FULLDATA_TLV        0x0112
106
#define SPARSEDATA_TLV      0x0113
107
#define RESULT_TLV          0x0114
108
#define METADATA_TLV        0x0115
109
#define REDIRECTDATA_TLV    0x0116
110
111
/*Operation Type*/
112
#define Reserved            0x0000
113
#define SET                 0x0001
114
#define SET_PROP            0x0002
115
#define SET_RESPONSE        0x0003
116
#define SET_PROP_RESPONSE   0x0004
117
#define DEL                 0x0005
118
#define DEL_RESPONSE        0x0006
119
#define GET                 0x0007
120
#define GET_PROP            0x0008
121
#define GET_RESPONSE        0x0009
122
#define GET_PROP_RESPONSE   0x000A
123
#define REPORT              0x000B
124
#define COMMIT              0x000C
125
#define COMMIT_RESPONSE     0x000D
126
#define TRCOMP              0x000E
127
128
0
#define FLAG_SELECTOR       0x8000
129
130
0
#define ForCES_HEADER_LENGTH    24
131
0
#define TLV_TL_LENGTH            4 /*Type+length*/
132
0
#define MIN_IP_HEADER_LENGTH    20
133
134
/*For TCP+UDP TML. There are two bytes added to the ForCES PL message, not strictly combine to the ForCES protocol.
135
  For other type TMLs,no need to add these 2 bytes.*/
136
0
#define TCP_UDP_TML_FOCES_MESSAGE_OFFSET_TCP    2
137
138
/*SCTP TML*/
139
static unsigned forces_alternate_sctp_high_prio_channel_port;
140
static unsigned forces_alternate_sctp_med_prio_channel_port;
141
static unsigned forces_alternate_sctp_low_prio_channel_port;
142
143
/*Initialize the subtree pointers*/
144
static int   ett_forces;
145
static int   ett_forces_main_header;
146
static int   ett_forces_flags;
147
static int   ett_forces_tlv;
148
static int   ett_forces_lfbselect_tlv_type;
149
150
/*Operation TLV subtree*/
151
static int   ett_forces_lfbselect_tlv_type_operation;
152
static int   ett_forces_lfbselect_tlv_type_operation_path;
153
static int   ett_forces_lfbselect_tlv_type_operation_path_data;
154
static int   ett_forces_lfbselect_tlv_type_operation_path_data_path;
155
static int   ett_forces_path_data_tlv;
156
static int   ett_forces_path_data_tlv_flags;
157
158
/*Selector subtree*/
159
static int   ett_forces_lfbselect_tlv_type_operation_path_selector;
160
161
/*Redirect TLV subtree*/
162
static int   ett_forces_redirect_tlv_type;
163
static int   ett_forces_redirect_tlv_meta_data_tlv;
164
static int   ett_forces_redirect_tlv_meta_data_tlv_meta_data_ilv;
165
static int   ett_forces_redirect_tlv_redirect_data_tlv;
166
167
/*ASResult TLV subtree*/
168
static int   ett_forces_asresult_tlv;
169
170
/*ASReason subtree*/
171
static int   ett_forces_astreason_tlv;
172
173
/*Main_TLV unknown subtree*/
174
static int   ett_forces_unknown_tlv;
175
176
177
static expert_field ei_forces_length;
178
static expert_field ei_forces_tlv_type;
179
static expert_field ei_forces_tlv_length;
180
static expert_field ei_forces_lfbselect_tlv_type_operation_path_length;
181
static expert_field ei_forces_lfbselect_tlv_type_operation_type;
182
static expert_field ei_forces_redirect_tlv_redirect_data_tlv_length;
183
184
/*ACK values and the strings to be displayed*/
185
static const value_string main_header_flags_ack_vals[] = {
186
    { 0x0, "NoACK" },
187
    { 0x1, "SuccessACK" },
188
    { 0x2, "FailureACK" },
189
    { 0x3, "AlwaysACK" },
190
    { 0, NULL}
191
};
192
193
/*Execution mode(EM) values and the strings to be displayed*/
194
static const value_string main_header_flags_em_vals[] = {
195
    { 0x0, "Reserved" },
196
    { 0x1, "Execute-all-or-none" },
197
    { 0x2, "Execute-until-failure" },
198
    { 0x3, "Continue-execute-on-failure" },
199
    { 0, NULL}
200
};
201
202
/*Transaction Phase values and the strings to be displayed*/
203
static const value_string main_header_flags_tp_vals[] = {
204
    { 0x0, "SOT (Start of Transaction)" },
205
    { 0x1, "MOT (Middle of Transaction)" },
206
    { 0x2, "EOT (End of Transaction)" },
207
    { 0x3, "ABT (Abort)" },
208
    { 0, NULL}
209
};
210
211
/*Atomic Transaction(AT) values and the strings to be displayed*/
212
static const value_string main_header_flags_at_vals[] = {
213
    { 0x0, "Stand-alone Message"},
214
    { 0x1, "2PC Transaction Message"},
215
    { 0, NULL}
216
};
217
218
/*Association Setup Result*/
219
static const value_string association_setup_result_at_vals[] = {
220
    { 0x0, "success"},
221
    { 0x1, "FE ID invalid"},
222
    { 0x2, "permission denied"},
223
    { 0, NULL},
224
};
225
226
/*Teardown Reason*/
227
static const value_string teardown_reason_at_vals[] = {
228
    { 0x0,   "normal-teardown by administrator"},
229
    { 0x1,   "error - loss of heartbeats"},
230
    { 0x2,   "error - out of bandwidth"},
231
    { 0x3,   "error - out of memory"},
232
    { 0x4,   "error - application crash"},
233
    { 0x255, "error - other or unspecified"},
234
    { 0,     NULL},
235
};
236
237
static const value_string message_type_vals[] = {
238
    { AssociationSetup,         "AssociationSetup" },
239
    { AssociationTeardown,      "AssociationTeardown" },
240
    { Config,                   "Config" },
241
    { Query,                    "Query" },
242
    { EventNotification,        "EventNotification" },
243
    { PacketRedirect,           "PacketRedirect" },
244
    { Heartbeat,                "Heartbeat" },
245
    { AssociationSetupResponse, "AssociationSetupResponse" },
246
    { ConfigResponse,           "ConfigResponse" },
247
    { QueryResponse,            "QueryResponse" },
248
    { 0,                        NULL},
249
};
250
251
static const value_string tlv_type_vals[] = {
252
    { REDIRECT_TLV,     "REDIRECT-TLV" },
253
    { ASResult_TLV,     "ASResult-TLV" },
254
    { ASTreason_TLV,    "ASTreason-TLV" },
255
    { LFBselect_TLV,    "LFBselect-TLV" },
256
    { PATH_DATA_TLV,    "PATH DATA-TLV" },
257
    { KEYINFO_TLV,      "KEYINFO-TLV" },
258
    { FULLDATA_TLV,     "FULLDATA-TLV" },
259
    { SPARSEDATA_TLV,   "SPARSEDATA-TLV" },
260
    { RESULT_TLV,       "RESULT-TLV" },
261
    { METADATA_TLV,     "METADATA-TLV" },
262
    { REDIRECTDATA_TLV, "REDIRECTDATA-TLV" },
263
    { 0,                NULL},
264
};
265
266
static const value_string operation_type_vals[] = {
267
    { Reserved,          "Reserved" },
268
    { SET,               "SET" },
269
    { SET_PROP,          "SET-PROP" },
270
    { SET_RESPONSE,      "SET-RESPONSE" },
271
    { SET_PROP_RESPONSE, "SET-PROP-RESPONSE" },
272
    { DEL,               "DEL" },
273
    { DEL_RESPONSE,      "DEL-RESPONSE" },
274
    { GET,               "GET" },
275
    { GET_PROP,          "GET-PROP" },
276
    { GET_RESPONSE,      "GET-RESPONSE" },
277
    { GET_PROP_RESPONSE, "GET-PROP-RESPONSE" },
278
    { REPORT,            "REPORT" },
279
    { COMMIT,            "COMMIT" },
280
    { COMMIT_RESPONSE,   "COMMIT-RESPONSE" },
281
    { TRCOMP,            "TRCOMP" },
282
    { 0,                 NULL},
283
};
284
285
static void
286
dissect_path_data_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
287
0
{
288
0
    proto_item *ti, *flag_item;
289
0
    unsigned    length_TLV, IDcount, i;
290
0
    uint16_t    type, flag;
291
0
    proto_tree *tlv_tree, *path_data_tree, *flag_tree;
292
293
0
    while (tvb_reported_length_remaining(tvb, offset) >= TLV_TL_LENGTH)
294
0
    {
295
0
        tlv_tree = proto_tree_add_subtree(tree, tvb, offset, TLV_TL_LENGTH, ett_forces_path_data_tlv, &ti, "TLV");
296
297
0
        proto_tree_add_item_ret_uint16(tlv_tree, hf_forces_lfbselect_tlv_type_operation_path_type,
298
0
                                       tvb, offset, 2, ENC_BIG_ENDIAN, &type);
299
0
        length_TLV = tvb_get_ntohs(tvb, offset+2);
300
0
        proto_tree_add_item(tlv_tree, hf_forces_lfbselect_tlv_type_operation_path_length,
301
0
                            tvb, offset+2, 2, ENC_BIG_ENDIAN);
302
0
        if (length_TLV < TLV_TL_LENGTH)
303
0
        {
304
0
            expert_add_info_format(pinfo, ti, &ei_forces_lfbselect_tlv_type_operation_path_length, "Bogus TLV length: %u", length_TLV);
305
0
            break;
306
0
        }
307
0
        proto_item_set_len(ti, length_TLV);
308
309
0
        if (type == PATH_DATA_TLV)
310
0
        {
311
0
            path_data_tree = proto_tree_add_subtree(tree, tvb, offset+TLV_TL_LENGTH, length_TLV-TLV_TL_LENGTH,
312
0
                                    ett_forces_path_data_tlv, NULL, "Path Data TLV");
313
314
0
            flag = tvb_get_ntohs(tvb, offset+TLV_TL_LENGTH);
315
0
            flag_item = proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_flags,
316
0
                                tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN);
317
0
            flag_tree = proto_item_add_subtree(flag_item, ett_forces_path_data_tlv_flags);
318
0
            proto_tree_add_item(flag_tree, hf_forces_lfbselect_tlv_type_operation_path_flags_selector,
319
0
                                tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN);
320
0
            proto_tree_add_item(flag_tree, hf_forces_lfbselect_tlv_type_operation_path_flags_reserved,
321
0
                                tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN);
322
323
0
            IDcount = tvb_get_ntohs(tvb, offset + TLV_TL_LENGTH + 2);
324
0
            proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_IDcount,
325
0
                                tvb, offset+TLV_TL_LENGTH+2, 2, ENC_BIG_ENDIAN);
326
327
0
            for (i = 0; i < IDcount; i++)
328
0
                proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_IDs,
329
0
                                    tvb, offset+TLV_TL_LENGTH+2+(i*4), 4, ENC_BIG_ENDIAN);
330
0
        }
331
0
        else
332
0
        {
333
0
            flag = 0;
334
0
            proto_tree_add_item(tree, hf_forces_lfbselect_tlv_type_operation_path_data,
335
0
                                tvb, offset+TLV_TL_LENGTH, length_TLV-TLV_TL_LENGTH, ENC_NA);
336
0
        }
337
338
0
        if ((flag & FLAG_SELECTOR) == 0)
339
0
            break;
340
341
0
        offset += length_TLV;
342
0
    }
343
0
}
344
345
static void
346
dissect_operation_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length_count)
347
0
{
348
0
    proto_item *ti;
349
0
    proto_tree *oper_tree;
350
0
    unsigned    type, length;
351
352
0
    while (tvb_reported_length_remaining(tvb, offset) >= TLV_TL_LENGTH)
353
0
    {
354
0
        oper_tree = proto_tree_add_subtree(tree, tvb, offset, length_count,
355
0
            ett_forces_lfbselect_tlv_type_operation, &ti, "Operation TLV");
356
357
0
        ti = proto_tree_add_item_ret_uint(oper_tree, hf_forces_lfbselect_tlv_type_operation_type,
358
0
                                          tvb, offset, 2, ENC_BIG_ENDIAN, &type);
359
0
        if (try_val_to_str(type, operation_type_vals) == NULL)
360
0
            expert_add_info_format(pinfo, ti, &ei_forces_lfbselect_tlv_type_operation_type,
361
0
                "Bogus: ForCES Operation TLV (Type:0x%04x) is not supported", type);
362
363
0
        proto_tree_add_item_ret_uint(oper_tree, hf_forces_lfbselect_tlv_type_operation_length,
364
0
                                   tvb, offset+2, 2, ENC_BIG_ENDIAN, &length);
365
366
0
        dissect_path_data_tlv(tvb, pinfo, oper_tree, offset+TLV_TL_LENGTH);
367
0
        if (length == 0)
368
0
            break;
369
0
        offset += length;
370
0
    }
371
0
}
372
373
static void
374
dissect_lfbselecttlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length_count)
375
0
{
376
0
    unsigned tlv_length;
377
378
0
    proto_tree_add_item(tree, hf_forces_lfbselect_tlv_type_lfb_classid,    tvb, offset,   4, ENC_BIG_ENDIAN);
379
0
    proto_tree_add_item(tree, hf_forces_lfbselect_tlv_type_lfb_instanceid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
380
381
0
    offset += 8;
382
0
    while ((tvb_reported_length_remaining(tvb, offset) > TLV_TL_LENGTH) && (length_count > 12))
383
0
    {
384
0
        tlv_length = tvb_get_ntohs(tvb, offset+2);
385
0
        dissect_operation_tlv(tvb, pinfo, tree, offset, tlv_length);
386
0
        if (tlv_length == 0)
387
0
            break;
388
0
        offset += tlv_length;
389
0
    }
390
0
}
391
392
static void
393
dissect_redirecttlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
394
0
{
395
0
    proto_tree *meta_data_tree, *meta_data_ilv_tree, *redirect_data_tree;
396
0
    unsigned    start_offset;
397
0
    unsigned    length_meta, length_ilv, length_redirect;
398
0
    proto_item *ti;
399
0
    address     src_addr, src_net_addr;
400
0
    address     dst_addr, dst_net_addr;
401
402
0
    copy_address_shallow(&src_addr, &pinfo->src);
403
0
    copy_address_shallow(&src_net_addr, &pinfo->net_src);
404
0
    copy_address_shallow(&dst_addr, &pinfo->dst);
405
0
    copy_address_shallow(&dst_net_addr, &pinfo->net_dst);
406
407
0
    meta_data_tree = proto_tree_add_subtree(tree, tvb, offset, TLV_TL_LENGTH,
408
0
        ett_forces_redirect_tlv_meta_data_tlv, &ti, "Meta Data TLV");
409
0
    proto_tree_add_item(meta_data_tree, hf_forces_redirect_tlv_meta_data_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
410
411
0
    length_meta = tvb_get_ntohs(tvb, offset+2);
412
0
    proto_tree_add_uint(meta_data_tree, hf_forces_redirect_tlv_meta_data_tlv_length, tvb, offset+2, 2, length_meta);
413
0
    proto_item_set_len(ti, length_meta);
414
415
0
    start_offset = offset;
416
0
    while ((tvb_reported_length_remaining(tvb, offset) >= 8) && (start_offset+length_meta > offset))
417
0
    {
418
0
        meta_data_ilv_tree = proto_tree_add_subtree(tree, tvb, offset, TLV_TL_LENGTH,
419
0
            ett_forces_redirect_tlv_meta_data_tlv_meta_data_ilv, &ti, "Meta Data ILV");
420
421
0
        proto_tree_add_item(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_id,
422
0
                                   tvb, offset+8, 4, ENC_BIG_ENDIAN);
423
0
        length_ilv = tvb_get_ntohl(tvb, offset+12);
424
0
        proto_tree_add_uint(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length,
425
0
                                   tvb, offset+12, 4, length_ilv);
426
0
        offset += 8;
427
0
        if (length_ilv > 0) {
428
0
            proto_tree_add_item(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv,
429
0
                                   tvb, offset, length_ilv, ENC_NA);
430
431
0
            if (offset + length_ilv > offset) {
432
0
                offset += length_ilv;
433
0
            }
434
0
        }
435
436
0
        proto_item_set_len(ti, length_ilv + 8);
437
0
    }
438
439
0
    if (tvb_reported_length_remaining(tvb, offset) > 0)
440
0
    {
441
0
        redirect_data_tree = proto_tree_add_subtree(tree, tvb, offset, TLV_TL_LENGTH,
442
0
            ett_forces_redirect_tlv_redirect_data_tlv, &ti, "Redirect Data TLV");
443
444
0
        proto_tree_add_item(redirect_data_tree, hf_forces_redirect_tlv_redirect_data_tlv_type,
445
0
                            tvb, offset, 2,  ENC_BIG_ENDIAN);
446
0
        length_redirect = tvb_get_ntohs(tvb, offset+2);
447
0
        proto_tree_add_uint(redirect_data_tree, hf_forces_redirect_tlv_redirect_data_tlv_length,
448
0
                            tvb, offset+2, 2, length_redirect);
449
450
0
        if (tvb_reported_length_remaining(tvb, offset) < length_redirect)
451
0
        {
452
0
            expert_add_info_format(pinfo, ti, &ei_forces_redirect_tlv_redirect_data_tlv_length, "Bogus: Redirect Data TLV length (%u bytes) is wrong", length_redirect);
453
0
        }
454
0
        else if (length_redirect < TLV_TL_LENGTH + MIN_IP_HEADER_LENGTH)
455
0
        {
456
0
            expert_add_info_format(pinfo, ti, &ei_forces_redirect_tlv_redirect_data_tlv_length, "Bogus: Redirect Data TLV length (%u bytes) not big enough for IP layer", length_redirect);
457
0
        }
458
0
        else
459
0
        {
460
0
            tvbuff_t  *next_tvb;
461
462
0
            next_tvb = tvb_new_subset_length(tvb, offset+4, length_redirect-TLV_TL_LENGTH);
463
0
            call_dissector(ip_handle, next_tvb, pinfo, redirect_data_tree);
464
465
            /* Restore IP info */
466
0
            copy_address_shallow(&pinfo->src, &src_addr);
467
0
            copy_address_shallow(&pinfo->net_src, &src_net_addr);
468
0
            copy_address_shallow(&pinfo->dst, &dst_addr);
469
0
            copy_address_shallow(&pinfo->net_dst, &dst_net_addr);
470
0
        }
471
0
    }
472
0
}
473
474
static void
475
dissect_forces(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset)
476
0
{
477
    /* Set up structures needed to add the protocol subtree and manage it */
478
0
    proto_item *ti, *tlv_item;
479
0
    proto_tree *forces_tree, *forces_flags_tree;
480
0
    proto_tree *forces_main_header_tree, *forces_tlv_tree, *tlv_tree;
481
0
    unsigned    length_count;
482
483
0
    uint8_t     message_type;
484
0
    uint16_t    tlv_type;
485
486
    /* Make entries in Protocol column and Info column on summary display */
487
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ForCES");
488
0
    col_clear(pinfo->cinfo, COL_INFO);
489
490
0
    ti = proto_tree_add_item(tree, proto_forces, tvb, 0, -1, ENC_NA);
491
0
    forces_tree = proto_item_add_subtree(ti, ett_forces);
492
493
0
    forces_main_header_tree = proto_tree_add_subtree(forces_tree, tvb, 0, ForCES_HEADER_LENGTH,
494
0
                ett_forces_main_header, NULL, "Common Header");
495
496
0
    proto_tree_add_item(forces_main_header_tree, hf_forces_version, tvb, 0, 1, ENC_BIG_ENDIAN);
497
0
    proto_tree_add_item(forces_main_header_tree, hf_forces_rsvd,    tvb, 0, 1, ENC_BIG_ENDIAN);
498
499
0
    message_type = tvb_get_uint8(tvb, offset+1);
500
0
    proto_tree_add_item( forces_main_header_tree, hf_forces_messagetype, tvb, offset+1, 1, ENC_BIG_ENDIAN);
501
502
0
    length_count = tvb_get_ntohs(tvb, offset+2) * 4;  /*multiply 4 DWORD*/
503
0
    ti = proto_tree_add_uint_format( forces_main_header_tree, hf_forces_length,
504
0
                                     tvb, offset+2, 2, length_count, "Length: %u Bytes", length_count);
505
0
    if (length_count != tvb_reported_length_remaining(tvb, offset))
506
0
        expert_add_info_format(pinfo, ti, &ei_forces_length, "Bogus: ForCES Header length (%u bytes) is wrong),should be (%u bytes)",
507
0
            length_count, tvb_reported_length_remaining(tvb, offset));
508
0
    if (length_count < 24)
509
0
        expert_add_info_format(pinfo, ti, &ei_forces_length, "Bogus: ForCES Header length (%u bytes) is less than 24bytes)", length_count);
510
511
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %s, Total Length:  %u Bytes",
512
0
            val_to_str(pinfo->pool, message_type, message_type_vals, "Unknown messagetype 0x%x"), length_count);
513
514
0
    proto_tree_add_item( forces_main_header_tree, hf_forces_sid,        tvb, offset+4,  4, ENC_BIG_ENDIAN);
515
0
    proto_tree_add_item( forces_main_header_tree, hf_forces_did,        tvb, offset+8,  4, ENC_BIG_ENDIAN);
516
0
    proto_tree_add_item( forces_main_header_tree, hf_forces_correlator, tvb, offset+12, 8, ENC_BIG_ENDIAN);
517
518
    /*Add flags tree*/
519
0
    ti = proto_tree_add_item(forces_main_header_tree, hf_forces_flags, tvb, offset+20, 4, ENC_BIG_ENDIAN);
520
0
    forces_flags_tree = proto_item_add_subtree(ti, ett_forces_flags);
521
522
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_ack,      tvb, offset+20, 4, ENC_BIG_ENDIAN);
523
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_at,       tvb, offset+20, 4, ENC_BIG_ENDIAN);
524
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_em,       tvb, offset+20, 4, ENC_BIG_ENDIAN);
525
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_pri,      tvb, offset+20, 4, ENC_BIG_ENDIAN);
526
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_reserved, tvb, offset+20, 4, ENC_BIG_ENDIAN);
527
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_rsrvd,    tvb, offset+20, 4, ENC_BIG_ENDIAN);
528
0
    proto_tree_add_item(forces_flags_tree, hf_forces_flags_tp,       tvb, offset+20, 4, ENC_BIG_ENDIAN);
529
530
0
    offset += 24;
531
0
    while (tvb_reported_length_remaining(tvb, offset) >= TLV_TL_LENGTH)
532
0
    {
533
0
        forces_tlv_tree = proto_tree_add_subtree(forces_tree, tvb, offset, TLV_TL_LENGTH, ett_forces_tlv, &ti, "TLV");
534
535
0
        tlv_item = proto_tree_add_item_ret_uint16(forces_tlv_tree, hf_forces_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN, &tlv_type);
536
0
        length_count = tvb_get_ntohs(tvb, offset+2) * 4;
537
0
        proto_item_set_len(ti, length_count);
538
0
        ti = proto_tree_add_uint(forces_tlv_tree, hf_forces_tlv_length,
539
0
                                        tvb, offset+2, 2, length_count);
540
0
        if (tvb_reported_length_remaining(tvb, offset) < length_count)
541
0
            expert_add_info_format(pinfo, ti, &ei_forces_tlv_length, "Bogus: Main TLV length (%u bytes) is wrong", length_count);
542
543
0
        if (length_count < TLV_TL_LENGTH)
544
0
        {
545
0
            expert_add_info_format(pinfo, ti, &ei_forces_tlv_length, "Bogus TLV length: %u", length_count);
546
0
            break;
547
0
        }
548
549
0
        offset       += TLV_TL_LENGTH;
550
0
        length_count -= TLV_TL_LENGTH;
551
552
0
        switch(tlv_type)
553
0
        {
554
0
        case LFBselect_TLV:
555
0
            tlv_tree = proto_tree_add_subtree(forces_tlv_tree, tvb, offset, length_count,
556
0
                    ett_forces_lfbselect_tlv_type, NULL, "LFB select TLV");
557
0
            dissect_lfbselecttlv(tvb, pinfo, tlv_tree, offset, length_count);
558
0
            break;
559
560
0
        case REDIRECT_TLV:
561
0
            tlv_tree = proto_tree_add_subtree(forces_tlv_tree, tvb, offset, length_count,
562
0
                            ett_forces_redirect_tlv_type, NULL, "Redirect TLV");
563
0
            dissect_redirecttlv(tvb, pinfo, tlv_tree, offset);
564
0
            break;
565
566
0
        case ASResult_TLV:
567
0
            tlv_tree = proto_tree_add_subtree(forces_tlv_tree, tvb, offset, length_count,
568
0
                        ett_forces_asresult_tlv, NULL, "ASResult TLV");
569
0
            proto_tree_add_item(tlv_tree, hf_forces_asresult_association_setup_result, tvb, offset, 4, ENC_BIG_ENDIAN);
570
0
            break;
571
572
0
        case ASTreason_TLV:
573
0
            tlv_tree = proto_tree_add_subtree(forces_tlv_tree, tvb, offset, length_count,
574
0
                            ett_forces_astreason_tlv, NULL, "ASTreason TLV");
575
0
            proto_tree_add_item(tlv_tree, hf_forces_astreason_tlv_teardown_reason, tvb, offset, 4, ENC_BIG_ENDIAN);
576
0
            break;
577
578
0
        default:
579
0
            expert_add_info(pinfo, tlv_item, &ei_forces_tlv_type);
580
0
            tlv_tree = proto_tree_add_subtree(forces_tlv_tree, tvb, offset, length_count,
581
0
                ett_forces_unknown_tlv, NULL, "Unknown TLV");
582
0
            proto_tree_add_item(tlv_tree, hf_forces_unknown_tlv, tvb, offset, length_count, ENC_NA);
583
0
            break;
584
0
        }
585
586
0
        offset += length_count;
587
0
    }
588
0
}
589
590
/* Code to actually dissect the TCP packets */
591
static int
592
dissect_forces_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
593
0
{
594
0
    dissect_forces(tvb, pinfo, tree, TCP_UDP_TML_FOCES_MESSAGE_OFFSET_TCP);
595
0
    return tvb_captured_length(tvb);
596
0
}
597
598
/* Code to actually dissect the ForCES protocol layer packets,like UDP,SCTP and others */
599
static int
600
dissect_forces_not_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
601
0
{
602
0
    dissect_forces(tvb, pinfo, tree, 0);
603
0
    return tvb_captured_length(tvb);
604
0
}
605
606
void
607
proto_register_forces(void)
608
15
{
609
15
    module_t *forces_module;
610
15
    expert_module_t* expert_forces;
611
612
    /* Setup list of header fields  See Section 1.6.1 for details*/
613
15
    static hf_register_info hf[] = {
614
15
        { &hf_forces_version,
615
15
            { "Version", "forces.flags.version",
616
15
            FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }
617
15
        },
618
15
        { &hf_forces_rsvd,
619
15
            { "Rsvd", "forces.flags.rsvd",
620
15
            FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }
621
15
        },
622
15
        { &hf_forces_messagetype,
623
15
            { "Message Type", "forces.messagetype",
624
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
625
15
        },
626
15
        { &hf_forces_length,
627
15
            { "Header Length", "forces.length",
628
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
629
15
        },
630
15
        { &hf_forces_sid,
631
15
            { "Source ID", "forces.sid",
632
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
633
15
        },
634
15
        { &hf_forces_did,
635
15
            { "Destination ID", "forces.did",
636
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
637
15
        },
638
15
        { &hf_forces_correlator,
639
15
            { "Correlator", "forces.correlator",
640
15
            FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
641
15
        },
642
15
        { &hf_forces_tlv_type,
643
15
            { "Type", "forces.tlv.type",
644
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
645
15
        },
646
15
        { &hf_forces_tlv_length,
647
15
            { "Length", "forces.tlv.length",
648
15
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }
649
15
        },
650
        /*flags*/
651
15
        { &hf_forces_flags,
652
15
            { "Flags", "forces.Flags",
653
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
654
15
        },
655
15
        { &hf_forces_flags_ack,
656
15
            { "ACK indicator", "forces.flags.ack",
657
15
            FT_UINT32, BASE_DEC, VALS(main_header_flags_ack_vals), 0xC0000000, NULL, HFILL }
658
15
        },
659
15
        { &hf_forces_flags_pri,
660
15
            { "Priority", "forces.flags.pri",
661
15
            FT_UINT32, BASE_DEC, NULL, 0x38000000, NULL, HFILL }
662
15
        },
663
15
        { &hf_forces_flags_rsrvd,
664
15
            { "Rsrvd", "forces.flags.rsrvd",
665
15
            FT_UINT32, BASE_DEC,NULL, 0x07000000, NULL, HFILL }
666
15
        },
667
15
        { &hf_forces_flags_em,
668
15
            { "Execution mode", "forces.flags.em",
669
15
            FT_UINT32, BASE_DEC, VALS(main_header_flags_em_vals), 0x00C00000, NULL, HFILL }
670
15
        },
671
15
        { &hf_forces_flags_at,
672
15
            { "Atomic Transaction", "forces.flags.at",
673
15
            FT_UINT32, BASE_DEC, VALS(main_header_flags_at_vals), 0x00200000, NULL, HFILL }
674
15
        },
675
15
        { &hf_forces_flags_tp,
676
15
            { "Transaction phase", "forces.flags.tp",
677
15
            FT_UINT32, BASE_DEC, VALS(main_header_flags_tp_vals), 0x00180000, NULL, HFILL }
678
15
        },
679
15
        { &hf_forces_flags_reserved,
680
15
            { "Reserved", "forces.flags.reserved",
681
15
            FT_UINT32, BASE_DEC,NULL, 0x0007ffff, NULL, HFILL }
682
15
        },
683
        /*LFBSelectTLV*/
684
15
        { &hf_forces_lfbselect_tlv_type_lfb_classid,
685
15
            { "Class ID", "forces.lfbselect.tlv.type.lfb.classid",
686
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
687
15
        },
688
15
        { &hf_forces_lfbselect_tlv_type_lfb_instanceid,
689
15
            { "Instance ID", "forces.fbselect.tlv.type.lfb.instanceid",
690
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
691
15
        },
692
        /*Operation TLV*/
693
15
        { &hf_forces_lfbselect_tlv_type_operation_type,
694
15
            { "Type", "forces.lfbselect.tlv.type.operation.type",
695
15
            FT_UINT16, BASE_DEC, VALS(operation_type_vals), 0x0, NULL, HFILL }
696
15
        },
697
15
        { &hf_forces_lfbselect_tlv_type_operation_length,
698
15
            { "Length", "forces.lfbselect.tlv.type.operation.length",
699
15
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }
700
15
        },
701
15
        { &hf_forces_lfbselect_tlv_type_operation_path_type,
702
15
            { "Type", "forces.lfbselect.tlv.type.operation.path.type",
703
15
            FT_UINT16, BASE_DEC, VALS(tlv_type_vals), 0x0, NULL, HFILL }
704
15
        },
705
15
        { &hf_forces_lfbselect_tlv_type_operation_path_length,
706
15
            { "Length", "forces.lfbselect.tlv.type.operation.path.length",
707
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
708
15
        },
709
15
        { &hf_forces_lfbselect_tlv_type_operation_path_data,
710
15
            { "Data", "forces.lfbselect.tlv.type.operation.path.data",
711
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
712
15
        },
713
15
        { &hf_forces_lfbselect_tlv_type_operation_path_flags,
714
15
            {"Path Data Flags", "forces.lfbselect.tlv.type.operation.path.data.flags",
715
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
716
15
        },
717
15
        { &hf_forces_lfbselect_tlv_type_operation_path_flags_selector,
718
15
            {"Selector", "forces.lfbselect.tlv.type.operation.path.data.flags.selector",
719
15
            FT_UINT16, BASE_HEX, NULL, 0x80, NULL, HFILL }
720
15
        },
721
15
        { &hf_forces_lfbselect_tlv_type_operation_path_flags_reserved,
722
15
            {"Reserved", "forces.lfbselect.tlv.type.operation.path.data.flags.reserved",
723
15
            FT_UINT16, BASE_HEX, NULL, 0x7F, NULL, HFILL }
724
15
        },
725
15
        { &hf_forces_lfbselect_tlv_type_operation_path_IDcount,
726
15
            { "Path Data IDcount", "forces.lfbselect.tlv.type.operation.path.data.IDcount",
727
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
728
15
        },
729
15
        { &hf_forces_lfbselect_tlv_type_operation_path_IDs,
730
15
            { "Path Data IDs", "forces.lfbselect.tlv.type.operation.path.data.IDs",
731
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
732
15
        },
733
        /*Meta data TLV*/
734
15
        {&hf_forces_redirect_tlv_meta_data_tlv_type,
735
15
            { "Type", "forces.redirect.tlv.meta.data.tlv.type",
736
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
737
15
        },
738
15
        { &hf_forces_redirect_tlv_meta_data_tlv_length,
739
15
            { "Length", "forces.redirect.tlv.meta.data.tlv.length",
740
15
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }
741
15
        },
742
15
        { &hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv,
743
15
            { "Meta Data ILV", "forces.redirect.tlv.meta.data.tlv.meta.data.ilv",
744
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
745
15
        },
746
15
        { &hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_id,
747
15
            { "ID", "forces.redirect.tlv.meta.data.tlv.meta.data.ilv.id",
748
15
            FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }
749
15
        },
750
15
        { &hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length,
751
15
            { "Length", "forces.redirect.tlv.meta.data.tlv.meta.data.ilv.length",
752
15
            FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }
753
15
        },
754
15
        { &hf_forces_redirect_tlv_redirect_data_tlv_type,
755
15
            { "Type", "forces.redirect.tlv.redirect.data.tlv.type",
756
15
            FT_UINT16, BASE_DEC, VALS(tlv_type_vals), 0x0, NULL, HFILL }
757
15
        },
758
15
        { &hf_forces_redirect_tlv_redirect_data_tlv_length,
759
15
            { "Length", "forces.redirect.tlv.redirect.data.tlv.length",
760
15
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }
761
15
        },
762
15
        { &hf_forces_asresult_association_setup_result,
763
15
            { "Association Setup Result", "forces.teardown.reason",
764
15
            FT_UINT32, BASE_DEC, VALS(association_setup_result_at_vals), 0x0, NULL, HFILL }
765
15
        },
766
15
        { &hf_forces_astreason_tlv_teardown_reason,
767
15
            { "AStreason TLV TearDown Reason", "forces.astreason.tlv.teardown.reason",
768
15
            FT_UINT32, BASE_DEC, VALS(teardown_reason_at_vals), 0x0, NULL, HFILL }
769
15
        },
770
15
        { &hf_forces_unknown_tlv,
771
15
            { "Data", "forces.unknown.tlv",
772
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
773
15
        }
774
15
    };
775
776
    /* Setup protocol subtree array */
777
15
    static int *ett[] = {
778
15
        &ett_forces,
779
15
        &ett_forces_main_header,
780
15
        &ett_forces_flags,
781
15
        &ett_forces_tlv,
782
15
        &ett_forces_lfbselect_tlv_type,
783
15
        &ett_forces_lfbselect_tlv_type_operation,
784
15
        &ett_forces_lfbselect_tlv_type_operation_path,
785
15
        &ett_forces_lfbselect_tlv_type_operation_path_data,
786
15
        &ett_forces_lfbselect_tlv_type_operation_path_data_path,
787
15
        &ett_forces_lfbselect_tlv_type_operation_path_selector,
788
15
        &ett_forces_path_data_tlv,
789
15
        &ett_forces_path_data_tlv_flags,
790
15
        &ett_forces_redirect_tlv_type,
791
15
        &ett_forces_redirect_tlv_meta_data_tlv,
792
15
        &ett_forces_redirect_tlv_redirect_data_tlv,
793
15
        &ett_forces_redirect_tlv_meta_data_tlv_meta_data_ilv,
794
15
        &ett_forces_asresult_tlv,
795
15
        &ett_forces_astreason_tlv,
796
15
        &ett_forces_unknown_tlv
797
15
    };
798
799
15
    static ei_register_info ei[] = {
800
15
        { &ei_forces_length, { "forces.length.bad", PI_PROTOCOL, PI_WARN, "ForCES Header length is wrong", EXPFILL }},
801
15
        { &ei_forces_tlv_type, { "forces.tlv.type.unknown", PI_PROTOCOL, PI_WARN, "Bogus: The Main_TLV type is unknown", EXPFILL }},
802
15
        { &ei_forces_tlv_length, { "forces.tlv.length.bad", PI_PROTOCOL, PI_WARN, "Bogus TLV length", EXPFILL }},
803
15
        { &ei_forces_lfbselect_tlv_type_operation_path_length, { "forces.lfbselect.tlv.type.operation.path.length.bad", PI_PROTOCOL, PI_WARN, "Bogus TLV length", EXPFILL }},
804
15
        { &ei_forces_lfbselect_tlv_type_operation_type, { "forces.lfbselect.tlv.type.operation.type.unsupported", PI_PROTOCOL, PI_WARN, "ForCES Operation TLV is not supported", EXPFILL }},
805
15
        { &ei_forces_redirect_tlv_redirect_data_tlv_length, { "forces.redirect.tlv.redirect.data.tlv.length.bad", PI_PROTOCOL, PI_WARN, "Redirect Data TLV length is wrong", EXPFILL }},
806
15
    };
807
808
    /* Register the protocol name and description */
809
15
    proto_forces = proto_register_protocol("Forwarding and Control Element Separation Protocol", "ForCES", "forces");
810
811
    /* Required function calls to register the header fields and subtrees used */
812
15
    proto_register_field_array(proto_forces, hf, array_length(hf));
813
15
    proto_register_subtree_array(ett, array_length(ett));
814
15
    expert_forces = expert_register_protocol(proto_forces);
815
15
    expert_register_field_array(expert_forces, ei, array_length(ei));
816
817
15
    forces_handle_tcp = register_dissector("forces.tcp", dissect_forces_tcp,     proto_forces);
818
15
    forces_handle     = register_dissector("forces",     dissect_forces_not_tcp, proto_forces);
819
820
15
    forces_module = prefs_register_protocol(proto_forces,proto_reg_handoff_forces);
821
822
15
    prefs_register_uint_preference(forces_module, "sctp_high_prio_port",
823
15
                                   "SCTP High Priority channel port",
824
15
                                   "Decode packets on this sctp port as ForCES",
825
15
                                   10, &forces_alternate_sctp_high_prio_channel_port);
826
827
15
    prefs_register_uint_preference(forces_module, "sctp_med_prio_port",
828
15
                                   "SCTP Medium Priority channel port",
829
15
                                   "Decode packets on this sctp port as ForCES",
830
15
                                   10, &forces_alternate_sctp_med_prio_channel_port);
831
832
15
    prefs_register_uint_preference(forces_module, "sctp_low_prio_port",
833
15
                                   "SCTP Low Priority channel port",
834
15
                                   "Decode packets on this sctp port as ForCES",
835
15
                                   10, &forces_alternate_sctp_low_prio_channel_port);
836
15
}
837
838
void
839
proto_reg_handoff_forces(void)
840
15
{
841
15
    static bool inited = false;
842
843
15
    static unsigned alternate_sctp_high_prio_channel_port = 0; /* 6700 */
844
15
    static unsigned alternate_sctp_med_prio_channel_port  = 0;
845
15
    static unsigned alternate_sctp_low_prio_channel_port  = 0;
846
847
15
    if (!inited) {
848
15
        ip_handle = find_dissector_add_dependency("ip", proto_forces);
849
        /* Register TCP port for dissection */
850
15
        dissector_add_for_decode_as_with_preference("tcp.port", forces_handle_tcp);
851
        /* Register UDP port for dissection */
852
15
        dissector_add_for_decode_as_with_preference("udp.port", forces_handle);
853
854
15
        inited = true;
855
15
    }
856
857
    /* Register SCTP port for high priority dissection */
858
15
    if ((alternate_sctp_high_prio_channel_port != 0) &&
859
0
        (alternate_sctp_high_prio_channel_port != forces_alternate_sctp_high_prio_channel_port))
860
0
        dissector_delete_uint("sctp.port", alternate_sctp_high_prio_channel_port, forces_handle);
861
15
    if ((forces_alternate_sctp_high_prio_channel_port != 0) &&
862
0
        (alternate_sctp_high_prio_channel_port != forces_alternate_sctp_high_prio_channel_port))
863
0
        dissector_add_uint("sctp.port", forces_alternate_sctp_high_prio_channel_port, forces_handle);
864
15
    alternate_sctp_high_prio_channel_port = forces_alternate_sctp_high_prio_channel_port;
865
866
    /* Register SCTP port for medium priority dissection */
867
15
    if ((alternate_sctp_med_prio_channel_port != 0) &&
868
0
        (alternate_sctp_med_prio_channel_port != forces_alternate_sctp_med_prio_channel_port))
869
0
        dissector_delete_uint("sctp.port", alternate_sctp_med_prio_channel_port, forces_handle);
870
15
    if ((forces_alternate_sctp_med_prio_channel_port != 0) &&
871
0
        (alternate_sctp_med_prio_channel_port != forces_alternate_sctp_med_prio_channel_port))
872
0
        dissector_add_uint("sctp.port", forces_alternate_sctp_med_prio_channel_port, forces_handle);
873
15
    alternate_sctp_med_prio_channel_port = forces_alternate_sctp_med_prio_channel_port;
874
875
    /* Register SCTP port for low priority dissection */
876
15
    if ((alternate_sctp_low_prio_channel_port != 0) &&
877
0
        (alternate_sctp_low_prio_channel_port != forces_alternate_sctp_low_prio_channel_port))
878
0
        dissector_delete_uint("sctp.port", alternate_sctp_low_prio_channel_port, forces_handle);
879
15
    if ((forces_alternate_sctp_low_prio_channel_port != 0) &&
880
0
        (alternate_sctp_low_prio_channel_port != forces_alternate_sctp_low_prio_channel_port))
881
0
        dissector_add_uint("sctp.port", forces_alternate_sctp_low_prio_channel_port, forces_handle);
882
15
    alternate_sctp_low_prio_channel_port = forces_alternate_sctp_low_prio_channel_port;
883
15
}
884
885
/*
886
* Editor modelines - https://www.wireshark.org/tools/modelines.html
887
*
888
* Local variables:
889
* c-basic-offset: 4
890
* tab-width: 8
891
* indent-tabs-mode: nil
892
* End:
893
*
894
* vi: set shiftwidth=4 tabstop=8 expandtab:
895
* :indentSize=4:tabSize=8:noTabs=true:
896
*/