Coverage Report

Created: 2026-01-02 06:13

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
    mid =  tvb_get_uint8(tvb, local_offset);
152
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mid, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
153
154
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "(SDP %s)",
155
0
                    rval_to_str_const(mid, mid_meanings, "Unknown"));
156
157
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags, tvb, local_offset, 1, ENC_BIG_ENDIAN);
158
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_oobpres, tvb, local_offset, 1, ENC_BIG_ENDIAN);
159
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_oob_pend, tvb, local_offset, 1, ENC_BIG_ENDIAN);
160
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_flags_reqpipe, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
161
162
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_bufs, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
163
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_len, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
164
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mseq, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
165
0
    proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mseqack, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
166
167
0
    switch (mid) {
168
0
        case Hello:
169
0
            SDP_EH_header_item = proto_tree_add_item(SDP_header_tree, hf_ib_sdp_hh, tvb, local_offset, 48, ENC_NA);
170
0
            SDP_EH_header_tree = proto_item_add_subtree(SDP_EH_header_item, ett_ib_sdp_hh);
171
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_majv, tvb, local_offset, 1, ENC_BIG_ENDIAN);
172
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_minv, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
173
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_ipv, tvb, local_offset, 1, ENC_BIG_ENDIAN);
174
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap, tvb, local_offset, 1, ENC_BIG_ENDIAN);
175
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap_invalidate, tvb, local_offset, 1, ENC_BIG_ENDIAN);
176
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_cap_extmaxadverts, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
177
0
            local_offset += 1;  /* skip reserved */
178
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_maxadverts, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
179
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_desremrcvsz, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
180
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_localrcvsz, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
181
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_localport, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
182
0
            local_offset += 2;  /* skip reserved */
183
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_src_ip, tvb, local_offset, 16, ENC_NA); local_offset += 16;
184
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_dst_ip, tvb, local_offset, 16, ENC_NA); local_offset += 16;
185
0
            local_offset += 2;  /* skip reserved */
186
0
            proto_tree_add_item(SDP_EH_header_tree, hf_ib_sdp_extmaxadverts, tvb, local_offset, 2, ENC_BIG_ENDIAN); /*local_offset += 2;*/
187
0
            break;
188
0
        case HelloAck:
189
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_hah, tvb, local_offset, 48, ENC_NA);
190
0
            break;
191
0
        case DisConn:
192
0
            break;
193
0
        case AbortConn:
194
0
            break;
195
0
        case SendSm:
196
0
            break;
197
0
        case RdmaWrCompl:
198
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_rwch, tvb, local_offset, 48, ENC_NA);
199
0
            break;
200
0
        case RdmaRdCompl:
201
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_rrch, tvb, local_offset, 48, ENC_NA);
202
0
            break;
203
0
        case ModeChange:
204
0
            proto_tree_add_item(SDP_BSDH_header_tree, hf_ib_sdp_mch, tvb, local_offset, 48, ENC_NA);
205
0
            break;
206
0
        case SrcAvailCancel:
207
0
            break;
208
0
        case SinkAvailCancel:
209
0
            break;
210
0
        case SinkCancelAck:
211
0
            break;
212
0
        case ChRcvBuf:
213
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_crbh, tvb, local_offset, 48, ENC_NA);
214
0
            break;
215
0
        case ChRcvBufAck:
216
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_crbah, tvb, local_offset, 48, ENC_NA);
217
0
            break;
218
0
        case SuspComm:
219
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_suspch, tvb, local_offset, 48, ENC_NA);
220
0
            break;
221
0
        case SuspCommAck:
222
0
            break;
223
0
        case SinkAvail:
224
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_sinkah, tvb, local_offset, 48, ENC_NA);
225
0
            break;
226
0
        case SrcAvail:
227
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_srcah, tvb, local_offset, 48, ENC_NA);
228
0
            break;
229
0
        case Data:
230
0
            proto_tree_add_item(SDP_header_tree, hf_ib_sdp_data, tvb, local_offset, -1, ENC_NA);
231
0
            break;
232
0
        default:
233
0
            break;
234
0
    }
235
236
0
    return tvb_captured_length(tvb);
237
0
}
238
239
static bool
240
dissect_ib_sdp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
241
364
{
242
364
    conversation_t *conv;
243
364
    conversation_infiniband_data *convo_data = NULL;
244
245
364
    if (tvb_captured_length(tvb) < 16)   /* check this has at least enough bytes for the BSDH */
246
135
        return false;
247
248
    /* first try to find a conversation between the two current hosts. in most cases this
249
       will not work since we do not have the source QP. this WILL succeed when we're still
250
       in the process of CM negotiations */
251
229
    conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
252
229
                             CONVERSATION_IBQP, pinfo->srcport, pinfo->destport, 0);
253
254
229
    if (!conv) {
255
        /* if not, try to find an established RC channel. recall Infiniband conversations are
256
           registered with one side of the channel. since the packet is only guaranteed to
257
           contain the qpn of the destination, we'll use this */
258
0
        conv = find_conversation(pinfo->num, &pinfo->dst, &pinfo->dst,
259
0
                                 CONVERSATION_IBQP, pinfo->destport, pinfo->destport, NO_ADDR_B|NO_PORT_B);
260
261
0
        if (!conv)
262
0
            return false;   /* nothing to do with no conversation context */
263
0
    }
264
265
229
    convo_data = (conversation_infiniband_data *)conversation_get_proto_data(conv, proto_infiniband);
266
267
229
    if (!convo_data)
268
229
        return false;
269
270
0
    if (!(convo_data->service_id & SERVICE_ID_MASK))
271
0
        return false;   /* the service id doesn't match that of SDP - nothing for us to do here */
272
273
0
    dissect_ib_sdp(tvb, pinfo, tree, data);
274
0
    return true;
275
0
}
276
277
void
278
proto_register_ib_sdp(void)
279
14
{
280
14
    module_t *ib_sdp_module;
281
14
    static hf_register_info hf[] = {
282
        /* SDP BSDH Header */
283
14
        { &hf_ib_sdp_bsdh, {
284
14
            "BSDH", "infiniband_sdp.bsdh",
285
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
286
14
        },
287
14
        { &hf_ib_sdp_mid, {
288
14
            "MID", "infiniband_sdp.bsdh.mid",
289
14
            FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(mid_meanings), 0x0, NULL, HFILL}
290
14
        },
291
14
        {&hf_ib_sdp_flags, {
292
14
            "Flags", "infiniband_sdp.bsdh.flags",
293
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
294
14
        },
295
14
        {&hf_ib_sdp_flags_oobpres, {
296
14
            "OOB_PRES", "infiniband_sdp.bsdh.oobpres",
297
14
            FT_UINT8, BASE_HEX, NULL, 0x01, "Out-Of-Band Data is present", HFILL}
298
14
        },
299
14
        {&hf_ib_sdp_flags_oob_pend, {
300
14
            "OOB_PEND", "infiniband_sdp.bsdh.oobpend",
301
14
            FT_UINT8, BASE_HEX, NULL, 0x02, "Out-Of-Band Data is pending", HFILL}
302
14
        },
303
14
        {&hf_ib_sdp_flags_reqpipe, {
304
14
            "REQ_PIPE", "infiniband_sdp.bsdh.reqpipe",
305
14
            FT_UINT8, BASE_HEX, NULL, 0x04, "Request change to Pipelined Mode", HFILL}
306
14
        },
307
14
        {&hf_ib_sdp_bufs, {
308
14
            "Buffers", "infiniband_sdp.bsdh.bufs",
309
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
310
14
        },
311
14
        {&hf_ib_sdp_len, {
312
14
            "Length", "infiniband_sdp.bsdh.len",
313
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
314
14
        },
315
14
        {&hf_ib_sdp_mseq, {
316
14
            "MSeq", "infiniband_sdp.bsdh.mseq",
317
14
            FT_UINT32, BASE_HEX, NULL, 0x0, "Message Sequence Number", HFILL}
318
14
        },
319
14
        {&hf_ib_sdp_mseqack, {
320
14
            "MSeqAck", "infiniband_sdp.bsdh.mseqack",
321
14
            FT_UINT32, BASE_HEX, NULL, 0x0, "Message Sequence Number Acknowledgement", HFILL}
322
14
        },
323
        /* SDP Hello Header */
324
14
        {&hf_ib_sdp_hh, {
325
14
            "Hello Header", "infiniband_sdp.hh",
326
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
327
14
        },
328
14
        {&hf_ib_sdp_majv, {
329
14
            "Major Protocol Version Number", "infiniband_sdp.hh.majv",
330
14
            FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL}
331
14
        },
332
14
        {&hf_ib_sdp_minv, {
333
14
            "Minor Protocol Version Number", "infiniband_sdp.hh.minv",
334
14
            FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL}
335
14
        },
336
14
        {&hf_ib_sdp_ipv,
337
14
            {"IP version", "infiniband_sdp.hh.ipv",
338
14
            FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL}
339
14
        },
340
14
        {&hf_ib_sdp_cap, {
341
14
            "Capabilities", "infiniband_sdp.hh.cap",
342
14
            FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL}
343
14
        },
344
14
        {&hf_ib_sdp_cap_invalidate, {
345
14
            "INVALIDATE_CAP", "infiniband_sdp.hh.cap_invalidate",
346
14
            FT_UINT8, BASE_HEX, NULL, 0x1, "Supports incoming Send w/Invalidate opcode", HFILL}
347
14
        },
348
14
        {&hf_ib_sdp_cap_extmaxadverts, {
349
14
            "EXTENDED_MAXADVERTS", "infiniband_sdp.hh.cap_extmaxadverts",
350
14
            FT_UINT8, BASE_HEX, NULL, 0x2, "Extended MaxAdverts is used", HFILL}
351
14
        },
352
14
        {&hf_ib_sdp_maxadverts, {
353
14
            "Maximum Advertisements", "infiniband_sdp.hh.maxadverts",
354
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
355
14
        },
356
14
        {&hf_ib_sdp_desremrcvsz, {
357
14
            "DesRemRcvSz", "infiniband_sdp.hh.desremrcvsz",
358
14
            FT_UINT32, BASE_DEC, NULL, 0x0, "Desired Remote Receive Size", HFILL}
359
14
        },
360
14
        {&hf_ib_sdp_localrcvsz,
361
14
            {"LocalRcvSz", "infiniband_sdp.hh.localrcvsz",
362
14
                FT_UINT32, BASE_DEC, NULL, 0x0, "Local Receive Size", HFILL}
363
14
        },
364
14
        {&hf_ib_sdp_localport, {
365
14
            "Local Port", "infiniband_sdp.hh.localport",
366
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
367
14
        },
368
14
        {&hf_ib_sdp_src_ip, {
369
14
            "Source IP", "infiniband_sdp.hh.src_ip",
370
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
371
14
        },
372
14
        {&hf_ib_sdp_dst_ip, {
373
14
            "Destination IP", "infiniband_sdp.hh.dst_ip",
374
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
375
14
        },
376
14
        {&hf_ib_sdp_extmaxadverts, {
377
14
            "Extended MaxAdverts", "infiniband_sdp.hh.extmaxadverts",
378
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
379
14
        },
380
        /* Rest of Headers */
381
14
        {&hf_ib_sdp_hah, {
382
14
            "HelloAck Header", "infiniband_sdp.hah",
383
14
            FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}
384
14
        },
385
14
        {&hf_ib_sdp_rwch, {
386
14
            "RdmaWrCompl Header", "infiniband_sdp.rwch",
387
14
            FT_NONE, BASE_NONE, NULL, 0x00, "RDMA Write Complete", HFILL}
388
14
        },
389
14
        {&hf_ib_sdp_rrch, {
390
14
            "RdmaRdCompl Header", "infiniband_sdp.rrch",
391
14
            FT_NONE, BASE_NONE, NULL, 0x00, "RDMA Read Complete", HFILL}
392
14
        },
393
14
        {&hf_ib_sdp_mch, {
394
14
            "ModeChange Header", "infiniband_sdp.mch",
395
14
            FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}
396
14
        },
397
14
        {&hf_ib_sdp_crbh, {
398
14
            "ChRcvBuf Header", "infiniband_sdp.crbh",
399
14
            FT_NONE, BASE_NONE, NULL, 0x00, "Change Receive private Buffer size", HFILL}
400
14
        },
401
14
        {&hf_ib_sdp_crbah, {
402
14
            "ChRcvBufAck Header", "infiniband_sdp.crbah",
403
14
            FT_NONE, BASE_NONE, NULL, 0x00, "Change Receive private Buffer size Acknowledgement", HFILL}
404
14
        },
405
14
        {&hf_ib_sdp_suspch, {
406
14
            "SuspComm Header", "infiniband_sdp.suspch",
407
14
            FT_NONE, BASE_NONE, NULL, 0x00, "Suspend Communication", HFILL}
408
14
        },
409
14
        {&hf_ib_sdp_sinkah, {
410
14
            "SinkAvail Header", "infiniband_sdp.sinkah",
411
14
            FT_NONE, BASE_NONE, NULL, 0x00, "Data Sink Available", HFILL}
412
14
        },
413
14
        {&hf_ib_sdp_srcah, {
414
14
            "SrcAvail Header", "infiniband_sdp.srcah",
415
14
            FT_NONE, BASE_NONE, NULL, 0x00, "Data Source Available", HFILL}
416
14
        },
417
14
        {&hf_ib_sdp_data, {
418
14
            "Data", "infiniband_sdp.Data",
419
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
420
14
        }
421
14
    };
422
423
    /* Setup protocol subtree array */
424
14
    static int *ett[] = {
425
14
        &ett_ib_sdp,
426
14
        &ett_ib_sdp_bsdh,
427
14
        &ett_ib_sdp_hh,
428
14
    };
429
430
14
    proto_ib_sdp = proto_register_protocol("Infiniband Sockets Direct Protocol", "Infiniband SDP", "infiniband_sdp");
431
432
14
    ib_sdp_handle = register_dissector("infiniband_sdp", dissect_ib_sdp, proto_ib_sdp);
433
434
    /* Required function calls to register the header fields and subtrees used */
435
14
    proto_register_field_array(proto_ib_sdp, hf, array_length(hf));
436
14
    proto_register_subtree_array(ett, array_length(ett));
437
438
    /* Register preferences */
439
14
    ib_sdp_module = prefs_register_protocol(proto_ib_sdp, NULL);
440
441
14
    prefs_register_static_text_preference(ib_sdp_module, "use_decode_as",
442
14
        "Heuristic matching preferences removed.  Use Infiniband protocol preferences or Decode As.",
443
14
        "Simple heuristics can still be enable (may generate false positives) through Infiniband protocol preferences."
444
14
        "To force Infiniband SDP dissection use Decode As");
445
446
14
    prefs_register_obsolete_preference(ib_sdp_module, "manual_en");
447
448
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a");
449
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_type");
450
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_id");
451
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_a_qp");
452
453
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b");
454
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_type");
455
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_id");
456
14
    prefs_register_obsolete_preference(ib_sdp_module, "addr_b_qp");
457
14
}
458
459
void
460
proto_reg_handoff_ib_sdp(void)
461
14
{
462
14
    heur_dissector_add("infiniband.payload", dissect_ib_sdp_heur, "Infiniband SDP", "sdp_infiniband", proto_ib_sdp, HEURISTIC_ENABLE);
463
14
    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);
464
465
14
    dissector_add_for_decode_as("infiniband", ib_sdp_handle);
466
467
14
    proto_infiniband = proto_get_id_by_filter_name( "infiniband" );
468
14
}
469
470
/*
471
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
472
 *
473
 * Local variables:
474
 * c-basic-offset: 4
475
 * tab-width: 8
476
 * indent-tabs-mode: nil
477
 * End:
478
 *
479
 * vi: set shiftwidth=4 tabstop=8 expandtab:
480
 * :indentSize=4:tabSize=8:noTabs=true:
481
 */