^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) The Linux LAPB Module Interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) Version 1.3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) Jonathan Naylor 29.12.96
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Changed (Henner Eisen, 2000-10-29): int return value for data_indication()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) The LAPB module will be a separately compiled module for use by any parts of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) the Linux operating system that require a LAPB service. This document
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) defines the interfaces to, and the services provided by this module. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) term module in this context does not imply that the LAPB module is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) separately loadable module, although it may be. The term module is used in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) its more standard meaning.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) The interface to the LAPB module consists of functions to the module,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) callbacks from the module to indicate important state changes, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) structures for getting and setting information about the module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Probably the most important structure is the skbuff structure for holding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) received and transmitted data, however it is beyond the scope of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) document.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) The two LAPB specific structures are the LAPB initialisation structure and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) the LAPB parameter structure. These will be defined in a standard header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) file, <linux/lapb.h>. The header file <net/lapb.h> is internal to the LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) module and is not for use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) LAPB Initialisation Structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) This structure is used only once, in the call to lapb_register (see below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) It contains information about the device driver that requires the services
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) of the LAPB module::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct lapb_register_struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void (*connect_confirmation)(int token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void (*connect_indication)(int token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void (*disconnect_confirmation)(int token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void (*disconnect_indication)(int token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int (*data_indication)(int token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void (*data_transmit)(int token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) Each member of this structure corresponds to a function in the device driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) that is called when a particular event in the LAPB module occurs. These will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) be described in detail below. If a callback is not required (!!) then a NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) may be substituted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) LAPB Parameter Structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) This structure is used with the lapb_getparms and lapb_setparms functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) (see below). They are used to allow the device driver to get and set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) operational parameters of the LAPB implementation for a given connection::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct lapb_parms_struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) unsigned int t1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) unsigned int t1timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) unsigned int t2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) unsigned int t2timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) unsigned int n2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) unsigned int n2count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) unsigned int window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) unsigned int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) unsigned int mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) T1 and T2 are protocol timing parameters and are given in units of 100ms. N2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) is the maximum number of tries on the link before it is declared a failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) The window size is the maximum number of outstanding data packets allowed to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) be unacknowledged by the remote end, the value of the window is between 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) and 7 for a standard LAPB link, and between 1 and 127 for an extended LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) link.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) The mode variable is a bit field used for setting (at present) three values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) The bit fields have the following meanings:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ====== =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) Bit Meaning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ====== =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 0 LAPB operation (0=LAPB_STANDARD 1=LAPB_EXTENDED).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 1 [SM]LP operation (0=LAPB_SLP 1=LAPB=MLP).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 2 DTE/DCE operation (0=LAPB_DTE 1=LAPB_DCE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 3-31 Reserved, must be 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ====== =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) Extended LAPB operation indicates the use of extended sequence numbers and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) consequently larger window sizes, the default is standard LAPB operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) MLP operation is the same as SLP operation except that the addresses used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) LAPB are different to indicate the mode of operation, the default is Single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) Link Procedure. The difference between DCE and DTE operation is (i) the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) addresses used for commands and responses, and (ii) when the DCE is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) connected, it sends DM without polls set, every T1. The upper case constant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) names will be defined in the public LAPB header file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) Functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) The LAPB module provides a number of function entry points.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int lapb_register(void *token, struct lapb_register_struct);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) This must be called before the LAPB module may be used. If the call is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) successful then LAPB_OK is returned. The token must be a unique identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) generated by the device driver to allow for the unique identification of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) instance of the LAPB link. It is returned by the LAPB module in all of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) callbacks, and is used by the device driver in all calls to the LAPB module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) For multiple LAPB links in a single device driver, multiple calls to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) lapb_register must be made. The format of the lapb_register_struct is given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) above. The return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ============= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) LAPB_OK LAPB registered successfully.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) LAPB_BADTOKEN Token is already registered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) LAPB_NOMEM Out of memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) ============= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int lapb_unregister(void *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) This releases all the resources associated with a LAPB link. Any current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) LAPB link will be abandoned without further messages being passed. After
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) this call, the value of token is no longer valid for any calls to the LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) function. The valid return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ============= ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) LAPB_OK LAPB unregistered successfully.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) ============= ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) int lapb_getparms(void *token, struct lapb_parms_struct *parms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) This allows the device driver to get the values of the current LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) variables, the lapb_parms_struct is described above. The valid return values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ============= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) LAPB_OK LAPB getparms was successful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ============= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) int lapb_setparms(void *token, struct lapb_parms_struct *parms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) This allows the device driver to set the values of the current LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) variables, the lapb_parms_struct is described above. The values of t1timer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) t2timer and n2count are ignored, likewise changing the mode bits when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) connected will be ignored. An error implies that none of the values have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) been changed. The valid return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) ============= =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) LAPB_OK LAPB getparms was successful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) LAPB_INVALUE One of the values was out of its allowable range.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ============= =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int lapb_connect_request(void *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) Initiate a connect using the current parameter settings. The valid return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) ============== =================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) LAPB_OK LAPB is starting to connect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) LAPB_CONNECTED LAPB module is already connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) ============== =================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int lapb_disconnect_request(void *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) Initiate a disconnect. The valid return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ================= ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) LAPB_OK LAPB is starting to disconnect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) LAPB_NOTCONNECTED LAPB module is not connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ================= ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int lapb_data_request(void *token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) Queue data with the LAPB module for transmitting over the link. If the call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) is successful then the skbuff is owned by the LAPB module and may not be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) used by the device driver again. The valid return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) ================= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) LAPB_OK LAPB has accepted the data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) LAPB_NOTCONNECTED LAPB module is not connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ================= =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int lapb_data_received(void *token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) Queue data with the LAPB module which has been received from the device. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) is expected that the data passed to the LAPB module has skb->data pointing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) to the beginning of the LAPB data. If the call is successful then the skbuff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) is owned by the LAPB module and may not be used by the device driver again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) The valid return values are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ============= ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) LAPB_OK LAPB has accepted the data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) LAPB_BADTOKEN Invalid/unknown LAPB token.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ============= ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) Callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) These callbacks are functions provided by the device driver for the LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) module to call when an event occurs. They are registered with the LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) module with lapb_register (see above) in the structure lapb_register_struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) (see above).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void (*connect_confirmation)(void *token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) This is called by the LAPB module when a connection is established after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) being requested by a call to lapb_connect_request (see above). The reason is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) always LAPB_OK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void (*connect_indication)(void *token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) This is called by the LAPB module when the link is established by the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) system. The value of reason is always LAPB_OK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) void (*disconnect_confirmation)(void *token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) This is called by the LAPB module when an event occurs after the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) driver has called lapb_disconnect_request (see above). The reason indicates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) what has happened. In all cases the LAPB link can be regarded as being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) terminated. The values for reason are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ================= ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) LAPB_OK The LAPB link was terminated normally.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) LAPB_NOTCONNECTED The remote system was not connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) LAPB_TIMEDOUT No response was received in N2 tries from the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) ================= ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) void (*disconnect_indication)(void *token, int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) This is called by the LAPB module when the link is terminated by the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) system or another event has occurred to terminate the link. This may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) returned in response to a lapb_connect_request (see above) if the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) system refused the request. The values for reason are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) ================= ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) LAPB_OK The LAPB link was terminated normally by the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) LAPB_REFUSED The remote system refused the connect request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) LAPB_NOTCONNECTED The remote system was not connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) LAPB_TIMEDOUT No response was received in N2 tries from the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) ================= ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) int (*data_indication)(void *token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) This is called by the LAPB module when data has been received from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) remote system that should be passed onto the next layer in the protocol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) stack. The skbuff becomes the property of the device driver and the LAPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) module will not perform any more actions on it. The skb->data pointer will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) be pointing to the first byte of data after the LAPB header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) This method should return NET_RX_DROP (as defined in the header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) file include/linux/netdevice.h) if and only if the frame was dropped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) before it could be delivered to the upper layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) void (*data_transmit)(void *token, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) This is called by the LAPB module when data is to be transmitted to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) remote system by the device driver. The skbuff becomes the property of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) device driver and the LAPB module will not perform any more actions on it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) The skb->data pointer will be pointing to the first byte of the LAPB header.