Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / packet-dccp.c
1 /* packet-dccp.c
2  * Routines for Distributed Checksum Clearinghouse packet dissection
3  * DCC Home: http://www.rhyolite.com/anti-spam/dcc/
4  *
5  * Copyright 1999, Nathan Neulinger <nneul@umr.edu>
6  *
7  * $Id: packet-dccp.c,v 1.7 2002/08/02 23:35:48 jmayer Exp $
8  *
9  * Ethereal - Network traffic analyzer
10  * By Gerald Combs <gerald@ethereal.com>
11  * Copyright 1998 Gerald Combs
12  *
13  * Copied from packet-tftp.c
14  * 
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  * 
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  * 
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28  */
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <stdio.h>
35
36 #include <string.h>
37 #include <glib.h>
38 #include <epan/packet.h>
39
40 #include <packet-dccp.h>
41
42 static int proto_dccp = -1;
43 static int hf_dccp_len = -1;
44 static int hf_dccp_pkt_vers = -1;
45 static int hf_dccp_op = -1;
46 static int hf_dccp_clientid = -1;
47 static int hf_dccp_opnums_host = -1;
48 static int hf_dccp_opnums_pid = -1;
49 static int hf_dccp_opnums_report = -1;
50 static int hf_dccp_opnums_retrans = -1;
51
52 static int hf_dccp_signature = -1;
53 static int hf_dccp_max_pkt_vers = -1;
54 static int hf_dccp_qdelay_ms = -1;
55 static int hf_dccp_brand = -1;
56
57 static int hf_dccp_ck_type = -1;
58 static int hf_dccp_ck_len = -1;
59 static int hf_dccp_ck_sum = -1;
60
61 static int hf_dccp_date = -1;
62 static int hf_dccp_msg = -1;
63
64 static int hf_dccp_target = -1;
65
66 static int hf_dccp_adminop = -1;
67 static int hf_dccp_adminval = -1;
68 static int hf_dccp_floodop = -1;
69 static int hf_dccp_trace = -1;
70 static int hf_dccp_trace_admin = -1;
71 static int hf_dccp_trace_anon = -1;
72 static int hf_dccp_trace_client = -1;
73 static int hf_dccp_trace_rlim = -1;
74 static int hf_dccp_trace_query = -1;
75 static int hf_dccp_trace_ridc = -1;
76 static int hf_dccp_trace_flood = -1;
77
78 static gint ett_dccp = -1;
79 static gint ett_dccp_opnums = -1;
80 static gint ett_dccp_op = -1;
81 static gint ett_dccp_ck = -1;
82 static gint ett_dccp_trace = -1;
83
84 /* Utility macros */
85 #define D_SIGNATURE() \
86         proto_tree_add_item(dccp_optree, hf_dccp_signature, tvb, \
87                 offset, sizeof(DCC_SIGNATURE), FALSE); \
88         offset += sizeof(DCC_SIGNATURE);
89
90 #define D_LABEL(label,len) \
91         proto_tree_add_text(dccp_optree, tvb, offset, len, label); \
92         offset += len;
93
94 #define D_TEXT(label, endpad) { \
95         int next_offset,linelen,left; \
96         const char *line; \
97         while (tvb_offset_exists(tvb, offset+endpad)) { \
98                 left = tvb_length_remaining(tvb,offset) - endpad; \
99                 linelen = tvb_find_line_end(tvb, offset, left, &next_offset, \
100                     FALSE); \
101                 line = tvb_get_ptr(tvb, offset, linelen); \
102                 proto_tree_add_text(dccp_optree, tvb, offset, \
103                         next_offset - offset, "%s: %s", \
104                         label, tvb_format_text(tvb, offset, next_offset - offset)); \
105                 offset = next_offset; \
106         } \
107 }
108
109
110 #define D_TARGET() \
111         proto_tree_add_item_hidden(dccp_tree, hf_dccp_target, tvb, \
112                 offset, sizeof(DCC_TGTS), FALSE); \
113         proto_tree_add_text(dccp_optree, tvb, offset, sizeof(DCC_TGTS), \
114                 val_to_str(tvb_get_ntohl(tvb,offset), dccp_target_vals, "Targets (%u)")); \
115         offset += sizeof(DCC_TGTS); \
116
117 #define D_DATE() { \
118         nstime_t ts; \
119         ts.nsecs = 0; \
120         ts.secs = tvb_get_ntohl(tvb,offset); \
121         proto_tree_add_time(dccp_optree, hf_dccp_date, tvb, offset, 4, &ts); \
122         offset += 4; \
123 }
124         
125
126 #define D_CHECKSUM() { \
127         proto_tree *cktree, *ti; \
128         ti = proto_tree_add_text(dccp_optree, tvb, offset, sizeof(DCC_CK), \
129                 "Checksum - %s", val_to_str(tvb_get_guint8(tvb,offset), \
130                 dccp_cktype_vals, \
131                 "Unknown Type: %u")); \
132         cktree = proto_item_add_subtree(ti, ett_dccp_ck); \
133         proto_tree_add_item(cktree, hf_dccp_ck_type, tvb, offset, 1, FALSE); \
134         offset += 1; \
135         proto_tree_add_item(cktree, hf_dccp_ck_len, tvb, offset, 1, FALSE); \
136         offset += 1; \
137         proto_tree_add_item(cktree, hf_dccp_ck_sum, tvb, offset, \
138                 sizeof(DCC_SUM), FALSE); \
139         offset += sizeof(DCC_SUM); \
140 }
141
142
143 /* Lookup string tables */
144 static const value_string dccp_op_vals[] = {
145         {DCC_OP_INVALID, "Invalid Op"},
146         {DCC_OP_NOP,    "No-Op"},
147         {DCC_OP_REPORT, "Report and Query"},
148         {DCC_OP_QUERY, "Query"},
149         {DCC_OP_QUERY_RESP, "Server Response"},
150         {DCC_OP_ADMN, "Admin"},
151         {DCC_OP_OK, "Ok"},
152         {DCC_OP_ERROR, "Server Failing"},
153         {DCC_OP_DELETE, "Delete Checksum(s)"},
154         {0, NULL}
155 };
156
157 static const value_string dccp_cktype_vals[] = {
158         {DCC_CK_INVALID, "Invalid/Deleted from DB when seen"},
159         {DCC_CK_IP,     "MD5 of binary source IPv6 address"},
160         {DCC_CK_ENV_FROM, "MD5 of envelope Mail From value"},
161         {DCC_CK_FROM, "MD5 of header From: line"},
162         {DCC_CK_SUB, "MD5 of substitute header line"},
163         {DCC_CK_MESSAGE_ID, "MD5 of header Message-ID: line"},
164         {DCC_CK_RECEIVED, "MD5 of last header Received: line"},
165         {DCC_CK_BODY, "MD5 of body"},
166         {DCC_CK_FUZ1, "MD5 of filtered body - FUZ1"},
167         {DCC_CK_FUZ2, "MD5 of filtered body - FUZ2"},
168         {DCC_CK_FUZ3, "MD5 of filtered body - FUZ3"},
169         {DCC_CK_FUZ4, "MD5 of filtered body - FUZ4"},
170         {DCC_CK_SRVR_ID, "hostname for server-ID check "},
171         {DCC_CK_ENV_TO, "MD5 of envelope Rcpt To value"},
172         {0, NULL},
173 };
174
175 static const value_string dccp_adminop_vals[] = {
176         {DCC_AOP_OK, "Never sent"},
177         {DCC_AOP_STOP, "Stop Gracefully"},
178         {DCC_AOP_NEW_IDS, "Load keys and client IDs"},
179         {DCC_AOP_FLOD, "Flood control"},
180         {DCC_AOP_DB_UNLOCK, "Start Switch to new database"},
181         {DCC_AOP_DB_NEW, "Finish Switch to new database"},
182         {DCC_AOP_STATS, "Return counters"},
183         {DCC_AOP_STATS_CLEAR, "Return and zero counters"},
184         {DCC_AOP_TRACE_ON, "Enable tracing"},
185         {DCC_AOP_TRACE_OFF, "Disable tracing"},
186         {DCC_AOP_CUR_CLIENTS, "List clients"},
187         {0, NULL},
188 };
189
190 static const value_string dccp_target_vals[] = {
191         {DCC_TGTS_TOO_MANY, "Targets (>= 16777200)"},
192         {DCC_TGTS_OK, "Certified not spam"},
193         {DCC_TGTS_OK2, "Half certified not spam"},
194         {DCC_TGTS_DEL, "Deleted checksum"},
195         {DCC_TGTS_INVALID, "Invalid"},
196         {0, NULL},
197 };
198
199 static const value_string dccp_floodop_vals[] = {
200         {DCC_AOP_FLOD_CHECK, "Check"},   
201         {DCC_AOP_FLOD_SHUTDOWN, "Shutdown"},
202         {DCC_AOP_FLOD_HALT, "Halt"},
203         {DCC_AOP_FLOD_RESUME, "Resume"},
204         {DCC_AOP_FLOD_REWIND, "Rewind"},
205         {DCC_AOP_FLOD_LIST, "List"},
206         {DCC_AOP_FLOD_STATS, "Stats"},
207         {DCC_AOP_FLOD_STATS_CLEAR, "Clear Stats"},
208         {0,NULL},
209 };
210
211 static gboolean
212 dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
213 {
214         proto_tree      *dccp_tree, *dccp_optree, *dccp_opnumtree, *ti;
215         proto_tree *dccp_tracetree;
216         int offset = 0;
217         int client_is_le = 0;
218         int op = 0;
219         int i, count, is_response;
220
221         if (pinfo->srcport != DCC_PORT && pinfo->destport != DCC_PORT) {
222                 /* Not the right port - not a DCC packet. */
223                 return FALSE;
224         }
225
226         /* get at least a full packet structure */
227         if ( !tvb_bytes_exist(tvb, 0, sizeof(DCC_HDR)) ) {
228                 /* Doesn't have enough bytes to contain packet header. */
229                 return FALSE;
230         }
231
232         if (check_col(pinfo->cinfo, COL_PROTOCOL))
233                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCCP");
234
235         offset = 0;
236         is_response = pinfo->srcport == DCC_PORT;
237         
238         if (check_col(pinfo->cinfo, COL_INFO)) {
239                 col_add_fstr(pinfo->cinfo, COL_INFO, 
240                         "%s: %s", 
241                         is_response ? "Response" : "Request", 
242                         val_to_str(tvb_get_guint8(tvb, offset+3),
243                                  dccp_op_vals, "Unknown Op: %u")
244                 );
245         }
246
247         if (tree) {
248                 ti = proto_tree_add_item(tree, proto_dccp, tvb, offset, -1,
249                         FALSE);
250                 dccp_tree = proto_item_add_subtree(ti, ett_dccp);
251
252                 proto_tree_add_item(dccp_tree, hf_dccp_len, tvb, 
253                         offset, 2, FALSE);
254
255                 if ( !tvb_bytes_exist(tvb, 0, tvb_get_ntohs(tvb, offset))) {
256                         /* Doesn't have number of bytes that header claims. */
257                         proto_tree_add_text(dccp_tree, tvb, offset, 2, "Error - packet is shorter than header claims!");
258                 }
259                 offset += 2;
260
261                 proto_tree_add_item(dccp_tree, hf_dccp_pkt_vers, tvb, 
262                         offset, 1, FALSE);
263                 offset += 1;
264
265                 op = tvb_get_guint8(tvb, offset);
266                 proto_tree_add_item(dccp_tree, hf_dccp_op, tvb, 
267                         offset, 1, FALSE);
268                 offset += 1;
269
270                 proto_tree_add_item(dccp_tree, hf_dccp_clientid, tvb, 
271                         offset, 4, FALSE);
272                 offset += 4;
273
274                 ti = proto_tree_add_text(dccp_tree, tvb, offset, -1, "Operation Numbers (Opaque to Server)");
275                 dccp_opnumtree = proto_item_add_subtree(ti, ett_dccp_opnums);
276
277                 /* Note - these are indeterminate - they are sortof considered opaque to the client */
278                 /* Make some attempt to figure out if this data is little endian, not guaranteed to be
279                 correct if connection went through a firewall or similar. */
280
281                 /* Very hokey check - if all three of pid/report/retrans look like little-endian 
282                         numbers, host is probably little endian. Probably innacurate on super-heavily-used
283                         DCC clients though. This should be good enough for now. */
284                 client_is_le = ( (tvb_get_guint8(tvb, offset+4) | tvb_get_guint8(tvb, offset+4)) &&
285                                                  (tvb_get_guint8(tvb, offset+8) | tvb_get_guint8(tvb, offset+9)) &&
286                                                  (tvb_get_guint8(tvb, offset+12) | tvb_get_guint8(tvb, offset+13)) );
287
288                 proto_tree_add_item(dccp_opnumtree, hf_dccp_opnums_host, tvb, 
289                         offset, 4, client_is_le);
290                 offset += 4;
291
292                 proto_tree_add_item(dccp_opnumtree, hf_dccp_opnums_pid, tvb, 
293                         offset, 4, client_is_le);
294                 offset += 4;
295
296                 proto_tree_add_item(dccp_opnumtree, hf_dccp_opnums_report, tvb, 
297                         offset, 4, client_is_le);
298                 offset += 4;
299
300                 proto_tree_add_item(dccp_opnumtree, hf_dccp_opnums_retrans, tvb, 
301                         offset, 4, client_is_le);
302                 offset += 4;
303
304                 ti = proto_tree_add_text(dccp_tree, tvb, offset, -1, "Operation: %s",
305                         val_to_str(op, dccp_op_vals, "Unknown Op: %u"));
306                 dccp_optree = proto_item_add_subtree(ti, ett_dccp_op);
307
308                 switch(op) {
309                         case DCC_OP_NOP:
310                                 D_SIGNATURE();
311                                 break;
312
313                         case DCC_OP_REPORT:
314                                 D_TARGET();
315                                 for (i=0; i<=DCC_QUERY_MAX &&
316                                         tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++)
317                                 {
318                                         D_CHECKSUM();
319                                 }
320                                 D_SIGNATURE();
321                                 break;
322
323                         case DCC_OP_QUERY_RESP:
324                                 for (i=0; i<=DCC_QUERY_MAX &&
325                                         tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++)
326                                 {
327                                         D_TARGET();
328                                 }
329                                 D_SIGNATURE();
330                                 break;
331
332                         case DCC_OP_ADMN:
333                                 if ( is_response )
334                                 {
335                                         int left = tvb_length_remaining(tvb, offset) -
336                                                 sizeof(DCC_SIGNATURE);
337                                         if ( left == sizeof(DCC_ADMN_RESP_CLIENTS) )
338                                         {
339                                                 D_LABEL("Addr", 16);
340                                                 D_LABEL("Id", sizeof(DCC_CLNT_ID));
341                                                 D_LABEL("Last Used", 4);
342                                                 D_LABEL("Requests", 4);
343                                         }
344                                         else
345                                         {
346                                                 D_TEXT("Response Text", sizeof(DCC_SIGNATURE));
347                                         }
348                                         D_SIGNATURE();
349                                 }
350                                 else
351                                 {
352                                         int aop;
353
354                                         D_DATE();
355
356                                         aop = tvb_get_guint8(tvb, offset+4);
357                                         proto_tree_add_item(dccp_optree, hf_dccp_adminop, tvb, offset+4,
358                                                 1, FALSE);
359                                         if (check_col(pinfo->cinfo, COL_INFO)) {
360                                                 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
361                                                         val_to_str(tvb_get_guint8(tvb,offset+4), 
362                                                         dccp_adminop_vals, "Unknown (%u)"));
363                                         }
364         
365                                         if (aop == DCC_AOP_TRACE_ON || aop == DCC_AOP_TRACE_OFF )
366                                         {
367                                                 ti = proto_tree_add_item(dccp_optree, hf_dccp_trace, tvb, offset,
368                                                         4, FALSE);
369                                                 dccp_tracetree = proto_item_add_subtree(ti, ett_dccp_trace);
370                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_admin, tvb, offset, 4, FALSE);
371                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_anon, tvb, offset, 4, FALSE);
372                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_client, tvb, offset, 4, FALSE);
373                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_rlim, tvb, offset, 4, FALSE);
374                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_query, tvb, offset, 4, FALSE);
375                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_ridc, tvb, offset, 4, FALSE);
376                                                 proto_tree_add_item(dccp_tracetree, hf_dccp_trace_flood, tvb, offset, 4, FALSE);
377                                         }
378                                         else if ( aop == DCC_AOP_FLOD )
379                                         {
380                                                 proto_tree_add_item(dccp_optree, hf_dccp_floodop, 
381                                                         tvb, offset, 4, FALSE);
382                                                 if (check_col(pinfo->cinfo, COL_INFO)) {
383                                                         col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
384                                                                 val_to_str(tvb_get_ntohl(tvb,offset), 
385                                                                 dccp_floodop_vals, "Unknown (%u)"));
386                                                 }
387                                         }
388                                         else
389                                         {
390                                                 proto_tree_add_item(dccp_optree, hf_dccp_adminval, 
391                                                         tvb, offset, 4, FALSE);
392                                         }
393                                         offset += 4;
394
395                                         offset += 1; /* admin op we did in reverse order */
396                                         D_LABEL("Pad", 3);
397                                         D_SIGNATURE();
398                                 }
399                                 break;
400
401                         case DCC_OP_OK:
402                                 proto_tree_add_item(dccp_optree, hf_dccp_max_pkt_vers, tvb,
403                                         offset, 1, FALSE);
404                                 offset += 1;
405
406                                 D_LABEL("Unused", 1);
407
408                                 proto_tree_add_item(dccp_optree, hf_dccp_qdelay_ms, tvb,
409                                         offset, 2, FALSE);
410                                 offset += 2;
411                         
412                                 proto_tree_add_item(dccp_optree, hf_dccp_brand, tvb,
413                                         offset, sizeof(DCC_BRAND), FALSE);
414                                 offset += sizeof(DCC_BRAND);
415
416                                 D_SIGNATURE();
417                                 break;
418                                 
419                         default:
420                                 /* do nothing */
421                                 break;
422                 }
423         }
424
425         return TRUE;
426 }
427
428 void
429 proto_register_dccp(void)
430 {
431         static hf_register_info hf[] = {
432                         { &hf_dccp_len, {       
433                                 "Packet Length", "dccp.len", FT_UINT16, BASE_DEC,
434                                 NULL, 0, "Packet Length", HFILL }},
435
436                         { &hf_dccp_pkt_vers, {  
437                                 "Packet Version", "dccp.pkt_vers", FT_UINT16, BASE_DEC,
438                                 NULL, 0, "Packet Version", HFILL }},
439
440                         { &hf_dccp_op, {        
441                                 "Operation Type", "dccp.op", FT_UINT8, BASE_DEC,
442                                 VALS(dccp_op_vals), 0, "Operation Type", HFILL }},
443
444                         { &hf_dccp_clientid, {  
445                                 "Client ID", "dccp.clientid", FT_UINT32, BASE_DEC,
446                                 NULL, 0, "Client ID", HFILL }},
447
448                         { &hf_dccp_opnums_host, {       
449                                 "Host", "dccp.opnums.host", FT_IPv4, BASE_DEC,
450                                 NULL, 0, "Host", HFILL }},
451
452                         { &hf_dccp_opnums_pid, {        
453                                 "Process ID", "dccp.opnums.pid", FT_UINT32, BASE_DEC,
454                                 NULL, 0, "Process ID", HFILL }},
455
456                         { &hf_dccp_opnums_report, {     
457                                 "Report", "dccp.opnums.report", FT_UINT32, BASE_DEC,
458                                 NULL, 0, "Report", HFILL }},
459
460                         { &hf_dccp_opnums_retrans, {    
461                                 "Retransmission", "dccp.opnums.retrans", FT_UINT32, BASE_DEC,
462                                 NULL, 0, "Retransmission", HFILL }},
463
464                         { &hf_dccp_signature, { 
465                                 "Signature", "dccp.signature", FT_BYTES, BASE_HEX,
466                                 NULL, 0, "Signature", HFILL }},
467
468                         { &hf_dccp_max_pkt_vers, {      
469                                 "Maximum Packet Version", "dccp.max_pkt_vers", FT_UINT8, BASE_DEC,
470                                 NULL, 0, "Maximum Packet Version", HFILL }},
471
472                         { &hf_dccp_qdelay_ms, { 
473                                 "Client Delay", "dccp.qdelay_ms", FT_UINT16, BASE_DEC,
474                                 NULL, 0, "Client Delay", HFILL }},
475
476                         { &hf_dccp_brand, {     
477                                 "Server Brand", "dccp.brand", FT_STRING, BASE_DEC,
478                                 NULL, 0, "Server Brand", HFILL }},
479
480                         { &hf_dccp_ck_type, {   
481                                 "Type", "dccp.checksum.type", FT_UINT8, BASE_DEC,
482                                 VALS(dccp_cktype_vals), 0, "Checksum Type", HFILL }},
483
484                         { &hf_dccp_ck_len, {    
485                                 "Length", "dccp.checksum.length", FT_UINT8, BASE_DEC,
486                                 NULL, 0, "Checksum Length", HFILL }},
487
488                         { &hf_dccp_ck_sum, {    
489                                 "Sum", "dccp.checksum.sum", FT_BYTES, BASE_HEX,
490                                 NULL, 0, "Checksum", HFILL }},
491
492                         { &hf_dccp_target, {    
493                                 "Target", "dccp.target", FT_UINT32, BASE_HEX,
494                                 NULL, 0, "Target", HFILL }},
495
496                         { &hf_dccp_date, {      
497                                 "Date", "dccp.date", FT_ABSOLUTE_TIME, BASE_DEC,
498                                 NULL, 0, "Date", HFILL }},
499
500                         { &hf_dccp_adminop, {   
501                                 "Admin Op", "dccp.adminop", FT_UINT8, BASE_DEC,
502                                 VALS(dccp_adminop_vals), 0, "Admin Op", HFILL }},
503
504                         { &hf_dccp_adminval, {  
505                                 "Admin Value", "dccp.adminval", FT_UINT32, BASE_DEC,
506                                 NULL, 0, "Admin Value", HFILL }},
507
508                         { &hf_dccp_trace, {     
509                                 "Trace Bits", "dccp.trace", FT_UINT32, BASE_HEX,
510                                 NULL, 0, "Trace Bits", HFILL }},
511
512                         { &hf_dccp_trace_admin, {
513                                 "Admin Requests", "dccp.trace.admin", FT_UINT32, BASE_BIN,
514                                 NULL, 0x0001, "Admin Requests", HFILL }},
515
516                         { &hf_dccp_trace_anon, {
517                                 "Anonymous Requests", "dccp.trace.anon", FT_UINT32, BASE_BIN,
518                                 NULL, 0x0002, "Anonymous Requests", HFILL }},
519
520                         { &hf_dccp_trace_client, {
521                                 "Authenticated Client Requests", "dccp.trace.client", FT_UINT32, BASE_BIN,
522                                 NULL, 0x0004, "Authenticated Client Requests", HFILL }},
523
524                         { &hf_dccp_trace_rlim, {
525                                 "Rate-Limited Requests", "dccp.trace.rlim", FT_UINT32, BASE_BIN,
526                                 NULL, 0x0008, "Rate-Limited Requests", HFILL }},
527
528                         { &hf_dccp_trace_query, {
529                                 "Queries and Reports", "dccp.trace.query", FT_UINT32, BASE_BIN,
530                                 NULL, 0x0010, "Queries and Reports", HFILL }},
531
532                         { &hf_dccp_trace_ridc, {
533                                 "RID Cache Messages", "dccp.trace.ridc", FT_UINT32, BASE_BIN,
534                                 NULL, 0x0020, "RID Cache Messages", HFILL }},
535
536                         { &hf_dccp_trace_flood, {
537                                 "Input/Output Flooding", "dccp.trace.flood", FT_UINT32, BASE_BIN,
538                                 NULL, 0x0040, "Input/Output Flooding", HFILL }},
539
540                         { &hf_dccp_floodop, {
541                                 "Flood Control Operation", "dccp.floodop", FT_UINT32, BASE_DEC,
542                                 VALS(dccp_floodop_vals), 0, "Flood Control Operation", HFILL }},
543
544         };
545         static gint *ett[] = {
546                 &ett_dccp,
547                 &ett_dccp_op,
548                 &ett_dccp_ck,
549                 &ett_dccp_opnums,
550                 &ett_dccp_trace,
551         };
552
553         proto_dccp = proto_register_protocol("Distributed Checksum Clearinghouse Prototocl",
554             "DCCP", "dccp");
555
556         proto_register_field_array(proto_dccp, hf, array_length(hf));
557
558         proto_register_subtree_array(ett, array_length(ett));
559 }
560
561 void
562 proto_reg_handoff_dccp(void)
563 {
564         heur_dissector_add("udp", dissect_dccp, proto_dccp);
565 }