Solstice X.25 9.2 Developer's Guide

11.2.2 LAPB ioctls

The ioctls described in this section can only be used over LAPB.

11.2.2.1 L_GETGSTATS--Reads Global Layer 2 Statistics

The L_GETGSTATS ioctl reads global layer 2 statistics from the LAPB driver.

Associated Structures

The lapb_gstioc structure is used.

/* Ioctl block for L_GETGSTATS ioctl */
 struct lapb_gstioc {
     uint8         lli_type;      /* Table type = LI_GSTATS  */
     uint8         lli_spare[3];  /*   (for alignment)   */
     uint32        lapbgstats[globstatmax];
        /* global statistics table           */
 };

 /* Global L2 statistics */
 #define frames_tx     0 /* frames transmitted  */
 #define frames_rx     1 /* frames received  */
 #define sabme_tx      2 /* SABMEs transmitted  */
 #define sabme_rx      3 /* SABMEs received  */
 #define bytes_tx      4 /* data bytes transmitted */
 #define bytes_rx      5 /* data bytes received  */
 #define globstatmax   6 /* size of global stats array */

The members of the lapb_gstioc structure are:

Table 11-43 Members of the lapb_gstioc structure

Member 

Description 

lli_type

The table type 

lapbgstats

The global statistics table 

11.2.2.2 L_GETPPA--Returns the PPA Associated With a Stream

This ioctl returns the PPA and link index associated with the stream.

Associated Structure:
/* Ioctl block for L_SETPPA and L_GETPPA commands */
 struct ll_snioc {
     uint8        lli_type;     /* Table type = LI_SPPA            */
     uint8        lli_class;    /* DTE/DCE/extended                */
     uint16       lli_slp_pri;  /* SLP priority                    */
     uint32       lli_ppa;      /* PPA/ Subnetwork ID character    */
     uint32       lli_index;    /* Link index                      */
 };

The members of the ll_snioc structure are:

Table 11-44 Members of the ll_snioc structure

Member 

Description 

lli_type

The table type. This should always be LI_SPPA. 

lli_class

This indicates the type of link. LC_LLC2 must be used for LLC2; LC__LAPBDTE or LC_LAPBDCE must be used for LAPB. The file /usr/include/netdlc/ll_proto.h contains a complete list of values.

lli_slp_pri

This determines the priority of SLP when MLP is used. 

lli_ppa

The PPA identifier 

lli_index

The link index. This must be set with the muxid value returned by the I-LINK ioctl when LAPB is placed over a serial driver.

Errors
Table 11-45 L_GETPPA errors

Error 

Description 

ENODEV

No such device or a DL_ATTACH_REQ has not been sent.

11.2.2.3 L_GETSTATS--Retrieves Per-Link Statistics

The L_GETSTATS ioctl reads per-link (i.e., per-PPA) statistics from the LAPB driver.

Associated Structures

The lapb_stioc structure is used

/* Ioctl block for L_GETSTATS ioctl */
 struct lapb_stioc {
     uint8           lli_type;      /* Table type = LI_STATS  */
     uint8           lli_spare[3];  /*   (for alignment)   */
     uint32          lli_ppa;       /* PPA    */
     lapbstats_t     lli_stats;     /* Table of stats values  */
 };

The lapbstats_t structure needed for L_GETSTATS is defined as follows:


Example 11-1 lapbstats_t structure

typedef struct lapb2_stats {
  uint32 lapbmonarray[laphstatmax]; /* array of LAPB stats */
 } lapbstats_t;

 /* Statistics table definitions  */
 #define tx_ign              0 /* no. ignored + not sent */
 #define rx_badlen           1 /* bad length frames received */
 #define rx_unknown          2 /* unknown frames received */
 #define t1_exp              3 /* no. of T1 timeouts  */
 #define t4_exp              4 /* no. of T4 timeouts  */
 #define t4_n2_exp           5 /* T4 timeouts after N2 times */

 #define RR_rx_cmd           6 /* RR = Receive Ready  */
 #define RR_rx_rsp           7 /* tx = transmitted  */
 #define RR_tx_cmd           8 /* rx = received  */
 #define RR_tx_rsp           9 /* cmd/rsp = command/response */
 #define RR_tx_cmd_p        10 /* p = p-bit set        */

 #define RNR_rx_cmd         11 /* RNR = Receive Not Ready */
 #define RNR_rx_rsp         12
 #define RNR_tx_cmd         13
 #define RNR_tx_rsp         14
 #define RNR_tx_cmd_p       15

 #define REJ_rx_cmd         16 /* REJ = Reject   */
 #define REJ_rx_rsp         17
 #define REJ_tx_cmd         18
 #define REJ_tx_rsp         19
 #define REJ_tx_cmd_p       20

 #define SABME_rx_cmd       21 /* SABME = Set Asynchronous  */
 #define SABME_tx_cmd       22 /*  Balanced Mode Extended */

 #define DISC_rx_cmd        23 /* DISC = Disconnect  */
 #define DISC_tx_cmd        24

 #define UA_rx_rsp          25 /* UA = Unnumbered   */
 #define UA_tx_rsp          26 /* Acknowledgment  */

 #define DM_rx_rsp          27 /*    */
 #define DM_tx_rsp          28

 #define I_rx_cmd           29 /* I = Information  */
 #define I_tx_cmd           30

 #define FRMR_rx_rsp        31 /* FRMR = Frame Reject  */
 #define FRMR_tx_rsp        32

 #define tx_rtr             33 /* no. of retransmitted frames  */
 #define rx_bad             34 /* erroneous frames received    */
 #define rx_dud             35 /* received and discarded      */
 #define rx_ign             36 /* received and ignored         */

 #define I_rx_rsp           37
 #define I_tx_rsp           38

 #define UI_rx_cmd          39
 #define UI_tx_cmd          40

 #define XID_rx_cmd         41
 #define XID_rx_rsp         42
 #define XID_tx_cmd         43
 #define XID_tx_rsp         44

 #define TEST_rx_cmd        45
 #define TEST_rx_rsp        46
 #define TEST_tx_cmd        47
 #define TEST_tx_rsp        48

 #define llc2statmax        40

11.2.2.4 L_SETPPA--Associates a PPA With a Physical Device

This ioctl associates a PPA with a physical device underneath the layer two provider.

Associated Structure:
/* Ioctl block for L_SETPPA and L_GETPPA commands */
 struct ll_snioc {
     uint8        lli_type;     /* Table type = LI_SPPA            */
     uint8        lli_class;    /* DTE/DCE/extended                */
     uint16       lli_slp_pri;  /* SLP priority                    */
     uint32       lli_ppa;      /* PPA/ Subnetwork ID character    */
     uint32       lli_index;    /* Link index                      */
 };

The members are:

Table 11-46 Members of the ll_snioc structure

Member 

Description 

lli_type

The table type. This should always be LI_SPPA. 

lli_class

This indicates the type of link. LC_LAPBDTE or LC_LAPBDCE must be used for LAPB. The file /usr/include/netdlc/ll_proto.h contains a complete list of values.

lli_slp_pri

This determines the priority of SLP when MLP is used. 

lli_ppa

The PPA identifier 

lli_index

The link index. This must be set with the muxid value returned by the I-LINK ioctl when LAPB is placed over a serial driver.

Errors
Table 11-47 L_SETPPA errors

Error 

Description 

EBUSY

The PPA is already being used by another stream. 

ENODEV

The specified lli_index has not been found.

11.2.2.5 L_ZEROSTATS--Clears the Per-Link Statistics Count

The L_ZEROSTATS ioctl clears per-link statistics in the LLC2 and LAPB drivers.

Associated Structure
/* Ioctl block for L_ZEROSTATS ioctl */
 struct ll_hdioc {
     uint8           lli_type;      /* Table type = LI_PLAIN */
     uint8           lli_spare[3];  /*   (for alignment)  */
     uint32          lli_ppa;       /* PPA (0xff for all links) */
 };

11.2.2.6 W_SETTUNE--Sets wanmod Tunable Parameters

The W_SETTUNE ioctl sets the tunable parameters of the LAPB wanmod module. This controls physical parameters such as the maximum frame length and line speed.

Associated Structure

The following is from the file /usr/include/netx25/wan_control.h.

/*    Ioctl block for WAN W_SETTUNE command  
*/  
struct wan_tnioc {    
   uint8     w_type;     /* Always = WAN_TUNE                      */    
   uint8     w_spare[3]; /* (for alignment)                        */    
   uint32    w_snid;     /* subnetwork id character ('*' => 'all') */    
   wantune_t wan_tune;   /* Table of tuning values        
         */  
};   
/*    WAN tuning structure  */  
typedef struct wantune  {    
   uint16            WAN_options;  /* WAN options       */    
   struct WAN_hddef  WAN_hd;       /* HD information.   */  
   } wantune_t;   
/*        
This is the structure which contains all tuneable information  
*/  
struct  WAN_hddef  {        
   uint16      WAN_maxframe;    /* WAN maximum frame size       */        
   int         WAN_baud;        /* WAN baud rate                */        
   uint16      WAN_interface ;  /* WAN physical interface       */   
} 
union {        
   uint16         WAN_cptype;      /* Variant type */        
   struct WAN_x21 WAN_x21def;        
   struct WAN_v25 WAN_v25def;        
   } WAN_cpdef ;                   /* WAN call procedural definition *                                                      											 																						       												* for hardware interface.        */  
};   
/*
This contains all of the national network specific timeouts.  
*/  
struct  WAN_v25  {    
   uint16 WAN_cptype;   /* Variant type.        */    
   uint16 callreq;      /* Abort time for call request command  *                          																* if network does not support CFI.     */
};

The members of the wan_tnioc structure are:

Table 11-48 Members of the wan_tnioc structure

Member 

Description 

w_snid

The link id. It should be set to the same value as lli_ppa in the L_SETPPA L_SETTUNE ioctls.

WAN_options

Reserved for future use. Must be set to 0. 

WAN_maxframe

The maximum frame size to be used on this interface (unit is octet). 

WAN_baud

The speed of the line (unit is baud, 0 is used for external clocking). 

WAN_interface

The type of interface. Should always be set to WAN_V28

WAN_cptype

The type of interface. Set this to WAN_NONE if no calling procedures are used (the most frequent case), or to WAN_V25bis if a calling procedure and V25bis modem are used. In this instance, the WAN_v25 structure must be filled.