4 * Copyright (c) 1997 by Procom Technology, Inc.
7 * This program can be redistributed or modified under the terms of the
8 * GNU General Public License as published by the Free Software Foundation.
9 * This program is distributed without any warranty or implied warranty
10 * of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
16 #include <linux/if_ether.h>
17 #include <linux/list.h>
18 #include <linux/spinlock.h>
19 #include <linux/rculist_nulls.h>
21 #include <asm/atomic.h>
29 unsigned char mac[IFHWADDRLEN];
32 #define LLC_SAP_STATE_INACTIVE 1
33 #define LLC_SAP_STATE_ACTIVE 2
36 * struct llc_sap - Defines the SAP component
38 * @station - station this sap belongs to
40 * @p_bit - only lowest-order bit used
41 * @f_bit - only lowest-order bit used
42 * @laddr - SAP value in this 'lsap'
43 * @node - entry in station sap_list
44 * @sk_list - LLC sockets this one manages
51 int (*rcv_func)(struct sk_buff *skb,
52 struct net_device *dev,
53 struct packet_type *pt,
54 struct net_device *orig_dev);
55 struct llc_addr laddr;
56 struct list_head node;
58 struct hlist_nulls_head sk_list;
61 #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
62 #define LLC_DEST_SAP 1 /* Type 1 goes here */
63 #define LLC_DEST_CONN 2 /* Type 2 goes here */
65 extern struct list_head llc_sap_list;
66 extern rwlock_t llc_sap_list_lock;
68 extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
69 struct packet_type *pt, struct net_device *orig_dev);
71 extern int llc_mac_hdr_init(struct sk_buff *skb,
72 const unsigned char *sa, const unsigned char *da);
74 extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
75 struct sk_buff *skb));
76 extern void llc_remove_pack(int type);
78 extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
80 extern struct llc_sap *llc_sap_open(unsigned char lsap,
81 int (*rcv)(struct sk_buff *skb,
82 struct net_device *dev,
83 struct packet_type *pt,
84 struct net_device *orig_dev));
85 static inline void llc_sap_hold(struct llc_sap *sap)
87 atomic_inc(&sap->refcnt);
90 extern void llc_sap_close(struct llc_sap *sap);
92 static inline void llc_sap_put(struct llc_sap *sap)
94 if (atomic_dec_and_test(&sap->refcnt))
98 extern struct llc_sap *llc_sap_find(unsigned char sap_value);
100 extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
101 unsigned char *dmac, unsigned char dsap);
103 extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
104 extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
106 extern int llc_station_init(void);
107 extern void llc_station_exit(void);
109 #ifdef CONFIG_PROC_FS
110 extern int llc_proc_init(void);
111 extern void llc_proc_exit(void);
113 #define llc_proc_init() (0)
114 #define llc_proc_exit() do { } while(0)
115 #endif /* CONFIG_PROC_FS */
117 extern int llc_sysctl_init(void);
118 extern void llc_sysctl_exit(void);
120 extern int sysctl_llc2_ack_timeout;
121 extern int sysctl_llc2_busy_timeout;
122 extern int sysctl_llc2_p_timeout;
123 extern int sysctl_llc2_rej_timeout;
124 extern int sysctl_llc_station_ack_timeout;
126 #define llc_sysctl_init() (0)
127 #define llc_sysctl_exit() do { } while(0)
128 #endif /* CONFIG_SYSCTL */