Give the IPX dissector dissector hash tables for the IPX type and socket
[obnox/wireshark/wip.git] / xdlc.h
1 /* xdlc.h
2  * Define *DLC frame types, and routine to dissect the control field of
3  * a *DLC frame.
4  *
5  * $Id: xdlc.h,v 1.12 2000/01/24 02:05:39 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@zing.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 /*
28  * Low-order bits of first (extended) or only (basic) octet of control
29  * field, specifying the frame type.
30  */
31 #define XDLC_I          0x00    /* Information frames */
32 #define XDLC_S          0x01    /* Supervisory frames */
33 #define XDLC_U          0x03    /* Unnumbered frames */
34
35 /*
36  * U-format modifiers.
37  */
38 #define XDLC_U_MODIFIER_MASK    0xEC
39 #define XDLC_UI         0x00    /* Unnumbered Information */
40 #define XDLC_UP         0x20    /* Unnumbered Poll */
41 #define XDLC_DISC       0x40    /* Disconnect (command) */
42 #define XDLC_RD         0x40    /* Request Disconnect (response) */
43 #define XDLC_UA         0x60    /* Unnumbered Acknowledge */
44 #define XDLC_SNRM       0x80    /* Set Normal Response Mode */
45 #define XDLC_TEST       0xE0    /* Test */
46 #define XDLC_SIM        0x04    /* Set Initialization Mode (command) */
47 #define XDLC_RIM        0x04    /* Request Initialization Mode (response) */
48 #define XDLC_FRMR       0x84    /* Frame reject */
49 #define XDLC_CFGR       0xC4    /* Configure */
50 #define XDLC_SARM       0x0C    /* Set Asynchronous Response Mode (command) */
51 #define XDLC_DM         0x0C    /* Disconnected mode (response) */
52 #define XDLC_SABM       0x2C    /* Set Asynchronous Balanced Mode */
53 #define XDLC_SARME      0x4C    /* Set Asynchronous Response Mode Extended */
54 #define XDLC_SABME      0x6C    /* Set Asynchronous Balanced Mode Extended */
55 #define XDLC_RESET      0x8C    /* Reset */
56 #define XDLC_XID        0xAC    /* Exchange identification */
57 #define XDLC_SNRME      0xCC    /* Set Normal Response Mode Extended */
58 #define XDLC_BCN        0xEC    /* Beacon */
59
60 /*
61  * This macro takes the control field of an xDLC frame, as returned by
62  * "get_xdlc_control()" or "dissect_xdlc_control()", and evaluates to
63  * TRUE if the frame is an "information" frame and FALSE if it isn't.
64  * Note that frames other than information frames can have data in them,
65  * e.g. TEST frames.
66  */
67 #define XDLC_IS_INFORMATION(control) \
68         (((control) & 0x1) == XDLC_I || (control) == (XDLC_UI|XDLC_U))
69
70 /*
71  * This macro takes the control field of an xDLC frame, and a flag saying
72  * whether we're doing basic or extended operation, and evaluates to
73  * the length of that field (if it's an Unnumbered frame, or we're not
74  * in extended mode, it's 1 byte long, otherwise it's 2 bytes long).
75  */
76 #define XDLC_CONTROL_LEN(control, is_extended) \
77         ((((control) & 0x3) == XDLC_U || !(is_extended)) ? 1 : 2)
78
79 int get_xdlc_control(const u_char *pd, int offset, int is_response,
80   int extended);
81
82 int dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd,
83   proto_tree *xdlc_tree, int hf_xdlc_control, gint ett_xdlc_control,
84   int is_response, int extended);