Blame view

include/net/llc.h 3.66 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  #ifndef LLC_H
  #define LLC_H
  /*
   * Copyright (c) 1997 by Procom Technology, Inc.
   * 		 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
   *
   * This program can be redistributed or modified under the terms of the
   * GNU General Public License as published by the Free Software Foundation.
   * This program is distributed without any warranty or implied warranty
   * of merchantability or fitness for a particular purpose.
   *
   * See the GNU General Public License for more details.
   */
  
  #include <linux/if.h>
  #include <linux/if_ether.h>
  #include <linux/list.h>
  #include <linux/spinlock.h>
6e2144b76   Arnaldo Carvalho de Melo   [LLC]: Use refcou...
19
  #include <asm/atomic.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  struct net_device;
  struct packet_type;
  struct sk_buff;
  
  struct llc_addr {
  	unsigned char lsap;
  	unsigned char mac[IFHWADDRLEN];
  };
  
  #define LLC_SAP_STATE_INACTIVE	1
  #define LLC_SAP_STATE_ACTIVE	2
  
  /**
   * struct llc_sap - Defines the SAP component
   *
   * @station - station this sap belongs to
   * @state - sap state
   * @p_bit - only lowest-order bit used
   * @f_bit - only lowest-order bit used
   * @laddr - SAP value in this 'lsap'
   * @node - entry in station sap_list
   * @sk_list - LLC sockets this one manages
   */
  struct llc_sap {
  	unsigned char	 state;
  	unsigned char	 p_bit;
  	unsigned char	 f_bit;
6e2144b76   Arnaldo Carvalho de Melo   [LLC]: Use refcou...
47
  	atomic_t         refcnt;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
  	int		 (*rcv_func)(struct sk_buff *skb,
  				     struct net_device *dev,
f2ccd8fa0   David S. Miller   [NET]: Kill skb->...
50
51
  				     struct packet_type *pt,
  				     struct net_device *orig_dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  	struct llc_addr	 laddr;
  	struct list_head node;
  	struct {
  		rwlock_t	  lock;
  		struct hlist_head list;
  	} sk_list;
  };
  
  #define LLC_DEST_INVALID         0      /* Invalid LLC PDU type */
  #define LLC_DEST_SAP             1      /* Type 1 goes here */
  #define LLC_DEST_CONN            2      /* Type 2 goes here */
  
  extern struct list_head llc_sap_list;
  extern rwlock_t llc_sap_list_lock;
  extern unsigned char llc_station_mac_sa[ETH_ALEN];
  
  extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
f2ccd8fa0   David S. Miller   [NET]: Kill skb->...
69
  		   struct packet_type *pt, struct net_device *orig_dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
71
  
  extern int llc_mac_hdr_init(struct sk_buff *skb,
f4ad2b162   Stephen Hemminger   [LLC]: llc_mac_hd...
72
  			    const unsigned char *sa, const unsigned char *da);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
75
76
77
78
79
80
81
82
  
  extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
  						   struct sk_buff *skb));
  extern void llc_remove_pack(int type);
  
  extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
  
  extern struct llc_sap *llc_sap_open(unsigned char lsap,
  				    int (*rcv)(struct sk_buff *skb,
  					       struct net_device *dev,
f2ccd8fa0   David S. Miller   [NET]: Kill skb->...
83
84
  					       struct packet_type *pt,
  					       struct net_device *orig_dev));
6e2144b76   Arnaldo Carvalho de Melo   [LLC]: Use refcou...
85
86
87
88
  static inline void llc_sap_hold(struct llc_sap *sap)
  {
  	atomic_inc(&sap->refcnt);
  }
2928c19e1   Arnaldo Carvalho de Melo   [LLC]: Fix sparse...
89
  extern void llc_sap_close(struct llc_sap *sap);
6e2144b76   Arnaldo Carvalho de Melo   [LLC]: Use refcou...
90
91
  static inline void llc_sap_put(struct llc_sap *sap)
  {
6e2144b76   Arnaldo Carvalho de Melo   [LLC]: Use refcou...
92
93
94
  	if (atomic_dec_and_test(&sap->refcnt))
  		llc_sap_close(sap);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
95
96
97
98
99
  
  extern struct llc_sap *llc_sap_find(unsigned char sap_value);
  
  extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
  				     unsigned char *dmac, unsigned char dsap);
2928c19e1   Arnaldo Carvalho de Melo   [LLC]: Fix sparse...
100
101
  extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
  extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
103
104
105
106
107
108
109
110
111
  extern int llc_station_init(void);
  extern void llc_station_exit(void);
  
  #ifdef CONFIG_PROC_FS
  extern int llc_proc_init(void);
  extern void llc_proc_exit(void);
  #else
  #define llc_proc_init()	(0)
  #define llc_proc_exit()	do { } while(0)
  #endif /* CONFIG_PROC_FS */
590232a71   Arnaldo Carvalho de Melo   [LLC]: Add sysctl...
112
113
114
  #ifdef CONFIG_SYSCTL
  extern int llc_sysctl_init(void);
  extern void llc_sysctl_exit(void);
2928c19e1   Arnaldo Carvalho de Melo   [LLC]: Fix sparse...
115
116
117
118
119
120
  
  extern int sysctl_llc2_ack_timeout;
  extern int sysctl_llc2_busy_timeout;
  extern int sysctl_llc2_p_timeout;
  extern int sysctl_llc2_rej_timeout;
  extern int sysctl_llc_station_ack_timeout;
590232a71   Arnaldo Carvalho de Melo   [LLC]: Add sysctl...
121
122
123
124
  #else
  #define llc_sysctl_init() (0)
  #define llc_sysctl_exit() do { } while(0)
  #endif /* CONFIG_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
  #endif /* LLC_H */