1 #ifndef LLC_H 2 #define LLC_H 3 /* 4 * Copyright (c) 1997 by Procom Technology, Inc. 5 * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 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. 11 * 12 * See the GNU General Public License for more details. 13 */ 14 15 #include <linux/if.h> 16 #include <linux/if_ether.h> 17 #include <linux/list.h> 18 #include <linux/spinlock.h> 19 20 struct net_device; 21 struct packet_type; 22 struct sk_buff; 23 24 struct llc_addr { 25 unsigned char lsap; 26 unsigned char mac[IFHWADDRLEN]; 27 }; 28 29 #define LLC_SAP_STATE_INACTIVE 1 30 #define LLC_SAP_STATE_ACTIVE 2 31 32 /** 33 * struct llc_sap - Defines the SAP component 34 * 35 * @station - station this sap belongs to 36 * @state - sap state 37 * @p_bit - only lowest-order bit used 38 * @f_bit - only lowest-order bit used 39 * @laddr - SAP value in this 'lsap' 40 * @node - entry in station sap_list 41 * @sk_list - LLC sockets this one manages 42 */ 43 struct llc_sap { 44 unsigned char state; 45 unsigned char p_bit; 46 unsigned char f_bit; 47 int (*rcv_func)(struct sk_buff *skb, 48 struct net_device *dev, 49 struct packet_type *pt, 50 struct net_device *orig_dev); 51 struct llc_addr laddr; 52 struct list_head node; 53 struct { 54 rwlock_t lock; 55 struct hlist_head list; 56 } sk_list; 57 }; 58 59 #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ 60 #define LLC_DEST_SAP 1 /* Type 1 goes here */ 61 #define LLC_DEST_CONN 2 /* Type 2 goes here */ 62 63 extern struct list_head llc_sap_list; 64 extern rwlock_t llc_sap_list_lock; 65 extern unsigned char llc_station_mac_sa[ETH_ALEN]; 66 67 extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 68 struct packet_type *pt, struct net_device *orig_dev); 69 70 extern int llc_mac_hdr_init(struct sk_buff *skb, 71 unsigned char *sa, unsigned char *da); 72 73 extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 74 struct sk_buff *skb)); 75 extern void llc_remove_pack(int type); 76 77 extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb)); 78 79 extern struct llc_sap *llc_sap_open(unsigned char lsap, 80 int (*rcv)(struct sk_buff *skb, 81 struct net_device *dev, 82 struct packet_type *pt, 83 struct net_device *orig_dev)); 84 extern void llc_sap_close(struct llc_sap *sap); 85 86 extern struct llc_sap *llc_sap_find(unsigned char sap_value); 87 88 extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, 89 unsigned char *dmac, unsigned char dsap); 90 91 extern int llc_station_init(void); 92 extern void llc_station_exit(void); 93 94 #ifdef CONFIG_PROC_FS 95 extern int llc_proc_init(void); 96 extern void llc_proc_exit(void); 97 #else 98 #define llc_proc_init() (0) 99 #define llc_proc_exit() do { } while(0) 100 #endif /* CONFIG_PROC_FS */ 101 #endif /* LLC_H */ 102