diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-09-26 20:31:51 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-09-26 20:31:51 +0000 |
commit | 63edea877fe8e3dfeea259d91f72bf830609d5ed (patch) | |
tree | 98fd5cf856fa1cdb9e97667c4edd4053e1905f4f /xdlc.h | |
parent | a673e8bb2c256140c69d31c502fd732f78533f72 (diff) | |
download | wireshark-63edea877fe8e3dfeea259d91f72bf830609d5ed.tar.gz wireshark-63edea877fe8e3dfeea259d91f72bf830609d5ed.tar.bz2 wireshark-63edea877fe8e3dfeea259d91f72bf830609d5ed.zip |
Have "get_xdlc_control()" and "dissect_xdlc_control()" return the
xDLC control field, so that its caller can not only determine from it
whether the frame has a payload, but can also determine how long the
control field is. Put macros in "xdlc.h" to determine both of those.
Have "capture_llc()" and "dissect_llc()" use that information
appropriately.
svn path=/trunk/; revision=727
Diffstat (limited to 'xdlc.h')
-rw-r--r-- | xdlc.h | 45 |
1 files changed, 44 insertions, 1 deletions
@@ -2,7 +2,7 @@ * Define *DLC frame types, and routine to dissect the control field of * a *DLC frame. * - * $Id: xdlc.h,v 1.3 1999/08/23 23:24:36 guy Exp $ + * $Id: xdlc.h,v 1.4 1999/09/26 20:31:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -32,6 +32,49 @@ #define XDLC_S 0x01 /* Supervisory frames */ #define XDLC_U 0x03 /* Unnumbered frames */ +/* + * U-format modifiers. + */ +#define XDLC_U_MODIFIER_MASK 0xEC +#define XDLC_UI 0x00 /* Unnumbered Information */ +#define XDLC_UP 0x20 /* Unnumbered Poll */ +#define XDLC_DISC 0x40 /* Disconnect (command) */ +#define XDLC_RD 0x40 /* Request Disconnect (response) */ +#define XDLC_UA 0x60 /* Unnumbered Acknowledge */ +#define XDLC_SNRM 0x80 /* Set Normal Response Mode */ +#define XDLC_TEST 0xE0 /* Test */ +#define XDLC_SIM 0x04 /* Set Initialization Mode (command) */ +#define XDLC_RIM 0x04 /* Request Initialization Mode (response) */ +#define XDLC_FRMR 0x84 /* Frame reject */ +#define XDLC_CFGR 0xC4 /* Configure */ +#define XDLC_SARM 0x0C /* Set Asynchronous Response Mode (command) */ +#define XDLC_DM 0x0C /* Disconnected mode (response) */ +#define XDLC_SABM 0x2C /* Set Asynchronous Balanced Mode */ +#define XDLC_SARME 0x4C /* Set Asynchronous Response Mode Extended */ +#define XDLC_SABME 0x6C /* Set Asynchronous Balanced Mode Extended */ +#define XDLC_RESET 0x8C /* Reset */ +#define XDLC_XID 0xAC /* Exchange identification */ +#define XDLC_SNRME 0xCC /* Set Normal Response Mode Extended */ +#define XDLC_BCN 0xEC /* Beacon */ + +/* + * This macro takes the control field of an xDLC frame, as returned by + * "get_xdlc_control()" or "dissect_xdlc_control()", and evaluates to + * TRUE if the frame has a payload (i.e., if it's an Information or + * Unnumbered Information frame) and FALSE if it doesn't. + */ +#define XDLC_HAS_PAYLOAD(control) \ + ((control) == XDLC_I || (control) == (XDLC_UI|XDLC_U)) + +/* + * This macro takes the control field of an xDLC frame, and a flag saying + * whether we're doing basic or extended operation, and evaluates to + * the length of that field (if it's an Unnumbered frame, or we're not + * in extended mode, it's 3 bytes long, otherwise it's 4 bytes long). + */ +#define XDLC_CONTROL_LEN(control, is_extended) \ + (((control) == XDLC_U || !(is_extended)) ? 3 : 4) + int get_xdlc_control(const u_char *pd, int offset, int is_response, int extended); |