linux-old/include/net/llc_frame.h
<<
>>
Prefs
   1/* if_ether.h needed for definition of ETH_DATA_LEN and ETH_ALEN
   2 */
   3#include "linux/if_ether.h"
   4
   5/* frame layout based on par3.2 "LLC PDU format"
   6 */
   7typedef union {                 /* pdu layout from pages 40 & 44 */
   8    struct {                    /* general header, all pdu types */
   9        unsigned dsap : 8;      /* dest service access point */
  10        unsigned ssap : 8;      /* source service access point */
  11        unsigned f1 : 1;        /* I- U- or S- format id bits */
  12        unsigned f2 : 1;
  13        unsigned : 6;
  14        unsigned : 8;
  15   } pdu_hdr;
  16   struct {
  17        char dummy1[2];         /* dsap + ssap */
  18        char byte1;
  19        char byte2;
  20   } pdu_cntl;                  /* unformatted control bytes */
  21   struct {                     /* header of an Information pdu */
  22        unsigned char dummy2[2];
  23        unsigned : 1;
  24        unsigned ns : 7;
  25        unsigned i_pflag : 1;   /* poll/final bit */
  26        unsigned nr : 7;        /* N(R)  */     
  27        unsigned char is_info[ ETH_DATA_LEN ];
  28   }  i_hdr;
  29   struct {                     /* header of a Supervisory pdu */
  30        unsigned char dummy3[2];
  31        unsigned : 2;
  32        unsigned ss : 2;        /* supervisory function bits */
  33        unsigned : 4;
  34        unsigned s_pflag : 1;   /* poll/final bit  */
  35        unsigned nr : 7;        /* N(R)  */
  36   } s_hdr;
  37
  38/* when accessing the P/F bit or the N(R) field there's no need to distinguish
  39   I pdus from S pdus i_pflag and s_pflag / i_nr and s_nr map to the same
  40   physical location.
  41 */ 
  42   struct {                     /* header of an Unnumbered pdu */
  43        unsigned char dummy4[2];
  44        unsigned : 2;
  45        unsigned mm1 : 2;       /* modifier function part1 */
  46        unsigned u_pflag : 1;    /* P/F for U- pdus */
  47        unsigned mm2 : 3;       /* modifier function part2 */
  48        unsigned char u_info[ ETH_DATA_LEN-1];
  49   } u_hdr;
  50   struct {                     /* mm field in an Unnumbered pdu */
  51        unsigned char dummy5[2];
  52        unsigned : 2;
  53        unsigned mm : 6;        /* must be masked to get ridd of P/F !  */
  54   } u_mm;
  55         
  56} frame_type, *frameptr;
  57
  58/* frame format test macros: */
  59
  60#define IS_UFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & ( (fr)->pdu_hdr.f2) )
  61
  62#define IS_IFRAME( fr ) ( !( (fr)->pdu_hdr.f1) )
  63
  64#define IS_SFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & !( (fr)->pdu_hdr.f2) )
  65
  66#define IS_RSP( fr ) ( fr->pdu_hdr.ssap & 0x01 )
  67
  68
  69/* The transition table, the _encode tables and some tests in the
  70   source code depend on the numeric order of these values.
  71   Think twice before changing.
  72 */
  73
  74/* frame names for TYPE 2 operation: */
  75#define I_CMD           0
  76#define RR_CMD          1
  77#define RNR_CMD         2
  78#define REJ_CMD         3
  79#define DISC_CMD        4
  80#define SABME_CMD       5
  81#define I_RSP           6
  82#define RR_RSP          7
  83#define RNR_RSP         8
  84#define REJ_RSP         9
  85#define UA_RSP          10
  86#define DM_RSP          11
  87#define FRMR_RSP        12
  88
  89/* junk frame name: */
  90#define BAD_FRAME       13
  91#define NO_FRAME        13
  92
  93/* frame names for TYPE 1 operation: */
  94#define UI_CMD          14
  95#define XID_CMD         15
  96#define TEST_CMD        16
  97#define XID_RSP         17
  98#define TEST_RSP        18
  99
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.