The following ioctls are specific to Sun. Take care when using them in programs that interwork with other versions of X.25.
These ioctls must be used with the ioctl(2) system call.
The following ioctls are related to statistics:
Table 11-37 Statistics Ioctls
name |
summary |
---|---|
reads per-link statistics (LAPB only) |
|
zeros per-link statistics (LAPB only) |
|
reads global layer two statistics (LAPB only) |
These ioctls are related to configuring a stream:
Table 11-38 Stream Configuration Ioctls
name |
summary |
---|---|
sets the PPA. (LAPB only) |
|
L_GETPPA |
retrieves the PPA (LAPB only) |
L_SETTUNE |
sets tunable parameters for a PPA |
retrieves the tunable parameters for a PPA |
|
sets wanmod tunable parameters for a PPA (LAPB only) |
The ioctles described in this section can be used over both LAPB and LLC2.
The L_GETTUNE ioctl retrieves the tunable parameters in the LLC2 and LAPB drivers for a given PPA.
LLC2 uses the llc2_tnioc structure.
/* Ioctl block for LLC2 L_GETTUNE command */ struct llc2_tnioc { u_char lli_type; /* Table type = LI_LLC2TUNE */ u_char lli_spare[3]; /* (for alignment) */ u_int lli_ppa; /* PPA (0xff for all PPAs) */ llc2tune_t llc2_tune; /* Table of tuning values */ }; /* LLC2 tuning structure */ typedef struct llc2tune { u_short N2; /* Maximum number of retries */ u_short T1; /* Acknowledgment time (unit 0.1 sec) */ u_short Tpf; /* P/F cycle retry time (unit 0.1 sec) */ u_short Trej; /* Reject retry time (unit 0.1 sec) */ u_short Tbusy; /* Remote busy check time (unit 0.1 sec) */ u_short Tidle; /* Idle P/F cycle time (unit 0.1 sec) */ u_short ack_delay; /* RR delay time (unit 0.1 sec) */ u_short notack_max; /* Maximum number of unack'ed Rx I-frames */ u_short tx_window; /* Transmit window (if no XID received) */ u_short tx_probe; /* P-bit position before end of Tx window */ u_short max_I_len; /* Maximum I-frame length */ u_short xid_window /* XID window size (receive window) */ u_short xid_Ndup; /* Duplicate MAC XID count (0 => no test) */ u_short xid_Tdup; /* Duplicate MAC XID time (unit 0.1 sec) */ } llc2tune_t;
The members of the llc2_tnoic structure are:
Table 11-39 Members of the llc2_tnoic structure
Member |
Description |
---|---|
lli_type |
The table type |
lli_ppa |
The PPA |
llc2_tune |
A table of tuning values |
LAPB uses the lapb_tnioc structure
/* Ioctl block for LAPB L_GETTUNE command */ struct lapb_tnioc { u_char lli_type; /* Table type = LI_LLAPBTUNE */ u_char lli_spare[3]; /* (for alignment) */ u_int lli_ppa; /* PPA (0xff for all PPAs) */ lapbtune_t lapb_tune; /* Table of tuning values */ }; /* LAPB tuning structure */ typedef struct lapb_tune { uint16 N2; /* Maximum number of retries */ uint16 T1; /* Acknowledgment time (unit 0.1 sec) */ uint16 Tpf; /* P/F cycle retry time (unit 0.1 sec) */ uint16 Trej; /* Reject retry time (unit 0.1 sec) */ uint16 Tbusy; /* Remote busy check time (unit 0.1 sec) */ uint16 Tidle; /* Idle P/F cycle time (unit 0.1 sec) */ uint16 ack_delay; /* RR delay time (unit 0.1 sec) */ uint16 notack_max; /* Maximum number of unack'ed Rx I-frames */ uint16 tx_window; /* Transmit window size */ uint16 tx_probe; /* P-bit position before end of Tx window */ uint16 max_I_len; /* Maximum I-frame length */ uint16 llconform; /* LAPB conformance */ } lapbtune_t;
The members of the lapb_tnoic structure are:
Table 11-40 Members of the lapb_tnoic structure
Member |
Description |
---|---|
lli_type |
The table type |
lli_ppa |
The PPA |
lapb_tune |
A table of tuning values |
The L_SETTUNE ioctl sets tunable parameters in the LLC2 and LAPB drivers for a given PPA.
LLCS uses the llc2_tnioc structure
/* Ioctl block for LLC2 L_SETTUNE command */ struct llc2_tnioc { u_char lli_type; /* Table type = LI_LLC2TUNE */ u_char lli_spare[3]; /* (for alignment) */ u_int lli_ppa; /* PPA (0xff for all PPAs) */ llc2tune_t llc2_tune; /* Table of tuning values */ }; /* LLC2 tuning structure */ typedef struct llc2tune { u_short N2; /* Maximum number of retries */ u_short T1; /* Acknowledgment time (unit 0.1 sec) */ u_short Tpf; /* P/F cycle retry time (unit 0.1 sec) */ u_short Trej; /* Reject retry time (unit 0.1 sec) */ u_short Tbusy; /* Remote busy check time (unit 0.1 sec) */ u_short Tidle; /* Idle P/F cycle time (unit 0.1 sec) */ u_short ack_delay; /* RR delay time (unit 0.1 sec) */ u_short notack_max; /* Maximum number of unack'ed Rx I-frames */ u_short tx_window; /* Transmit window (if no XID received) */ u_short tx_probe; /* P-bit position before end of Tx window */ u_short max_I_len; /* Maximum I-frame length */ u_short xid_window; /* XID window size (receive window) */ u_short xid_Ndup; /* Duplicate MAC XID count (0 => no test) */ u_short xid_Tdup; /* Duplicate MAC XID time (unit 0.1 sec) */ } llc2tune_t;
The members of the llc2_tnoic structure are:
Table 11-41 Members of the llc2_tnoic structure
Member |
Description |
---|---|
lli_type |
The table type |
lli_ppa |
The PPA |
llc2_tune |
A table of tuning values |
LAPB uses the lapb_tnioc structure
/* Ioctl block for LAPB L_SETTUNE command */ struct lapb_tnioc { u_char lli_type; /* Table type = LI_LLAPBTUNE */ u_char lli_spare[3]; /* (for alignment) */ u_int lli_ppa; /* PPA (0xff for all PPAs) */ lapbtune_t lapb_tune;/* Table of tuning values */ }; /* LAPB tuning structure */ typedef struct lapb_tune { uint16 N2; /* Maximum number of retries */ uint16 T1; /* Acknowledgment time (unit 0.1 sec) */ uint16 Tpf; /* P/F cycle retry time (unit 0.1 sec) */ uint16 Trej; /* Reject retry time (unit 0.1 sec) */ uint16 Tbusy; /* Remote busy check time (unit 0.1 sec) */ uint16 Tidle; /* Idle P/F cycle time (unit 0.1 sec) */ uint16 ack_delay; /* RR delay time (unit 0.1 sec) */ uint16 notack_max; /* Maximum number of unack'ed Rx I-frames */ uint16 tx_window; /* Transmit window size */ uint16 tx_probe; /* P-bit position before end of Tx window */ uint16 max_I_len; /* Maximum I-frame length */ uint16 llconform; /* LAPB conformance */ } lapbtune_t;
The members of the lapb_tnoic structure are:
Table 11-42 Members of the lapb_tnoic structure
Member |
Description |
---|---|
lli_type |
The table type |
lli_ppa |
The PPA |
lapb_tune |
A table of tuning values |
The ioctls described in this section can only be used over LAPB.
The L_GETGSTATS ioctl reads global layer 2 statistics from the LAPB driver.
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 |
This ioctl returns the PPA and link index associated with the stream.
/* 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. |
Error |
Description |
---|---|
ENODEV |
No such device or a DL_ATTACH_REQ has not been sent. |
The L_GETSTATS ioctl reads per-link (i.e., per-PPA) statistics from the LAPB driver.
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:
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
This ioctl associates a PPA with a physical device underneath the layer two provider.
/* 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. |
Error |
Description |
---|---|
EBUSY |
The PPA is already being used by another stream. |
ENODEV |
The specified lli_index has not been found. |
The L_ZEROSTATS ioctl clears per-link statistics in the LLC2 and LAPB drivers.
/* 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) */ };
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.
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. |