From Todd Sabin: allocate the buffer for the decrypted payload, rather
[obnox/wireshark/wip.git] / packet-dlsw.c
1 /* packet-dlsw.c
2  * Routines for DLSw packet dissection (Data Link Switching)
3  * Copyright 2001, Paul Ionescu <paul@acorp.ro>
4  *
5  * $Id: packet-dlsw.c,v 1.7 2002/08/28 21:00:12 jmayer Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 /* DLSw dissector ( RFC 1434, RFC 1795, RFC 2166) */
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <stdio.h>
33
34 #include <string.h>
35 #include <glib.h>
36 #include <epan/packet.h>
37
38 static int proto_dlsw = -1;
39
40 static gint ett_dlsw = -1;
41 static gint ett_dlsw_header = -1;
42 static gint ett_dlsw_data = -1;
43 static gint ett_dlsw_vector = -1;
44
45 #define  CANUREACH               0x03
46 #define  ICANREACH               0x04
47 #define  REACH_ACK               0x05
48 #define  DGRMFRAME               0x06
49 #define  XIDFRAME                0x07
50 #define  CONTACT                 0x08
51 #define  CONTACTED               0x09
52 #define  RESTART_DL              0x10
53 #define  DL_RESTARTED            0x11
54 #define  ENTER_BUSY              0x0C
55 #define  EXIT_BUSY               0x0D
56 #define  INFOFRAME               0x0A
57 #define  HALT_DL                 0x0E
58 #define  DL_HALTED               0x0F
59 #define  NETBIOS_NQ              0x12
60 #define  NETBIOS_NR              0x13
61 #define  DATAFRAME               0x14
62 #define  HALT_DL_NOACK           0x19
63 #define  NETBIOS_ANQ             0x1A
64 #define  NETBIOS_ANR             0x1B
65 #define  KEEPALIVE               0x1D
66 #define  CAP_EXCHANGE            0x20
67 #define  IFCM                    0x21
68 #define  TEST_CIRCUIT_REQ        0x7A
69 #define  TEST_CIRCUIT_RSP        0x7B
70
71 static const value_string dlsw_type_vals[] = {
72         { CANUREACH        , "Can U Reach Station-circuit start" },
73         { ICANREACH        , "I Can Reach Station-circuit start" },
74         { REACH_ACK        , "Reach Acknowledgment" },
75         { DGRMFRAME        , "Datagram Frame" },
76         { XIDFRAME         , "XID Frame" },
77         { CONTACT          , "Contact Remote Station" },
78         { CONTACTED        , "Remote Station Contacted" },
79         { RESTART_DL       , "Restart Data Link" },
80         { DL_RESTARTED     , "Data Link Restarted" },
81         { ENTER_BUSY       , "Enter Busy" },
82         { EXIT_BUSY        , "Exit Busy" },
83         { INFOFRAME        , "Information (I) Frame" },
84         { HALT_DL          , "Halt Data Link" },
85         { DL_HALTED        , "Data Link Halted" },
86         { NETBIOS_NQ       , "NETBIOS Name Query-circuit setup" },
87         { NETBIOS_NR       , "NETBIOS Name Recog-circuit setup" },
88         { DATAFRAME        , "Data Frame" },
89         { HALT_DL_NOACK    , "Halt Data Link with no Ack" },
90         { NETBIOS_ANQ      , "NETBIOS Add Name Query" },
91         { NETBIOS_ANR      , "NETBIOS Add Name Response" },
92         { KEEPALIVE        , "Transport Keepalive Message" },
93         { CAP_EXCHANGE     , "Capabilities Exchange" },
94         { IFCM             , "Independent Flow Control Message" },
95         { TEST_CIRCUIT_REQ , "Test Circuit Request" },
96         { TEST_CIRCUIT_RSP , "Test Circuit Response" },
97         { 0 , NULL }
98 };
99 static const value_string dlsw_version_vals[] = {
100         { 0x31        , "Version 1 (RFC 1795)" },
101         { 0x32        , "Version 2 (RFC 2166)" },
102         { 0x33        , "Vendor Specific" },
103         { 0x34        , "Vendor Specific" },
104         { 0x35        , "Vendor Specific" },
105         { 0x36        , "Vendor Specific" },
106         { 0x37        , "Vendor Specific" },
107         { 0x38        , "Vendor Specific" },
108         { 0x39        , "Vendor Specific" },
109         { 0x3A        , "Vendor Specific" },
110         { 0x3B        , "Vendor Specific" },
111         { 0x3C        , "Vendor Specific" },
112         { 0x3D        , "Vendor Specific" },
113         { 0x3E        , "Vendor Specific" },
114         { 0x3F        , "Vendor Specific" },
115         { 0x4B        , "Pre 1 (RFC 1434)" },
116         { 0x00        , NULL }
117 };
118
119 static const value_string dlsw_vector_vals[] = {
120         { 0x81        , "Vendor ID Control Vector" },
121         { 0x82        , "DLSw Version Control Vector" },
122         { 0x83        , "Initial Pacing Window Control Vector" },
123         { 0x84        , "Version String Control Vector" },
124         { 0x85        , "Mac Address Exclusivity Control Vector" },
125         { 0x86        , "Supported SAP List Control Vector" },
126         { 0x87        , "TCP Connections Control Vector" },
127         { 0x88        , "NetBIOS Name Exclusivity Control Vector" },
128         { 0x89        , "MAC Address List Control Vector" },
129         { 0x8a        , "NetBIOS Name List Control Vector" },
130         { 0x8b        , "Vendor Context Control Vector" },
131         { 0x8c        , "Multicast Capabilities Control Vector" },
132         { 0x8d        , "Reserved for future use" },
133         { 0x8e        , "Reserved for future use" },
134         { 0x8f        , "Reserved for future use" },
135         { 0x90        , "Reserved for future use" },
136         { 0x91        , " Control Vector" },
137         { 0x92        , " Control Vector" },
138         { 0x93        , " Control Vector" },
139         { 0x94        , " Control Vector" },
140         { 0x95        , " Control Vector" },
141         { 0x96        , " Control Vector" },
142         { 0x00        , NULL }
143 };
144
145 static const value_string dlsw_pri_vals[] = {
146         { 0        , "Unsupported" },
147         { 1        , "Low Priority" },
148         { 2        , "Medium Priority" },
149         { 3        , "High Priority" },
150         { 4        , "Highest Priority" },
151         { 5        , "Reserved" },
152         { 6        , "Reserved" },
153         { 7        , "Reserved" }
154 };
155
156
157
158
159 #define DLSW_GDSID_SEND         0x1520
160 #define DLSW_GDSID_ACK          0x1521
161 #define DLSW_GDSID_REF          0x1522
162
163 static const value_string dlsw_gds_vals[] = {
164         { DLSW_GDSID_SEND , "Request Capabilities GDS" },
165         { DLSW_GDSID_ACK  , "Response Capabilities GDS" },
166         { DLSW_GDSID_REF  , "Refuse Capabilities GDS" },
167         { 0               , NULL }
168 };
169
170 static const value_string dlsw_refuse_vals[] = {
171         { 0x1   , "invalid GDS length for a DLWs Capabilities Exchange Request"},
172         { 0x2   , "invalid GDS id for a DLSw Capabilities Exchange Request"},
173         { 0x3   , "vendor Id control vector is missing"},
174         { 0x4   , "DLSw Version control vector is missing"},
175         { 0x5   , "initial Pacing Window control vector is missing"},
176         { 0x6   , "length of control vectors doewn't correlate to the length of the GDS variable"},
177         { 0x7   , "invalid control vector id"},
178         { 0x8   , "length of control vector invalid"},
179         { 0x9   , "invalid control vector data value"},
180         { 0xa   , "duplicate control vector"},
181         { 0xb   , "out-of-sequence control vector"},
182         { 0xc   , "DLSw Supported SAP List control vector is missing"},
183         { 0xd   , "inconsistent DLSw Version, Multicast Capabilities,\
184  and TCP Connections CV received on the inbound Capabilities exchange"},
185         { 0x0   , NULL }
186 };
187
188 #define UDP_PORT_DLSW           2067
189 #define TCP_PORT_DLSW           2065
190 #define DLSW_INFO_HEADER        16
191 #define DLSW_CMD_HEADER         72
192
193 static void
194 dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti);
195
196 static void
197 dissect_dlsw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
198 {
199  guint version,hlen = 0,mlen = 0,mtype,dlchlen = 0,direction;
200  proto_tree      *dlsw_tree = NULL, *ti,*ti2, *dlsw_header_tree = NULL;
201  proto_tree      *dlsw_data_tree;
202
203  if (check_col(pinfo->cinfo, COL_PROTOCOL))
204    col_set_str(pinfo->cinfo, COL_PROTOCOL, "DLSw");
205
206  version=tvb_get_guint8(tvb,0);
207
208  if (check_col(pinfo->cinfo, COL_INFO))
209    col_add_fstr(pinfo->cinfo, COL_INFO, "DLSw %s",val_to_str(version , dlsw_version_vals, "Unknown Version"));
210
211  if (tree)
212  {
213    ti = proto_tree_add_item(tree, proto_dlsw, tvb, 0, -1, FALSE);
214    dlsw_tree = proto_item_add_subtree(ti, ett_dlsw);
215
216    hlen=tvb_get_guint8(tvb,1);
217
218    ti2 = proto_tree_add_text (dlsw_tree, tvb, 0, hlen,"DLSw header, %s",
219      val_to_str(version , dlsw_version_vals, "Unknown Version"));
220
221    dlsw_header_tree = proto_item_add_subtree(ti2, ett_dlsw_header);
222    proto_tree_add_text (dlsw_header_tree,tvb,0 ,1,"Version        = %s",
223     val_to_str(version , dlsw_version_vals, "Unknown Version, dissection may be innacurate"));
224    proto_tree_add_text (dlsw_header_tree,tvb,1 ,1,"Header Length  = %u",hlen) ;
225    mlen=tvb_get_ntohs(tvb,2);
226    proto_tree_add_text (dlsw_header_tree,tvb,2 ,2,"Message Length = %u",mlen);
227    proto_tree_add_text (dlsw_header_tree,tvb,4 ,4,"Remote DLC     = %u",tvb_get_ntohl(tvb,4)) ;
228    proto_tree_add_text (dlsw_header_tree,tvb,8 ,4,"Remote DLC PID = %u",tvb_get_ntohl(tvb,8)) ;
229    proto_tree_add_text (dlsw_header_tree,tvb,12,2,"Reserved") ;
230   } ;
231
232   mtype=tvb_get_guint8(tvb,14);
233   if (check_col(pinfo->cinfo, COL_INFO))
234      col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str(mtype , dlsw_type_vals, "Unknown message Type"));
235   if (tree)
236   {
237    proto_tree_add_text (dlsw_header_tree,tvb,14,1,"Message Type   = %s (%d)",
238     val_to_str(mtype , dlsw_type_vals, "Unknown Type"),mtype);
239    proto_tree_add_text (dlsw_header_tree, tvb, 15,1,"Flow ctrl byte = %d",tvb_get_guint8(tvb,15));
240
241    if (hlen != DLSW_INFO_HEADER)
242     {
243     proto_tree_add_text (dlsw_header_tree,tvb, 16,1,"Protocol ID    = %d",tvb_get_guint8(tvb,16)) ;
244     proto_tree_add_text (dlsw_header_tree,tvb, 17,1,"Header Number  = %d",tvb_get_guint8(tvb,17)) ;
245     proto_tree_add_text (dlsw_header_tree,tvb, 18,2,"Reserved") ;
246     proto_tree_add_text (dlsw_header_tree,tvb, 20,1,"Largest Frame size  = %d",tvb_get_guint8(tvb,20)) ;
247     proto_tree_add_text (dlsw_header_tree,tvb, 21,1,"SSP Flags      = %d",tvb_get_guint8(tvb,21)) ;
248     proto_tree_add_text (dlsw_header_tree,tvb, 22,1,"Circuit priority = %s",
249      match_strval((tvb_get_guint8(tvb,22)&7),dlsw_pri_vals)) ;
250     proto_tree_add_text (dlsw_header_tree,tvb, 23,1,"Old message type = %s (%d)",
251      val_to_str(tvb_get_guint8(tvb,23) , dlsw_type_vals, "Unknown Type"),tvb_get_guint8(tvb,23));
252     if (mtype==CAP_EXCHANGE)
253      {
254      proto_tree_add_text (dlsw_header_tree,tvb, 24 ,14,"Not used for CapEx") ;
255      proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   =  %s",
256       tvb_get_guint8(tvb,38)==1?"Capabilities request":"Capabilities response") ;
257      proto_tree_add_text (dlsw_header_tree,tvb, 39,33,"Not used for CapEx") ;
258      }
259     else
260      {
261      proto_tree_add_text (dlsw_header_tree,tvb, 24,6,"Target MAC Address  = %s",tvb_bytes_to_str(tvb,24,6)) ;
262      proto_tree_add_text (dlsw_header_tree,tvb, 30,6,"Origin MAC Address  = %s",tvb_bytes_to_str(tvb,30,6)) ;
263      proto_tree_add_text (dlsw_header_tree,tvb, 36,1,"Origin Link SAP     = %02x",tvb_get_guint8(tvb,36)) ;
264      proto_tree_add_text (dlsw_header_tree,tvb, 37,1,"Target Link SAP     = %02x",tvb_get_guint8(tvb,37)) ;
265      proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   = %d",tvb_get_guint8(tvb,38)) ;
266      proto_tree_add_text (dlsw_header_tree,tvb, 39,3,"Reserved") ;
267      dlchlen=tvb_get_ntohs(tvb,42);
268      proto_tree_add_text (dlsw_header_tree,tvb, 42,2,"DLC Header Length = %d",dlchlen) ;
269      proto_tree_add_text (dlsw_header_tree,tvb, 44,4,"Origin DLC Port ID     = %u",tvb_get_ntohl(tvb,44)) ;
270      proto_tree_add_text (dlsw_header_tree,tvb, 48,4,"Origin DLC             = %u",tvb_get_ntohl(tvb,48)) ;
271      proto_tree_add_text (dlsw_header_tree,tvb, 52,4,"Origin Transport ID    = %u",tvb_get_ntohl(tvb,52)) ;
272      proto_tree_add_text (dlsw_header_tree,tvb, 56,4,"Target DLC Port ID     = %u",tvb_get_ntohl(tvb,56)) ;
273      proto_tree_add_text (dlsw_header_tree,tvb, 60,4,"Target DLC             = %u",tvb_get_ntohl(tvb,60)) ;
274      proto_tree_add_text (dlsw_header_tree,tvb, 64,4,"Target Transport ID    = %u",tvb_get_ntohl(tvb,64)) ;
275      proto_tree_add_text (dlsw_header_tree,tvb, 68,4,"Reserved") ;
276      }
277     direction=tvb_get_guint8(tvb,38);
278     }
279
280 /* end of header dissector */
281
282     ti2 = proto_tree_add_text (dlsw_tree, tvb, hlen, mlen,"DLSw data");
283     dlsw_data_tree = proto_item_add_subtree(ti2, ett_dlsw_data);
284
285     switch (mtype)
286       {
287       case CAP_EXCHANGE:
288         dissect_dlsw_capex(tvb_new_subset(tvb, hlen, mlen, -1), dlsw_data_tree,ti2);
289         break;
290       case IFCM:
291       case INFOFRAME:
292       case KEEPALIVE:
293         proto_tree_add_text (dlsw_data_tree,tvb,hlen,mlen,"Data") ;
294         break;
295
296       default:
297         if (dlchlen!=0)
298          {
299          proto_tree_add_text (dlsw_data_tree,tvb,hlen,1,"DLC Header - AC byte : 0x%02x",tvb_get_guint8(tvb,hlen)) ;
300          proto_tree_add_text (dlsw_data_tree,tvb,hlen+1,1,"DLC Header - FC byte : 0x%02x",tvb_get_guint8(tvb,hlen+1)) ;
301          proto_tree_add_text (dlsw_data_tree,tvb,hlen+2,6,"DLC Header - DA : %s",tvb_bytes_to_str(tvb,hlen+2,6)) ;
302          proto_tree_add_text (dlsw_data_tree,tvb,hlen+8,6,"DLC Header - SA : %s",tvb_bytes_to_str(tvb,hlen+8,6)) ;
303          proto_tree_add_text (dlsw_data_tree,tvb,hlen+14,18,"DLC Header - RIF : %s",tvb_bytes_to_str(tvb,hlen+14,18)) ;
304          proto_tree_add_text (dlsw_data_tree,tvb,hlen+32,1,"DLC Header - DSAP : 0x%02x",tvb_get_guint8(tvb,hlen+32)) ;
305          proto_tree_add_text (dlsw_data_tree,tvb,hlen+33,1,"DLC Header - SSAP : 0x%02x",tvb_get_guint8(tvb,hlen+33)) ;
306          proto_tree_add_text (dlsw_data_tree,tvb,hlen+34,1,"DLC Header - Ctrl : 0x%02x",tvb_get_guint8(tvb,hlen+34)) ;
307          }
308         proto_tree_add_text (dlsw_data_tree,tvb,hlen+dlchlen,mlen-dlchlen,"Data") ;
309       }
310
311    }
312 }
313
314 static void
315 dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti2)
316 {
317  int mlen,vlen,vtype,offset=4,gdsid,sap,i=0;
318  proto_tree *ti,*dlsw_vector_tree;
319  mlen=tvb_get_ntohs(tvb,0);
320  gdsid=tvb_get_ntohs(tvb,2);
321  proto_tree_add_text (tree,tvb,0,2,"Capabilities Length =  %d",mlen) ;
322  proto_tree_add_text (tree,tvb,2,2,"%s",val_to_str( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
323  proto_item_append_text(ti2," - %s",val_to_str( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
324  switch (gdsid) {
325   case DLSW_GDSID_ACK:
326     break;
327   case DLSW_GDSID_REF:
328     proto_tree_add_text (tree,tvb,4,2,"Erorr pointer =  %d",tvb_get_ntohs(tvb,4));
329     proto_tree_add_text (tree,tvb,6,2,"Erorr cause = %s",
330      val_to_str(tvb_get_ntohs(tvb,6), dlsw_refuse_vals, "Unknown refuse cause"));
331     break;
332   case DLSW_GDSID_SEND:
333     while (offset < mlen){
334       vlen=tvb_get_guint8(tvb,offset);
335       vtype=tvb_get_guint8(tvb,offset+1);
336       ti=proto_tree_add_text (tree,tvb,offset,vlen,"%s",
337          val_to_str(vtype,dlsw_vector_vals,"Unknown vector type"));
338       dlsw_vector_tree = proto_item_add_subtree(ti, ett_dlsw_vector);
339       proto_tree_add_text (dlsw_vector_tree,tvb,offset,1,  "Vector Length = %d",vlen);
340       proto_tree_add_text (dlsw_vector_tree,tvb,offset+1,1,"Vector Type   = %s (0x%02x)",
341        val_to_str(vtype,dlsw_vector_vals,"Unknown vector type"),vtype);
342       switch (vtype){
343         case 0x81:
344           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
345            "OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
346           break;
347         case 0x82:
348           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
349            "DLSw Version = %d.%d",tvb_get_guint8(tvb,offset+2),tvb_get_guint8(tvb,offset+3));
350           break;
351         case 0x83:
352           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
353            "Initial Pacing Window = %d",tvb_get_ntohs(tvb,offset+2));
354           break;
355         case 0x84:
356            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
357            "Version String = %s",tvb_format_text(tvb,offset+2,vlen-2));
358           break;
359         case 0x85:
360           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
361            "MAC Address Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
362           break;
363         case 0x86:
364           while (i<vlen-2)
365            {
366            sap=tvb_get_guint8(tvb,offset+2+i);
367            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2+i,1,
368             "SAP List Support = 0x%x0=%s 0x%x2=%s 0x%x4=%s 0x%x6=%s 0x%x8=%s 0x%xa=%s 0x%xc=%s 0x%xe=%s",
369             i,sap&0x80?"on ":"off",i,sap&0x40?"on ":"off",i,sap&0x20?"on ":"off",i,sap&0x10?"on ":"off",
370             i,sap&0x08?"on ":"off",i,sap&0x04?"on ":"off",i,sap&0x02?"on ":"off",i,sap&0x01?"on ":"off");
371            i++;
372            }
373           break;
374         case 0x87:
375           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
376            "TCP connections  = %d",tvb_get_guint8(tvb,offset+2));
377           break;
378         case 0x88:
379           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
380            "NetBIOS Name Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
381           break;
382         case 0x89:
383           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
384            "MAC Address List = %s / %s",tvb_bytes_to_str(tvb,offset+2,6)
385            ,tvb_bytes_to_str(tvb,offset+8,6));
386           break;
387         case 0x8a:
388           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
389 /* %s */           "NetBIOS name = %s",/* tvb_get_guint8(tvb,offset+2)==0?"Individual":"Group",*/
390            tvb_format_text(tvb,offset+2,vlen-2));
391           break;
392         case 0x8b:
393           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
394            "Vendor OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
395           break;
396         case 0x8c:
397           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
398            "Multicast Version Number = %d",tvb_get_guint8(tvb,offset+2));
399           break;
400         default:
401         proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,"Vector Data = ???");
402         }
403       offset+=vlen;
404       };
405     break;
406   default:
407     proto_tree_add_text (tree,tvb,4,mlen - 4,"Unknown data");
408   }
409
410 }
411
412 void
413 proto_register_dlsw(void)
414 {
415         static gint *ett[] = {
416                 &ett_dlsw,
417                 &ett_dlsw_header,
418                 &ett_dlsw_data,
419                 &ett_dlsw_vector,
420         };
421         proto_dlsw = proto_register_protocol("Data Link SWitching", "DLSw", "dlsw");
422 /*      proto_register_field_array(proto_dlsw, hf, array_length(hf)); */
423         proto_register_subtree_array(ett, array_length(ett));
424 }
425
426 void
427 proto_reg_handoff_dlsw(void)
428 {
429         dissector_handle_t dlsw_handle;
430
431         dlsw_handle = create_dissector_handle(dissect_dlsw, proto_dlsw);
432
433         dissector_add("tcp.port", TCP_PORT_DLSW, dlsw_handle);
434         dissector_add("udp.port", UDP_PORT_DLSW, dlsw_handle);
435 }