Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / net / llc.h
blobc9aed2a8b4e20590d5f882e1150e4c714b8e0afa
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>
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.
15 #include <linux/if.h>
16 #include <linux/if_ether.h>
17 #include <linux/list.h>
18 #include <linux/spinlock.h>
20 struct net_device;
21 struct packet_type;
22 struct sk_buff;
24 struct llc_addr {
25 unsigned char lsap;
26 unsigned char mac[IFHWADDRLEN];
29 #define LLC_SAP_STATE_INACTIVE 1
30 #define LLC_SAP_STATE_ACTIVE 2
32 /**
33 * struct llc_sap - Defines the SAP component
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
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 llc_addr laddr;
51 struct list_head node;
52 struct {
53 rwlock_t lock;
54 struct hlist_head list;
55 } sk_list;
58 #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
59 #define LLC_DEST_SAP 1 /* Type 1 goes here */
60 #define LLC_DEST_CONN 2 /* Type 2 goes here */
62 extern struct list_head llc_sap_list;
63 extern rwlock_t llc_sap_list_lock;
64 extern unsigned char llc_station_mac_sa[ETH_ALEN];
66 extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
67 struct packet_type *pt);
69 extern int llc_mac_hdr_init(struct sk_buff *skb,
70 unsigned char *sa, unsigned char *da);
72 extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
73 struct sk_buff *skb));
74 extern void llc_remove_pack(int type);
76 extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
78 extern struct llc_sap *llc_sap_open(unsigned char lsap,
79 int (*rcv)(struct sk_buff *skb,
80 struct net_device *dev,
81 struct packet_type *pt));
82 extern void llc_sap_close(struct llc_sap *sap);
84 extern struct llc_sap *llc_sap_find(unsigned char sap_value);
86 extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
87 unsigned char *dmac, unsigned char dsap);
89 extern int llc_station_init(void);
90 extern void llc_station_exit(void);
92 #ifdef CONFIG_PROC_FS
93 extern int llc_proc_init(void);
94 extern void llc_proc_exit(void);
95 #else
96 #define llc_proc_init() (0)
97 #define llc_proc_exit() do { } while(0)
98 #endif /* CONFIG_PROC_FS */
99 #endif /* LLC_H */