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-xdmcp.c
Line
Count
Source
1
/* packet-xdmcp.c
2
 * Routines for XDMCP message dissection
3
 * Copyright 2002, Pasi Eronen <pasi.eronen@nixu.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
#include <epan/to_str.h>
16
#include <epan/expert.h>
17
18
14
#define UDP_PORT_XDMCP 177
19
20
7
#define XDMCP_PROTOCOL_VERSION 1
21
22
0
#define XDMCP_BROADCAST_QUERY 1
23
0
#define XDMCP_QUERY 2
24
0
#define XDMCP_INDIRECT_QUERY 3
25
0
#define XDMCP_FORWARD_QUERY 4
26
0
#define XDMCP_WILLING 5
27
0
#define XDMCP_UNWILLING 6
28
0
#define XDMCP_REQUEST 7
29
0
#define XDMCP_ACCEPT 8
30
0
#define XDMCP_DECLINE 9
31
0
#define XDMCP_MANAGE 10
32
0
#define XDMCP_REFUSE 11
33
0
#define XDMCP_FAILED 12
34
0
#define XDMCP_KEEPALIVE 13
35
0
#define XDMCP_ALIVE 14
36
37
void proto_register_xdmcp(void);
38
void proto_reg_handoff_xdmcp(void);
39
40
static dissector_handle_t xdmcp_handle;
41
42
static const value_string opcode_vals[] = {
43
  { XDMCP_BROADCAST_QUERY, "Broadcast_query" },
44
  { XDMCP_QUERY, "Query" },
45
  { XDMCP_INDIRECT_QUERY, "Indirect_query" },
46
  { XDMCP_FORWARD_QUERY, "Forward_query" },
47
  { XDMCP_WILLING, "Willing" },
48
  { XDMCP_UNWILLING, "Unwilling" },
49
  { XDMCP_REQUEST, "Request" },
50
  { XDMCP_ACCEPT, "Accept "},
51
  { XDMCP_DECLINE, "Decline" },
52
  { XDMCP_MANAGE, "Manage" },
53
  { XDMCP_REFUSE, "Refuse" },
54
  { XDMCP_FAILED, "Failed" },
55
  { XDMCP_KEEPALIVE, "Keepalive" },
56
  { XDMCP_ALIVE, "Alive" },
57
  { 0, NULL }
58
};
59
60
/* Copied from packet-x11.c */
61
static const value_string family_vals[] = {
62
  { 0, "Internet" },
63
  { 1, "DECnet" },
64
  { 2, "Chaos" },
65
  { 6, "InternetV6" },
66
  { 0, NULL }
67
};
68
69
static int proto_xdmcp;
70
static int hf_xdmcp_version;
71
static int hf_xdmcp_opcode;
72
static int hf_xdmcp_length;
73
static int hf_xdmcp_authentication_name;
74
static int hf_xdmcp_authorization_name;
75
static int hf_xdmcp_hostname;
76
static int hf_xdmcp_status;
77
static int hf_xdmcp_session_id;
78
static int hf_xdmcp_display_number;
79
static int hf_xdmcp_manufacturer_display_id;
80
static int hf_xdmcp_manufacturer_display_id_len;
81
static int hf_xdmcp_display_class;
82
static int hf_xdmcp_display_class_len;
83
static int hf_xdmcp_client_address_ipv4;
84
static int hf_xdmcp_client_address_ipv6;
85
static int hf_xdmcp_client_address_bytes;
86
static int hf_xdmcp_client_address_bytes_len;
87
static int hf_xdmcp_client_port_u16;
88
static int hf_xdmcp_client_port_bytes;
89
static int hf_xdmcp_client_port_len;
90
static int hf_xdmcp_authentication_data;
91
static int hf_xdmcp_authentication_data_len;
92
static int hf_xdmcp_authorization_data;
93
static int hf_xdmcp_authorization_data_len;
94
static int hf_xdmcp_connection_type;
95
static int hf_xdmcp_connection_address_ipv4;
96
static int hf_xdmcp_connection_address_ipv6;
97
static int hf_xdmcp_connection_address_bytes;
98
static int hf_xdmcp_session_running;
99
100
static int ett_xdmcp;
101
static int ett_xdmcp_authentication_names;
102
static int ett_xdmcp_authorization_names;
103
static int ett_xdmcp_connections;
104
static int ett_xdmcp_connection;
105
106
static expert_field ei_xdmcp_conn_address_mismatch;
107
108
static int xdmcp_add_string(proto_tree *tree, packet_info* pinfo, int hf,
109
                             tvbuff_t *tvb, int offset)
110
0
{
111
0
  char *str;
112
0
  unsigned len;
113
114
0
  len = tvb_get_ntohs(tvb, offset);
115
0
  str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, len, ENC_ASCII);
116
0
  proto_tree_add_string(tree, hf, tvb, offset, len+2, str);
117
118
0
  return len+2;
119
0
}
120
121
static int xdmcp_add_bytes(proto_tree *tree, int hf_byte, int hf_length,
122
                     tvbuff_t *tvb, int offset)
123
0
{
124
0
  unsigned len;
125
0
  len = tvb_get_ntohs(tvb, offset);
126
127
0
  proto_tree_add_item(tree, hf_length, tvb, offset, 2, ENC_BIG_ENDIAN);
128
0
  proto_tree_add_item(tree, hf_byte, tvb, offset, len+2, ENC_NA);
129
0
  return len+2;
130
0
}
131
132
static int xdmcp_add_authentication_names(proto_tree *tree, packet_info* pinfo,
133
                                    tvbuff_t *tvb, int offset)
134
0
{
135
0
  proto_tree *anames_tree;
136
0
  proto_item *anames_ti;
137
0
  int anames_len, anames_start_offset;
138
139
0
  anames_start_offset = offset;
140
0
  anames_len = tvb_get_uint8(tvb, offset);
141
0
  anames_tree = proto_tree_add_subtree_format(tree, tvb,
142
0
                                  anames_start_offset, -1,
143
0
                                  ett_xdmcp_authentication_names, &anames_ti, "Authentication names (%d)",
144
0
                                  anames_len);
145
146
0
  anames_len = tvb_get_uint8(tvb, offset);
147
0
  offset++;
148
0
  while (anames_len > 0) {
149
0
    offset += xdmcp_add_string(anames_tree, pinfo, hf_xdmcp_authentication_name,
150
0
                               tvb, offset);
151
0
    anames_len--;
152
0
  }
153
0
  proto_item_set_len(anames_ti, offset - anames_start_offset);
154
0
  return offset - anames_start_offset;
155
0
}
156
157
static int xdmcp_add_authorization_names(proto_tree *tree, packet_info* pinfo,
158
                                    tvbuff_t *tvb, int offset)
159
0
{
160
0
  proto_tree *anames_tree;
161
0
  proto_item *anames_ti;
162
0
  int anames_len, anames_start_offset;
163
164
0
  anames_start_offset = offset;
165
0
  anames_len = tvb_get_uint8(tvb, offset);
166
0
  anames_tree = proto_tree_add_subtree_format(tree, tvb,
167
0
                                  anames_start_offset, -1,
168
0
                                  ett_xdmcp_authorization_names, &anames_ti, "Authorization names (%d)",
169
0
                                  anames_len);
170
171
0
  anames_len = tvb_get_uint8(tvb, offset);
172
0
  offset++;
173
0
  while (anames_len > 0) {
174
0
    offset += xdmcp_add_string(anames_tree, pinfo, hf_xdmcp_authorization_name,
175
0
                               tvb, offset);
176
0
    anames_len--;
177
0
  }
178
0
  proto_item_set_len(anames_ti, offset - anames_start_offset);
179
0
  return offset - anames_start_offset;
180
0
}
181
182
/*
183
 * I didn't find any documentation for the XDMCP protocol, so
184
 * this is reverse-engineered from XFree86 source files
185
 * xc/programs/xdm/xdmcp.c and xc/programs/Xserver/os/xdmcp.c.
186
 */
187
188
static int dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
189
7
{
190
7
  int version = -1, opcode = -1;
191
7
  int offset = 0;
192
7
  proto_item *ti;
193
7
  proto_tree *xdmcp_tree = 0;
194
195
7
  version = tvb_get_ntohs(tvb, offset);
196
7
  if (version != XDMCP_PROTOCOL_VERSION) {
197
    /* Only version 1 exists, so this probably is not XDMCP at all... */
198
6
    return offset;
199
6
  }
200
201
1
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "XDMCP");
202
1
  col_clear(pinfo->cinfo, COL_INFO);
203
204
1
  ti = proto_tree_add_item(tree, proto_xdmcp, tvb, offset, -1, ENC_NA);
205
1
  xdmcp_tree = proto_item_add_subtree(ti, ett_xdmcp);
206
207
1
  proto_tree_add_uint(xdmcp_tree, hf_xdmcp_version, tvb,
208
1
                        offset, 2, version);
209
210
1
  offset += 2;
211
212
1
  opcode = tvb_get_ntohs(tvb, offset);
213
1
  if (tree) {
214
1
    proto_tree_add_uint(xdmcp_tree, hf_xdmcp_opcode, tvb,
215
1
                        offset, 2, opcode);
216
1
  }
217
1
  offset += 2;
218
219
1
  col_add_str(pinfo->cinfo, COL_INFO,
220
1
                 val_to_str(pinfo->pool, opcode, opcode_vals, "Unknown (0x%04x)"));
221
222
1
  proto_tree_add_item(xdmcp_tree, hf_xdmcp_length, tvb,
223
1
                        offset, 2, ENC_BIG_ENDIAN);
224
225
1
  offset += 2;
226
227
1
  switch (opcode) {
228
0
    case XDMCP_FORWARD_QUERY:
229
0
    {
230
0
      int alen, plen;
231
0
      alen = tvb_get_ntohs(tvb, offset);
232
      /* I have never seen anything except IPv4 addresses here,
233
       * but in theory the protocol should support other address
234
       * families. */
235
0
      if (alen == 4) {
236
0
    proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_address_ipv4, tvb, offset+2, alen, ENC_BIG_ENDIAN);
237
0
        offset += 6;
238
0
      } else if (alen == 16) {
239
0
    proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_address_ipv6, tvb, offset+2, alen, ENC_NA);
240
0
        offset += 18;
241
0
      } else {
242
0
        offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_client_address_bytes, hf_xdmcp_client_address_bytes_len,
243
0
                              tvb, offset);
244
0
      }
245
246
0
      plen = tvb_get_ntohs(tvb, offset);
247
0
      if (plen == 2) {
248
0
    proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_port_u16, tvb, offset+2, plen, ENC_BIG_ENDIAN);
249
0
        offset += 4;
250
0
      } else {
251
0
        offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_client_port_bytes, hf_xdmcp_client_port_len,
252
0
                  tvb, offset);
253
0
      }
254
0
    }
255
    /* fall-through */
256
257
0
    case XDMCP_BROADCAST_QUERY:
258
0
    case XDMCP_QUERY:
259
0
    case XDMCP_INDIRECT_QUERY:
260
0
      offset += xdmcp_add_authentication_names(xdmcp_tree, pinfo, tvb, offset);
261
0
      break;
262
263
0
    case XDMCP_WILLING:
264
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_authentication_name,
265
0
                                 tvb, offset);
266
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_hostname,
267
0
                                 tvb, offset);
268
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_status,
269
0
                                 tvb, offset);
270
0
      break;
271
272
0
    case XDMCP_UNWILLING:
273
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_hostname,
274
0
                                 tvb, offset);
275
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_status,
276
0
                                 tvb, offset);
277
0
      break;
278
279
0
    case XDMCP_REQUEST:
280
0
    {
281
0
      proto_tree *clist_tree;
282
0
      proto_item *clist_ti;
283
0
      int ctypes_len, caddrs_len, n;
284
0
      int ctypes_start_offset, caddrs_offset;
285
286
0
      ti = proto_tree_add_item(xdmcp_tree, hf_xdmcp_display_number, tvb,
287
0
                          offset, 2, ENC_BIG_ENDIAN);
288
0
      offset += 2;
289
290
0
      ctypes_len = tvb_get_uint8(tvb, offset);
291
0
      ctypes_start_offset = offset;
292
0
      caddrs_offset = offset + 1 + 2*ctypes_len;
293
0
      caddrs_len = tvb_get_uint8(tvb, caddrs_offset);
294
0
      if (ctypes_len != caddrs_len) {
295
0
        expert_add_info(pinfo, ti, &ei_xdmcp_conn_address_mismatch);
296
0
        return offset;
297
0
      }
298
299
0
      clist_tree = proto_tree_add_subtree_format(xdmcp_tree,
300
0
                                     tvb, ctypes_start_offset, -1,
301
0
                                     ett_xdmcp_connections, &clist_ti, "Connections (%d)",
302
0
                                     ctypes_len);
303
304
0
      offset++;
305
0
      caddrs_offset++;
306
307
0
      n = 1;
308
0
      while (ctypes_len > 0) {
309
0
        proto_item *connection_ti;
310
0
        proto_tree *connection_tree;
311
312
0
        int alen;
313
0
        int ctype = tvb_get_ntohs(tvb, offset);
314
0
        offset += 2;
315
0
        alen = tvb_get_ntohs(tvb, caddrs_offset);
316
0
        caddrs_offset += 2;
317
318
0
        connection_tree = proto_tree_add_subtree_format(clist_tree, tvb, 0, 0,
319
0
                                            ett_xdmcp_connection, &connection_ti, "Connection %d", n);
320
321
0
        proto_tree_add_item(connection_tree, hf_xdmcp_connection_type, tvb, offset-2, 2, ENC_BIG_ENDIAN);
322
323
0
        if ((ctype == 0) && (alen == 4)) {
324
0
          proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_ipv4, tvb, caddrs_offset, alen, ENC_BIG_ENDIAN);
325
0
          proto_item_append_text(connection_ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb, caddrs_offset));
326
0
        } else if ((ctype == 6) && (alen == 16)) {
327
0
          proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_ipv6, tvb, caddrs_offset, alen, ENC_NA);
328
0
          proto_item_append_text(connection_ti, ": %s", tvb_ip6_to_str(pinfo->pool, tvb, caddrs_offset));
329
0
        } else {
330
0
          proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_bytes, tvb, caddrs_offset, alen, ENC_NA);
331
0
        }
332
333
0
        caddrs_offset += alen;
334
0
        ctypes_len--;
335
0
        n++;
336
0
      }
337
0
      offset = caddrs_offset;
338
0
      proto_item_set_len(clist_ti, offset - ctypes_start_offset);
339
340
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_authentication_name,
341
0
                                 tvb, offset);
342
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
343
0
                                 tvb, offset);
344
345
0
      offset += xdmcp_add_authorization_names(xdmcp_tree, pinfo, tvb, offset);
346
347
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_manufacturer_display_id, hf_xdmcp_manufacturer_display_id_len,
348
0
                               tvb, offset);
349
0
      break;
350
0
    }
351
352
0
    case XDMCP_ACCEPT:
353
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
354
0
                          offset, 4, ENC_BIG_ENDIAN);
355
0
      offset += 4;
356
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_authentication_name,
357
0
                                 tvb, offset);
358
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
359
0
                                 tvb, offset);
360
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_authorization_name,
361
0
                                 tvb, offset);
362
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authorization_data, hf_xdmcp_authorization_data_len,
363
0
                                 tvb, offset);
364
0
      break;
365
366
0
    case XDMCP_DECLINE:
367
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_status,
368
0
                                 tvb, offset);
369
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_authentication_name,
370
0
                                 tvb, offset);
371
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
372
0
                                 tvb, offset);
373
0
      break;
374
375
0
    case XDMCP_MANAGE:
376
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
377
0
                          offset, 4, ENC_BIG_ENDIAN);
378
0
      offset += 4;
379
380
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_display_number, tvb,
381
0
                          offset, 2, ENC_BIG_ENDIAN);
382
0
      offset += 2;
383
384
0
      offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_display_class, hf_xdmcp_display_class_len,
385
0
                               tvb, offset);
386
0
      break;
387
388
0
    case XDMCP_REFUSE:
389
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
390
0
                          offset, 4, ENC_BIG_ENDIAN);
391
0
      offset += 4;
392
0
      break;
393
394
0
    case XDMCP_FAILED:
395
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
396
0
                          offset, 4, ENC_BIG_ENDIAN);
397
0
      offset += 4;
398
399
0
      offset += xdmcp_add_string(xdmcp_tree, pinfo, hf_xdmcp_status,
400
0
                                 tvb, offset);
401
0
      break;
402
403
0
    case XDMCP_KEEPALIVE:
404
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_display_number, tvb,
405
0
                          offset, 2, ENC_BIG_ENDIAN);
406
0
      offset += 2;
407
408
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
409
0
                          offset, 4, ENC_BIG_ENDIAN);
410
0
      offset += 4;
411
0
      break;
412
413
0
    case XDMCP_ALIVE:
414
0
    {
415
0
      uint8_t session_running = tvb_get_uint8(tvb, offset);
416
0
      proto_tree_add_uint_format_value(xdmcp_tree, hf_xdmcp_session_running, tvb,
417
0
                          offset, 1, session_running, "%s", session_running ? "Yes" : "No");
418
0
      offset++;
419
420
0
      proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
421
0
                          offset, 4, ENC_BIG_ENDIAN);
422
0
      offset += 4;
423
0
    }
424
0
      break;
425
1
    default:
426
1
      break;
427
1
  }
428
1
  return offset;
429
430
1
}
431
432
/* Register the protocol with Wireshark */
433
void proto_register_xdmcp(void)
434
14
{
435
  /* Setup list of header fields */
436
14
  static hf_register_info hf[] = {
437
14
    { &hf_xdmcp_version,
438
14
      { "Version",           "xdmcp.version",
439
14
      FT_UINT16, BASE_DEC, NULL, 0,
440
14
      "Protocol version", HFILL }
441
14
    },
442
14
    { &hf_xdmcp_opcode,
443
14
      { "Opcode",              "xdmcp.opcode",
444
14
      FT_UINT16, BASE_HEX, VALS(opcode_vals), 0,
445
14
      NULL, HFILL }
446
14
    },
447
14
    { &hf_xdmcp_length,
448
14
      { "Message length",     "xdmcp.length",
449
14
      FT_UINT16, BASE_DEC, NULL, 0,
450
14
      "Length of the remaining message", HFILL }
451
14
    },
452
14
    { &hf_xdmcp_authentication_name,
453
14
      { "Authentication name",     "xdmcp.authentication_name",
454
14
      FT_STRING, BASE_NONE, NULL, 0,
455
14
      NULL, HFILL }
456
14
    },
457
14
    { &hf_xdmcp_authorization_name,
458
14
      { "Authorization name",     "xdmcp.authorization_name",
459
14
      FT_STRING, BASE_NONE, NULL, 0,
460
14
      NULL, HFILL }
461
14
    },
462
14
    { &hf_xdmcp_hostname,
463
14
      { "Hostname",     "xdmcp.hostname",
464
14
      FT_STRING, BASE_NONE, NULL, 0,
465
14
      NULL, HFILL }
466
14
    },
467
14
    { &hf_xdmcp_status,
468
14
      { "Status",     "xdmcp.status",
469
14
      FT_STRING, BASE_NONE, NULL, 0,
470
14
      NULL, HFILL }
471
14
    },
472
14
    { &hf_xdmcp_session_id,
473
14
      { "Session ID",     "xdmcp.session_id",
474
14
      FT_UINT32, BASE_HEX, NULL, 0,
475
14
      "Session identifier", HFILL }
476
14
    },
477
14
    { &hf_xdmcp_display_number,
478
14
      { "Display number",     "xdmcp.display_number",
479
14
      FT_UINT16, BASE_DEC, NULL, 0,
480
14
      NULL, HFILL }
481
14
    },
482
14
    { &hf_xdmcp_manufacturer_display_id_len,
483
14
      { "Manufacturer display ID Length",     "xdmcp.manufacturer_display_id_len",
484
14
      FT_UINT16, BASE_DEC, NULL, 0,
485
14
      NULL, HFILL }
486
14
    },
487
14
    { &hf_xdmcp_manufacturer_display_id,
488
14
      { "Manufacturer display ID",     "xdmcp.manufacturer_display_id",
489
14
      FT_BYTES, BASE_NONE, NULL, 0,
490
14
      NULL, HFILL }
491
14
    },
492
14
    { &hf_xdmcp_display_class_len,
493
14
      { "Display class Length",     "xdmcp.display_class_len",
494
14
      FT_UINT16, BASE_DEC, NULL, 0,
495
14
      NULL, HFILL }
496
14
    },
497
14
    { &hf_xdmcp_display_class,
498
14
      { "Display class",     "xdmcp.display_class",
499
14
      FT_BYTES, BASE_NONE, NULL, 0,
500
14
      NULL, HFILL }
501
14
    },
502
    /* XXX - the following 3 could be the same filter, but mixed types of the same filter seem to cause issues */
503
14
    { &hf_xdmcp_client_address_ipv4,
504
14
      { "Client Address",     "xdmcp.client_address_ipv4",
505
14
      FT_IPv4, BASE_NONE, NULL, 0,
506
14
      NULL, HFILL }
507
14
    },
508
14
    { &hf_xdmcp_client_address_ipv6,
509
14
      { "Client Address",     "xdmcp.client_address_ipv6",
510
14
      FT_IPv6, BASE_NONE, NULL, 0,
511
14
      NULL, HFILL }
512
14
    },
513
14
    { &hf_xdmcp_client_address_bytes,
514
14
      { "Client Address",     "xdmcp.client_address_bytes",
515
14
      FT_BYTES, BASE_NONE, NULL, 0,
516
14
      NULL, HFILL }
517
14
    },
518
14
    { &hf_xdmcp_client_address_bytes_len,
519
14
      { "Client Address Length",     "xdmcp.client_address_bytes_len",
520
14
      FT_UINT16, BASE_DEC, NULL, 0,
521
14
      NULL, HFILL }
522
14
    },
523
14
    { &hf_xdmcp_client_port_len,
524
14
      { "Client port Length",     "xdmcp.client_port_len",
525
14
      FT_UINT16, BASE_DEC, NULL, 0,
526
14
      NULL, HFILL }
527
14
    },
528
14
    { &hf_xdmcp_client_port_bytes,
529
14
      { "Client port",     "xdmcp.client_port_bytes",
530
14
      FT_BYTES, BASE_NONE, NULL, 0,
531
14
      NULL, HFILL }
532
14
    },
533
14
    { &hf_xdmcp_client_port_u16,
534
14
      { "Client port",     "xdmcp.client_port",
535
14
      FT_UINT16, BASE_DEC, NULL, 0,
536
14
      NULL, HFILL }
537
14
    },
538
14
    { &hf_xdmcp_authentication_data_len,
539
14
      { "Authentication data Length",     "xdmcp.authentication_data_len",
540
14
      FT_UINT16, BASE_DEC, NULL, 0,
541
14
      NULL, HFILL }
542
14
    },
543
14
    { &hf_xdmcp_authentication_data,
544
14
      { "Authentication data",     "xdmcp.authentication_data",
545
14
      FT_BYTES, BASE_NONE, NULL, 0,
546
14
      NULL, HFILL }
547
14
    },
548
14
    { &hf_xdmcp_authorization_data_len,
549
14
      { "Authorization data Length",     "xdmcp.authorization_data_len",
550
14
      FT_UINT16, BASE_DEC, NULL, 0,
551
14
      NULL, HFILL }
552
14
    },
553
14
    { &hf_xdmcp_authorization_data,
554
14
      { "Authorization data",     "xdmcp.authorization_data",
555
14
      FT_BYTES, BASE_NONE, NULL, 0,
556
14
      NULL, HFILL }
557
14
    },
558
    /* XXX - the following 3 could be the same filter, but mixed types of the same filter seem to cause issues */
559
14
    { &hf_xdmcp_connection_address_ipv4,
560
14
      { "Address",     "xdmcp.connection_address_ipv4",
561
14
      FT_IPv4, BASE_NONE, NULL, 0,
562
14
      NULL, HFILL }
563
14
    },
564
14
    { &hf_xdmcp_connection_address_ipv6,
565
14
      { "Address",     "xdmcp.connection_address_ipv6",
566
14
      FT_IPv6, BASE_NONE, NULL, 0,
567
14
      NULL, HFILL }
568
14
    },
569
14
    { &hf_xdmcp_connection_address_bytes,
570
14
      { "Address",     "xdmcp.connection_address_bytes",
571
14
      FT_BYTES, BASE_NONE, NULL, 0,
572
14
      NULL, HFILL }
573
14
    },
574
14
    { &hf_xdmcp_connection_type,
575
14
      { "Type",     "xdmcp.connection_type",
576
14
      FT_UINT16, BASE_HEX, VALS(family_vals), 0,
577
14
      NULL, HFILL }
578
14
    },
579
14
    { &hf_xdmcp_session_running,
580
14
      { "Session running",     "xdmcp.session_running",
581
14
      FT_UINT8, BASE_DEC, NULL, 0,
582
14
      NULL, HFILL }
583
14
    },
584
585
14
  };
586
587
  /* Setup protocol subtree array */
588
14
  static int *ett[] = {
589
14
    &ett_xdmcp,
590
14
    &ett_xdmcp_authentication_names,
591
14
    &ett_xdmcp_authorization_names,
592
14
    &ett_xdmcp_connections,
593
14
    &ett_xdmcp_connection
594
14
  };
595
596
14
  static ei_register_info ei[] = {
597
14
     { &ei_xdmcp_conn_address_mismatch, { "xdmcp.conn_address_mismatch", PI_PROTOCOL, PI_WARN, "Error: Connection type/address arrays don't match", EXPFILL }},
598
14
  };
599
600
14
  expert_module_t* expert_xdmcp;
601
602
  /* Register the protocol name and description */
603
14
  proto_xdmcp = proto_register_protocol("X Display Manager Control Protocol", "XDMCP", "xdmcp");
604
605
  /* Required function calls to register the header fields and subtrees used */
606
14
  proto_register_field_array(proto_xdmcp, hf, array_length(hf));
607
14
  proto_register_subtree_array(ett, array_length(ett));
608
14
  expert_xdmcp = expert_register_protocol(proto_xdmcp);
609
14
  expert_register_field_array(expert_xdmcp, ei, array_length(ei));
610
611
  /* Register the dissector handle */
612
14
  xdmcp_handle = register_dissector("xdmcp", dissect_xdmcp, proto_xdmcp);
613
14
}
614
615
void
616
proto_reg_handoff_xdmcp(void)
617
14
{
618
14
  dissector_add_uint_with_preference("udp.port", UDP_PORT_XDMCP, xdmcp_handle);
619
14
}
620
/*
621
 * Editor modelines
622
 *
623
 * Local Variables:
624
 * c-basic-offset: 2
625
 * tab-width: 8
626
 * indent-tabs-mode: nil
627
 * End:
628
 *
629
 * ex: set shiftwidth=2 tabstop=8 expandtab:
630
 * :indentSize=2:tabSize=8:noTabs=true:
631
 */