From Matthijs Melchior: check whether the ring buffer timeout has
[obnox/wireshark/wip.git] / packet-lwapp.c
1 /* packet-lwapp.c
2  *
3  * Routines for LWAPP encapsulated packet disassembly
4  * draft-calhoun-seamoby-lwapp-N (the current draft is 3)
5  *
6  * $Id: packet-lwapp.c,v 1.4 2003/09/24 23:35:39 guy Exp $
7  *
8  * Copyright (c) 2003 by David Frascone <dave@frascone.com>
9  *
10  * Ethereal - Network traffic analyzer
11  * By Gerald Combs <gerald@ethereal.com>
12  * Copyright 1998 Gerald Combs
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27  */
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <ctype.h>
37 #include <time.h>
38 #include <glib.h>
39 #include <epan/filesystem.h>
40 #include "xmlstub.h"
41 #include <epan/packet.h>
42 #include <epan/resolv.h>
43 #include "prefs.h"
44
45
46 #ifdef NEED_SNPRINTF_H
47 # include "snprintf.h"
48 #endif
49
50 #define LWAPP_FLAGS_T 0x04
51 #define LWAPP_FLAGS_F 0x02
52 #define LWAPP_FLAGS_FT 0x01
53
54 static gint proto_lwapp = -1;
55 static gint proto_lwapp_l3 = -1;
56 static gint proto_lwapp_control = -1;
57 static gint ett_lwapp = -1;
58 static gint ett_lwapp_l3 = -1;
59 static gint ett_lwapp_flags = -1;
60 static gint ett_lwapp_control = -1;
61
62 static gint hf_lwapp_version = -1;
63 static gint hf_lwapp_slotid = -1;
64 static gint hf_lwapp_flags_type = -1;
65 static gint hf_lwapp_flags_fragment = -1;
66 static gint hf_lwapp_flags_fragment_type = -1;
67 static gint hf_lwapp_fragment_id = -1;
68 static gint hf_lwapp_length = -1;
69 static gint hf_lwapp_rssi = -1;
70 static gint hf_lwapp_snr = -1;
71 static gint hf_lwapp_control = -1;
72 static gint hf_lwapp_control_type = -1;
73 static gint hf_lwapp_control_seq_no = -1;
74 static gint hf_lwapp_control_length = -1;
75
76 static dissector_handle_t eth_handle;
77 static dissector_handle_t wlan_handle;
78 static dissector_handle_t wlan_bsfc_handle;
79 static dissector_handle_t data_handle;
80
81 /* Set by preferences */
82 static gboolean swap_frame_control;
83
84 typedef struct {
85     guint8 flags;
86     guint8 fragmentId;
87     guint16 length;
88     guint8 rssi;
89     guint8 snr;
90 } LWAPP_Header;
91
92 typedef struct {
93     guint8   tag;
94     guint16  length;
95 } CNTL_Data_Header;
96
97 typedef struct {
98     guint8    type;
99     guint8    seqNo;
100     guint16   length;
101 } CNTL_Header;
102
103 typedef enum {
104     RESULT_CODE = 1,
105     MWAR_ADDR_PAYLOAD,
106     RAD_PAYLOAD,
107     RAD_SLOT_PAYLOAD,
108     RAD_NAME_PAYLOAD,
109     MWAR_PAYLOAD,
110     VAP_PAYLOAD,
111     STATION_CFG_PAYLOAD,
112     OPERATION_RATE_SET_PAYLOAD,
113     MULTI_DOMAIN_CAPABILITY_PAYLOAD,
114     MAC_OPERATION_PAYLOAD,
115     PHY_TX_POWER_PAYLOAD,
116     PHY_TX_POWER_LEVEL_PAYLOAD,
117     PHY_DSSS_PAYLOAD,
118     PHY_OFDM_PAYLOAD,
119     SUPPORTED_RATES_PAYLOAD,
120     AUTH_PAYLOAD,
121     TEST_PAYLOAD,
122     RRM_NEIGHBOR_CTRL_PAYLOAD,
123     RRM_NOISE_CTRL_PAYLOAD,
124     RRM_NOISE_DATA_PAYLOAD,
125     RRM_INTERFERENCE_CTRL_PAYLOAD,
126     RRM_INTERFERENCE_DATA_PAYLOAD,
127     RRM_LOAD_CTRL_PAYLOAD,
128     RRM_LOAD_DATA_PAYLOAD,
129     CHANGE_STATE_EVENT_PAYLOAD,
130     ADMIN_STATE_PAYLOAD,
131     DELETE_VAP_PAYLOAD,
132     ADD_MOBILE_PAYLOAD,
133     DELETE_MOBILE_PAYLOAD
134 } control_tags;
135
136 typedef enum
137   {
138     DISCOVERY_REQUEST = 1,
139     DISCOVERY_REPLY,
140     JOIN_REQUEST,
141     JOIN_REPLY,
142     HANDOFF_REQUEST,
143     HANDOFF_REPLY,
144     HANDOFF_COMMAND,
145     HANDOFF_RESPONSE,
146     HANDOFF_CONFIRM,
147     CONFIGURE_REQUEST,
148     CONFIGURE_RESPONSE,
149     CONFIGURE_COMMAND,
150     CONFIGURE_COMMAND_RES,
151     STATISTICS_INFO,
152     CHANGE_STATE_EVENT,
153     CHANGE_STATE_EVENT_RES,
154     RRM_CONTROL_REQ,
155     RRM_CONTROL_RES,
156     RRM_DATA_REQ,
157     RRM_DATA_RES,
158     ECHO_REQUEST,
159     ECHO_RESPONSE,
160     I_AM_UP_REQ,
161     I_AM_UP_RES
162   }CNTLMsgType;
163
164 const value_string control_msg_vals[] = {
165     {DISCOVERY_REQUEST, "DISCOVERY_REQUEST"},
166     {DISCOVERY_REPLY, "DISCOVERY_REPLY"},
167     {JOIN_REQUEST, "JOIN_REQUEST"},
168     {JOIN_REPLY, "JOIN_REPLY"},
169     {HANDOFF_REQUEST, "HANDOFF_REQUEST"},
170     {HANDOFF_REPLY, "HANDOFF_REPLY"},
171     {HANDOFF_COMMAND, "HANDOFF_COMMAND"},
172     {HANDOFF_RESPONSE, "HANDOFF_RESPONSE"},
173     {HANDOFF_CONFIRM, "HANDOFF_CONFIRM"},
174     {CONFIGURE_REQUEST, "CONFIGURE_REQUEST"},
175     {CONFIGURE_RESPONSE, "CONFIGURE_RESPONSE"},
176     {CONFIGURE_COMMAND, "CONFIGURE_COMMAND"},
177     {CONFIGURE_COMMAND_RES, "CONFIGURE_COMMAND_RES"},
178     {STATISTICS_INFO, "STATISTICS_INFO"},
179     {CHANGE_STATE_EVENT, "CHANGE_STATE_EVENT"},
180     {CHANGE_STATE_EVENT_RES, "CHANGE_STATE_EVENT_RES"},
181     {RRM_CONTROL_REQ, "RRM_CONTROL_REQ"},
182     {RRM_CONTROL_RES, "RRM_CONTROL_RES"},
183     {RRM_DATA_REQ, "RRM_DATA_REQ"},
184     {RRM_DATA_RES, "RRM_DATA_RES"},
185     {ECHO_REQUEST, "ECHO_REQUEST"},
186     {ECHO_RESPONSE, "ECHO_RESPONSE"},
187     {I_AM_UP_REQ, "I_AM_UP_REQ"},
188     {I_AM_UP_RES, "I_AM_UP_RES"},
189
190     { 0, NULL}
191 };
192 const value_string control_tag_vals[] = {
193
194     {RESULT_CODE, "RESULT_CODE"},
195     {MWAR_ADDR_PAYLOAD, "MWAR_ADDR_PAYLOAD"},
196     {RAD_PAYLOAD, "RAD_PAYLOAD"},
197     {RAD_SLOT_PAYLOAD, "RAD_SLOT_PAYLOAD"},
198     {RAD_NAME_PAYLOAD, "RAD_NAME_PAYLOAD"},
199     {MWAR_PAYLOAD, "MWAR_PAYLOAD"},
200     {VAP_PAYLOAD, "VAP_PAYLOAD"},
201     {STATION_CFG_PAYLOAD, "STATION_CFG_PAYLOAD"},
202     {OPERATION_RATE_SET_PAYLOAD, "OPERATION_RATE_SET_PAYLOAD"},
203     {MULTI_DOMAIN_CAPABILITY_PAYLOAD, "MULTI_DOMAIN_CAPABILITY_PAYLOAD"},
204     {MAC_OPERATION_PAYLOAD, "MAC_OPERATION_PAYLOAD"},
205     {PHY_TX_POWER_PAYLOAD, "PHY_TX_POWER_PAYLOAD"},
206     {PHY_TX_POWER_LEVEL_PAYLOAD, "PHY_TX_POWER_LEVEL_PAYLOAD"},
207     {PHY_DSSS_PAYLOAD, "PHY_DSSS_PAYLOAD"},
208     {PHY_OFDM_PAYLOAD, "PHY_OFDM_PAYLOAD"},
209     {SUPPORTED_RATES_PAYLOAD, "SUPPORTED_RATES_PAYLOAD"},
210     {AUTH_PAYLOAD, "AUTH_PAYLOAD"},
211     {TEST_PAYLOAD, "TEST_PAYLOAD"},
212     {RRM_NEIGHBOR_CTRL_PAYLOAD, "RRM_NEIGHBOR_CTRL_PAYLOAD"},
213     {RRM_NOISE_CTRL_PAYLOAD, "RRM_NOISE_CTRL_PAYLOAD"},
214     {RRM_NOISE_DATA_PAYLOAD, "RRM_NOISE_DATA_PAYLOAD"},
215     {RRM_INTERFERENCE_CTRL_PAYLOAD, "RRM_INTERFERENCE_CTRL_PAYLOAD"},
216     {RRM_INTERFERENCE_DATA_PAYLOAD, "RRM_INTERFERENCE_DATA_PAYLOAD"},
217     {RRM_LOAD_CTRL_PAYLOAD, "RRM_LOAD_CTRL_PAYLOAD"},
218     {RRM_LOAD_DATA_PAYLOAD, "RRM_LOAD_DATA_PAYLOAD"},
219     {CHANGE_STATE_EVENT_PAYLOAD, "CHANGE_STATE_EVENT_PAYLOAD"},
220     {ADMIN_STATE_PAYLOAD, "ADMIN_STATE_PAYLOAD"},
221     {DELETE_VAP_PAYLOAD, "DELETE_VAP_PAYLOAD"},
222     {ADD_MOBILE_PAYLOAD, "ADD_MOBILE_PAYLOAD"},
223     {DELETE_MOBILE_PAYLOAD, "DELETE_MOBILE_PAYLOAD"},
224     {0, NULL}
225 };
226
227 static const true_false_string lwapp_flags_type = {
228     "LWAPP Control Packet" ,
229     "Encapsulated 80211"
230 };
231
232 static const true_false_string lwapp_set_truth = {
233     "Not Set",
234     "Set" 
235 };
236
237 /* 
238  * dissect lwapp control packets.  This is not fully implemented,
239  * but it's a good start.
240  */
241 static void dissect_control(tvbuff_t *tvb, packet_info *pinfo,
242                          proto_tree *tree)
243 {
244     CNTL_Header header;
245     proto_tree      *control_tree;
246     tvbuff_t        *next_tvb;
247
248     /* Set up structures needed to add the protocol subtree and manage it */
249     proto_item      *ti;
250     size_t           offset=0;
251
252     /* Make entries in Protocol column and Info column on summary display */
253     if (check_col(pinfo->cinfo, COL_PROTOCOL))
254         col_set_str(pinfo->cinfo, COL_PROTOCOL, "LWAPP");
255     if (check_col(pinfo->cinfo, COL_INFO)) {
256         col_clear(pinfo->cinfo, COL_INFO);
257         col_add_str(pinfo->cinfo, COL_INFO,
258                     "CNTL ");
259     }
260
261     /* Copy our header */
262     tvb_memcpy(tvb, (guint8*) &header, offset, sizeof(header));
263
264     /* 
265      * Fix the length (network byte ordering), and set our version &
266      * slot id
267      */
268     header.length = g_ntohs(header.length);
269
270     if (check_col(pinfo->cinfo, COL_INFO)) {
271         col_append_str(pinfo->cinfo, COL_INFO,
272             val_to_str(header.type, control_msg_vals, "Bad Type: 0x%02x"));
273     }
274
275     /* In the interest of speed, if "tree" is NULL, don't do any work not
276        necessary to generate protocol tree items. */
277     if (tree) {
278         /* create display subtree for the protocol */
279         ti = proto_tree_add_item(tree, proto_lwapp_control, tvb, offset,
280                                  -1, FALSE);
281         control_tree = proto_item_add_subtree(ti, ett_lwapp_control);
282         
283         proto_tree_add_uint(control_tree, hf_lwapp_control_type, 
284                                tvb, offset, 1, header.type);
285         offset++;
286
287         proto_tree_add_uint(control_tree, hf_lwapp_control_seq_no, 
288                                tvb, offset, 1, header.seqNo);
289         offset++;
290
291         proto_tree_add_uint(control_tree, hf_lwapp_control_length, 
292                                tvb, offset, 2, header.length);
293         offset += 2;
294
295         /* Dissect rest of packet as data */
296         next_tvb = tvb_new_subset(tvb, offset, -1, -1);
297         call_dissector(data_handle,next_tvb, pinfo, tree);
298     }
299
300 } /* dissect_control */
301
302 /*
303  * This lwapp dissector assumes that there is an 802.3 header at
304  * the start of the packet, so it simply re-calls the ethernet
305  * dissector on the packet.
306  */
307 static void dissect_lwapp_l3(tvbuff_t *tvb, packet_info *pinfo,
308                             proto_tree *tree)
309 {
310     /* Set up structures needed to add the protocol subtree and manage it */
311     proto_item      *ti;
312     proto_tree      *lwapp_tree;
313     size_t           offset=0;
314     tvbuff_t        *next_client;
315
316     /* Make entries in Protocol column and Info column on summary display */
317     if (check_col(pinfo->cinfo, COL_PROTOCOL))
318         col_set_str(pinfo->cinfo, COL_PROTOCOL, "LWAPP-L3");
319     if (check_col(pinfo->cinfo, COL_INFO)) {
320         col_clear(pinfo->cinfo, COL_INFO);
321         col_add_str(pinfo->cinfo, COL_INFO, "802.3 Packets over Layer 3");
322     }
323
324     if (tree) {
325         /* create display subtree for the protocol */
326         ti = proto_tree_add_item(tree, proto_lwapp_l3, tvb, offset,
327                                  -1, FALSE);
328         lwapp_tree = proto_item_add_subtree(ti, ett_lwapp_l3);
329     }
330
331     /* Dissect as Ethernet */
332     next_client = tvb_new_subset(tvb, 0, -1, -1);
333     call_dissector(eth_handle, next_client, pinfo, tree);
334     return;
335
336 } /* dissect_lwapp_l3*/
337
338
339 /*
340  * This dissector dissects the lwapp protocol itself.  It assumes an 
341  * lwapp payload in the data, and doesn't care whether the data was
342  * from a UDP packet, or a Layer 2 one.
343  */
344 static void dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo,
345                         proto_tree *tree)
346 {
347     LWAPP_Header header;
348     guint8     slotId;
349     guint8     version;
350     proto_tree      *lwapp_tree;
351     proto_tree      *flags_tree;
352     tvbuff_t        *next_client;
353
354     /* Set up structures needed to add the protocol subtree and manage it */
355     proto_item      *ti;
356     size_t           offset=0;
357
358     /* Make entries in Protocol column and Info column on summary display */
359     if (check_col(pinfo->cinfo, COL_PROTOCOL))
360         col_set_str(pinfo->cinfo, COL_PROTOCOL, "LWAPP");
361     if (check_col(pinfo->cinfo, COL_INFO)) {
362         col_clear(pinfo->cinfo, COL_INFO);
363         col_add_str(pinfo->cinfo, COL_INFO,
364                     "LWAPP IP or Layer 2");
365     }
366
367     /* Copy our header */
368     tvb_memcpy(tvb, (guint8*) &header, offset, sizeof(header));
369
370     /* 
371      * Fix the length (network byte ordering), and set our version &
372      * slot id
373      */
374     header.length = g_ntohs(header.length);
375     version = (header.flags & 0xc0) >> 6;
376     slotId = (header.flags & 0x38) >> 3;
377
378     if (check_col(pinfo->cinfo, COL_INFO)) {
379         if ((header.flags & LWAPP_FLAGS_T) != 0)
380             col_append_str(pinfo->cinfo, COL_INFO,
381                            " Control Packet");
382         else
383             col_append_str(pinfo->cinfo, COL_INFO,
384                            " 802.11 Packet");
385     }
386
387     /* In the interest of speed, if "tree" is NULL, don't do any work not
388        necessary to generate protocol tree items. */
389     if (tree) {
390
391         /* create display subtree for the protocol */
392         ti = proto_tree_add_item(tree, proto_lwapp, tvb, offset,
393                                  tvb_length(tvb), FALSE);
394         lwapp_tree = proto_item_add_subtree(ti, ett_lwapp);
395
396         proto_tree_add_uint(lwapp_tree, hf_lwapp_version, 
397                                tvb, offset, 1, version);
398         proto_tree_add_uint(lwapp_tree, hf_lwapp_slotid, 
399                                tvb, offset, 1, slotId);
400
401         flags_tree = proto_item_add_subtree(lwapp_tree, ett_lwapp_flags);
402         proto_tree_add_boolean(flags_tree, hf_lwapp_flags_type, 
403                                tvb, offset, 1, header.flags);
404         proto_tree_add_boolean(flags_tree, hf_lwapp_flags_fragment, 
405                                tvb, offset, 1, header.flags);
406         proto_tree_add_boolean(flags_tree, hf_lwapp_flags_fragment_type, 
407                                tvb, offset, 1, header.flags);
408         offset++;
409
410         proto_tree_add_uint(lwapp_tree, hf_lwapp_fragment_id, 
411                                tvb, offset, 1, header.fragmentId);
412         offset++;
413
414         proto_tree_add_uint(lwapp_tree, hf_lwapp_length, 
415                                tvb, offset, 2, header.length);
416         offset += 2;
417
418         proto_tree_add_uint(lwapp_tree, hf_lwapp_rssi, 
419                                tvb, offset, 1, header.rssi);
420         offset++;
421         proto_tree_add_uint(lwapp_tree, hf_lwapp_snr, 
422                                tvb, offset, 1, header.snr);
423         offset++;
424
425
426     }  /* tree */
427
428     next_client = tvb_new_subset(tvb, sizeof(LWAPP_Header), -1, -1);
429     if ((header.flags & LWAPP_FLAGS_T) == 0) {
430         call_dissector(swap_frame_control ? wlan_bsfc_handle : wlan_handle,
431                         next_client, pinfo, tree);
432     } else {
433         dissect_control(next_client, pinfo, tree);
434     }
435     return;
436
437 } /* dissect_lwapp*/
438
439 /* registration with the filtering engine */
440 void
441 proto_register_lwapp(void)
442 {
443     static hf_register_info hf[] = {
444         { &hf_lwapp_version,
445           { "Version", "lwapp.version", FT_UINT8, BASE_DEC, NULL, 0x00,
446             "", HFILL }},
447         { &hf_lwapp_slotid,
448           { "slotId","lwapp.slotId", FT_UINT24, BASE_DEC, NULL, 0x0,
449             "", HFILL }},
450         { &hf_lwapp_flags_type,
451           { "Type", "lwapp.flags.type", FT_BOOLEAN, 8, 
452             TFS(&lwapp_flags_type), LWAPP_FLAGS_T, "", HFILL }},
453         { &hf_lwapp_flags_fragment,
454           { "Fragment", "lwapp.flags.fragment", FT_BOOLEAN, 8,
455             TFS(&lwapp_set_truth), LWAPP_FLAGS_F,
456             "", HFILL }},
457         { &hf_lwapp_flags_fragment_type,
458           { "Fragment Type", "lwapp.flags.fragmentType", FT_BOOLEAN, 8,
459             TFS(&lwapp_set_truth), LWAPP_FLAGS_FT,
460             "", HFILL }},
461         { &hf_lwapp_fragment_id,
462           { "Fragment Id","lwapp.fragmentId", FT_UINT8, BASE_HEX,
463             NULL, 0x0, "", HFILL }},
464         { &hf_lwapp_length,
465           { "Length","lwapp.Length", FT_UINT16, BASE_DEC,
466             NULL, 0x0, "", HFILL }},
467         { &hf_lwapp_rssi,
468           { "RSSI","lwapp.rssi", FT_UINT8, BASE_HEX,
469             NULL, 0x0, "", HFILL }},
470         { &hf_lwapp_snr,
471           { "SNR","lwapp.snr", FT_UINT8, BASE_HEX,
472             NULL, 0x0, "", HFILL }},
473         { &hf_lwapp_control,
474           { "Control Data (not dissected yet)","lwapp.control", FT_BYTES, BASE_NONE,
475             NULL, 0x0, "", HFILL }},
476         { &hf_lwapp_control_type,
477           { "Control Type", "lwapp.control.type", FT_UINT8, BASE_DEC, NULL, 0x00,
478             "", HFILL }},
479         { &hf_lwapp_control_seq_no,
480           { "Control Sequence Number", "lwapp.control.seqno", FT_UINT8, BASE_DEC, NULL, 0x00,
481             "", HFILL }},
482         { &hf_lwapp_control_length,
483           { "Control Length","lwapp.control.length", FT_UINT16, BASE_DEC,
484             NULL, 0x0, "", HFILL }},
485     };
486     static gint *ett[] = {
487         &ett_lwapp_l3,
488         &ett_lwapp,
489         &ett_lwapp_control,
490         &ett_lwapp_flags
491     };
492     module_t *lwapp_module;
493
494     proto_lwapp = proto_register_protocol ("LWAPP Encapsulated Packet", 
495                                          "LWAPP", "lwapp");
496
497     proto_lwapp_l3 = proto_register_protocol ("LWAPP Layer 3 Packet", 
498                                          "LWAPP-L3", "lwapp-l3");
499
500     proto_lwapp_control = proto_register_protocol ("LWAP Control Message", 
501                                          "LWAPP-CNTL", "lwapp-cntl");
502     proto_register_field_array(proto_lwapp, hf, array_length(hf));
503     proto_register_subtree_array(ett, array_length(ett));
504
505     lwapp_module = prefs_register_protocol(proto_lwapp, NULL);
506
507     prefs_register_bool_preference(lwapp_module,"swap_fc","Swap Frame Control",
508                                    "Swap frame control bytes (needed for some APs",
509                                     &swap_frame_control);
510
511 } /* proto_register_diameter */
512
513 void
514 proto_reg_handoff_lwapp(void)
515 {
516     dissector_handle_t lwapp_l3_handle;
517     dissector_handle_t lwapp_handle;
518
519     /*
520      * Get handles for the Ethernet and wireless dissectors.
521      */
522     eth_handle = find_dissector("eth");
523     wlan_handle = find_dissector("wlan");
524     wlan_bsfc_handle = find_dissector("wlan_bsfc");
525     data_handle = find_dissector("data");
526
527     /* This dissector assumes lwapp packets in an 802.3 frame */
528     lwapp_l3_handle = create_dissector_handle(dissect_lwapp_l3, proto_lwapp_l3);
529
530     /* This dissector assumes a lwapp packet */
531     lwapp_handle = create_dissector_handle(dissect_lwapp, proto_lwapp);
532
533     /*
534      * Ok, the following deserves some comments.  We have four 
535      * different ways lwapp can appear on the wire.  Mostly, this is
536      * because lwapp is such a new protocol.
537      * 
538      * First, lwapp can join on multiple udp ports, as encapsulated
539      * packets on top of UDP.  In this case, there is a full raw
540      * ethernet frame inside of the UDP packet.  This method is 
541      * becoming obscelete, but we still wanted to dissect the 
542      * packets.
543      *
544      * Next, lwapp can be over UDP, but packged for L3 tunneling.  This
545      * is the new-style.  In this case, LWAP headers are just transmitted
546      * via UDP.  
547      *
548      * The last method is lwapp directly over layer 2.  For this, we
549      * dissect two different ethertypes (until IANA gives us one)
550      *
551      */
552
553     /* Obsceleted LWAP via encapsulated 802.3 over UDP */
554
555     dissector_add("udp.port", 12220, lwapp_l3_handle);
556
557     /* new-style lwapp directly over UDP: L3-lwapp*/
558     dissector_add("udp.port", 12222, lwapp_handle);
559
560     /* Lwapp over L2 */
561     dissector_add("ethertype", 0x88bb, lwapp_handle);
562     dissector_add("ethertype", 0xbbbb, lwapp_handle);
563
564 }