1  /* SPDX-License-Identifier: GPL-2.0 */
2  /*
3   * These are the public elements of the Linux LAPB module.
4   */
5  
6  #ifndef	LAPB_KERNEL_H
7  #define	LAPB_KERNEL_H
8  
9  #include <linux/skbuff.h>
10  #include <linux/timer.h>
11  
12  struct net_device;
13  
14  #define	LAPB_OK			0
15  #define	LAPB_BADTOKEN		1
16  #define	LAPB_INVALUE		2
17  #define	LAPB_CONNECTED		3
18  #define	LAPB_NOTCONNECTED	4
19  #define	LAPB_REFUSED		5
20  #define	LAPB_TIMEDOUT		6
21  #define	LAPB_NOMEM		7
22  
23  #define	LAPB_STANDARD		0x00
24  #define	LAPB_EXTENDED		0x01
25  
26  #define	LAPB_SLP		0x00
27  #define	LAPB_MLP		0x02
28  
29  #define	LAPB_DTE		0x00
30  #define	LAPB_DCE		0x04
31  
32  struct lapb_register_struct {
33  	void (*connect_confirmation)(struct net_device *dev, int reason);
34  	void (*connect_indication)(struct net_device *dev, int reason);
35  	void (*disconnect_confirmation)(struct net_device *dev, int reason);
36  	void (*disconnect_indication)(struct net_device *dev, int reason);
37  	int  (*data_indication)(struct net_device *dev, struct sk_buff *skb);
38  	void (*data_transmit)(struct net_device *dev, struct sk_buff *skb);
39  };
40  
41  struct lapb_parms_struct {
42  	unsigned int t1;
43  	unsigned int t1timer;
44  	unsigned int t2;
45  	unsigned int t2timer;
46  	unsigned int n2;
47  	unsigned int n2count;
48  	unsigned int window;
49  	unsigned int state;
50  	unsigned int mode;
51  };
52  
53  extern int lapb_register(struct net_device *dev,
54  			 const struct lapb_register_struct *callbacks);
55  extern int lapb_unregister(struct net_device *dev);
56  extern int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms);
57  extern int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms);
58  extern int lapb_connect_request(struct net_device *dev);
59  extern int lapb_disconnect_request(struct net_device *dev);
60  extern int lapb_data_request(struct net_device *dev, struct sk_buff *skb);
61  extern int lapb_data_received(struct net_device *dev, struct sk_buff *skb);
62  
63  #endif
64