blob: 71769a5aeef3b929afd6b8dd0aa9fdab6f3c7f13 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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
20struct net_device;
21struct packet_type;
22struct sk_buff;
23
24struct 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 */
43struct 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,
David S. Millerf2ccd8f2005-08-09 19:34:12 -070049 struct packet_type *pt,
50 struct net_device *orig_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 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
63extern struct list_head llc_sap_list;
64extern rwlock_t llc_sap_list_lock;
65extern unsigned char llc_station_mac_sa[ETH_ALEN];
66
67extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
David S. Millerf2ccd8f2005-08-09 19:34:12 -070068 struct packet_type *pt, struct net_device *orig_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70extern int llc_mac_hdr_init(struct sk_buff *skb,
71 unsigned char *sa, unsigned char *da);
72
73extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
74 struct sk_buff *skb));
75extern void llc_remove_pack(int type);
76
77extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
78
79extern struct llc_sap *llc_sap_open(unsigned char lsap,
80 int (*rcv)(struct sk_buff *skb,
81 struct net_device *dev,
David S. Millerf2ccd8f2005-08-09 19:34:12 -070082 struct packet_type *pt,
83 struct net_device *orig_dev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070084extern void llc_sap_close(struct llc_sap *sap);
85
86extern struct llc_sap *llc_sap_find(unsigned char sap_value);
87
88extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
89 unsigned char *dmac, unsigned char dsap);
90
91extern int llc_station_init(void);
92extern void llc_station_exit(void);
93
94#ifdef CONFIG_PROC_FS
95extern int llc_proc_init(void);
96extern 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 */