Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-infiniband_sdp.c
Line
Count
Source
1
/* packet-infiniband_sdp.c
2
 * Routines for Infiniband Sockets Direct Protocol dissection
3
 * Copyright 2010, Mellanox Technologies Ltd.
4
 * Code by Amir Vadai and Slava Koyfman.
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 <stdlib.h>
16
17
#include <epan/packet.h>
18
#include <epan/prefs.h>
19
#include <epan/conversation.h>
20
21
#include "packet-infiniband.h"
22
23
void proto_register_ib_sdp(void);
24
void proto_reg_handoff_ib_sdp(void);
25
26
static dissector_handle_t ib_sdp_handle;
27
28
/* If the service-id is non-zero after being ANDed with the following mask then
29
   this is SDP traffic */
30
0
#define SERVICE_ID_MASK 0x0000000000010000
31
32
static int proto_infiniband;   /* we'll need the Infiniband protocol index for conversation data */
33
34
/* Initialize the protocol and registered fields... */
35
static int proto_ib_sdp;
36
37
/* IB SDP BSDH Header */
38
static int hf_ib_sdp_bsdh;
39
static int hf_ib_sdp_mid;
40
static int hf_ib_sdp_flags;
41
static int hf_ib_sdp_flags_oobpres;
42
static int hf_ib_sdp_flags_oob_pend;
43
static int hf_ib_sdp_flags_reqpipe;
44
45
static int hf_ib_sdp_len;
46
static int hf_ib_sdp_bufs;
47
static int hf_ib_sdp_mseq;
48
static int hf_ib_sdp_mseqack;
49
50
/* IB SDP Hello Header */
51
static int hf_ib_sdp_hh;
52
static int hf_ib_sdp_majv;
53
static int hf_ib_sdp_minv;
54
static int hf_ib_sdp_ipv;
55
static int hf_ib_sdp_cap;
56
static int hf_ib_sdp_cap_invalidate;
57
static int hf_ib_sdp_cap_extmaxadverts;
58
static int hf_ib_sdp_maxadverts;
59
static int hf_ib_sdp_desremrcvsz;
60
static int hf_ib_sdp_localrcvsz;
61
static int hf_ib_sdp_localport;
62
static int hf_ib_sdp_src_ip;
63
static int hf_ib_sdp_dst_ip;
64
static int hf_ib_sdp_extmaxadverts;
65
static int hf_ib_sdp_hah;
66
static int hf_ib_sdp_rwch;
67
static int hf_ib_sdp_rrch;
68
static int hf_ib_sdp_mch;
69
static int hf_ib_sdp_crbh;
70
static int hf_ib_sdp_crbah;
71
static int hf_ib_sdp_suspch;
72
static int hf_ib_sdp_sinkah;
73
static int hf_ib_sdp_srcah;
74
static int hf_ib_sdp_data;
75
76
/* Initialize the subtree pointers */
77
static int ett_ib_sdp;
78
static int ett_ib_sdp_bsdh;
79
static int ett_ib_sdp_hh;
80
81
typedef enum {
82
    Hello = 0x0,
83
    HelloAck,
84
    DisConn,
85
    AbortConn,
86
    SendSm,
87
    RdmaWrCompl,
88
    RdmaRdCompl,
89
    ModeChange,
90
    SrcAvailCancel,
91
    SinkAvailCancel,
92
    SinkCancelAck,
93
    ChRcvBuf,
94
    ChRcvBufAck,
95
    SuspComm,
96
    SuspCommAck,
97
    SinkAvail = 0xfd,
98
    SrcAvail,
99
    Data
100
} message_by_mid_t;
101
102
static const range_string mid_meanings[] = {
103
    { Hello, Hello, "Hello" },
104
    { HelloAck, HelloAck, "HelloAck" },
105
    { DisConn, DisConn, "DisConn" },
106
    { AbortConn, AbortConn, "AbortConn" },
107
    { SendSm, SendSm, "SendSm" },
108
    { RdmaWrCompl, RdmaWrCompl, "RdmaWrCompl" },
109
    { RdmaRdCompl, RdmaRdCompl, "RdmaRdCompl" },
110
    { ModeChange, ModeChange, "ModeChange" },
111
    { SrcAvailCancel, SrcAvailCancel, "SrcAvailCancel" },
112
    { SinkAvailCancel, SinkAvailCancel, "SinkAvailCancel" },
113
    { SinkCancelAck, SinkCancelAck, "SinkCancelAck" },
114
    { ChRcvBuf, ChRcvBuf, "ChRcvBuf" },
115
    { ChRcvBufAck, ChRcvBufAck, "ChRcvBufAck" },
116
    { SuspComm, SuspComm, "SuspComm" },
117
    { SuspCommAck, SuspCommAck, "SuspCommAck" },
118
    { SinkAvail, SinkAvail, "SinkAvail" },
119
    { SrcAvail, SrcAvail, "SrcAvail" },
120
    { Data, Data, "Data" },
121
    { 0x00001111, 0x00111111, "Reserved" },
122
    { 0x01000000, 0x01111111, "Experimental" },
123
    { 0x10000000, 0x11111100, "Reserved" },
124
    { 0, 0, NULL }
125
};
126
127
/* Code to actually dissect the packets */
128
static int
129
dissect_ib_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
130
0
{
131
0
    int local_offset = 0;
132
0
    proto_item *SDP_header_item;
133
0
    proto_tree *SDP_header_tree;
134
0
    proto_item *SDP_BSDH_header_item;
135
0
    proto_tree *SDP_BSDH_header_tree;
136
0
    proto_item *SDP_EH_header_item;
137
0
    proto_tree *SDP_EH_header_tree;
138
0
    uint8_t mid;
139
140
0
    if (tvb_captured_length(tvb) < 16)   /* check this has at least enough bytes for the BSDH */
141
0
        return 0;
142
143
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SDP");
144
145
0
    SDP_header_item = proto_tree_add_item(tree, proto_ib_sdp, tvb, local_offset, -1, ENC_NA);
146
0
    SDP_header_tree = proto_item_add_subtree(SDP_header_item, ett_ib_sdp);
147
148
0
    SDP_BSDH_header_item = proto_tree_add_item(SDP_header_tree, hf_ib_sdp_bsdh, tvb, local_offset, 16, ENC_NA);
149
0
    SDP_BSDH_header_tree = proto_item_add_subtree(SDP_BSDH_header_item, ett_ib_sdp_bsdh);
150
151
0
    proto_tree_add_item_ret_uint8(SDP_BSDH_header_tree, hf_ib_sdp_mid, tvb, local_offset, 1, ENC_BIG_ENDIAN, &mid); local_offset += 1;
152
153
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "(SDP %s)",
154
0
                    rval_to_str_const(mid, mid_meanings, "Unknown"));
155
156
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags, tvb, local_offset, 1, ENC_BIG_ENDIAN);
157
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_oobpres, tvb, local_offset, 1, ENC_BIG_ENDIAN);
158
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_oob_pend, tvb, local_offset, 1, ENC_BIG_ENDIAN);
159
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_reqpipe, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
160
161
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_bufs, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
162
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_len, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
163
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mseq, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
164
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mseqack, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
165
166
0
    switch (mid) {
167
0
        case Hello:
168
0
            SDP_EH_header_item = proto_tree_add_item(SDP_header_tree, hf_ib_sdp_hh, tvb, local_offset, 48, ENC_NA);
169
0
            SDP_EH_header_tree = proto_item_add_subtree(SDP_EH_header_item, ett_ib_sdp_hh);
170
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_majv, tvb, local_offset, 1, ENC_BIG_ENDIAN);
171
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_minv, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
172
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_ipv, tvb, local_offset, 1, ENC_BIG_ENDIAN);
173
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap, tvb, local_offset, 1, ENC_BIG_ENDIAN);
174
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap_invalidate, tvb, local_offset, 1, ENC_BIG_ENDIAN);
175
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap_extmaxadverts, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
176
0
            local_offset += 1;  /* skip reserved */
177
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_maxadverts, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
178
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_desremrcvsz, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
179
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_localrcvsz, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
180
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_localport, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
181
0
            local_offset += 2;  /* skip reserved */
182
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_src_ip, tvb, local_offset, 16, ENC_NA); local_offset += 16;
183
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_dst_ip, tvb, local_offset, 16, ENC_NA); local_offset += 16;
184
0
            local_offset += 2;  /* skip reserved */
185
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_extmaxadverts, tvb, local_offset, 2, ENC_BIG_ENDIAN); /*local_offset += 2;*/
186
0
            break;
187
0
        case HelloAck:
188
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_hah, tvb, local_offset, 48, ENC_NA);
189
0
            break;
190
0
        case DisConn:
191
0
            break;
192
0
        case AbortConn:
193
0
            break;
194
0
        case SendSm:
195
0
            break;
196
0
        case RdmaWrCompl:
197
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_rwch, tvb, local_offset, 48, ENC_NA);
198
0
            break;
199
0
        case RdmaRdCompl:
200
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_rrch, tvb, local_offset, 48, ENC_NA);
201
0
            break;
202
0
        case ModeChange:
203
0
            proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mch, tvb, local_offset, 48, ENC_NA);
204
0
            break;
205
0
        case SrcAvailCancel:
206
0
            break;
207
0
        case SinkAvailCancel:
208
0
            break;
209
0
        case SinkCancelAck:
210
0
            break;
211
0
        case ChRcvBuf:
212
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_crbh, tvb, local_offset, 48, ENC_NA);
213
0
            break;
214
0
        case ChRcvBufAck:
215
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_crbah, tvb, local_offset, 48, ENC_NA);
216
0
            break;
217
0
        case SuspComm:
218
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_suspch, tvb, local_offset, 48, ENC_NA);
219
0
            break;
220
0
        case SuspCommAck:
221
0
            break;
222
0
        case SinkAvail:
223
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_sinkah, tvb, local_offset, 48, ENC_NA);
224
0
            break;
225
0
        case SrcAvail:
226
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_srcah, tvb, local_offset, 48, ENC_NA);
227
0
            break;
228
0
        case Data:
229
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_data, tvb, local_offset, -1, ENC_NA);
230
0
            break;
231
0
        default:
232
0
            break;
233
0
    }
234
235
0
    return tvb_captured_length(tvb);
236
0
}
237
238
static bool
239
dissect_ib_sdp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
240
262
{
241
262
    conversation_t *conv;
242
262
    conversation_infiniband_data *convo_data = NULL;
243
244
262
    if (tvb_captured_length(tvb) < 16)   /* check this has at least enough bytes for the BSDH */
245
83
        return false;
246
247
    /* first try to find a conversation between the two current hosts. in most cases this
248
       will not work since we do not have the source QP. this WILL succeed when we're still
249
       in the process of CM negotiations */
250
179
    conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
251
179
                             CONVERSATION_IBQP, pinfo->srcport, pinfo->destport, 0);
252
253
179
    if (!conv) {
254
        /* if not, try to find an established RC channel. recall Infiniband conversations are
255
           registered with one side of the channel. since the packet is only guaranteed to
256
           contain the qpn of the destination, we'll use this */
257
0
        conv = find_conversation(pinfo->num, &pinfo->dst, &pinfo->dst,
258
0
                                 CONVERSATION_IBQP, pinfo->destport, pinfo->destport, NO_ADDR_B|NO_PORT_B);
259
260
0
        if (!conv)
261
0
            return false;   /* nothing to do with no conversation context */
262
0
    }
263
264
179
    convo_data = (conversation_infiniband_data *)conversation_get_proto_data(conv, proto_infiniband);
265
266
179
    if (!convo_data)
267
179
        return false;
268
269
0
    if (!(convo_data->service_id & SERVICE_ID_MASK))
270
0
        return false;   /* the service id doesn't match that of SDP - nothing for us to do here */
271
272
0
    dissect_ib_sdp(tvb, pinfo, tree, data);
273
0
    return true;
274
0
}
275
276
void
277
proto_register_ib_sdp(void)
278
16
{
279
16
    module_t *ib_sdp_module;
280
16
    static hf_register_info hf[] = {
281
        /* SDP BSDH Header */
282
16
        { &hf_ib_sdp_bsdh, {
283
16
            "BSDH", "infiniband_sdp.bsdh",
284
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
285
16
        },
286
16
        { &hf_ib_sdp_mid, {
287
16
            "MID", "infiniband_sdp.bsdh.mid",
288
16
            FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(mid_meanings), 0x0, NULL, HFILL}
289
16
        },
290
16
        {&hf_ib_sdp_flags, {
291
16
            "Flags", "infiniband_sdp.bsdh.flags",
292
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
293
16
        },
294
16
        {&hf_ib_sdp_flags_oobpres, {
295
16
            "OOB_PRES", "infiniband_sdp.bsdh.oobpres",
296
16
            FT_UINT8, BASE_HEX, NULL, 0x01, "Out-Of-Band Data is present", HFILL}
297
16
        },
298
16
        {&hf_ib_sdp_flags_oob_pend, {
299
16
            "OOB_PEND", "infiniband_sdp.bsdh.oobpend",
300
16
            FT_UINT8, BASE_HEX, NULL, 0x02, "Out-Of-Band Data is pending", HFILL}
301
16
        },
302
16
        {&hf_ib_sdp_flags_reqpipe, {
303
16
            "REQ_PIPE", "infiniband_sdp.bsdh.reqpipe",
304
16
            FT_UINT8, BASE_HEX, NULL, 0x04, "Request change to Pipelined Mode", HFILL}
305
16
        },
306
16
        {&hf_ib_sdp_bufs, {
307
16
            "Buffers", "infiniband_sdp.bsdh.bufs",
308
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
309
16
        },
310
16
        {&hf_ib_sdp_len, {
311
16
            "Length", "infiniband_sdp.bsdh.len",
312
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
313
16
        },
314
16
        {&hf_ib_sdp_mseq, {
315
16
            "MSeq", "infiniband_sdp.bsdh.mseq",
316
16
            FT_UINT32, BASE_HEX, NULL, 0x0, "Message Sequence Number", HFILL}
317
16
        },
318
16
        {&hf_ib_sdp_mseqack, {
319
16
            "MSeqAck", "infiniband_sdp.bsdh.mseqack",
320
16
            FT_UINT32, BASE_HEX, NULL, 0x0, "Message Sequence Number Acknowledgement", HFILL}
321
16
        },
322
        /* SDP Hello Header */
323
16
        {&hf_ib_sdp_hh, {
324
16
            "Hello Header", "infiniband_sdp.hh",
325
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
326
16
        },
327
16
        {&hf_ib_sdp_majv, {
328
16
            "Major Protocol Version Number", "infiniband_sdp.hh.majv",
329
16
            FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL}
330
16
        },
331
16
        {&hf_ib_sdp_minv, {
332
16
            "Minor Protocol Version Number", "infiniband_sdp.hh.minv",
333
16
            FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL}
334
16
        },
335
16
        {&hf_ib_sdp_ipv,
336
16
            {"IP version", "infiniband_sdp.hh.ipv",
337
16
            FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL}
338
16
        },
339
16
        {&hf_ib_sdp_cap, {
340
16
            "Capabilities", "infiniband_sdp.hh.cap",
341
16
            FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL}
342
16
        },
343
16
        {&hf_ib_sdp_cap_invalidate, {
344
16
            "INVALIDATE_CAP", "infiniband_sdp.hh.cap_invalidate",
345
16
            FT_UINT8, BASE_HEX, NULL, 0x1, "Supports incoming Send w/Invalidate opcode", HFILL}
346
16
        },
347
16
        {&hf_ib_sdp_cap_extmaxadverts, {
348
16
            "EXTENDED_MAXADVERTS", "infiniband_sdp.hh.cap_extmaxadverts",
349
16
            FT_UINT8, BASE_HEX, NULL, 0x2, "Extended MaxAdverts is used", HFILL}
350
16
        },
351
16
        {&hf_ib_sdp_maxadverts, {
352
16
            "Maximum Advertisements", "infiniband_sdp.hh.maxadverts",
353
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
354
16
        },
355
16
        {&hf_ib_sdp_desremrcvsz, {
356
16
            "DesRemRcvSz", "infiniband_sdp.hh.desremrcvsz",
357
16
            FT_UINT32, BASE_DEC, NULL, 0x0, "Desired Remote Receive Size", HFILL}
358
16
        },
359
16
        {&hf_ib_sdp_localrcvsz,
360
16
            {"LocalRcvSz", "infiniband_sdp.hh.localrcvsz",
361
16
                FT_UINT32, BASE_DEC, NULL, 0x0, "Local Receive Size", HFILL}
362
16
        },
363
16
        {&hf_ib_sdp_localport, {
364
16
            "Local Port", "infiniband_sdp.hh.localport",
365
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
366
16
        },
367
16
        {&hf_ib_sdp_src_ip, {
368
16
            "Source IP", "infiniband_sdp.hh.src_ip",
369
16
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
370
16
        },
371
16
        {&hf_ib_sdp_dst_ip, {
372
16
            "Destination IP", "infiniband_sdp.hh.dst_ip",
373
16
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
374
16
        },
375
16
        {&hf_ib_sdp_extmaxadverts, {
376
16
            "Extended MaxAdverts", "infiniband_sdp.hh.extmaxadverts",
377
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
378
16
        },
379
        /* Rest of Headers */
380
16
        {&hf_ib_sdp_hah, {
381
16
            "HelloAck Header", "infiniband_sdp.hah",
382
16
            FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}
383
16
        },
384
16
        {&hf_ib_sdp_rwch, {
385
16
            "RdmaWrCompl Header", "infiniband_sdp.rwch",
386
16
            FT_NONE, BASE_NONE, NULL, 0x00, "RDMA Write Complete", HFILL}
387
16
        },
388
16
        {&hf_ib_sdp_rrch, {
389
16
            "RdmaRdCompl Header", "infiniband_sdp.rrch",
390
16
            FT_NONE, BASE_NONE, NULL, 0x00, "RDMA Read Complete", HFILL}
391
16
        },
392
16
        {&hf_ib_sdp_mch, {
393
16
            "ModeChange Header", "infiniband_sdp.mch",
394
16
            FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}
395
16
        },
396
16
        {&hf_ib_sdp_crbh, {
397
16
            "ChRcvBuf Header", "infiniband_sdp.crbh",
398
16
            FT_NONE, BASE_NONE, NULL, 0x00, "Change Receive private Buffer size", HFILL}
399
16
        },
400
16
        {&hf_ib_sdp_crbah, {
401
16
            "ChRcvBufAck Header", "infiniband_sdp.crbah",
402
16
            FT_NONE, BASE_NONE, NULL, 0x00, "Change Receive private Buffer size Acknowledgement", HFILL}
403
16
        },
404
16
        {&hf_ib_sdp_suspch, {
405
16
            "SuspComm Header", "infiniband_sdp.suspch",
406
16
            FT_NONE, BASE_NONE, NULL, 0x00, "Suspend Communication", HFILL}
407
16
        },
408
16
        {&hf_ib_sdp_sinkah, {
409
16
            "SinkAvail Header", "infiniband_sdp.sinkah",
410
16
            FT_NONE, BASE_NONE, NULL, 0x00, "Data Sink Available", HFILL}
411
16
        },
412
16
        {&hf_ib_sdp_srcah, {
413
16
            "SrcAvail Header", "infiniband_sdp.srcah",
414
16
            FT_NONE, BASE_NONE, NULL, 0x00, "Data Source Available", HFILL}
415
16
        },
416
16
        {&hf_ib_sdp_data, {
417
16
            "Data", "infiniband_sdp.Data",
418
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
419
16
        }
420
16
    };
421
422
    /* Setup protocol subtree array */
423
16
    static int *ett[] = {
424
16
        &ett_ib_sdp,
425
16
        &ett_ib_sdp_bsdh,
426
16
        &ett_ib_sdp_hh,
427
16
    };
428
429
16
    proto_ib_sdp = proto_register_protocol("Infiniband Sockets Direct Protocol", "Infiniband SDP", "infiniband_sdp");
430
431
16
    ib_sdp_handle = register_dissector("infiniband_sdp", dissect_ib_sdp, proto_ib_sdp);
432
433
    /* Required function calls to register the header fields and subtrees used */
434
16
    proto_register_field_array(proto_ib_sdp, hf, array_length(hf));
435
16
    proto_register_subtree_array(ett, array_length(ett));
436
437
    /* Register preferences */
438
16
    ib_sdp_module = prefs_register_protocol(proto_ib_sdp, NULL);
439
440
16
    prefs_register_static_text_preference(ib_sdp_module, "use_decode_as",
441
16
        "Heuristic matching preferences removed.  Use Infiniband protocol preferences or Decode As.",
442
16
        "Simple heuristics can still be enable (may generate false positives) through Infiniband protocol preferences."
443
16
        "To force Infiniband SDP dissection use Decode As");
444
445
16
    prefs_register_obsolete_preference(ib_sdp_module, "manual_en");
446
447
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a");
448
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_type");
449
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_id");
450
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_qp");
451
452
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b");
453
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_type");
454
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_id");
455
16
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_qp");
456
16
}
457
458
void
459
proto_reg_handoff_ib_sdp(void)
460
16
{
461
16
    heur_dissector_add("infiniband.payload", dissect_ib_sdp_heur, "Infiniband SDP", "sdp_infiniband", proto_ib_sdp, HEURISTIC_ENABLE);
462
16
    heur_dissector_add("infiniband.mad.cm.private", dissect_ib_sdp_heur, "Infiniband SDP in PrivateData of CM packets", "sdp_ib_private", proto_ib_sdp, HEURISTIC_ENABLE);
463
464
16
    dissector_add_for_decode_as("infiniband", ib_sdp_handle);
465
466
16
    proto_infiniband = proto_get_id_by_filter_name( "infiniband" );
467
16
}
468
469
/*
470
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
471
 *
472
 * Local variables:
473
 * c-basic-offset: 4
474
 * tab-width: 8
475
 * indent-tabs-mode: nil
476
 * End:
477
 *
478
 * vi: set shiftwidth=4 tabstop=8 expandtab:
479
 * :indentSize=4:tabSize=8:noTabs=true:
480
 */