1 /********************************************************************* 3 * Filename: irlan_common.h 5 * Description: IrDA LAN access layer 6 * Status: Experimental. 7 * Author: Dag Brattli <dagb@cs.uit.no> 8 * Created at: Sun Aug 31 20:14:37 1997 9 * Modified at: Mon May 31 13:54:20 1999 10 * Modified by: Dag Brattli <dagb@cs.uit.no> 12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 13 * All Rights Reserved. 15 * This program is free software; you can redistribute it and/or 16 * modify it under the terms of the GNU General Public License as 17 * published by the Free Software Foundation; either version 2 of 18 * the License, or (at your option) any later version. 20 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * provide warranty for any of this software. This material is 22 * provided "AS-IS" and at no charge. 24 ********************************************************************/ 29 #include <asm/param.h>/* for HZ */ 31 #include <linux/kernel.h> 32 #include <linux/types.h> 33 #include <linux/skbuff.h> 34 #include <linux/netdevice.h> 36 #include <net/irda/irqueue.h> 37 #include <net/irda/irttp.h> 39 #define IRLAN_MTU 1518 40 #define IRLAN_TIMEOUT 10*HZ/* 10 seconds */ 42 /* Command packet types */ 43 #define CMD_GET_PROVIDER_INFO 0 44 #define CMD_GET_MEDIA_CHAR 1 45 #define CMD_OPEN_DATA_CHANNEL 2 46 #define CMD_CLOSE_DATA_CHAN 3 47 #define CMD_RECONNECT_DATA_CHAN 4 48 #define CMD_FILTER_OPERATION 5 52 #define RSP_INSUFFICIENT_RESOURCES 1 53 #define RSP_INVALID_COMMAND_FORMAT 2 54 #define RSP_COMMAND_NOT_SUPPORTED 3 55 #define RSP_PARAM_NOT_SUPPORTED 4 56 #define RSP_VALUE_NOT_SUPPORTED 5 57 #define RSP_NOT_OPEN 6 58 #define RSP_AUTHENTICATION_REQUIRED 7 59 #define RSP_INVALID_PASSWORD 8 60 #define RSP_PROTOCOL_ERROR 9 61 #define RSP_ASYNCHRONOUS_ERROR 255 67 /* Filter parameters */ 73 #define IRLAN_DIRECTED 0x01 74 #define IRLAN_FUNCTIONAL 0x02 75 #define IRLAN_GROUP 0x04 76 #define IRLAN_MAC_FRAME 0x08 77 #define IRLAN_MULTICAST 0x10 78 #define IRLAN_BROADCAST 0x20 79 #define IRLAN_IPX_SOCKET 0x40 86 /* Filter operations */ 94 #define ACCESS_DIRECT 1 96 #define ACCESS_HOSTED 3 100 #define IRLAN_ARRAY 2 102 #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) 107 struct irlan_client_cb
{ 112 struct tsap_cb
*tsap_ctrl
; 114 __u8 max_header_size
; 116 int access_type
;/* Access type of provider */ 117 __u8 reconnect_key
[255]; 128 struct sk_buff_head txq
;/* Transmit control queue */ 130 struct timer_list kick_timer
; 136 struct irlan_provider_cb
{ 139 struct tsap_cb
*tsap_ctrl
; 141 __u8 max_header_size
; 144 * Store some values here which are used by the provider to parse 145 * the filter operations 150 int filter_operation
; 152 int access_type
;/* Access type */ 155 __u8 mac_address
[6];/* Generated MAC address for peer device */ 159 * IrLAN control block 162 QUEUE queue
;/* Must be first */ 166 struct net_device dev
;/* Ethernet device structure*/ 167 struct enet_statistics stats
; 169 __u32 saddr
;/* Source device address */ 170 __u32 daddr
;/* Destination device address */ 171 int netdev_registered
; 172 int notify_irmanager
; 174 int media
;/* Media type */ 175 __u8 version
[2];/* IrLAN version */ 177 struct tsap_cb
*tsap_data
; 179 int master
;/* Master instance? */ 180 int use_udata
;/* Use Unit Data transfers */ 182 __u8 stsap_sel_data
;/* Source data TSAP selector */ 183 __u8 dtsap_sel_data
;/* Destination data TSAP selector */ 184 __u8 dtsap_sel_ctrl
;/* Destination ctrl TSAP selector */ 186 struct irlan_client_cb client
;/* Client specific fields */ 187 struct irlan_provider_cb provider
;/* Provider specific fields */ 190 __u8 max_header_size
; 192 struct timer_list watchdog_timer
; 195 struct irlan_cb
*irlan_open(__u32 saddr
, __u32 daddr
,int netdev
); 196 voidirlan_close(struct irlan_cb
*self
); 197 voidirlan_close_tsaps(struct irlan_cb
*self
); 198 voidirlan_mod_inc_use_count(void); 199 voidirlan_mod_dec_use_count(void); 201 intirlan_register_netdev(struct irlan_cb
*self
); 202 voidirlan_ias_register(struct irlan_cb
*self
, __u8 tsap_sel
); 203 voidirlan_start_watchdog_timer(struct irlan_cb
*self
,int timeout
); 205 voidirlan_open_data_tsap(struct irlan_cb
*self
); 207 intirlan_run_ctrl_tx_queue(struct irlan_cb
*self
); 209 voidirlan_get_provider_info(struct irlan_cb
*self
); 210 voidirlan_get_unicast_addr(struct irlan_cb
*self
); 211 voidirlan_get_media_char(struct irlan_cb
*self
); 212 voidirlan_open_data_channel(struct irlan_cb
*self
); 213 voidirlan_close_data_channel(struct irlan_cb
*self
); 214 voidirlan_set_multicast_filter(struct irlan_cb
*self
,int status
); 215 voidirlan_set_broadcast_filter(struct irlan_cb
*self
,int status
); 216 voidirlan_open_unicast_addr(struct irlan_cb
*self
); 218 intirlan_insert_byte_param(struct sk_buff
*skb
,char*param
, __u8 value
); 219 intirlan_insert_short_param(struct sk_buff
*skb
,char*param
, __u16 value
); 220 intirlan_insert_string_param(struct sk_buff
*skb
,char*param
,char*value
); 221 intirlan_insert_array_param(struct sk_buff
*skb
,char*name
, __u8
*value
, 224 intirlan_extract_param(__u8
*buf
,char*name
,char*value
, __u16
*len
); 225 voidprint_ret_code(__u8 code
); 227 extern hashbin_t
*irlan
;