Make the Zebra dissector, and a routine it uses, static, as they're not
[obnox/wireshark/wip.git] / packet-atalk.c
1 /* packet-atalk.c
2  * Routines for Appletalk packet disassembly (DDP, currently).
3  *
4  * $Id: packet-atalk.c,v 1.48 2001/01/03 06:55:27 guy Exp $
5  *
6  * Simon Wilkinson <sxw@dcs.ed.ac.uk>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  * 
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
26
27 #ifdef HAVE_SYS_TYPES_H
28 # include <sys/types.h>
29 #endif
30
31 #ifdef HAVE_NETINET_IN_H
32 # include <netinet/in.h>
33 #endif
34
35 #include <glib.h>
36 #include "packet.h"
37 #include "packet-atalk.h"
38 #include "etypes.h"
39 #include "ppptypes.h"
40 #include "aftypes.h"
41
42 static int proto_ddp = -1;
43 static int hf_ddp_hopcount = -1;
44 static int hf_ddp_len = -1;
45 static int hf_ddp_checksum = -1;
46 static int hf_ddp_dst_net = -1;
47 static int hf_ddp_src_net = -1;
48 static int hf_ddp_dst_node = -1;
49 static int hf_ddp_src_node = -1;
50 static int hf_ddp_dst_socket = -1;
51 static int hf_ddp_src_socket = -1;
52 static int hf_ddp_type = -1;
53
54 static int proto_nbp = -1;
55 static int hf_nbp_op = -1;
56 static int hf_nbp_info = -1;
57 static int hf_nbp_count = -1;
58 static int hf_nbp_tid = -1;
59
60 static int hf_nbp_node_net = -1;
61 static int hf_nbp_node_port = -1;
62 static int hf_nbp_node_node = -1;
63 static int hf_nbp_node_enum = -1;
64 static int hf_nbp_node_object = -1;
65 static int hf_nbp_node_type = -1;
66 static int hf_nbp_node_zone = -1;
67
68 static int proto_rtmp = -1;
69 static int hf_rtmp_net = -1;
70 static int hf_rtmp_node_len = -1;
71 static int hf_rtmp_node = -1;
72 static int hf_rtmp_tuple_net = -1;
73 static int hf_rtmp_tuple_range_start = -1;
74 static int hf_rtmp_tuple_range_end = -1;
75 static int hf_rtmp_tuple_dist = -1;
76 static int hf_rtmp_function = -1;
77
78 static gint ett_nbp = -1;
79 static gint ett_nbp_info = -1;
80 static gint ett_nbp_node = -1;
81 static gint ett_rtmp = -1;
82 static gint ett_rtmp_tuple = -1;
83 static gint ett_ddp = -1;
84 static gint ett_pstring = -1;
85
86 static dissector_table_t ddp_dissector_table;
87
88 /*
89  * P = Padding, H = Hops, L = Len
90  *
91  * PPHHHHLL LLLLLLLL
92  *
93  * Assumes the argument is in host byte order.
94  */
95 #define ddp_hops(x)     ( ( x >> 10) & 0x3C )
96 #define ddp_len(x)              ( x & 0x03ff )
97 typedef struct _e_ddp {
98   guint16       hops_len; /* combines pad, hops, and len */
99   guint16       sum,dnet,snet;
100   guint8        dnode,snode;
101   guint8        dport,sport;
102   guint8        type;
103 } e_ddp;
104
105 #define DDP_HEADER_SIZE 13
106
107 gchar *
108 atalk_addr_to_str(const struct atalk_ddp_addr *addrp)
109 {
110   static gchar  str[3][14];
111   static gchar  *cur;
112
113   if (cur == &str[0][0]) {
114     cur = &str[1][0];
115   } else if (cur == &str[1][0]) {
116     cur = &str[2][0];
117   } else {
118     cur = &str[0][0];
119   }
120
121   sprintf(cur, "%u.%u:%u", addrp->net, addrp->node, addrp->port);
122   return cur;
123 }
124
125 static const value_string op_vals[] = {
126   {DDP_RTMPDATA, "AppleTalk Routing Table response or data" },
127   {DDP_NBP, "AppleTalk Name Binding Protocol packet"},
128   {DDP_ATP, "AppleTalk Transaction Protocol packet"},
129   {DDP_AEP, "AppleTalk Echo Protocol packet"},
130   {DDP_RTMPREQ, "AppleTalk Routing Table request"},
131   {DDP_ZIP, "AppleTalk Zone Information Protocol packet"},
132   {DDP_ADSP, "AppleTalk Data Stream Protocol"},
133   {DDP_EIGRP, "Cisco EIGRP for AppleTalk"},
134   {0, NULL}
135 };
136
137 static const value_string rtmp_function_vals[] = {
138   {1, "Request"},
139   {2, "Route Data Request (split horizon processed)"},
140   {3, "Route Data Request (no split horizon processing)"},
141   {0, NULL}
142 };
143
144 #define NBP_LOOKUP 2
145 #define NBP_FORWARD 4
146 #define NBP_REPLY 3
147
148 static const value_string nbp_op_vals[] = {
149   {NBP_LOOKUP, "lookup"},
150   {NBP_FORWARD, "forward request"},
151   {NBP_REPLY, "reply"},
152   {0, NULL}
153 };
154
155 /*
156  * XXX - do this with an FT_UINT_STRING?
157  * Unfortunately, you can't extract from an FT_UINT_STRING the string,
158  * which we'd want to do in order to put it into the "Data:" portion.
159  */
160 int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree,
161         int hf_index)
162 {
163         int len;
164         
165         len = tvb_get_guint8(tvb, offset);
166         offset++;
167
168         if ( tree )
169         {
170                 char *tmp;
171                 proto_tree *item;
172                 proto_tree *subtree;
173                 
174                 /*
175                  * XXX - if we could do this inside the protocol tree
176                  * code, we could perhaps avoid allocating and freeing
177                  * this string buffer.
178                  */
179                 tmp = g_malloc( len+1 );
180                 tvb_memcpy(tvb, tmp, offset, len);
181                 tmp[len] = 0;
182                 item = proto_tree_add_string(tree, hf_index, tvb, offset-1, len+1, tmp);
183
184                 subtree = proto_item_add_subtree(item, ett_pstring);
185                 proto_tree_add_text(subtree, tvb, offset-1, 1, "Length: %d", len);
186                 proto_tree_add_text(subtree, tvb, offset, len, "Data: %s", tmp);
187                 
188                 g_free(tmp);
189         }
190         offset += len;
191         
192         return offset;  
193 }
194
195 static void
196 dissect_rtmp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
197   proto_tree *rtmp_tree;
198   proto_item *ti;
199   guint8 function;
200
201   CHECK_DISPLAY_AS_DATA(proto_rtmp, tvb, pinfo, tree);
202
203   pinfo->current_proto = "RTMP";
204
205   function = tvb_get_guint8(tvb, 0);
206
207   if (check_col(pinfo->fd, COL_PROTOCOL))
208     col_set_str(pinfo->fd, COL_PROTOCOL, "RTMP");
209
210   if (check_col(pinfo->fd, COL_INFO))
211     col_add_fstr(pinfo->fd, COL_INFO, "%s",
212         val_to_str(function, rtmp_function_vals, "Unknown function (%02)"));
213   
214   if (tree) {
215     ti = proto_tree_add_item(tree, proto_rtmp, tvb, 0, 1, FALSE);
216     rtmp_tree = proto_item_add_subtree(ti, ett_rtmp);
217
218     proto_tree_add_uint(rtmp_tree, hf_rtmp_function, tvb, 0, 1, function);
219   }
220 }
221
222 static void
223 dissect_rtmp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
224   proto_tree *rtmp_tree;
225   proto_item *ti;
226   int offset = 0;
227   guint16 net;
228   guint8 nodelen,nodelen_bits;
229   guint16 node; /* might be more than 8 bits */
230   int i;
231
232   CHECK_DISPLAY_AS_DATA(proto_rtmp, tvb, pinfo, tree);
233
234   pinfo->current_proto = "RTMP";
235
236   net = tvb_get_ntohs(tvb, offset);
237   nodelen_bits = tvb_get_guint8(tvb, offset+2);
238   if ( nodelen_bits <= 8 ) {
239     node = tvb_get_guint8(tvb, offset)+1;
240     nodelen = 1;
241   } else {
242     node = tvb_get_ntohs(tvb, offset);
243     nodelen = 2;
244   }
245   
246   if (check_col(pinfo->fd, COL_PROTOCOL))
247     col_set_str(pinfo->fd, COL_PROTOCOL, "RTMP");
248
249   if (check_col(pinfo->fd, COL_INFO))
250     col_add_fstr(pinfo->fd, COL_INFO, "Net: %u  Node Len: %u  Node: %u",
251                 net, nodelen_bits, node);
252   
253   if (tree) {
254     ti = proto_tree_add_item(tree, proto_rtmp, tvb, offset,
255                              tvb_length_remaining(tvb, offset), FALSE);
256     rtmp_tree = proto_item_add_subtree(ti, ett_rtmp);
257
258     proto_tree_add_uint(rtmp_tree, hf_rtmp_net, tvb, offset, 2, net);
259     proto_tree_add_uint(rtmp_tree, hf_rtmp_node_len, tvb, offset+2, 1,
260                         nodelen_bits);
261     proto_tree_add_uint(rtmp_tree, hf_rtmp_node, tvb, offset+3, nodelen,
262                         node);
263     offset += 3 + nodelen;
264
265     i = 1;
266     while (tvb_offset_exists(tvb, offset)) {
267       proto_tree *tuple_item, *tuple_tree;
268       guint16 tuple_net;
269       guint8 tuple_dist;
270       guint16 tuple_range_end;
271
272       tuple_net = tvb_get_ntohs(tvb, offset);
273       tuple_dist = tvb_get_guint8(tvb, offset+2);
274
275       if (tuple_dist & 0x80) {
276         tuple_range_end = tvb_get_ntohs(tvb, offset+3);
277         tuple_item = proto_tree_add_text(rtmp_tree, tvb, offset, 6,
278                         "Tuple %d:  Range Start: %u  Dist: %u  Range End: %u",
279                         i, tuple_net, tuple_dist&0x7F, tuple_range_end);
280       } else {
281         tuple_item = proto_tree_add_text(rtmp_tree, tvb, offset, 3,
282                         "Tuple %d:  Net: %u  Dist: %u",
283                         i, tuple_net, tuple_dist);
284       }
285       tuple_tree = proto_item_add_subtree(tuple_item, ett_rtmp_tuple);
286
287       if (tuple_dist & 0x80) {
288         proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_range_start, tvb, offset, 2, 
289                         tuple_net);
290       } else {
291         proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_net, tvb, offset, 2, 
292                         tuple_net);
293       }
294       proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_dist, tvb, offset+2, 1,
295                         tuple_dist & 0x7F);
296
297       if (tuple_dist & 0x80) {
298         /*
299          * Extended network tuple.
300          */
301         proto_tree_add_item(tuple_tree, hf_rtmp_tuple_range_end, tvb, offset+3, 2, 
302                                 FALSE);
303         offset += 6;
304       } else
305         offset += 3;
306
307       i++;
308     }
309   }
310 }
311
312 static void
313 dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
314   proto_tree *nbp_tree;
315   proto_tree *nbp_info_tree;
316   proto_item *ti, *info_item;
317   int offset = 0;
318   guint8 info;
319   guint op, count;
320   int i;
321
322   CHECK_DISPLAY_AS_DATA(proto_nbp, tvb, pinfo, tree);
323
324   pinfo->current_proto = "NBP";
325
326   info = tvb_get_guint8(tvb, offset);
327   op = info >> 4;
328   count = info & 0x0F;
329
330   if (check_col(pinfo->fd, COL_PROTOCOL))
331     col_set_str(pinfo->fd, COL_PROTOCOL, "NBP");
332
333   if (check_col(pinfo->fd, COL_INFO))
334     col_add_fstr(pinfo->fd, COL_INFO, "Op: %s  Count: %u",
335       val_to_str(op, nbp_op_vals, "Unknown (0x%01x)"), count);
336   
337   if (tree) {
338     ti = proto_tree_add_item(tree, proto_nbp, tvb, offset, END_OF_FRAME, FALSE);
339     nbp_tree = proto_item_add_subtree(ti, ett_nbp);
340
341     info_item = proto_tree_add_uint_format(nbp_tree, hf_nbp_info, tvb, offset, 1,
342                 info,
343                 "Info: 0x%01X  Operation: %s  Count: %u", info,
344                 val_to_str(op, nbp_op_vals, "Unknown (0x%01X)"),
345                 count);
346     nbp_info_tree = proto_item_add_subtree(info_item, ett_nbp_info);
347     proto_tree_add_uint(nbp_info_tree, hf_nbp_op, tvb, offset, 1, info);
348     proto_tree_add_uint(nbp_info_tree, hf_nbp_count, tvb, offset, 1, info);
349     proto_tree_add_item(nbp_tree, hf_nbp_tid, tvb, offset+1, 1, FALSE);
350     offset += 2;
351
352     for (i=0; i<count; i++) {
353       proto_tree *node_item,*node_tree;
354       int soffset = offset;
355
356       node_item = proto_tree_add_text(nbp_tree, tvb, offset, 4, 
357                         "Node %d", i+1);
358       node_tree = proto_item_add_subtree(node_item, ett_nbp_node);
359
360       proto_tree_add_item(node_tree, hf_nbp_node_net, tvb, offset, 2, FALSE);
361       offset += 2;
362       proto_tree_add_item(node_tree, hf_nbp_node_node, tvb, offset, 1, FALSE);
363       offset++;
364       proto_tree_add_item(node_tree, hf_nbp_node_port, tvb, offset, 1, FALSE);
365       offset++;
366       proto_tree_add_item(node_tree, hf_nbp_node_enum, tvb, offset, 1, FALSE);
367       offset++;
368
369       offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_object);
370       offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_type);
371       offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_zone);
372
373       proto_item_set_len(node_item, offset-soffset);
374     }
375   }
376
377   return;
378 }
379
380 static void
381 dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
382   e_ddp       ddp;
383   proto_tree *ddp_tree;
384   proto_item *ti;
385   static struct atalk_ddp_addr src, dst;
386   tvbuff_t   *new_tvb;
387
388   CHECK_DISPLAY_AS_DATA(proto_ddp, tvb, pinfo, tree);
389
390   pinfo->current_proto = "DDP";
391
392   tvb_memcpy(tvb, (guint8 *)&ddp, 0, sizeof(e_ddp));
393   ddp.dnet=ntohs(ddp.dnet);
394   ddp.snet=ntohs(ddp.snet);
395   ddp.sum=ntohs(ddp.sum);
396   ddp.hops_len=ntohs(ddp.hops_len);
397   
398   src.net = ddp.snet;
399   src.node = ddp.snode;
400   src.port = ddp.sport;
401   dst.net = ddp.dnet;
402   dst.node = ddp.dnode;
403   dst.port = ddp.dport;
404   SET_ADDRESS(&pinfo->net_src, AT_ATALK, sizeof src, (guint8 *)&src);
405   SET_ADDRESS(&pinfo->src, AT_ATALK, sizeof src, (guint8 *)&src);
406   SET_ADDRESS(&pinfo->net_dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
407   SET_ADDRESS(&pinfo->dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
408
409   if (check_col(pinfo->fd, COL_PROTOCOL))
410     col_set_str(pinfo->fd, COL_PROTOCOL, "DDP");
411   if (check_col(pinfo->fd, COL_INFO))
412     col_add_str(pinfo->fd, COL_INFO,
413       val_to_str(ddp.type, op_vals, "Unknown DDP protocol (%02x)"));
414   
415   if (tree) {
416     ti = proto_tree_add_item(tree, proto_ddp, tvb, 0, DDP_HEADER_SIZE,
417                              FALSE);
418     ddp_tree = proto_item_add_subtree(ti, ett_ddp);
419     proto_tree_add_uint(ddp_tree, hf_ddp_hopcount,   tvb, 0, 1,
420                         ddp_hops(ddp.hops_len));
421     proto_tree_add_uint(ddp_tree, hf_ddp_len,        tvb, 0, 2, 
422                         ddp_len(ddp.hops_len));
423     proto_tree_add_uint(ddp_tree, hf_ddp_checksum,   tvb, 2,  2,
424                         ddp.sum);
425     proto_tree_add_uint(ddp_tree, hf_ddp_dst_net,    tvb, 4,  2,
426                         ddp.dnet);
427     proto_tree_add_uint(ddp_tree, hf_ddp_src_net,    tvb, 6,  2,
428                         ddp.snet);
429     proto_tree_add_uint(ddp_tree, hf_ddp_dst_node,   tvb, 8,  1,
430                         ddp.dnode);
431     proto_tree_add_uint(ddp_tree, hf_ddp_src_node,   tvb, 9,  1,
432                         ddp.snode);
433     proto_tree_add_uint(ddp_tree, hf_ddp_dst_socket, tvb, 10, 1,
434                         ddp.dport);
435     proto_tree_add_uint(ddp_tree, hf_ddp_src_socket, tvb, 11, 1,
436                         ddp.sport);
437     proto_tree_add_uint(ddp_tree, hf_ddp_type,       tvb, 12, 1,
438                         ddp.type);  
439   }
440
441   new_tvb = tvb_new_subset(tvb, DDP_HEADER_SIZE, -1, -1);
442
443   if (!dissector_try_port(ddp_dissector_table, ddp.type, new_tvb, pinfo, tree))
444     dissect_data(new_tvb, 0, pinfo, tree);
445 }
446
447 void
448 proto_register_atalk(void)
449 {
450   static hf_register_info hf_ddp[] = {
451     { &hf_ddp_hopcount,
452       { "Hop count",            "ddp.hopcount", FT_UINT8,  BASE_DEC, NULL, 0x0,
453         "" }},
454
455     { &hf_ddp_len,
456       { "Datagram length",      "ddp.len",      FT_UINT16, BASE_DEC, NULL, 0x0,
457         "" }},
458
459     { &hf_ddp_checksum,
460       { "Checksum",             "ddp.checksum", FT_UINT16, BASE_DEC, NULL, 0x0,
461         "" }},
462
463     { &hf_ddp_dst_net,
464       { "Destination Net",      "ddp.dst.net",  FT_UINT16, BASE_DEC, NULL, 0x0,
465         "" }},
466
467     { &hf_ddp_src_net,
468       { "Source Net",           "ddp.src.net",  FT_UINT16, BASE_DEC, NULL, 0x0,
469         "" }},
470
471     { &hf_ddp_dst_node,
472       { "Destination Node",     "ddp.dst.node", FT_UINT8,  BASE_DEC, NULL, 0x0,
473         "" }},
474
475     { &hf_ddp_src_node,
476       { "Source Node",          "ddp.src.node", FT_UINT8,  BASE_DEC, NULL, 0x0,
477         "" }},
478
479     { &hf_ddp_dst_socket,
480       { "Destination Socket",   "ddp.dst.socket", FT_UINT8,  BASE_DEC, NULL, 0x0,
481         "" }},
482
483     { &hf_ddp_src_socket,
484       { "Source Socket",        "ddp.src.socket", FT_UINT8,  BASE_DEC, NULL, 0x0,
485         "" }},
486
487     { &hf_ddp_type,
488       { "Protocol type",        "ddp.type",     FT_UINT8,  BASE_DEC, VALS(op_vals), 0x0,
489         "" }},
490   };
491
492   static hf_register_info hf_nbp[] = {
493     { &hf_nbp_op,
494       { "Operation",            "nbp.op",       FT_UINT8,  BASE_DEC, 
495                 VALS(nbp_op_vals), 0xF0, "Operation" }},
496     { &hf_nbp_info,
497       { "Info",         "nbp.info",     FT_UINT8,  BASE_HEX, 
498                 NULL, 0x0, "Info" }},
499     { &hf_nbp_count,
500       { "Count",                "nbp.count",    FT_UINT8,  BASE_DEC, 
501                 NULL, 0x0F, "Count" }},
502     { &hf_nbp_node_net,
503       { "Network",              "nbp.net",      FT_UINT16,  BASE_DEC, 
504                 NULL, 0x0, "Network" }},
505     { &hf_nbp_node_node,
506       { "Node",         "nbp.node",     FT_UINT8,  BASE_DEC, 
507                 NULL, 0x0, "Node" }},
508     { &hf_nbp_node_port,
509       { "Port",         "nbp.port",     FT_UINT8,  BASE_DEC, 
510                 NULL, 0x0, "Port" }},
511     { &hf_nbp_node_enum,
512       { "Enumerator",           "nbp.enum",     FT_UINT8,  BASE_DEC, 
513                 NULL, 0x0, "Enumerator" }},
514     { &hf_nbp_node_object,
515       { "Object",               "nbp.object",   FT_STRING,  BASE_DEC, 
516                 NULL, 0x0, "Object" }},
517     { &hf_nbp_node_type,
518       { "Type",         "nbp.type",     FT_STRING,  BASE_DEC, 
519                 NULL, 0x0, "Type" }},
520     { &hf_nbp_node_zone,
521       { "Zone",         "nbp.zone",     FT_STRING,  BASE_DEC, 
522                 NULL, 0x0, "Zone" }},
523     { &hf_nbp_tid,
524       { "Transaction ID",               "nbp.tid",      FT_UINT8,  BASE_DEC, 
525                 NULL, 0x0, "Transaction ID" }}
526   };
527
528   static hf_register_info hf_rtmp[] = {
529     { &hf_rtmp_net,
530       { "Net",          "rtmp.net",     FT_UINT16,  BASE_DEC, 
531                 NULL, 0x0, "Net" }},
532     { &hf_rtmp_node,
533       { "Node",         "nbp.nodeid",   FT_UINT8,  BASE_DEC, 
534                 NULL, 0x0, "Node" }},
535     { &hf_rtmp_node_len,
536       { "Node Length",          "nbp.nodeid.length",    FT_UINT8,  BASE_DEC, 
537                 NULL, 0x0, "Node Length" }},
538     { &hf_rtmp_tuple_net,
539       { "Net",          "rtmp.tuple.net",       FT_UINT16,  BASE_DEC, 
540                 NULL, 0x0, "Net" }},
541     { &hf_rtmp_tuple_range_start,
542       { "Range Start",          "rtmp.tuple.range_start",       FT_UINT16,  BASE_DEC, 
543                 NULL, 0x0, "Range Start" }},
544     { &hf_rtmp_tuple_range_end,
545       { "Range End",            "rtmp.tuple.range_end", FT_UINT16,  BASE_DEC, 
546                 NULL, 0x0, "Range End" }},
547     { &hf_rtmp_tuple_dist,
548       { "Distance",             "rtmp.tuple.dist",      FT_UINT16,  BASE_DEC, 
549                 NULL, 0x0, "Distance" }},
550     { &hf_rtmp_function,
551       { "Function",             "rtmp.function",        FT_UINT8,  BASE_DEC, 
552                 VALS(rtmp_function_vals), 0x0, "Request Function" }}
553   };
554
555
556   static gint *ett[] = {
557         &ett_ddp,
558         &ett_nbp,
559         &ett_nbp_info,
560         &ett_nbp_node,
561         &ett_pstring,
562         &ett_rtmp,
563         &ett_rtmp_tuple
564   };
565
566   proto_ddp = proto_register_protocol("Datagram Delivery Protocol", "DDP", "ddp");
567   proto_register_field_array(proto_ddp, hf_ddp, array_length(hf_ddp));
568
569   proto_nbp = proto_register_protocol("Name Binding Protocol", "NBP", "nbp");
570   proto_register_field_array(proto_nbp, hf_nbp, array_length(hf_nbp));
571
572   proto_rtmp = proto_register_protocol("Routing Table Maintenance Protocol",
573                                        "RTMP", "rtmp");
574   proto_register_field_array(proto_rtmp, hf_rtmp, array_length(hf_rtmp));
575
576   proto_register_subtree_array(ett, array_length(ett));
577
578   /* subdissector code */
579   ddp_dissector_table = register_dissector_table("ddp.type");
580 }
581
582 void
583 proto_reg_handoff_atalk(void)
584 {
585   dissector_add("ethertype", ETHERTYPE_ATALK, dissect_ddp);
586   dissector_add("ppp.protocol", PPP_AT, dissect_ddp);
587   dissector_add("null.type", BSD_AF_APPLETALK, dissect_ddp);
588   dissector_add("ddp.type", DDP_NBP, dissect_nbp);
589   dissector_add("ddp.type", DDP_RTMPREQ, dissect_rtmp_request);
590   dissector_add("ddp.type", DDP_RTMPDATA, dissect_rtmp_data);
591 }