at v2.6.13 99 lines 2.8 kB view raw
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 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, 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; 56}; 57 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 */ 61 62extern struct list_head llc_sap_list; 63extern rwlock_t llc_sap_list_lock; 64extern unsigned char llc_station_mac_sa[ETH_ALEN]; 65 66extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 67 struct packet_type *pt); 68 69extern int llc_mac_hdr_init(struct sk_buff *skb, 70 unsigned char *sa, unsigned char *da); 71 72extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 73 struct sk_buff *skb)); 74extern void llc_remove_pack(int type); 75 76extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb)); 77 78extern 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)); 82extern void llc_sap_close(struct llc_sap *sap); 83 84extern struct llc_sap *llc_sap_find(unsigned char sap_value); 85 86extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, 87 unsigned char *dmac, unsigned char dsap); 88 89extern int llc_station_init(void); 90extern void llc_station_exit(void); 91 92#ifdef CONFIG_PROC_FS 93extern int llc_proc_init(void); 94extern 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 */