summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/br.h4
-rw-r--r--include/net/ip_masq.h3
-rw-r--r--include/net/ipconfig.h8
-rw-r--r--include/net/irda/crc.h30
-rw-r--r--include/net/irda/dongle.h48
-rw-r--r--include/net/irda/ircomm_common.h233
-rw-r--r--include/net/irda/irda.h155
-rw-r--r--include/net/irda/irda_device.h153
-rw-r--r--include/net/irda/irdacall.h2
-rw-r--r--include/net/irda/iriap.h123
-rw-r--r--include/net/irda/iriap_event.h84
-rw-r--r--include/net/irda/irias_object.h107
-rw-r--r--include/net/irda/irlan_cli.h65
-rw-r--r--include/net/irda/irlan_common.h199
-rw-r--r--include/net/irda/irlan_eth.h40
-rw-r--r--include/net/irda/irlan_event.h86
-rw-r--r--include/net/irda/irlan_srv.h62
-rw-r--r--include/net/irda/irlap.h232
-rw-r--r--include/net/irda/irlap_comp.h47
-rw-r--r--include/net/irda/irlap_event.h121
-rw-r--r--include/net/irda/irlap_frame.h155
-rw-r--r--include/net/irda/irlmp.h239
-rw-r--r--include/net/irda/irlmp_event.h113
-rw-r--r--include/net/irda/irlmp_frame.h57
-rw-r--r--include/net/irda/irlpt_cli.h47
-rw-r--r--include/net/irda/irlpt_cli_fsm.h34
-rw-r--r--include/net/irda/irlpt_common.h184
-rw-r--r--include/net/irda/irlpt_server.h42
-rw-r--r--include/net/irda/irlpt_server_fsm.h30
-rw-r--r--include/net/irda/irmod.h265
-rw-r--r--include/net/irda/irobex.h135
-rw-r--r--include/net/irda/irport.h61
-rw-r--r--include/net/irda/irqueue.h106
-rw-r--r--include/net/irda/irttp.h136
-rw-r--r--include/net/irda/irtty.h68
-rw-r--r--include/net/irda/irvtd.h104
-rw-r--r--include/net/irda/irvtd_driver.h122
-rw-r--r--include/net/irda/pc87108.h194
-rw-r--r--include/net/irda/qos.h104
-rw-r--r--include/net/irda/smc_ircc.h123
-rw-r--r--include/net/irda/timer.h79
-rw-r--r--include/net/irda/uircc.h121
-rw-r--r--include/net/irda/w83977af.h54
-rw-r--r--include/net/irda/w83977af_ir.h158
-rw-r--r--include/net/irda/wrapper.h57
-rw-r--r--include/net/sock.h8
-rw-r--r--include/net/tcp.h5
48 files changed, 4596 insertions, 9 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h
index fd25e9f7f..2c8d20a62 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -281,7 +281,7 @@ extern void ax25_output(ax25_cb *, int, struct sk_buff *);
extern void ax25_kick(ax25_cb *);
extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
extern void ax25_queue_xmit(struct sk_buff *);
-extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
+extern int ax25_check_iframes_acked(ax25_cb *, unsigned short);
/* ax25_route.c */
extern void ax25_rt_device_down(struct device *);
diff --git a/include/net/br.h b/include/net/br.h
index 8f47d3c12..c0b69e54a 100644
--- a/include/net/br.h
+++ b/include/net/br.h
@@ -293,9 +293,11 @@ void requeue_fdb(struct fdb *node, int new_port);
struct fdb *br_avl_find_addr(unsigned char addr[6]);
struct fdb *br_avl_insert (struct fdb * new_node);
+void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length);
+int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy);
/* externs */
extern struct br_stat br_stats;
-
+extern Port_data port_info[];
diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h
index 03c65fddc..70b627305 100644
--- a/include/net/ip_masq.h
+++ b/include/net/ip_masq.h
@@ -48,7 +48,8 @@
#define IP_MASQ_F_NO_SADDR 0x0004 /* no sport set yet */
#define IP_MASQ_F_NO_SPORT 0x0008 /* no sport set yet */
-#define IP_MASQ_F_NO_REPLY 0x0010 /* no reply yet from outside */
+#define IP_MASQ_F_DLOOSE 0x0010 /* loose dest binding */
+#define IP_MASQ_F_NO_REPLY 0x0080 /* no reply yet from outside */
#define IP_MASQ_F_HASHED 0x0100 /* hashed entry */
#define IP_MASQ_F_OUT_SEQ 0x0200 /* must do output seq adjust */
diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h
index db64243a6..f93569461 100644
--- a/include/net/ipconfig.h
+++ b/include/net/ipconfig.h
@@ -1,5 +1,5 @@
/*
- * $Id: ipconfig.h,v 1.2 1997/10/17 12:41:16 mj Exp $
+ * $Id: ipconfig.h,v 1.3 1999/01/04 20:13:29 davem Exp $
*
* Copyright (C) 1997 Martin Mares
*
@@ -12,8 +12,10 @@ extern u32 ic_myaddr;
extern u32 ic_servaddr;
extern u32 ic_gateway;
extern u32 ic_netmask;
-extern int ic_bootp_flag;
-extern int ic_rarp_flag;
extern int ic_enable;
extern int ic_host_name_set;
extern int ic_set_manually;
+extern int ic_proto_enabled;
+
+#define IC_BOOTP 1
+#define IC_RARP 2
diff --git a/include/net/irda/crc.h b/include/net/irda/crc.h
new file mode 100644
index 000000000..d4ee011e4
--- /dev/null
+++ b/include/net/irda/crc.h
@@ -0,0 +1,30 @@
+/*********************************************************************
+ *
+ * Filename: crc.h
+ * Version:
+ * Description: CRC routines
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Aug 4 20:40:53 1997
+ * Modified at: Tue Dec 15 22:18:53 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ ********************************************************************/
+
+#ifndef IR_CRC_H
+#define IR_CRC_H
+
+#include <linux/types.h>
+
+#define INIT_FCS 0xffff /* Initial FCS value */
+#define GOOD_FCS 0xf0b8 /* Good final FCS value */
+
+/* Recompute the FCS with one more character appended. */
+#define IR_FCS(fcs, c) (((fcs) >> 8) ^ irda_crc16_table[((fcs) ^ (c)) & 0xff])
+
+/* Recompute the FCS with len bytes appended. */
+unsigned short crc_calc( __u16 fcs, __u8 const *buf, size_t len);
+
+extern __u16 const irda_crc16_table[];
+
+#endif
diff --git a/include/net/irda/dongle.h b/include/net/irda/dongle.h
new file mode 100644
index 000000000..8498f4176
--- /dev/null
+++ b/include/net/irda/dongle.h
@@ -0,0 +1,48 @@
+/*********************************************************************
+ *
+ * Filename: dongle.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Wed Oct 21 22:47:12 1998
+ * Modified at: Mon Dec 14 11:47:25 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef DONGLE_H
+#define DONGLE_H
+
+#include <net/irda/qos.h>
+#include <net/irda/irda_device.h>
+
+/* These are the currently known dongles */
+typedef enum {
+ TEKRAM_DONGLE,
+ ESI_DONGLE,
+ ACTISYS_DONGLE,
+ ACTISYS_PLUS_DONGLE,
+} DONGLE_T;
+
+struct dongle {
+ DONGLE_T type;
+ void (*open)(struct irda_device *, int type);
+ void (*close)(struct irda_device *);
+ void (*reset)( struct irda_device *, int unused);
+ void (*change_speed)( struct irda_device *, int baudrate);
+ void (*qos_init)( struct irda_device *, struct qos_info *);
+};
+
+#endif
diff --git a/include/net/irda/ircomm_common.h b/include/net/irda/ircomm_common.h
new file mode 100644
index 000000000..a092d9808
--- /dev/null
+++ b/include/net/irda/ircomm_common.h
@@ -0,0 +1,233 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_common.h
+ * Version:
+ * Description: An implementation of IrCOMM service interface and state machine
+ * Status: Experimental.
+ * Author: Takahide Higuchi <thiguchi@pluto.dti.ne.jp>
+ *
+ * Copyright (c) 1998, Takahide Higuchi, <thiguchi@pluto.dti.ne.jp>,
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Takahide Higuchi, provide no warranty for any of this software.
+ * This material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+/* #define DEBUG(n, args...) printk( KERN_DEBUG args) */ /* enable all debug message */
+
+#include <linux/types.h>
+#include <net/irda/irmod.h>
+
+typedef enum {
+ COMM_DISCOVERY,
+ COMM_IDLE,
+ COMM_WAITI,
+ COMM_WAITR,
+ COMM_CONN,
+} IRCOMM_STATE;
+
+/* IrCOMM Events */
+typedef enum {
+ IRCOMM_CONNECT_REQUEST,
+ TTP_CONNECT_INDICATION,
+ LMP_CONNECT_INDICATION,
+
+ TTP_CONNECT_CONFIRM,
+ TTP_DISCONNECT_INDICATION,
+ LMP_CONNECT_CONFIRM,
+ LMP_DISCONNECT_INDICATION,
+
+ IRCOMM_CONNECT_RESPONSE,
+ IRCOMM_DISCONNECT_REQUEST,
+
+ TTP_DATA_INDICATION,
+ IRCOMM_DATA_REQUEST,
+ LMP_DATA_INDICATION,
+ IRCOMM_CONTROL_REQUEST,
+} IRCOMM_EVENT;
+
+
+#define IRCOMM_MAGIC 0x434f4d4d
+#define COMM_INIT_CTRL_PARAM 3 /* length of initial control parameters */
+#define COMM_CTRL_MIN 1 /* length of clen field */
+#define COMM_HEADER_SIZE (LAP_HEADER+LMP_HEADER+TTP_HEADER+COMM_CTRL_MIN)
+#define COMM_DEFAULT_DATA_SIZE 64
+#define IRCOMM_MAX_CONNECTION 1 /* Don't change */
+
+#define IAS_PARAM 1
+#define CONTROL_CHANNEL 2
+
+
+
+#define UNKNOWN 0x00 /* not defined yet. */
+/* we use 9wire if servicetype=DEFAULT, but is it good? */
+#define DEFAULT 0x0a /* private number */
+#define THREE_WIRE_RAW 0x01 /* bit 0 */
+#define THREE_WIRE 0x02 /* bit 1 */
+#define NINE_WIRE 0x04 /* bit 2 */
+#define CENTRONICS 0x08 /* bit 3 */
+
+#define SERIAL 0x01 /* bit 0 */
+#define PARALLEL 0x02 /* bit 1 */
+
+
+#define SERVICETYPE 0x00
+#define PORT_TYPE 0x02
+#define PORT_NAME 0x02
+#define FIXED_PORT_NAME 0x82
+
+#define DATA_RATE 0x10
+#define DATA_FORMAT 0x11
+#define FLOW_CONTROL 0x12
+#define XON_XOFF_CHAR 0x13
+#define ENQ_ACK_CHAR 0x14
+#define LINESTATUS 0x15
+#define BREAK_SIGNAL 0x16
+
+#define DTELINE_STATE 0x20
+#define DCELINE_STATE 0x21
+#define POLL_FOR_LINE_SETTINGS 0x22
+
+#define STATUS_QUERY 0x30
+#define SET_BUSY_TIMEOUT 0x31
+#define IEEE1284_MODE_SUPPORT 0x32
+#define IEEE1284_DEVICEID 0x33
+#define IEEE1284_MODE 0x34
+#define IEEE1284_ECP_EPP_DATA_TRANSFER 0x35
+
+#define TX_READY 0xFE /* FIXME: this is not defined in IrCOMM spec */
+#define TX_BUSY 0XFF /* so we should find another way */
+
+
+/* parameters of FLOW_CONTROL */
+
+#define USE_RTS 0x08 /* use RTS on output */
+#define USE_CTS 0x04 /* use CTS on input */
+#define USE_DTR 0x20 /* use DTR on output */
+
+/* parameters of DTELINE_STATE */
+
+#define DELTA_DTR 0x01
+#define DELTA_RTS 0x02
+#define MCR_DTR 0x04
+#define MCR_RTS 0x08
+
+/* parameters of DCELINE_STATE */
+
+#define DELTA_CTS 0x01
+#define DELTA_DSR 0x02
+#define DELTA_RI 0x04
+#define DELTA_DCD 0x08
+#define MSR_CTS 0x10
+#define MSR_DSR 0x20
+#define MSR_RI 0x40
+#define MSR_DCD 0x80
+
+/* parameters of DATA_FORMAT */
+
+#define LSR_OE 0x02 /* Overrun error indicator */
+#define LSR_PE 0x04 /* Parity error indicator */
+#define LSR_FE 0x08 /* Frame error indicator */
+#define LSR_BI 0x01 /* Break interrupt indicator */
+
+
+struct ircomm_cb{
+ int magic;
+ int state; /* Current state of IrCOMM layer:
+ * DISCOVERY,COMM_IDLE, COMM_WAITR,
+ * COMM_WAITI, COMM_CONN
+ */
+ int in_use;
+ int null_modem_mode; /* switch for null modem emulation */
+ int ttp_stop;
+ int max_txbuff_size;
+ int maxsdusize;
+ __u32 daddr; /* Device address of the peer device */
+
+ void (*d_handler)(struct ircomm_cb *self);
+ struct notify_t notify; /* container of callbacks */
+
+ struct sk_buff *ctrl_skb; /* queue of control channel */
+
+ struct tsap_cb *tsap; /* IrTTP/LMP handle */
+ struct qos_info *qos; /* Quality of Service */
+
+ int reason; /* I don't know about reason:
+ see Irlmp.c or somewhere :p)*/
+
+ __u8 dlsap; /* IrLMP dlsap */
+ __u8 lsap; /* sap of local device */
+
+ __u8 pi ; /* instruction of control channel*/
+ __u8 port_type;
+ __u8 peer_port_type;
+
+ __u8 servicetype;
+ __u8 peer_servicetype;
+ __u8 data_format;
+ __u8 peer_data_format;
+ __u8 flow_ctrl;
+ __u8 peer_flow_ctrl;
+ __u8 line_status;
+ __u8 peer_line_status;
+ __u8 break_signal;
+ __u8 peer_break_signal;
+ __u8 dte;
+ __u8 peer_dte;
+ __u8 dce;
+ __u8 peer_dce;
+ __u8 xon_char;
+ __u8 xoff_char;
+ __u8 peer_xon_char;
+ __u8 peer_xoff_char;
+ __u8 enq_char;
+ __u8 ack_char;
+ __u8 peer_enq_char;
+ __u8 peer_ack_char;
+ __u8 busy_timeout;
+ __u8 peer_busy_timeout;
+ __u8 ecp_epp_mode;
+ __u8 peer_ecp_epp_mode;
+ __u8 channel_or_addr;
+ __u8 peer_channel_or_addr;
+
+ __u32 data_rate;
+ __u32 peer_data_rate;
+ char port_name[60];
+
+};
+
+
+
+void ircomm_connect_request(struct ircomm_cb *self, int maxsdusize);
+void ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata,
+ int maxsdusize);
+void ircomm_disconnect_request(struct ircomm_cb *self,
+ struct sk_buff *userdata);
+void ircomm_data_request(struct ircomm_cb *self,
+ struct sk_buff *userdata);
+void ircomm_control_request(struct ircomm_cb *self);
+void ircomm_append_ctrl(struct ircomm_cb *self, __u8 instruction);
+struct ircomm_cb *ircomm_attach_cable( __u8 servicetype, struct notify_t notify,
+ void *handler);
+int ircomm_detach_cable(struct ircomm_cb *self);
+
+
+void ircomm_accept_data_indication(void *instance, void *sap, struct sk_buff *skb);
+void ircomm_accept_connect_confirm(void *instance, void *sap, struct qos_info *qos,
+ int maxsdusize, struct sk_buff *skb);
+void ircomm_accept_connect_indication(void *instance, void *sap,
+ struct qos_info *qos,
+ int maxsdusize, struct sk_buff *skb);
+void ircomm_accept_disconnect_indication(void *instance, void *sap, LM_REASON reason,
+ struct sk_buff *skb);
+void ircomm_accept_flow_indication(void *instance, void *sap, LOCAL_FLOW flow);
+void ircomm_next_state( struct ircomm_cb *self, IRCOMM_STATE state);
+
+
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
new file mode 100644
index 000000000..22458aa0b
--- /dev/null
+++ b/include/net/irda/irda.h
@@ -0,0 +1,155 @@
+/*********************************************************************
+ *
+ * Filename: irda.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Tue Dec 9 21:13:12 1997
+ * Modified at: Sat Jan 16 01:23:15 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRDA_H
+#define IRDA_H
+
+#include <linux/config.h>
+#include <linux/skbuff.h>
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define ALIGN __attribute__((aligned))
+#define PACK __attribute__((packed))
+
+/* use 0 for production, 1 for verification, >2 for debug */
+#ifdef CONFIG_IRDA_DEBUG
+
+extern __u32 irda_debug;
+
+#define IRDA_DEBUG 3
+
+#define DEBUG(n, args...) if (irda_debug >= (n)) printk( KERN_DEBUG args)
+#define ASSERT(expr, func) \
+if(!(expr)) { \
+ printk( "Assertion failed! %s,%s,%s,line=%d\n",\
+ #expr,__FILE__,__FUNCTION__,__LINE__); \
+ ##func}
+#else
+#define DEBUG(n, args...)
+#define ASSERT(expr, func)
+#endif /* CONFIG_IRDA_DEBUG */
+
+#ifdef CHECK_SKB
+static unsigned int check_skb = CHECK_SKB;
+
+#define SK_FREED_SKB 0x0DE2C0DE
+#define SK_GOOD_SKB 0xDEC0DED1
+#define SK_HEAD_SKB 0x12231298
+
+extern int skb_check(struct sk_buff *skb,int,int, char *);
+
+#ifdef IS_SKB
+#undef IS_SKB
+#endif
+
+#define IS_SKB(skb, func) \
+if( skb_check((skb), 0, __LINE__,__FILE__) == -1) { \
+ ##func}
+
+#ifdef IS_SKB_HEAD
+#undef IS_SKB_HEAD
+#endif
+
+#define IS_SKB_HEAD(skb) skb_check((skb), 1, __LINE__,__FILE__)
+
+#define ALLOC_SKB_MAGIC(skb) \
+if( check_skb) \
+ skb->magic_debug_cookie = SK_GOOD_SKB;
+
+#define FREE_SKB_MAGIC(skb) \
+if( check_skb) {\
+ skb->magic_debug_cookie = SK_FREED_SKB; \
+}
+
+#else
+#undef IS_SKB
+#define IS_SKB(skb, func)
+#undef IS_SKB_HEAD
+#define IS_SKB_HEAD(skb)
+#define ALLOC_SKB_MAGIC(skb)
+#define FREE_SKB_MAGIC(skb)
+#endif /* CHECK_SKB */
+
+/*
+ * Magic numbers used by Linux/IR. Random numbers which must be unique to
+ * give the best protection
+ */
+#define IRTTY_MAGIC 0x2357
+#define LAP_MAGIC 0x1357
+#define LMP_MAGIC 0x4321
+#define LMP_LSAP_MAGIC 0x69333
+#define LMP_LAP_MAGIC 0x3432
+#define IRDA_DEVICE_MAGIC 0x63454
+#define IAS_MAGIC 0x007
+#define TTP_MAGIC 0x241169
+#define TTP_TSAP_MAGIC 0x4345
+#define IROBEX_MAGIC 0x341324
+#define HB_MAGIC 0x64534
+#define IRLAN_MAGIC 0x754
+#define IAS_OBJECT_MAGIC 0x34234
+#define IAS_ATTRIB_MAGIC 0x45232
+
+#define IAS_DEVICE_ID 0x5342
+#define IAS_PNP_ID 0xd342
+#define IAS_OBEX_ID 0x34323
+#define IAS_IRLAN_ID 0x34234
+#define IAS_IRCOMM_ID 0x2343
+#define IAS_IRLPT_ID 0x9876
+
+#endif /* IRDA_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
new file mode 100644
index 000000000..d8e546bb5
--- /dev/null
+++ b/include/net/irda/irda_device.h
@@ -0,0 +1,153 @@
+/*********************************************************************
+ *
+ * Filename: irda_device.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Haris Zukanovic <haris@stud.cs.uit.no>
+ * Created at: Tue Apr 14 12:41:42 1998
+ * Modified at: Mon Jan 18 10:52:10 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Haris Zukanovic, <haris@stud.cs.uit.no>
+ * Copyright (c) 1998 Dag Brattli, <dagb@cs.uit.no>
+ * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Haris Zukanovic nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRDA_DEVICE_H
+#define IRDA_DEVICE_H
+
+#include <linux/tty.h>
+#include <linux/netdevice.h>
+
+#include <net/irda/irda.h>
+#include <net/irda/qos.h>
+#include <net/irda/irqueue.h>
+
+#define SIR_MODE 0x01
+#define MIR_MODE 0x02
+#define FIR_MODE 0x04
+#define IO_PIO 0x08
+#define IO_DMA 0x10
+
+#define IO_XMIT 0x01
+#define IO_RECV 0x02
+
+/* Chip specific info */
+struct chipio_t {
+ int iobase, iobase2; /* IO base */
+ int io_ext, io_ext2; /* Length of iobase */
+ int irq, irq2; /* Interrupts used */
+ int fifo_size; /* FIFO size */
+
+ int dma, dma2; /* DMA channel used */
+ int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */
+ int direction; /* Used by some FIR drivers */
+
+ int baudrate; /* Currently used baudrate */
+ int dongle_id; /* Dongle or transceiver currently used */
+};
+
+/* Buffer specific info */
+struct iobuff_t {
+ int state; /* Receiving state (transmit state not used) */
+ int in_frame; /* True if receiving frame */
+
+ __u8 *data; /* the buffer */
+ __u8 *head; /* start of data in buffer */
+ __u8 *tail; /* end of data in buffer */
+
+ int offset; /* Usually data + offset = head */
+ int len; /* currently used bytes in buffer */
+ int truesize; /* total size of the data area */
+ __u16 fcs;
+
+ int flags; /* Allocation flags (GFP_KERNEL | GFP_DMA ) */
+};
+
+/*
+ * This structure contains data that _we_ would have liked to be in the device
+ * structure, but we don't want to mess it up more than it is already. Better
+ * to keep the data in separate structures! This structure abstracts common
+ * stuff from IrDA port implementations.
+ */
+struct irda_device {
+ QUEUE q; /* Must be first */
+
+ int magic; /* Our magic bullet */
+ char name[16]; /* Name of device "irda0" */
+ char description[32]; /* Something like "irda0 <-> ttyS0" */
+
+ struct irlap_cb *irlap; /* The link layer we are connected to */
+ struct device netdev; /* Yes! we are some kind of netdevice */
+ struct enet_statistics stats;
+
+/* int flags; */
+
+ void *priv; /* Pointer to low level implementation */
+
+ struct qos_info qos; /* QoS capabilities for this device */
+
+ struct chipio_t io;
+ struct iobuff_t tx_buff;
+ struct iobuff_t rx_buff;
+
+ int media_busy;
+
+ /* Media busy stuff */
+ struct timer_list media_busy_timer;
+ struct timer_list todo_timer;
+
+ int (*hard_xmit)( struct sk_buff *skb, struct device *dev);
+ void (*change_speed)( struct irda_device *driver, int baud);
+
+ int (*is_receiving)(struct irda_device *); /* receiving? */
+ /* int (*is_tbusy)(struct irda_device *); */ /* transmitting? */
+ void (*wait_until_sent)(struct irda_device *);
+
+ int new_speed; /* Will be removed in future */
+};
+
+extern hashbin_t *irda_device;
+
+/* Function prototypes */
+int irda_device_init( void);
+void irda_device_cleanup( void);
+
+int irda_device_open( struct irda_device *, char *name, void *priv);
+void irda_device_close( struct irda_device *);
+
+/* Interface to be uses by IrLAP */
+inline void irda_device_set_media_busy( struct irda_device *, int status);
+inline int irda_device_is_media_busy( struct irda_device *);
+inline int irda_device_is_receiving( struct irda_device *);
+inline void irda_device_change_speed( struct irda_device *, int);
+
+inline struct qos_info *irda_device_get_qos( struct irda_device *self);
+int irda_device_txqueue_empty( struct irda_device *self);
+
+int irda_device_setup( struct device *dev);
+
+__inline__ int irda_get_mtt( struct sk_buff *skb);
+
+void setup_dma( int channel, char *buffer, int count, int mode);
+
+#endif
+
+
+
+
+
+
+
diff --git a/include/net/irda/irdacall.h b/include/net/irda/irdacall.h
new file mode 100644
index 000000000..f7f67ce92
--- /dev/null
+++ b/include/net/irda/irdacall.h
@@ -0,0 +1,2 @@
+/* Separate to keep compilation of protocols.c simpler */
+extern void irda_proto_init(struct net_proto *pro);
diff --git a/include/net/irda/iriap.h b/include/net/irda/iriap.h
new file mode 100644
index 000000000..495da351e
--- /dev/null
+++ b/include/net/irda/iriap.h
@@ -0,0 +1,123 @@
+/*********************************************************************
+ *
+ * Filename: iriap.h
+ * Version:
+ * Description: Information Access Protocol (IAP)
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Thu Aug 21 00:02:07 1997
+ * Modified at: Sat Dec 5 13:45:37 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRIAP_H
+#define IRIAP_H
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#include <net/irda/qos.h>
+#include <net/irda/iriap_event.h>
+#include <net/irda/irias_object.h>
+#include <net/irda/irqueue.h>
+#include <net/irda/timer.h>
+
+#define LST 0x80
+#define ACK 0x40
+
+#define IAS_SERVER 0
+#define IAS_CLIENT 1
+
+/* IrIAP Op-codes */
+#define GET_INFO_BASE 0x01
+#define GET_OBJECTS 0x02
+#define GET_VALUE 0x03
+#define GET_VALUE_BY_CLASS 0x04
+#define GET_OBJECT_INFO 0x05
+#define GET_ATTRIB_NAMES 0x06
+
+#define IAS_SUCCESS 0
+#define IAS_CLASS_UNKNOWN 1
+#define IAS_ATTRIB_UNKNOWN 2
+
+typedef void (*CONFIRM_CALLBACK)( __u16 obj_id, struct ias_value *value,
+ void *priv);
+
+struct iap_value {
+ char *full;
+ char *name;
+ char *attr;
+ __u16 obj_id;
+ __u8 ret_code;
+ __u8 type;
+ int len;
+ int value_int;
+ char *value_char;
+};
+
+struct iriap_cb {
+ QUEUE queue; /* Must be first */
+
+ int magic; /* Magic cookie */
+ int mode; /* Client or server */
+ __u32 daddr;
+ __u8 operation;
+
+ struct sk_buff *skb;
+ struct lsap_cb *lsap;
+ __u8 slsap_sel;
+
+ /* Client states */
+ IRIAP_STATE client_state;
+ IRIAP_STATE call_state;
+
+ /* Server states */
+ IRIAP_STATE server_state;
+ IRIAP_STATE r_connect_state;
+
+ CONFIRM_CALLBACK confirm;
+ void *priv;
+
+ struct timer_list watchdog_timer;
+};
+
+int iriap_init(void);
+void iriap_cleanup(void);
+void iriap_getvaluebyclass_request( __u32 addr, char *name, char *attr,
+ CONFIRM_CALLBACK callback, void *priv);
+void iriap_getvaluebyclass_confirm( struct iriap_cb *self,
+ struct sk_buff *skb);
+
+void iriap_send_ack( struct iriap_cb *self);
+void iriap_data_indication( void *instance, void *sap, struct sk_buff *skb);
+void iriap_connect_confirm( void *instance, void *sap, struct qos_info *qos,
+ int max_sdu_size, struct sk_buff *skb);
+void iriap_connect_indication( void *instance, void *sap,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *skb);
+void iriap_call_indication( struct iriap_cb *self, struct sk_buff *skb);
+
+void iriap_register_server(void);
+
+void iriap_watchdog_timer_expired( unsigned long data);
+
+static inline void iriap_start_watchdog_timer( struct iriap_cb *self,
+ int timeout)
+{
+ irda_start_timer( &self->watchdog_timer, timeout,
+ (unsigned long) self, iriap_watchdog_timer_expired);
+}
+
+#endif
diff --git a/include/net/irda/iriap_event.h b/include/net/irda/iriap_event.h
new file mode 100644
index 000000000..e99f319a3
--- /dev/null
+++ b/include/net/irda/iriap_event.h
@@ -0,0 +1,84 @@
+/*********************************************************************
+ *
+ * Filename: iriap_event.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Aug 4 20:40:53 1997
+ * Modified at: Fri Sep 4 13:19:28 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRIAP_FSM_H
+#define IRIAP_FSM_H
+
+/* Forward because of circular include dependecies */
+struct iriap_cb;
+
+/* IrIAP states */
+typedef enum {
+ /* Client */
+ S_DISCONNECT,
+ S_CONNECTING,
+ S_CALL,
+
+ /* S-Call */
+ S_MAKE_CALL,
+ S_CALLING,
+ S_OUTSTANDING,
+ S_REPLYING,
+ S_WAIT_FOR_CALL,
+ S_WAIT_ACTIVE,
+
+ /* Server */
+ R_DISCONNECT,
+ R_CALL,
+
+ /* R-Connect */
+ R_WAITING,
+ R_WAIT_ACTIVE,
+ R_RECEIVING,
+ R_EXECUTE,
+ R_RETURNING,
+} IRIAP_STATE;
+
+typedef enum {
+ IAP_CALL_REQUEST,
+ IAP_CALL_REQUEST_GVBC,
+ IAP_CALL_RESPONSE,
+ IAP_RECV_F_LST,
+ IAP_LM_DISCONNECT_INDICATION,
+ IAP_LM_CONNECT_INDICATION,
+ IAP_LM_CONNECT_CONFIRM,
+} IRIAP_EVENT;
+
+void iriap_next_client_state ( struct iriap_cb *self, IRIAP_STATE state);
+void iriap_next_call_state ( struct iriap_cb *self, IRIAP_STATE state);
+void iriap_next_server_state ( struct iriap_cb *self, IRIAP_STATE state);
+void iriap_next_r_connect_state( struct iriap_cb *self, IRIAP_STATE state);
+
+
+void iriap_do_client_event( struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb);
+void iriap_do_call_event ( struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb);
+
+void iriap_do_server_event ( struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb);
+void iriap_do_r_connect_event( struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb);
+
+#endif
diff --git a/include/net/irda/irias_object.h b/include/net/irda/irias_object.h
new file mode 100644
index 000000000..efacac854
--- /dev/null
+++ b/include/net/irda/irias_object.h
@@ -0,0 +1,107 @@
+/*********************************************************************
+ *
+ * Filename: irias_object.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Thu Oct 1 22:49:50 1998
+ * Modified at: Sun Oct 25 00:28:56 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef LM_IAS_OBJECT_H
+#define LM_IAS_OBJECT_H
+
+#include "irqueue.h"
+
+/* LM-IAS Attribute types */
+#define IAS_MISSING 0
+#define IAS_INTEGER 1
+#define IAS_OCT_SEQ 2
+#define IAS_STRING 3
+
+/*
+ * LM-IAS Object
+ */
+struct ias_object {
+ QUEUE queue; /* Must be first! */
+
+ int magic;
+
+ char *name;
+ int id;
+
+ hashbin_t *attribs;
+};
+
+/*
+ * Values used by LM-IAS attributes
+ */
+struct ias_value {
+ /* Value description */
+ __u8 type;
+ int charset; /* Only used by string type */
+ int len;
+
+ /* Value */
+ union {
+ int integer;
+ char *string;
+ __u8 *oct_seq;
+ } t;
+};
+
+/*
+ * Attributes used by LM-IAS objects
+ */
+struct ias_attrib {
+ QUEUE queue; /* Must be first! */
+
+ int magic;
+
+ /* Attribute name */
+ char *name;
+ /* char *attr; What do we need this for? */
+
+ /* Attribute value */
+ struct ias_value *value;
+};
+
+char *strdup( char *str);
+
+struct ias_object *irias_new_object( char *name, int id);
+void irias_insert_object( struct ias_object *obj);
+void __irias_delete_object( struct ias_object *obj);
+void irias_delete_object( char *name);
+
+void irias_add_integer_attrib( struct ias_object *obj, char *name,
+ int value);
+void irias_add_string_attrib( struct ias_object *obj, char *name,
+ char *value);
+void irias_add_octseq_attrib( struct ias_object *obj, char *name,
+ __u8 *octets, int len);
+struct ias_object *irias_find_object( char *name);
+struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name);
+
+struct ias_value *irias_new_string_value( char *string);
+struct ias_value *irias_new_integer_value( int integer);
+struct ias_value *irias_new_octseq_value( __u8 *octseq , int len);
+void irias_delete_value( struct ias_value *value);
+
+extern struct ias_value missing;
+extern hashbin_t *objects;
+
+#endif
diff --git a/include/net/irda/irlan_cli.h b/include/net/irda/irlan_cli.h
new file mode 100644
index 000000000..fb677af20
--- /dev/null
+++ b/include/net/irda/irlan_cli.h
@@ -0,0 +1,65 @@
+/*********************************************************************
+ *
+ * Filename: client.h
+ * Version: 0.3
+ * Description: IrDA LAN access layer
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 31 20:14:37 1997
+ * Modified at: Mon Oct 19 12:37:20 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAN_CLIENT_H
+#define IRLAN_CLIENT_H
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+
+int irlan_client_init(void);
+void irlan_client_cleanup(void);
+
+void irlan_discovery_indication( DISCOVERY*);
+void irlan_client_disconnect_indication( void *instance, void *sap,
+ LM_REASON reason, struct sk_buff *);
+
+void irlan_client_data_indication( void *instance, void *sap,
+ struct sk_buff *skb);
+
+void irlan_client_control_data_indication( void *instance, void *sap,
+ struct sk_buff *skb);
+
+void irlan_client_connect_confirm( void *instance, void *sap,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *);
+void irlan_client_connect_indication( void *instance, void *sap,
+ struct sk_buff *);
+void irlan_client_connect_response( void *instance, void *sap,
+ int max_sdu_size, struct sk_buff *skb);
+
+void irlan_client_open_tsaps( struct irlan_cb *self);
+
+void irlan_client_extract_params( struct irlan_cb *self,
+ struct sk_buff *skb);
+void check_response_param( struct irlan_cb *self, char *param,
+ char *value, int val_len);
+void handle_request( struct irlan_cb *self);
+void irlan_client_register_server(void);
+void irlan_client_get_value_confirm( __u16 obj_id, struct ias_value *value,
+ void *priv);
+
+#endif
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
new file mode 100644
index 000000000..33ba52377
--- /dev/null
+++ b/include/net/irda/irlan_common.h
@@ -0,0 +1,199 @@
+/*********************************************************************
+ *
+ * Filename: irlan.h
+ * Version: 0.1
+ * Description: IrDA LAN access layer
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 31 20:14:37 1997
+ * Modified at: Thu Oct 29 13:23:11 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAN_H
+#define IRLAN_H
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+
+#include "irqueue.h"
+#include "irttp.h"
+
+#define IRLAN_MTU 1518
+
+/* Command packet types */
+#define CMD_GET_PROVIDER_INFO 0
+#define CMD_GET_MEDIA_CHAR 1
+#define CMD_OPEN_DATA_CHANNEL 2
+#define CMD_CLOSE_DATA_CHAN 3
+#define CMD_RECONNECT_DATA_CHAN 4
+#define CMD_FILTER_OPERATION 5
+
+/* Some responses */
+#define RSP_SUCCESS 0
+#define RSP_INSUFFICIENT_RESOURCES 1
+#define RSP_INVALID_COMMAND_FORMAT 2
+#define RSP_COMMAND_NOT_SUPPORTED 3
+#define RSP_PARAM_NOT_SUPPORTED 4
+#define RSP_VALUE_NOT_SUPPORTED 5
+#define RSP_NOT_OPEN 6
+#define RSP_AUTHENTICATION_REQUIRED 7
+#define RSP_INVALID_PASSWORD 8
+#define RSP_PROTOCOL_ERROR 9
+#define RSP_ASYNCHRONOUS_ERROR 255
+
+/* Media types */
+#define MEDIA_802_3 1
+#define MEDIA_802_5 2
+
+/* Filter parameters */
+#define DATA_CHAN 1
+#define FILTER_TYPE 2
+#define FILTER_MODE 3
+
+/* Filter types */
+#define IR_DIRECTED 1
+#define IR_FUNCTIONAL 2
+#define IR_GROUP 3
+#define IR_MAC_FRAME 4
+#define IR_MULTICAST 5
+#define IR_BROADCAST 6
+#define IR_IPX_SOCKET 7
+
+/* Filter modes */
+#define ALL 1
+#define FILTER 2
+#define NONE 3
+
+/* Filter operations */
+#define GET 1
+#define CLEAR 2
+#define ADD 3
+#define REMOVE 4
+#define DYNAMIC 5
+
+/* Access types */
+#define DIRECT 1
+#define PEER 2
+#define HOSTED 3
+
+#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER)
+
+/*
+ * IrLAN client subclass
+ */
+struct irlan_client_cb {
+ /*
+ * Client fields
+ */
+ int open_retries;
+
+ __u8 reconnect_key[255];
+ __u8 key_len;
+
+ int unicast_open;
+ int broadcast_open;
+};
+
+/*
+ * IrLAN servers subclass
+ */
+struct irlan_server_cb {
+
+ /*
+ * Store some values here which are used by the irlan_server to parse
+ * FILTER_OPERATIONs
+ */
+ int data_chan;
+ int filter_type;
+ int filter_mode;
+ int filter_operation;
+ int filter_entry;
+
+ __u8 mac_address[6]; /* Generated MAC address for peer device */
+};
+
+/*
+ * IrLAN super class
+ */
+struct irlan_cb {
+ QUEUE queue; /* Must be first */
+
+ int magic;
+ char ifname[9];
+ struct device dev; /* Ethernet device structure*/
+ struct enet_statistics stats;
+
+ __u32 saddr; /* Source devcie address */
+ __u32 daddr; /* Destination device address */
+ int connected; /* TTP layer ready to exchange ether frames */
+
+ int state; /* Current state of IrLAN layer */
+
+ int media;
+
+ struct tsap_cb *tsap_ctrl;
+ struct tsap_cb *tsap_data;
+
+ int use_udata; /* Use Unit Data transfers */
+
+ __u8 dtsap_sel_data; /* Destination data TSAP selector */
+ __u8 stsap_sel_data; /* Source data TSAP selector */
+ __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */
+
+ int client; /* Client or server */
+ union {
+ struct irlan_client_cb client;
+ struct irlan_server_cb server;
+ } t;
+
+ /* void (*irlan_dev_init)(struct irlan_cb *); */
+
+ /*
+ * Used by extract_params, placed here for now to avoid placing
+ * them on the stack. FIXME: remove these!
+ */
+ char name[255];
+ char value[1016];
+};
+
+struct irlan_cb *irlan_open(void);
+
+void irlan_get_provider_info( struct irlan_cb *self);
+void irlan_get_unicast_addr( struct irlan_cb *self);
+void irlan_get_media_char( struct irlan_cb *self);
+void irlan_open_data_channel( struct irlan_cb *self);
+void irlan_set_multicast_filter( struct irlan_cb *self, int status);
+void irlan_set_broadcast_filter( struct irlan_cb *self, int status);
+void irlan_open_unicast_addr( struct irlan_cb *self);
+
+int insert_byte_param( struct sk_buff *skb, char *param, __u8 value);
+int insert_string_param( struct sk_buff *skb, char *param, char *value);
+int insert_array_param( struct sk_buff *skb, char *name, __u8 *value,
+ __u16 value_len);
+
+int insert_param( struct sk_buff *skb, char *param, int type, char *value_char,
+ __u8 value_byte, __u16 value_short);
+
+int irlan_get_response_param( __u8 *buf, char *name, char *value, int *len);
+void print_ret_code( __u8 code);
+
+extern hashbin_t *irlan;
+
+#endif
+
+
diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h
new file mode 100644
index 000000000..72f14ff75
--- /dev/null
+++ b/include/net/irda/irlan_eth.h
@@ -0,0 +1,40 @@
+/*********************************************************************
+ *
+ * Filename: irlan_eth.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Thu Oct 15 08:36:58 1998
+ * Modified at: Thu Oct 15 12:28:12 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAN_ETH_H
+#define IRLAN_ETH_H
+
+int irlan_eth_init( struct device *dev);
+int irlan_eth_open( struct device *dev);
+int irlan_eth_close( struct device *dev);
+
+void irlan_eth_rx( void *instance, void *sap, struct sk_buff *skb);
+int irlan_eth_tx( struct sk_buff *skb, struct device *dev);
+
+void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow);
+
+void irlan_eth_set_multicast_list( struct device *dev);
+struct enet_statistics *irlan_eth_get_stats(struct device *dev);
+
+#endif
diff --git a/include/net/irda/irlan_event.h b/include/net/irda/irlan_event.h
new file mode 100644
index 000000000..d3a062af0
--- /dev/null
+++ b/include/net/irda/irlan_event.h
@@ -0,0 +1,86 @@
+/*********************************************************************
+ *
+ * Filename: irlan_event.h
+ * Version:
+ * Description: LAN access
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 31 20:14:37 1997
+ * Modified at: Tue Oct 20 09:59:31 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAN_EVENT_H
+#define IRLAN_EVENT_H
+
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+
+#include <net/irda/irlan_common.h>
+
+typedef enum {
+ IRLAN_IDLE,
+ IRLAN_QUERY,
+ IRLAN_CONN,
+ IRLAN_INFO,
+ IRLAN_MEDIA,
+ IRLAN_OPEN,
+ IRLAN_WAIT,
+ IRLAN_ARB,
+ IRLAN_DATA,
+ IRLAN_CLOSE,
+ IRLAN_SYNC
+} IRLAN_STATE;
+
+/* IrLAN Client Events */
+typedef enum {
+ IRLAN_DISCOVERY_INDICATION,
+ IRLAN_IAS_PROVIDER_AVAIL,
+ IRLAN_IAS_PROVIDER_NOT_AVAIL,
+ IRLAN_LAP_DISCONNECT,
+ IRLAN_LMP_DISCONNECT,
+ IRLAN_CONNECT_COMPLETE,
+ IRLAN_DATA_INDICATION,
+ IRLAN_DATA_CONNECT_INDICATION,
+ IRLAN_RETRY_CONNECT,
+
+ IRLAN_CONNECT_INDICATION,
+ IRLAN_GET_INFO_CMD,
+ IRLAN_GET_MEDIA_CMD,
+ IRLAN_OPEN_DATA_CMD,
+ IRLAN_FILTER_CONFIG_CMD,
+} IRLAN_EVENT;
+
+struct irlan_info {
+ __u8 dlsap_sel;
+ __u32 daddr;
+ struct tsap_cb *tsap;
+};
+
+extern char *irlan_state[];
+
+void irlan_do_client_event( struct irlan_cb *self,
+ IRLAN_EVENT event,
+ struct sk_buff *skb);
+
+void irlan_do_server_event( struct irlan_cb *self,
+ IRLAN_EVENT event,
+ struct sk_buff *skb,
+ struct irlan_info *info);
+
+void irlan_next_state( struct irlan_cb *self,
+ IRLAN_STATE state);
+
+#endif
diff --git a/include/net/irda/irlan_srv.h b/include/net/irda/irlan_srv.h
new file mode 100644
index 000000000..c187302e2
--- /dev/null
+++ b/include/net/irda/irlan_srv.h
@@ -0,0 +1,62 @@
+/*********************************************************************
+ *
+ * Filename: server.h
+ * Version: 0.1
+ * Description: IrDA LAN access layer
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 31 20:14:37 1997
+ * Modified at: Fri Oct 16 11:25:37 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAN_SERVER_H
+#define IRLAN_SERVER_H
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+
+#include <net/irda/irlan_common.h>
+
+int irlan_server_init(void);
+void irlan_server_cleanup(void);
+struct irlan_cb *irlan_server_open(void);
+void irlan_server_close( struct irlan_cb *self);
+
+void irlan_server_disconnect_indication( void *instance, void *sap,
+ LM_REASON reason,
+ struct sk_buff *skb);
+
+void irlan_server_data_indication( void *instance, void *sap,
+ struct sk_buff *skb);
+void irlan_server_control_data_indication( void *instance, void *sap,
+ struct sk_buff *skb);
+
+void irlan_server_connect_indication( void *instance, void *sap,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *skb);
+void irlan_server_connect_response( struct irlan_cb *, struct tsap_cb *);
+
+int irlan_parse_open_data_cmd( struct irlan_cb *self, struct sk_buff *skb);
+int irlan_server_extract_params( struct irlan_cb *self, int cmd,
+ struct sk_buff *skb);
+
+void irlan_server_send_reply( struct irlan_cb *self, int command,
+ int ret_code);
+void irlan_server_register(void);
+
+#endif
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
new file mode 100644
index 000000000..524d2b799
--- /dev/null
+++ b/include/net/irda/irlap.h
@@ -0,0 +1,232 @@
+/*********************************************************************
+ *
+ * Filename: irlap.h
+ * Version: 0.3
+ * Description: An IrDA LAP driver for Linux
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Aug 4 20:40:53 1997
+ * Modified at: Sat Dec 12 12:25:33 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAP_H
+#define IRLAP_H
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/ppp_defs.h>
+#include <linux/ppp-comp.h>
+
+#include <net/irda/irlap_event.h>
+
+#define LAP_RELIABLE 1
+#define LAP_UNRELIABLE 0
+
+#define LAP_ADDR_HEADER 1 /* IrLAP Address Header */
+#define LAP_CTRL_HEADER 1 /* IrLAP Control Header */
+#define LAP_COMP_HEADER 1 /* IrLAP Compression Header */
+
+#ifdef CONFIG_IRDA_COMPRESSION
+# define LAP_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER + LAP_COMP_HEADER)
+# define IRDA_COMPRESSED 1
+# define IRDA_NORMAL 0
+#else
+#define LAP_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER)
+#endif
+
+#define BROADCAST 0xffffffff /* Broadcast device address */
+#define CBROADCAST 0xfe /* Connection broadcast address */
+#define XID_FORMAT 0x01 /* Discovery XID format */
+
+#define LAP_WINDOW_SIZE 8
+#define MAX_CONNECTIONS 1
+
+#define NR_EXPECTED 1
+#define NR_UNEXPECTED 0
+#define NR_INVALID -1
+
+#define NS_EXPECTED 1
+#define NS_UNEXPECTED 0
+#define NS_INVALID -1
+
+#ifdef CONFIG_IRDA_COMPRESSION
+/*
+ * Just some shortcuts (may give you strange compiler errors if you change
+ * them :-)
+ */
+#define irda_compress (*self->compessor.cp->compress)
+#define irda_comp_free (*self->compressor.cp->comp_free)
+#define irda_decompress (*self->decompressor.cp->decompress)
+#define irda_decomp_free (*self->decompressor.cp->decomp_free)
+#define irda_incomp (*self->decompressor.cp->incomp)
+
+struct irda_compressor {
+ QUEUE queue;
+
+ struct compressor *cp;
+ void *state; /* Not used by IrDA */
+};
+#endif
+
+/* Main structure of IrLAP */
+struct irlap_cb {
+ QUEUE q; /* Must be first */
+
+ int magic;
+
+ struct irda_device *irdev;
+ struct device *netdev;
+
+ /* Connection state */
+ volatile IRLAP_STATE state; /* Current state */
+
+ /* Timers used by IrLAP */
+ struct timer_list query_timer;
+ struct timer_list slot_timer;
+ struct timer_list discovery_timer;
+ struct timer_list final_timer;
+ struct timer_list poll_timer;
+ struct timer_list wd_timer;
+ struct timer_list backoff_timer;
+
+ /* Timeouts which will be different with different turn time */
+ int poll_timeout;
+ int final_timeout;
+ int wd_timeout;
+
+ struct sk_buff_head tx_list; /* Frames to be transmitted */
+
+ __u8 caddr; /* Connection address */
+ __u32 saddr; /* Source device address */
+ __u32 daddr; /* Destination device address */
+
+ int retry_count; /* Times tried to establish connection */
+ int add_wait; /* True if we are waiting for frame */
+
+#ifdef CONFIG_IRDA_FAST_RR
+ /*
+ * To send a faster RR if tx queue empty
+ */
+ int fast_RR_timeout;
+ int fast_RR;
+#endif
+
+ int N1; /* N1 * F-timer = Negitiated link disconnect warning threshold */
+ int N2; /* N2 * F-timer = Negitiated link disconnect time */
+ int N3; /* Connection retry count */
+
+ int local_busy;
+ int remote_busy;
+ int xmitflag;
+
+ __u8 vs; /* Next frame to be sent */
+ __u8 vr; /* Next frame to be received */
+ int tmp;
+ __u8 va; /* Last frame acked */
+ int window; /* Nr of I-frames allowed to send */
+ int window_size; /* Current negotiated window size */
+ int window_bytes; /* Number of bytes allowed to send */
+ int bytes_left; /* Number of bytes allowed to transmit */
+
+ struct sk_buff_head wx_list;
+
+ __u8 ack_required;
+
+ /* XID parameters */
+ __u8 S; /* Number of slots */
+ __u8 slot; /* Random chosen slot */
+ __u8 s; /* Current slot */
+ int frame_sent; /* Have we sent reply? */
+
+ int discovery_count;
+ hashbin_t *discovery_log;
+ DISCOVERY *discovery_cmd;
+
+ struct qos_info qos_tx; /* QoS requested by peer */
+ struct qos_info qos_rx; /* QoS requested by self */
+
+ struct notify_t notify; /* Callbacks to IrLMP */
+
+ int mtt_required; /* Minumum turnaround time required */
+ int xbofs_delay; /* Nr of XBOF's used to MTT */
+ int bofs_count; /* Negotiated extra BOFs */
+
+ struct irda_statistics stats;
+
+#ifdef CONFIG_IRDA_RECYCLE_RR
+ struct sk_buff *recycle_rr_skb;
+#endif
+
+#ifdef CONFIG_IRDA_COMPRESSION
+ struct irda_compressor compressor;
+ struct irda_compressor decompressor;
+#endif
+};
+
+extern hashbin_t *irlap;
+
+/*
+ * Function prototypes
+ */
+
+int irlap_init( void);
+void irlap_cleanup( void);
+
+struct irlap_cb *irlap_open( struct irda_device *dev);
+void irlap_close( struct irlap_cb *self);
+
+void irlap_connect_request( struct irlap_cb *self, __u32 daddr,
+ struct qos_info *qos, int sniff);
+void irlap_connect_response( struct irlap_cb *self, struct sk_buff *skb);
+void irlap_connect_indication( struct irlap_cb *self, struct sk_buff *skb);
+void irlap_connect_confirm( struct irlap_cb *, struct sk_buff *skb);
+
+inline void irlap_data_indication( struct irlap_cb *, struct sk_buff *);
+inline void irlap_unit_data_indication( struct irlap_cb *, struct sk_buff *);
+inline void irlap_data_request( struct irlap_cb *, struct sk_buff *,
+ int reliable);
+
+void irlap_disconnect_request( struct irlap_cb *);
+void irlap_disconnect_indication( struct irlap_cb *, LAP_REASON reason);
+
+void irlap_status_indication( int quality_of_link);
+
+void irlap_test_request( __u8 *info, int len);
+
+void irlap_discovery_request( struct irlap_cb *, DISCOVERY *discovery);
+void irlap_discovery_confirm( struct irlap_cb *, hashbin_t *discovery_log);
+void irlap_discovery_indication( struct irlap_cb *, DISCOVERY *discovery);
+
+void irlap_reset_indication( struct irlap_cb *self);
+void irlap_reset_confirm(void);
+
+void irlap_update_nr_received( struct irlap_cb *, int nr);
+int irlap_validate_nr_received( struct irlap_cb *, int nr);
+int irlap_validate_ns_received( struct irlap_cb *, int ns);
+
+int irlap_generate_rand_time_slot( int S, int s);
+void irlap_initiate_connection_state( struct irlap_cb *);
+void irlap_flush_all_queues( struct irlap_cb *);
+void irlap_change_speed( struct irlap_cb *, int);
+void irlap_wait_min_turn_around( struct irlap_cb *, struct qos_info *);
+
+void irlap_init_qos_capabilities( struct irlap_cb *, struct qos_info *);
+void irlap_apply_default_connection_parameters( struct irlap_cb *self);
+void irlap_apply_connection_parameters( struct irlap_cb *, struct qos_info *);
+
+#endif
diff --git a/include/net/irda/irlap_comp.h b/include/net/irda/irlap_comp.h
new file mode 100644
index 000000000..59f268e53
--- /dev/null
+++ b/include/net/irda/irlap_comp.h
@@ -0,0 +1,47 @@
+/*********************************************************************
+ *
+ * Filename: irlap_comp.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Fri Oct 9 09:21:12 1998
+ * Modified at: Sat Dec 12 12:23:16 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAP_COMP_H
+#define IRLAP_COMP_H
+
+#include <linux/ppp-comp.h>
+
+#define CI_BZIP2 27 /* Random pick */
+
+extern hashbin_t *irlap_compressors;
+
+int irda_register_compressor( struct compressor *cp);
+void irda_unregister_compressor( struct compressor *cp);
+
+int irda_set_compression( struct irlap_cb *self, int proto);
+void irlap_compressor_init( struct irlap_cb *self, int compress);
+void irda_free_compression( struct irlap_cb *self);
+
+struct sk_buff *irlap_compress_frame( struct irlap_cb *self,
+ struct sk_buff *skb);
+struct sk_buff *irlap_decompress_frame( struct irlap_cb *self,
+ struct sk_buff *skb);
+
+#endif
+
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
new file mode 100644
index 000000000..bf4128939
--- /dev/null
+++ b/include/net/irda/irlap_event.h
@@ -0,0 +1,121 @@
+/*********************************************************************
+ *
+ * Filename: irlap_event.h
+ * Version: 0.1
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Aug 16 00:59:29 1997
+ * Modified at: Thu Dec 17 11:58:10 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAP_EVENT_H
+#define IRLAP_EVENT_H
+
+#include "irmod.h"
+
+struct irlap_cb;
+
+/* IrLAP States */
+typedef enum {
+ LAP_NDM, /* Normal disconnected mode */
+ LAP_QUERY,
+ LAP_REPLY,
+ LAP_CONN, /* Connect indication */
+ LAP_SETUP, /* Setting up connection */
+ LAP_OFFLINE, /* A really boring state */
+ LAP_XMIT_P,
+ LAP_PCLOSE,
+ LAP_NRM_P, /* Normal response mode as primary */
+ LAP_RESET_WAIT,
+ LAP_RESET,
+ LAP_NRM_S, /* Normal response mode as secondary */
+ LAP_XMIT_S,
+ LAP_SCLOSE,
+ LAP_RESET_CHECK,
+} IRLAP_STATE;
+
+/* IrLAP Events */
+typedef enum {
+ /* Services events */
+ DISCOVERY_REQUEST,
+ CONNECT_REQUEST,
+ CONNECT_RESPONSE,
+ DISCONNECT_REQUEST,
+ DATA_REQUEST,
+ RESET_REQUEST,
+ RESET_RESPONSE,
+
+ /* Send events */
+ SEND_I_CMD,
+
+ /* Receive events */
+ RECV_DISCOVERY_XID_CMD,
+ RECV_DISCOVERY_XID_RSP,
+ RECV_SNRM_CMD,
+ RECV_TEST_CMD,
+ RECV_UA_RSP,
+ RECV_DM_RSP,
+ RECV_I_CMD,
+ RECV_I_RSP,
+ RECV_UI_FRAME,
+ RECV_FRMR_RSP,
+ RECV_RR_CMD,
+ RECV_RR_RSP,
+ RECV_RNR_FRAME,
+ RECV_DISC_FRAME,
+
+ /* Timer events */
+ SLOT_TIMER_EXPIRED,
+ QUERY_TIMER_EXPIRED,
+ FINAL_TIMER_EXPIRED,
+ POLL_TIMER_EXPIRED,
+ DISCOVERY_TIMER_EXPIRED,
+ WD_TIMER_EXPIRED,
+ BACKOFF_TIMER_EXPIRED,
+} IRLAP_EVENT;
+
+/*
+ * Various things used by the IrLAP state machine
+ */
+struct irlap_info {
+ __u8 caddr; /* Connection address */
+ __u8 control; /* Frame type */
+ __u8 cmd;
+
+ __u32 saddr;
+ __u32 daddr;
+
+ int pf; /* Poll/final bit set */
+
+ __u8 nr; /* Sequence number of next frame expected */
+ __u8 ns; /* Sequence number of frame sent */
+
+ int S; /* Number of slots */
+ int slot; /* Random chosen slot */
+ int s; /* Current slot */
+
+ DISCOVERY *discovery; /* Discovery information */
+};
+
+extern char *irlap_state[];
+
+void irlap_do_event( struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info);
+void irlap_next_state( struct irlap_cb *self, IRLAP_STATE state);
+void irlap_print_event( IRLAP_EVENT event);
+
+#endif
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
new file mode 100644
index 000000000..6b661e4b5
--- /dev/null
+++ b/include/net/irda/irlap_frame.h
@@ -0,0 +1,155 @@
+/*********************************************************************
+ *
+ * Filename: irlap_frame.h
+ * Version: 0.3
+ * Description: Build and transmit IrLAP frames
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Tue Aug 19 10:27:26 1997
+ * Modified at: Mon Dec 14 14:22:23 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLAP_FRAME_H
+#define IRLAP_FRAME_H
+
+#include <linux/skbuff.h>
+
+#include <net/irda/irmod.h>
+#include <net/irda/irlap.h>
+#include <net/irda/qos.h>
+
+/* Frame types and templates */
+#define INVALID 0xff
+
+/* Unnumbered (U) commands */
+#define SNRM_CMD 0x83 /* Set Normal Response Mode */
+#define DISC_CMD 0x43 /* Disconnect */
+#define XID_CMD 0x2f /* Exchange Station Identification */
+#define TEST_CMD 0xe3 /* Test */
+
+/* Unnumbered responses */
+#define RNRM_RSP 0x83 /* Request Normal Response Mode */
+#define UA_RSP 0x63 /* Unnumbered Acknowledgement */
+#define FRMR_RSP 0x87 /* Frame Reject */
+#define DM_RSP 0x0f /* Disconnect Mode */
+#define RD_RSP 0x43 /* Request Disconnection */
+#define XID_RSP 0xaf /* Exchange Station Identification */
+#define TEST_RSP 0xe3 /* Test frame */
+
+/* Supervisory (S) */
+#define RR 0x01 /* Receive Ready */
+#define REJ 0x09 /* Reject */
+#define RNR 0x05 /* Receive Not Ready */
+#define SREJ 0x0d /* Selective Reject */
+
+/* Information (I) */
+#define I_FRAME 0x00 /* Information Format */
+#define UI_FRAME 0x03 /* Unnumbered Information */
+
+#define CMD_FRAME 0x01
+#define RSP_FRAME 0x00
+
+#define PF_BIT 0x10 /* Poll/final bit */
+
+#define IR_S 0x01 /* Supervisory frames */
+#define IR_RR 0x01 /* Receiver ready */
+#define IR_RNR 0x05 /* Receiver not ready */
+#define IR_REJ 0x09 /* Reject */
+#define IR_U 0x03 /* Unnumbered frames */
+#define IR_SNRM 0x2f /* Set Asynchronous Balanced Mode */
+
+#define IR_DISC 0x43 /* Disconnect */
+#define IR_DM 0x0f /* Disconnected mode */
+#define IR_UA 0x63 /* Unnumbered acknowledge */
+#define IR_FRMR 0x87 /* Frame reject */
+#define IR_UI 0x03 /* Unnumbered information */
+
+struct xid_frame {
+ __u8 caddr __attribute__((packed)); /* Connection address */
+ __u8 control __attribute__((packed));
+ __u8 ident __attribute__((packed)); /* Should always be XID_FORMAT */
+ __u32 saddr __attribute__((packed)); /* Source device address */
+ __u32 daddr __attribute__((packed)); /* Destination device address */
+ __u8 flags __attribute__((packed)); /* Discovery flags */
+ __u8 slotnr __attribute__((packed));
+ __u8 version __attribute__((packed));
+ __u8 discovery_info[0] __attribute__((packed));
+};
+
+struct test_frame {
+ __u8 caddr; /* Connection address */
+ __u8 control;
+ __u8 saddr; /* Source device address */
+ __u8 daddr; /* Destination device address */
+ __u8 *info; /* Information */
+};
+
+struct ua_frame {
+ __u8 caddr __attribute__((packed));
+ __u8 control __attribute__((packed));
+
+ __u32 saddr __attribute__((packed)); /* Source device address */
+ __u32 daddr __attribute__((packed)); /* Dest device address */
+ __u8 params[0];
+};
+
+struct i_frame {
+ __u8 caddr __attribute__((packed));
+ __u8 control __attribute__((packed));
+ __u8 data[0] __attribute__((packed));
+};
+
+struct snrm_frame {
+ __u8 caddr __attribute__((packed));
+ __u8 control __attribute__((packed));
+ __u32 saddr __attribute__((packed));
+ __u32 daddr __attribute__((packed));
+ __u8 ncaddr __attribute__((packed));
+ __u8 params[0];
+};
+
+/* Per-packet information we need to hide inside sk_buff */
+struct irlap_skb_cb {
+ int mtt; /* minimum turn around time */
+ int xbofs; /* number of xbofs required */
+ int vs; /* next frame to send */
+ int vr; /* next frame to receive */
+};
+
+__inline__ void irlap_insert_mtt( struct irlap_cb *self, struct sk_buff *skb);
+
+void irlap_send_discovery_xid_frame( struct irlap_cb *, int S, __u8 s,
+ __u8 command, DISCOVERY *discovery);
+void irlap_send_snrm_frame( struct irlap_cb *, struct qos_info *);
+void irlap_send_ua_response_frame( struct irlap_cb *, struct qos_info *);
+void irlap_send_ui_frame( struct irlap_cb *self, struct sk_buff *skb,
+ int command);
+void irlap_send_dm_frame( struct irlap_cb *);
+void irlap_send_disc_frame( struct irlap_cb *);
+void irlap_send_rr_frame( struct irlap_cb *, int command);
+
+void irlap_send_data_primary( struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_primary_poll( struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_secondary( struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_secondary_final( struct irlap_cb *, struct sk_buff *);
+void irlap_resend_rejected_frames( struct irlap_cb *, int command);
+
+void irlap_send_i_frame( struct irlap_cb *, struct sk_buff *, int command);
+void irlap_send_ui_frame( struct irlap_cb *, struct sk_buff *, int command);
+
+/* void irlap_input( struct irlap_cb *self, struct sk_buff *skb); */
+
+#endif
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
new file mode 100644
index 000000000..a10a08fe1
--- /dev/null
+++ b/include/net/irda/irlmp.h
@@ -0,0 +1,239 @@
+/*********************************************************************
+ *
+ * Filename: irlmp.h
+ * Version: 0.3
+ * Description: IrDA Link Management Protocol (LMP) layer
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 17 20:54:32 1997
+ * Modified at: Mon Dec 7 21:11:32 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLMP_H
+#define IRLMP_H
+
+#include <linux/config.h>
+#include <linux/types.h>
+
+#include "irmod.h"
+#include "qos.h"
+#include "irlap.h"
+#include "irlmp_event.h"
+#include "irqueue.h"
+
+/* LSAP-SEL's */
+#define LSAP_MASK 0x7f
+#define LSAP_IAS 0x00
+#define LSAP_ANY 0xff
+
+/* Predefined LSAPs used by the various servers */
+#define TSAP_IRLAN 0x05
+#define LSAP_IRLPT 0x06
+#define TSAP_IROBEX 0x07
+#define TSAP_IRCOMM 0x08
+
+#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */
+#define LMP_CONTROL_HEADER 4
+#define LMP_MAX_HEADER (LAP_HEADER+LMP_HEADER)
+
+#define LM_MAX_CONNECTIONS 10
+
+/* Hint bit positions for first hint byte */
+#define HINT_PNP 0x01
+#define HINT_PDA 0x02
+#define HINT_COMPUTER 0x04
+#define HINT_PRINTER 0x08
+#define HINT_MODEM 0x10
+#define HINT_FAX 0x20
+#define HINT_LAN 0x40
+#define HINT_EXTENSION 0x80
+
+/* Hint bit positions for second hint byte (first extension byte) */
+#define HINT_TELEPHONY 0x01
+#define HINT_FILE_SERVER 0x02
+#define HINT_COMM 0x04
+#define HINT_MESSAGE 0x08
+#define HINT_HTTP 0x10
+#define HINT_OBEX 0x20
+
+typedef enum {
+ S_PNP,
+ S_PDA,
+ S_COMPUTER,
+ S_PRINTER,
+ S_MODEM,
+ S_FAX,
+ S_LAN,
+ S_TELEPHONY,
+ S_COMM,
+ S_OBEX,
+} SERVICE;
+
+#define S_END 0xff
+
+#define CLIENT 1
+#define SERVER 2
+
+typedef void (*DISCOVERY_CALLBACK) ( DISCOVERY*);
+
+struct irlmp_registration {
+ QUEUE queue; /* Must be first */
+
+ int service; /* LAN, OBEX, COMM etc. */
+ int type; /* Client or server or both */
+
+ DISCOVERY_CALLBACK discovery_callback;
+};
+
+struct lap_cb; /* Forward decl. */
+
+/*
+ * Information about each logical LSAP connection
+ */
+struct lsap_cb {
+ QUEUE queue; /* Must be first */
+
+ int magic;
+
+ int connected;
+ int persistent;
+
+ struct irda_statistics stats;
+
+ __u8 slsap_sel; /* Source (this) LSAP address */
+ __u8 dlsap_sel; /* Destination LSAP address (if connected) */
+
+ struct sk_buff *tmp_skb; /* Store skb here while connecting */
+
+ struct timer_list watchdog_timer;
+
+ IRLMP_STATE lsap_state; /* Connection state */
+ struct notify_t notify; /* Indication/Confirm entry points */
+ struct qos_info qos; /* QoS for this connection */
+
+ struct lap_cb *lap; /* Pointer to LAP connection structure */
+};
+
+/*
+ * Information about each registred IrLAP layer
+ */
+struct lap_cb {
+ QUEUE queue; /* Must be first */
+
+ int magic;
+ int reason; /* LAP disconnect reason */
+
+ IRLMP_STATE lap_state;
+
+ struct irlap_cb *irlap; /* Instance of IrLAP layer */
+
+ hashbin_t *lsaps; /* LSAP associated with this link */
+
+ __u8 caddr; /* Connection address */
+
+ __u32 saddr; /* Source device address */
+ __u32 daddr; /* Destination device address */
+
+ hashbin_t *cachelog; /* Discovered devices for this link */
+
+ struct qos_info *qos; /* LAP QoS for this session */
+};
+
+/*
+ * Used for caching the last slsap->dlsap->handle mapping
+ */
+typedef struct {
+ int valid;
+
+ __u8 slsap_sel;
+ __u8 dlsap_sel;
+ struct lsap_cb *lsap;
+} CACHE_ENTRY;
+
+/*
+ * Main structure for IrLMP
+ */
+struct irlmp_cb {
+ int magic;
+
+ __u8 conflict_flag;
+
+ /* int discovery; */
+
+ DISCOVERY discovery_rsp; /* Discovery response to use by IrLAP */
+ DISCOVERY discovery_cmd; /* Discovery command to use by IrLAP */
+
+ int free_lsap_sel;
+
+#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
+ CACHE_ENTRY cache; /* Caching last slsap->dlsap->handle mapping */
+#endif
+ struct timer_list discovery_timer;
+
+ hashbin_t *links; /* IrLAP connection table */
+ hashbin_t *unconnected_lsaps;
+ hashbin_t *registry;
+
+ __u8 hint[2]; /* Hint bits */
+};
+
+/* Prototype declarations */
+int irlmp_init(void);
+void irlmp_cleanup(void);
+
+struct lsap_cb *irlmp_open_lsap( __u8 slsap, struct notify_t *notify);
+void irlmp_close_lsap( struct lsap_cb *self);
+
+void irlmp_register_layer( int service, int type, int do_discovery,
+ DISCOVERY_CALLBACK);
+void irlmp_unregister_layer( int service, int type);
+
+void irlmp_register_irlap( struct irlap_cb *self, __u32 saddr,
+ struct notify_t *);
+void irlmp_unregister_irlap( __u32 saddr);
+
+void irlmp_connect_request( struct lsap_cb *, __u8 dlsap_sel, __u32 daddr,
+ struct qos_info *, struct sk_buff *);
+void irlmp_connect_indication( struct lsap_cb *self, struct sk_buff *skb);
+void irlmp_connect_response( struct lsap_cb *, struct sk_buff *);
+void irlmp_connect_confirm( struct lsap_cb *, struct sk_buff *);
+
+
+void irlmp_disconnect_indication( struct lsap_cb *self, LM_REASON reason,
+ struct sk_buff *userdata);
+void irlmp_disconnect_request( struct lsap_cb *, struct sk_buff *userdata);
+
+void irlmp_discovery_confirm( struct lap_cb *, hashbin_t *discovery_log);
+void irlmp_discovery_indication( struct lap_cb *, DISCOVERY *discovery);
+void irlmp_discovery_request( int nslots);
+DISCOVERY *irlmp_get_discovery_response(void);
+
+void irlmp_data_request( struct lsap_cb *, struct sk_buff *);
+void irlmp_udata_request( struct lsap_cb *, struct sk_buff *);
+void irlmp_data_indication( struct lsap_cb *, struct sk_buff *);
+void irlmp_udata_indication( struct lsap_cb *, struct sk_buff *);
+
+void irlmp_status_request(void);
+void irlmp_status_indication( LINK_STATUS link, LOCK_STATUS lock);
+
+int irlmp_slsap_inuse( __u8 slsap);
+__u8 irlmp_find_free_slsap(void);
+
+LM_REASON irlmp_convert_lap_reason( LAP_REASON);
+
+extern struct irlmp_cb *irlmp;
+
+#endif
diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h
new file mode 100644
index 000000000..1ffb6faa5
--- /dev/null
+++ b/include/net/irda/irlmp_event.h
@@ -0,0 +1,113 @@
+/*********************************************************************
+ *
+ * Filename: irlmp_event.h
+ * Version: 0.1
+ * Description: IrDA-LMP event handling
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Aug 4 20:40:53 1997
+ * Modified at: Wed Oct 28 14:58:23 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLMP_EVENT_H
+#define IRLMP_EVENT_H
+
+struct irlmp_cb;
+struct lsap_cb;
+struct lap_cb;
+
+/* LAP states */
+typedef enum {
+ /* IrLAP connection control states */
+ LAP_STANDBY, /* No LAP connection */
+ LAP_U_CONNECT, /* Starting LAP connection */
+ LAP_ACTIVE, /* LAP connection is active */
+} IRLMP_STATE;
+
+/* LSAP connection control states */
+typedef enum {
+ LSAP_DISCONNECTED, /* No LSAP connection */
+ LSAP_CONNECT, /* Connect indication from peer */
+ LSAP_CONNECT_PEND, /* Connect request from service user */
+ LSAP_DATA_TRANSFER_READY, /* LSAP connection established */
+ LSAP_SETUP, /* Trying to set up LSAP connection */
+ LSAP_SETUP_PEND, /* Request to start LAP connection */
+} LSAP_STATE;
+
+typedef enum {
+ /* LSAP events */
+ LM_CONNECT_REQUEST,
+ LM_CONNECT_CONFIRM,
+ LM_CONNECT_RESPONSE,
+ LM_CONNECT_INDICATION,
+
+ LM_DISCONNECT_INDICATION,
+ LM_DISCONNECT_REQUEST,
+
+ LM_DATA_REQUEST,
+ LM_UDATA_REQUEST,
+ LM_DATA_INDICATION,
+ LM_UDATA_INDICATION,
+
+ LM_WATCHDOG_TIMEOUT,
+
+ /* IrLAP events */
+ LM_LAP_CONNECT_REQUEST,
+ LM_LAP_CONNECT_INDICATION,
+ LM_LAP_CONNECT_CONFIRM,
+ LM_LAP_DISCONNECT_INDICATION,
+ LM_LAP_DISCONNECT_REQUEST,
+ LM_LAP_DISCOVERY_REQUEST,
+ LM_LAP_DISCOVERY_CONFIRM,
+
+} IRLMP_EVENT;
+
+/*
+ * Information which is used by the current thread, when executing in the
+ * state machine.
+ */
+struct irlmp_event {
+ IRLMP_EVENT *event;
+ struct sk_buff *skb;
+
+ __u8 hint;
+ __u32 daddr;
+ __u32 saddr;
+
+ __u8 slsap;
+ __u8 dlsap;
+
+ int reason;
+
+ DISCOVERY *discovery;
+};
+
+extern char *irlmp_state[];
+extern char *irlsap_state[];
+
+void irlmp_watchdog_timer_expired( unsigned long data);
+void irlmp_discovery_timer_expired( unsigned long data);
+
+void irlmp_next_station_state( IRLMP_STATE state);
+void irlmp_next_lsap_state( struct lsap_cb *self, LSAP_STATE state);
+void irlmp_next_lap_state( struct lap_cb *self, IRLMP_STATE state);
+
+void irlmp_do_lap_event( struct lap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb);
+void irlmp_do_lsap_event( struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb);
+
+#endif
diff --git a/include/net/irda/irlmp_frame.h b/include/net/irda/irlmp_frame.h
new file mode 100644
index 000000000..64960f31d
--- /dev/null
+++ b/include/net/irda/irlmp_frame.h
@@ -0,0 +1,57 @@
+/*********************************************************************
+ *
+ * Filename: irlmp_frame.h
+ * Version: 0.1
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Tue Aug 19 02:09:59 1997
+ * Modified at: Sun Oct 25 00:30:31 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRMLP_FRAME_H
+#define IRMLP_FRAME_H
+
+#include <linux/skbuff.h>
+
+/* Frame opcodes */
+#define CONNECT_CMD 0x01
+#define CONNECT_CNF 0x81
+#define DISCONNECT 0x02
+#define ACCESSMODE_CMD 0x03
+#define ACCESSMODE_CNF 0x83
+
+#define CONTROL_BIT 0x80
+
+inline void irlmp_send_data_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap,
+ int expedited, struct sk_buff *skb);
+void irlmp_send_lcf_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap,
+ __u8 opcode, struct sk_buff *skb);
+void irlmp_link_data_indication( struct lap_cb *, int reliable,
+ struct sk_buff *);
+void irlmp_link_connect_indication( struct lap_cb *, struct qos_info *qos,
+ struct sk_buff *skb);
+void irlmp_link_connect_request( __u32 daddr);
+void irlmp_link_connect_confirm( struct lap_cb *self, struct qos_info *qos,
+ struct sk_buff *skb);
+void irlmp_link_disconnect_indication( struct lap_cb *self,
+ struct irlap_cb *irlap,
+ LAP_REASON reason,
+ struct sk_buff *);
+void irlmp_link_discovery_confirm( struct lap_cb *self, hashbin_t *log);
+/* void irlmp_link_disconnect_request( void); */
+
+#endif
diff --git a/include/net/irda/irlpt_cli.h b/include/net/irda/irlpt_cli.h
new file mode 100644
index 000000000..1a54c68eb
--- /dev/null
+++ b/include/net/irda/irlpt_cli.h
@@ -0,0 +1,47 @@
+/*********************************************************************
+ *
+ * Filename: irlpt_client.h
+ * Version: 0.1
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Feb 21 18:54:38 1998
+ * Modified at: Mon Jan 11 15:58:16 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>
+ * Copyright (c) 1998, Dag Brattli,
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Thomas Davis, provide no warranty for any of this software. This
+ * material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLPT_CLIENT_H
+#define IRLPT_CLIENT_H
+
+/* Debug function */
+
+/* int client_init( struct device *dev); */
+
+/*
+ * if it's static, it doesn't go in here.
+ */
+
+void irlpt_client_get_value_confirm(__u16 obj_id,
+ struct ias_value *value, void *priv);
+void irlpt_client_connect_indication( void *instance, void *sap,
+ struct qos_info *qos,
+ int max_seg_size,
+ struct sk_buff *skb);
+void irlpt_client_connect_request( struct irlpt_cb *self);
+
+extern hashbin_t *irlpt_clients;
+
+#endif
diff --git a/include/net/irda/irlpt_cli_fsm.h b/include/net/irda/irlpt_cli_fsm.h
new file mode 100644
index 000000000..4013c2f4d
--- /dev/null
+++ b/include/net/irda/irlpt_cli_fsm.h
@@ -0,0 +1,34 @@
+/*********************************************************************
+ *
+ * Filename: irlpt_client_fsm.h
+ * Version: 0.1
+ * Sources: irlan_event.h
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Thomas Davis, provide no warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLPT_EVENT_H
+#define IRLPT_EVENT_H
+
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+
+extern void irlpt_client_do_event( struct irlpt_cb *self,
+ IRLPT_EVENT event,
+ struct sk_buff *skb,
+ struct irlpt_info *info);
+extern void irlpt_client_next_state( struct irlpt_cb *self,
+ IRLPT_CLIENT_STATE state);
+
+#endif
+
diff --git a/include/net/irda/irlpt_common.h b/include/net/irda/irlpt_common.h
new file mode 100644
index 000000000..0e51b017a
--- /dev/null
+++ b/include/net/irda/irlpt_common.h
@@ -0,0 +1,184 @@
+/*********************************************************************
+ *
+ * Filename: irlpt.c
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Thomas Davis, <ratbert@radiks.net>
+ * Created at: Sat Feb 21 18:54:38 1998
+ * Modified at: Sun Mar 8 23:44:19 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ * Sources: irlan.c
+ *
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
+ * Dag Brattli, <dagb@cs.uit.no>
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Thomas Davis, provide no warranty for any of this software.
+ * This material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLPT_COMMON_H
+#define IRLPT_COMMON_H
+
+#include <net/irda/qos.h>
+#include <net/irda/irmod.h>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/miscdevice.h>
+
+#include <linux/poll.h>
+
+extern char *irlpt_service_type[];
+extern char *irlpt_port_type[];
+extern char *irlpt_connected[];
+extern char *irlpt_reasons[];
+extern char *irlpt_client_fsm_state[];
+extern char *irlpt_server_fsm_state[];
+extern char *irlpt_fsm_event[];
+
+extern struct wait_queue *lpt_wait;
+
+extern struct irlpt_cb *irlpt_find_handle(unsigned int minor);
+extern void irlpt_flow_control(struct sk_buff *skb);
+
+extern ssize_t irlpt_read( struct file *file, char *buffer,
+ size_t count, loff_t *noidea);
+extern ssize_t irlpt_write(struct file *file, const char *buffer,
+ size_t count, loff_t *noidea);
+extern loff_t irlpt_seek(struct file *, loff_t, int);
+extern int irlpt_open(struct inode * inode, struct file *file);
+extern int irlpt_close(struct inode *inode, struct file *file);
+extern u_int irlpt_poll(struct file *file, poll_table *wait);
+
+/* FSM definitions */
+
+typedef enum {
+ IRLPT_CLIENT_IDLE,
+ IRLPT_CLIENT_QUERY,
+ IRLPT_CLIENT_READY,
+ IRLPT_CLIENT_WAITI,
+ IRLPT_CLIENT_WAITR,
+ IRLPT_CLIENT_CONN,
+} IRLPT_CLIENT_STATE;
+
+typedef enum {
+ IRLPT_SERVER_IDLE,
+ IRLPT_SERVER_CONN,
+} IRLPT_SERVER_STATE;
+
+/* IrLPT Events */
+
+typedef enum {
+ QUERY_REMOTE_IAS,
+ IAS_PROVIDER_AVAIL,
+ IAS_PROVIDER_NOT_AVAIL,
+ LAP_DISCONNECT,
+ LMP_CONNECT,
+ LMP_DISCONNECT,
+ LMP_CONNECT_INDICATION,
+ LMP_DISCONNECT_INDICATION,
+#if 0
+ TTP_CONNECT_INDICATION,
+ TTP_DISCONNECT_INDICATION,
+#endif
+ IRLPT_DISCOVERY_INDICATION,
+ IRLPT_CONNECT_REQUEST,
+ IRLPT_DISCONNECT_REQUEST,
+ CLIENT_DATA_INDICATION,
+} IRLPT_EVENT;
+
+struct irlpt_info {
+ struct lsap_cb *lsap;
+ __u8 dlsap_sel;
+ __u32 daddr;
+};
+
+/* Command packet types */
+
+#define IRLPT_MAX_PACKET 1024
+#define IRLPT_MAX_HEADER LMP_MAX_HEADER
+#define IRLPT_MAX_DEVICES 3
+#define IRLPT_MAGIC 0x0755
+
+typedef enum {
+ IRLPT_DISCONNECTED,
+ IRLPT_WAITING,
+ IRLPT_CONNECTED,
+ IRLPT_FLUSHED,
+} IRLPT_SERVER_STATUS;
+
+#define IRLPT_LSAP 0x09
+
+#define PI_SERVICE_TYPE 0x00
+
+#define IRLPT_UNKNOWN 0x00 /* not defined yet. */
+#define IRLPT_THREE_WIRE_RAW 0x01 /* bit 0 */
+#define IRLPT_THREE_WIRE 0x02 /* bit 1 */
+#define IRLPT_NINE_WIRE 0x04 /* bit 2 */
+#define IRLPT_CENTRONICS 0x08 /* bit 3 */
+#define IRLPT_SERVER_MODE 0xFF /* our own flag */
+
+#define PI_PORT_TYPE 0x01
+
+#define IRLPT_SERIAL 0x01 /* bit 0 */
+#define IRLPT_PARALLEL 0x02 /* bit 1 */
+
+#define PI_PORT_NAME 0x02
+
+#define PI_CRITICAL 0x80
+
+struct irlpt_cb {
+ QUEUE queue; /* must be first. */
+
+ int magic; /* magic used to detect corruption of
+ the struct */
+ __u32 daddr; /* my local address. */
+
+ struct timer_list retry_timer;
+
+ int volatile state; /* Current state of IrCOMM layer */
+ int open_retries;
+ int in_use; /* flag to prevent re-use */
+ char ifname[16]; /* name of the allocated instance,
+ and registered device. */
+ struct lsap_cb *lsap; /* lmp handle */
+
+ __u8 dlsap_sel; /* remote LSAP selector address */
+ __u8 slsap_sel; /* local LSAP selectoraddress */
+ __u8 servicetype; /* Type of remote service, ie THREE_WIRE_RAW */
+ __u8 porttype; /* type of remote port. */
+
+ struct miscdevice ir_dev; /* used to register the misc device. */
+
+ int count; /* open count */
+ int irlap_data_size; /* max frame size we can send */
+ int pkt_count; /* how many packets are queued up */
+
+ struct wait_queue *read_wait; /* wait queues */
+ struct wait_queue *write_wait;
+ struct wait_queue *ex_wait;
+
+ /* this is used by the server side of the system */
+
+ IRLPT_SERVER_STATE connected;
+
+ int eof;
+ int service_LSAP;
+
+ struct sk_buff_head rx_queue; /* read buffer queue */
+};
+
+/* Debug function */
+void irlpt_dump_buffer(struct sk_buff *);
+
+#endif
diff --git a/include/net/irda/irlpt_server.h b/include/net/irda/irlpt_server.h
new file mode 100644
index 000000000..7984a331d
--- /dev/null
+++ b/include/net/irda/irlpt_server.h
@@ -0,0 +1,42 @@
+/*********************************************************************
+ *
+ * Filename: server.h
+ * Version: 0.1
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Feb 21 18:54:38 1998
+ * Modified at: Tue Sep 22 11:41:42 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>
+ * Copyright (c) 1998, Dag Brattli,
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Thomas Davis, provide no warranty for any of this software. This
+ * material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLPT_SERVER_H
+#define IRLPT_SERVER_H
+
+#include "qos.h"
+#include "irmod.h"
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/miscdevice.h>
+
+/* int server_init( struct device *dev); */
+
+extern struct irlpt_cb *irlpt_server;
+
+#endif
diff --git a/include/net/irda/irlpt_server_fsm.h b/include/net/irda/irlpt_server_fsm.h
new file mode 100644
index 000000000..8f23226c3
--- /dev/null
+++ b/include/net/irda/irlpt_server_fsm.h
@@ -0,0 +1,30 @@
+/*********************************************************************
+ *
+ * Filename: server_fsm.h<2>
+ * Version: 0.1
+ * Sources: irlan_event.h
+ *
+ * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Thomas Davis, provide no warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRLPT_EVENT_H
+#define IRLPT_EVENT_H
+
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+
+void irlpt_server_do_event( struct irlpt_cb *self, IRLPT_EVENT event,
+ struct sk_buff *skb, struct irlpt_info *info);
+void irlpt_server_next_state( struct irlpt_cb *self, IRLPT_SERVER_STATE state);
+
+#endif
diff --git a/include/net/irda/irmod.h b/include/net/irda/irmod.h
new file mode 100644
index 000000000..a2f592572
--- /dev/null
+++ b/include/net/irda/irmod.h
@@ -0,0 +1,265 @@
+/*********************************************************************
+ *
+ * Filename: irmod.h
+ * Version: 0.3
+ * Description: IrDA module and utilities functions
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Dec 15 13:58:52 1997
+ * Modified at: Tue Jan 12 14:56:11 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charg.
+ *
+ ********************************************************************/
+
+#ifndef IRMOD_H
+#define IRMOD_H
+
+#include <linux/skbuff.h>
+#include <linux/miscdevice.h>
+
+#include <net/irda/irqueue.h>
+#include <net/irda/qos.h>
+
+#define IRMGR_IOC_MAGIC 'm'
+#define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1)
+#define IRMGR_IOC_MAXNR 1
+
+/*
+ * Events that we pass to the user space manager
+ */
+typedef enum {
+ EVENT_DEVICE_DISCOVERED = 0,
+ EVENT_REQUEST_MODULE,
+ EVENT_IRLAN_START,
+ EVENT_IRLAN_STOP,
+ EVENT_IRLPT_START,
+ EVENT_IRLPT_STOP,
+ EVENT_IROBEX_START,
+ EVENT_IROBEX_STOP,
+ EVENT_IRDA_STOP,
+ EVENT_NEED_PROCESS_CONTEXT,
+} IRMGR_EVENT;
+
+/*
+ * Event information passed to the IrManager daemon process
+ */
+struct irmanager_event {
+ IRMGR_EVENT event;
+ char devname[10];
+ char info[32];
+ int service;
+ __u32 saddr;
+ __u32 daddr;
+};
+
+typedef void (*TODO_CALLBACK)( void *self, __u32 param);
+
+/*
+ * Same as irmanager_event but this one can be queued and inclueds some
+ * addtional information
+ */
+struct irda_event {
+ QUEUE q; /* Must be first */
+
+ struct irmanager_event event;
+};
+
+/*
+ * Funtions with needs to be called with a process context
+ */
+struct irda_todo {
+ QUEUE q; /* Must be first */
+
+ void *self;
+ TODO_CALLBACK callback;
+ __u32 param;
+};
+
+/*
+ * Main structure for the IrDA device (not much here :-)
+ */
+struct irda_cb {
+ struct miscdevice dev;
+ struct wait_queue *wait_queue;
+
+ int in_use;
+
+ QUEUE *event_queue; /* Events queued for the irmanager */
+ QUEUE *todo_queue; /* Todo list */
+};
+
+typedef struct {
+ char irda_call[7]; /* 6 call + SSID (shifted ascii!) */
+} irda_address;
+
+struct sockaddr_irda {
+ short sirda_family;
+ irda_address sirda_call;
+ int sirda_ndigis;
+};
+
+/*
+ * This type is used by the protocols that transmit 16 bits words in
+ * little endian format. A little endian machine stores MSB of word in
+ * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0]
+ * and LSB in byte[1].
+ */
+typedef union {
+ __u16 word;
+ __u8 byte[2];
+} __u16_host_order;
+
+/*
+ * Information monitored by some layers
+ */
+struct irda_statistics
+{
+ int rx_packets; /* total packets received */
+ int tx_packets; /* total packets transmitted */
+ int rx_errors; /* bad packets received */
+ int tx_errors; /* packet transmit problems */
+ int rx_dropped; /* no space in linux buffers */
+ int tx_dropped; /* no space available in linux */
+ int rx_compressed;
+ int tx_compressed;
+ int rx_bytes; /* total bytes received */
+ int tx_bytes; /* total bytes transmitted */
+
+ int multicast; /* multicast packets received */
+ int collisions;
+
+ /* detailed rx_errors: */
+ int rx_length_errors;
+ int rx_over_errors; /* receiver ring buff overflow */
+ int rx_crc_errors; /* recved pkt with crc error */
+ int rx_frame_errors; /* recv'd frame alignment error */
+ int rx_fifo_errors; /* recv'r fifo overrun */
+ int rx_missed_errors; /* receiver missed packet */
+
+ /* detailed tx_errors */
+ int tx_aborted_errors;
+ int tx_carrier_errors;
+ int tx_fifo_errors;
+ int tx_heartbeat_errors;
+ int tx_window_errors;
+};
+
+typedef enum {
+ NO_CHANGE,
+ LOCKED,
+ UNLOCKED,
+} LOCK_STATUS;
+
+/* Misc status information */
+typedef enum {
+ STATUS_OK,
+ STATUS_ABORTED,
+ STATUS_NO_ACTIVITY,
+ STATUS_NOISY,
+ STATUS_REMOTE,
+} LINK_STATUS;
+
+typedef enum { /* FIXME check the two first reason codes */
+ LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
+ LAP_NO_RESPONSE, /* To many retransmits without response */
+ LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */
+ LAP_FOUND_NONE, /* No devices were discovered */
+ LAP_MEDIA_BUSY,
+ LAP_PRIMARY_CONFLICT,
+} LAP_REASON;
+
+/*
+ * IrLMP disconnect reasons. The order is very important, since they
+ * correspond to disconnect reasons sent in IrLMP disconnect frames, so
+ * please do not touch :-)
+ */
+typedef enum {
+ LM_USER_REQUEST = 1, /* User request */
+ LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */
+ LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */
+ LM_LAP_RESET, /* IrLAP reset */
+ LM_INIT_DISCONNECT, /* Link Management initiated disconnect */
+} LM_REASON; /* FIXME: Just for now */
+
+/*
+ * IrLMP character code values
+ */
+#define CS_ASCII 0x00
+#define CS_ISO_8859_1 0x01
+#define CS_ISO_8859_2 0x02
+#define CS_ISO_8859_3 0x03
+#define CS_ISO_8859_4 0x04
+#define CS_ISO_8859_5 0x05
+#define CS_ISO_8859_6 0x06
+#define CS_ISO_8859_7 0x07
+#define CS_ISO_8859_8 0x08
+#define CS_ISO_8859_9 0x09
+#define CS_UNICODE 0xff
+
+/*
+ * The DISCOVERY structure is used for both discovery requests and responses
+ */
+#define DISCOVERY struct discovery_t
+struct discovery_t {
+ QUEUE queue; /* Must be first! */
+
+ __u32 saddr; /* Which link the device was discovered */
+ __u32 daddr; /* Remote device address */
+ LAP_REASON condition; /* More info about the discovery */
+
+ __u8 hint[2]; /* Discovery hint bits */
+ __u8 charset;
+ char info[32]; /* Usually the name of the device */
+ __u8 info_len; /* Length of device info field */
+
+ int gen_addr_bit; /* Need to generate a new device address? */
+};
+
+typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
+
+/*
+ * Notify structure used between transport and link management layers
+ */
+struct notify_t {
+ void (*data_indication)( void *instance, void *sap,
+ struct sk_buff *skb);
+ void (*udata_indication)( void *instance, void *sap,
+ struct sk_buff *skb);
+ void (*connect_confirm)( void *instance, void *sap,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *skb);
+ void (*connect_indication)( void *instance, void *sap,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *skb);
+ void (*disconnect_indication)( void *instance, void *sap,
+ LM_REASON reason, struct sk_buff *);
+ void (*flow_indication)( void *instance, void *sap, LOCAL_FLOW flow);
+ void *instance; /* Layer instance pointer */
+ char name[16]; /* Name of layer */
+};
+
+#define NOTIFY_MAX_NAME 16
+
+int irmod_init_module(void);
+void irmod_cleanup_module(void);
+
+inline int irda_lock( int *lock);
+inline int irda_unlock( int *lock);
+
+void irda_notify_init( struct notify_t *notify);
+
+void irda_execute_as_process( void *self, TODO_CALLBACK callback, __u32 param);
+void irmanager_notify( struct irmanager_event *event);
+
+#endif
diff --git a/include/net/irda/irobex.h b/include/net/irda/irobex.h
new file mode 100644
index 000000000..8f69707d0
--- /dev/null
+++ b/include/net/irda/irobex.h
@@ -0,0 +1,135 @@
+/*********************************************************************
+ *
+ * Filename: irobex.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Jul 4 22:43:57 1998
+ * Modified at: Wed Jan 13 15:55:28 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IROBEX_H
+#define IROBEX_H
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+/* #include <linux/netdevice.h> */
+#include <linux/miscdevice.h>
+
+#include <net/irda/timer.h>
+#include <net/irda/qos.h>
+#include <net/irda/irmod.h>
+
+#define LOW_THRESHOLD 4
+#define HIGH_THRESHOLD 8
+#define IROBEX_MAX_QUEUE 12
+
+/* Small structure to be used by the IOCTL call */
+struct irobex_ioc_t {
+ __u32 daddr;
+};
+
+#define IROBEX_IOC_MAGIC 'k'
+
+#define IROBEX_IOCSCONNECT _IOW(IROBEX_IOC_MAGIC, 1, 4)
+#define IROBEX_IOCSDISCONNECT _IOW(IROBEX_IOC_MAGIC, 2, 4)
+#define IROBEX_IOC_MAXNR 2
+
+#define IROBEX_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER)
+
+typedef enum {
+ OBEX_IDLE, /* Doing nothing */
+ OBEX_DISCOVER, /* Trying to discovery remote device */
+ OBEX_QUERY, /* Querying remote LM-IAS */
+ OBEX_CONN, /* Trying to connect to remote device */
+ OBEX_DATA, /* Data transfer ready */
+} OBEX_STATE;
+
+struct irobex_cb {
+ QUEUE queue; /* Must be first! */
+
+ int magic; /* magic used to detect corruption of the struct */
+
+ OBEX_STATE state; /* Current state */
+
+ __u32 saddr; /* my local address */
+ __u32 daddr; /* peer address */
+ unsigned long time_discovered;
+
+ char devname[9]; /* name of the registered device */
+ struct tsap_cb *tsap;
+ int eof;
+
+ __u8 dtsap_sel; /* remote TSAP address */
+ __u8 stsap_sel; /* local TSAP address */
+
+ int irlap_data_size;
+
+ struct miscdevice dev;
+
+ int count; /* open count */
+
+ struct sk_buff_head rx_queue; /* Receive queue */
+
+ struct wait_queue *read_wait;
+ struct wait_queue *write_wait;
+
+ struct fasync_struct *async;
+
+ struct timer_list watchdog_timer;
+
+ LOCAL_FLOW tx_flow;
+ LOCAL_FLOW rx_flow;
+};
+
+int irobex_init(void);
+void irobex_cleanup(void);
+struct irobex_cb *irobex_open(void);
+void irobex_close( struct irobex_cb *self);
+
+void irobex_discovery_indication( DISCOVERY *);
+
+void irobex_data_request( int handle, struct sk_buff *skb);
+void irobex_data_indication( void *instance, void *sap, struct sk_buff *skb);
+void irobex_control_data_indication( void *instance, void *sap,
+ struct sk_buff *skb);
+
+void irobex_connect_request( struct irobex_cb *self);
+void irobex_connect(struct irobex_cb *self, struct sk_buff *skb);
+void irobex_connect_confirm( void *instance, void *sap, struct qos_info *qos,
+ int max_sdu_size, struct sk_buff *skb);
+void irobex_disconnect_indication( void *instance, void *sap, LM_REASON reason,
+ struct sk_buff *skb);
+void irobex_flow_indication( void *instance, void *sap, LOCAL_FLOW flow);
+
+void irobex_extract_params( struct sk_buff *skb);
+void irobex_get_value_confirm(__u16 obj_id, struct ias_value *value,
+ void *priv);
+void irobex_register_server( struct irobex_cb *self);
+
+void irobex_watchdog_timer_expired( unsigned long data);
+
+inline void irobex_start_watchdog_timer( struct irobex_cb *self, int timeout)
+{
+ irda_start_timer( &self->watchdog_timer, timeout, (unsigned long) self,
+ irobex_watchdog_timer_expired);
+}
+
+extern struct irobex_cb *irobex;
+
+#endif
diff --git a/include/net/irda/irport.h b/include/net/irda/irport.h
new file mode 100644
index 000000000..c4a036a4d
--- /dev/null
+++ b/include/net/irda/irport.h
@@ -0,0 +1,61 @@
+/*********************************************************************
+ *
+ * Filename: irport.h
+ * Version: 0.1
+ * Description: Serial driver for IrDA
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 3 13:49:59 1997
+ * Modified at: Thu Jan 7 14:17:31 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no>
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRPORT_H
+#define IRPORT_H
+
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/types.h>
+
+#include <net/irda/irda_device.h>
+
+#define SPEED_DEFAULT 9600
+#define SPEED_MAX 115200
+
+/*
+ * These are the supported serial types.
+ */
+#define PORT_UNKNOWN 0
+#define PORT_8250 1
+#define PORT_16450 2
+#define PORT_16550 3
+#define PORT_16550A 4
+#define PORT_CIRRUS 5
+#define PORT_16650 6
+#define PORT_MAX 6
+
+#define FRAME_MAX_SIZE 2048
+
+void irport_close( int iobase);
+int irport_open( int iobase);
+int irport_detect(struct irda_device *idev);
+
+void irport_change_speed( int iobase, int speed);
+void irport_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+
+int irport_hard_xmit( struct sk_buff *skb, struct device *dev);
+
+#endif
diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h
new file mode 100644
index 000000000..0551e3b52
--- /dev/null
+++ b/include/net/irda/irqueue.h
@@ -0,0 +1,106 @@
+/*********************************************************************
+ *
+ * Filename: irqueue.h
+ * Version: 0.3
+ * Description: General queue implementation
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Tue Jun 9 13:26:50 1998
+ * Modified at: Sun Oct 25 00:26:31 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (C) 1998, Aage Kvalnes <aage@cs.uit.no>
+ * Copyright (c) 1998, Dag Brattli
+ * All Rights Reserved.
+ *
+ * This code is taken from the Vortex Operating System written by Aage
+ * Kvalnes and has been ported to Linux and Linux/IR by Dag Brattli
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#include <linux/types.h>
+#include <asm/spinlock.h>
+
+#include <net/irda/irda.h>
+
+#ifndef QUEUE_H
+#define QUEUE_H
+
+#define NAME_SIZE 32
+
+/*
+ * Hash types
+ */
+#define HB_NOLOCK 0
+#define HB_GLOBAL 1
+#define HB_LOCAL 2
+#define HB_SORTED 4
+
+/*
+ * Hash defines
+ */
+#define HASHBIN_SIZE 8
+#define HASHBIN_MASK 0x7
+
+typedef void (*FREE_FUNC)( void *arg);
+
+/*
+ * Hashbin
+ */
+#define GET_HASHBIN(x) ( x & HASHBIN_MASK )
+
+#define QUEUE struct queue_t
+struct queue_t {
+ QUEUE* q_next;
+ QUEUE* q_prev;
+
+ char q_name[ NAME_SIZE];
+ __u32 q_hash;
+};
+
+typedef struct hashbin_t {
+ int magic;
+ int hb_type;
+ int hb_size;
+ spinlock_t hb_mutex[ HASHBIN_SIZE ] ALIGN;
+ QUEUE* hb_queue[ HASHBIN_SIZE ] ALIGN;
+
+ QUEUE* hb_current;
+} hashbin_t;
+
+hashbin_t *hashbin_new( int type);
+int hashbin_delete( hashbin_t* hashbin, FREE_FUNC func);
+int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func);
+void hashbin_insert( hashbin_t* hashbin, QUEUE* entry, __u32 hashv,
+ char* name);
+void* hashbin_find( hashbin_t* hashbin, __u32 hashv, char* name);
+void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name);
+void* hashbin_remove_first( hashbin_t *hashbin);
+QUEUE *hashbin_get_first( hashbin_t *hashbin);
+QUEUE *hashbin_get_next( hashbin_t *hashbin);
+
+void enqueue_last(QUEUE **queue, QUEUE* element);
+void enqueue_first(QUEUE **queue, QUEUE* element);
+QUEUE *dequeue_first(QUEUE **queue);
+
+/*
+ * Function hashbin_get_size (hashbin)
+ *
+ * Returns the number of elements in the hashbin
+ *
+ */
+extern __inline__ int hashbin_get_size( hashbin_t* hashbin)
+{
+ return hashbin->hb_size;
+}
+
+#endif
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
new file mode 100644
index 000000000..02a486dd5
--- /dev/null
+++ b/include/net/irda/irttp.h
@@ -0,0 +1,136 @@
+/*********************************************************************
+ *
+ * Filename: irttp.h
+ * Version: 0.3
+ * Description: Tiny Transport Protocol (TTP) definitions
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Aug 31 20:14:31 1997
+ * Modified at: Sat Dec 5 13:48:12 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRTTP_H
+#define IRTTP_H
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#include <net/irda/irmod.h>
+#include <net/irda/irlmp.h>
+#include <net/irda/qos.h>
+#include <net/irda/irqueue.h>
+
+#define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS
+#define TTP_HEADER 1
+#define TTP_HEADER_WITH_SAR 6
+#define TTP_PARAMETERS 0x80
+#define TTP_MORE 0x80
+
+#define DEFAULT_INITIAL_CREDIT 22
+
+#define LOW_THRESHOLD 4
+#define HIGH_THRESHOLD 8
+#define TTP_MAX_QUEUE 22
+
+/* Some priorities for disconnect requests */
+#define P_NORMAL 0
+#define P_HIGH 1
+
+#define SAR_DISABLE 0
+
+/*
+ * This structure contains all data assosiated with one instance of a TTP
+ * connection.
+ */
+struct tsap_cb {
+ QUEUE queue; /* For linking it into the hashbin */
+ int magic; /* Just in case */
+
+ int max_seg_size; /* Max data that fit into an IrLAP frame */
+
+ __u8 stsap_sel; /* Source TSAP */
+ __u8 dtsap_sel; /* Destination TSAP */
+
+ struct lsap_cb *lsap; /* Corresponding LSAP to this TSAP */
+
+ __u8 connected; /* TSAP connected */
+
+ __u8 initial_credit; /* Initial credit to give peer */
+
+ int avail_credit; /* Available credit to return to peer */
+ int remote_credit; /* Credit held by peer TTP entity */
+ int send_credit; /* Credit held by local TTP entity */
+
+ struct sk_buff_head tx_queue; /* Frames to be transmitted */
+ struct sk_buff_head rx_queue; /* Received frames */
+ struct sk_buff_head rx_fragments;
+ int tx_queue_lock;
+ int rx_queue_lock;
+
+ struct notify_t notify; /* Callbacks to client layer */
+
+ struct irda_statistics stats;
+ struct timer_list todo_timer;
+
+ int rx_sdu_busy; /* RxSdu.busy */
+ int rx_sdu_size; /* The current size of a partially received frame */
+ int rx_max_sdu_size; /* Max receive user data size */
+
+ int tx_sdu_busy; /* TxSdu.busy */
+ int tx_max_sdu_size; /* Max transmit user data size */
+
+ int no_defrag; /* Don't reassemble received fragments */
+
+ int disconnect_pend; /* Disconnect, but still data to send */
+ struct sk_buff *disconnect_skb;
+};
+
+struct irttp_cb {
+ int magic;
+
+ hashbin_t *tsaps;
+};
+
+int irttp_init(void);
+void irttp_cleanup(void);
+
+struct tsap_cb *irttp_open_tsap( __u8 stsap, int credit,
+ struct notify_t *notify);
+void irttp_close_tsap( struct tsap_cb *self);
+
+int irttp_data_request( struct tsap_cb *self, struct sk_buff *skb);
+int irttp_udata_request( struct tsap_cb *self, struct sk_buff *skb);
+
+void irttp_connect_request( struct tsap_cb *self, __u8 dtsap_sel, __u32 daddr,
+ struct qos_info *qos, int max_sdu_size,
+ struct sk_buff *userdata);
+void irttp_connect_confirm( void *instance, void *sap, struct qos_info *qos,
+ int max_sdu_size, struct sk_buff *skb);
+void irttp_connect_response( struct tsap_cb *self, int max_sdu_size,
+ struct sk_buff *userdata);
+
+void irttp_disconnect_request( struct tsap_cb *self, struct sk_buff *skb,
+ int priority);
+void irttp_flow_request( struct tsap_cb *self, LOCAL_FLOW flow);
+
+static __inline__ void irttp_no_reassemble( struct tsap_cb *self)
+{
+ self->no_defrag = TRUE;
+}
+
+extern struct irttp_cb *irttp;
+
+#endif /* IRTTP_H */
diff --git a/include/net/irda/irtty.h b/include/net/irda/irtty.h
new file mode 100644
index 000000000..313a32d9b
--- /dev/null
+++ b/include/net/irda/irtty.h
@@ -0,0 +1,68 @@
+/*********************************************************************
+ *
+ * Filename: irtty.h
+ * Version: 0.1
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Tue Dec 9 21:13:12 1997
+ * Modified at: Mon Dec 14 11:22:37 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRTTY_H
+#define IRTTY_H
+
+#include <linux/if.h>
+#include <linux/skbuff.h>
+#include <linux/termios.h>
+
+#include <net/irda/irda.h>
+#include <net/irda/irqueue.h>
+#include <net/irda/irda_device.h>
+
+#include <net/irda/dongle.h>
+
+#define IRTTY_IOC_MAGIC 'e'
+#define IRTTY_IOCTDONGLE _IO(IRTTY_IOC_MAGIC, 1)
+#define IRTTY_IOC_MAXNR 1
+
+#ifndef N_IRDA
+#define N_IRDA 11 /* This one should go in </asm/termio.h> */
+#endif
+
+struct dongle_q {
+ QUEUE q;
+
+ struct dongle *dongle;
+};
+
+struct irtty_cb {
+ QUEUE q; /* Must be first */
+
+/* char name[16]; */
+
+ int magic;
+
+ struct tty_struct *tty; /* Ptr to TTY structure */
+ struct irda_device idev;
+
+ struct dongle_q *dongle_q; /* Has this tty got a dongle attached? */
+};
+
+int irtty_register_dongle( struct dongle *dongle);
+void irtty_unregister_dongle( struct dongle *dongle);
+
+#endif
diff --git a/include/net/irda/irvtd.h b/include/net/irda/irvtd.h
new file mode 100644
index 000000000..43d61c9c0
--- /dev/null
+++ b/include/net/irda/irvtd.h
@@ -0,0 +1,104 @@
+/*********************************************************************
+ *
+ * Filename: irvtd.h
+ * Version: 0.1
+ * Sources: irlpt.h
+ *
+ * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>,
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Takahide Higuchi, provide no warranty for any of this software.
+ * This material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_H
+#define IRCOMM_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#include <linux/tqueue.h>
+
+#include <net/irda/irmod.h>
+#include <net/irda/qos.h>
+#include <net/irda/ircomm_common.h>
+
+
+#define IRVTD_MAGIC 0xff545943 /* random */
+#define COMM_MAX_TTY 1
+#define IRVTD_RX_QUEUE_HIGH 10
+#define IRVTD_RX_QUEUE_LOW 2
+
+
+/*
+ * Serial input interrupt line counters -- external structure
+ * Four lines can interrupt: CTS, DSR, RI, DCD
+ *
+ * this structure must be compatible with serial_icounter_struct defined in
+ * <linux/serial.h>.
+ */
+struct icounter_struct {
+ int cts, dsr, rng, dcd;
+ int reserved[16];
+};
+
+struct irvtd_cb {
+
+ int magic; /* magic used to detect corruption of the struct */
+
+ /* if daddr is NULL, remote device have not been discovered yet */
+
+ int rx_disable;
+ struct sk_buff *txbuff; /* buffer queue */
+ struct sk_buff_head rxbuff; /* buffer queue */
+ struct ircomm_cb *comm; /* ircomm instance */
+
+ /*
+ * These members are used for compatibility with usual serial device.
+ * See linux/serial.h
+ */
+
+ int baud_base;
+ int flags;
+ struct tty_struct *tty;
+
+ int line;
+ int count; /* open count */
+ int blocked_open;
+ struct wait_queue *open_wait;
+ struct wait_queue *close_wait;
+ struct wait_queue *delta_msr_wait;
+ struct wait_queue *tx_wait;
+
+ struct tq_struct rx_tqueue;
+
+ long pgrp;
+ long session;
+ struct termios normal_termios;
+ struct termios callout_termios;
+ unsigned short closing_wait; /* time to wait before closing */
+ unsigned short close_delay;
+
+ int mcr;
+ int msr;
+ int cts_stoptx;
+ int ttp_stoptx;
+ int ttp_stoprx;
+ struct icounter_struct icount;
+ int read_status_mask;
+ int ignore_status_mask;
+};
+
+
+/* Debug function */
+
+/* #define CHECK_SKB(skb) check_skb((skb), __LINE__,__FILE__) */
+
+
+
+#endif
diff --git a/include/net/irda/irvtd_driver.h b/include/net/irda/irvtd_driver.h
new file mode 100644
index 000000000..4983b3d2c
--- /dev/null
+++ b/include/net/irda/irvtd_driver.h
@@ -0,0 +1,122 @@
+/*********************************************************************
+ *
+ * Filename: irvtd_driver.h
+ * Version: 0.1
+ *
+ * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>,
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * I, Takahide Higuchi, provide no warranty for any of this software.
+ * This material is provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#include <linux/tty.h>
+
+#include <net/irda/irlap.h>
+#include <net/irda/irlmp.h>
+#include <net/irda/irttp.h>
+
+
+#define VSP_TYPE_NORMAL 1
+#define VSP_TYPE_CALLOUT 2
+#define IRCOMM_MAJOR 60; /* Zero means automatic allocation
+ 60,61,62,and 63 is reserved for experiment */
+#define IRVTD_MINOR 64
+#define IRVTD_CALLOUT_MINOR 32
+
+#define IRVTD_TYPE_NORMAL 11
+#define IRVTD_TYPE_CALLOUT 12
+
+
+#define IRCOMM_HEADER 1
+#define IRCOMM_RESERVE LAP_HEADER+LMP_HEADER+TTP_HEADER+IRCOMM_HEADER
+
+
+
+
+
+/*
+ * Definitions for ircomm_cb_struct flags field
+ * this section is "stolen" from linux-kernel (drivers/char/serial.c)
+ */
+#define IRVTD_ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
+ on the callout port */
+/* #define IRVTD_ASYNC_FOURPORT 0x0002 */
+/* Set OU1, OUT2 per AST Fourport settings */
+
+#define IRVTD_ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */
+
+#define IRVTD_ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
+
+#define IRVTD_ASYNC_SPD_MASK 0x0030
+#define IRVTD_ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
+
+#define IRVTD_ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
+#define IRVTD_ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */
+
+#define IRVTD_ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
+#define IRVTD_ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
+#define IRVTD_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
+#define IRVTD_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
+#define IRVTD_ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
+
+#define IRVTD_ASYNC_FLAGS 0x0FFF /* Possible legal async flags */
+#define IRVTD_ASYNC_USR_MASK 0x0430 /* Legal flags that non-privileged
+ * users can set or reset */
+
+/* Internal flags used only by kernel/chr_drv/serial.c */
+#define IRVTD_ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */
+#define IRVTD_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */
+#define IRVTD_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
+#define IRVTD_ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
+#define IRVTD_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
+#define IRVTD_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
+#define IRVTD_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
+#define IRVTD_ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */
+
+
+#define IRVTD_ASYNC_CLOSING_WAIT_INF 0
+#define IRVTD_ASYNC_CLOSING_WAIT_NONE 65535
+
+/**************************************/
+
+#define DELTA_DTR 0x01
+#define DELTA_RTS 0x02
+#define MCR_DTR 0x04
+#define MCR_RTS 0x08
+
+#define DELTA_CTS 0x01
+#define DELTA_DSR 0x02
+#define DELTA_RI 0x04
+#define DELTA_DCD 0x08
+#define MSR_CTS 0x10
+#define MSR_DSR 0x20
+#define MSR_RI 0x40
+#define MSR_DCD 0x80
+
+#define LSR_OE 0x02 /* Overrun error indicator */
+#define LSR_PE 0x04 /* Parity error indicator */
+#define LSR_FE 0x08 /* Frame error indicator */
+#define LSR_BI 0x01 /* Break interrupt indicator */
+
+
+
+/**************************************/
+
+
+
+
+int irvtd_register_ttydriver(void);
+void irvtd_unregister_ttydriver(void);
+
+void irvtd_flush_chars(struct tty_struct *tty);
+
+
+
+
diff --git a/include/net/irda/pc87108.h b/include/net/irda/pc87108.h
new file mode 100644
index 000000000..ed47bdc1b
--- /dev/null
+++ b/include/net/irda/pc87108.h
@@ -0,0 +1,194 @@
+/*********************************************************************
+ *
+ * Filename: pc87108.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Fri Nov 13 14:37:40 1998
+ * Modified at: Thu Dec 10 19:58:20 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>
+ * Copyright (c) 1998 Lichen Wang, <lwang@actisys.com>
+ * Copyright (c) 1998 Actisys Corp., www.actisys.com
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef PC87108_H
+#define PC87108_H
+
+#include <asm/io.h>
+
+/* Flags for configuration register CRF0 */
+#define APEDCRC 0x02
+#define ENBNKSEL 0x01
+
+/* Set 0 */
+#define TXD 0x00 /* Transmit data port */
+#define RXD 0x00 /* Receive data port */
+
+/* Register 1 */
+#define IER 0x01 /* Interrupt Enable Register*/
+#define IER_RXHDL_IE 0x01 /* Receiver high data level interrupt */
+#define IER_TXLDL_IE 0x02 /* Transeiver low data level interrupt */
+#define IER_LS_IE 0x04//* Link Status Interrupt */
+#define IER_ETXURI 0x04 /* Tx underrun */
+#define IER_DMA_IE 0x10 /* DMA finished interrupt */
+#define IER_TXEMP_IE 0x20
+#define IER_SFIF_IE 0x40 /* Frame status FIFO intr */
+#define IER_TMR_IE 0x80 /* Timer event */
+
+#define FCR 0x02 /* (write only) */
+#define FCR_FIFO_EN 0x01 /* Enable FIFO's */
+#define FCR_RXSR 0x02 /* Rx FIFO soft reset */
+#define FCR_TXSR 0x04 /* Tx FIFO soft reset */
+#define FCR_RXTH 0x80 /* Rx FIFO threshold (set to 16) */
+#define FCR_TXTH 0x20 /* Tx FIFO threshold (set to 17) */
+
+#define EIR 0x02 /* (read only) */
+#define EIR_RXHDL_EV 0x01
+#define EIR_TXLDL_EV 0x02
+#define EIR_LS_EV 0x04
+#define EIR_DMA_EV 0x10
+#define EIR_TXEMP_EV 0x20
+#define EIR_SFIF_EV 0x40
+#define EIR_TMR_EV 0x80
+
+#define LCR 0x03 /* Link control register */
+#define LCR_WLS_8 0x03 /* 8 bits */
+
+#define BSR 0x03 /* Bank select register */
+#define BSR_BKSE 0x80
+#define BANK0 LCR_WLS_8 /* Must make sure that we set 8N1 */
+#define BANK1 0x80
+#define BANK2 0xe0
+#define BANK3 0xe4
+#define BANK4 0xe8
+#define BANK5 0xec
+#define BANK6 0xf0
+#define BANK7 0xf4
+
+#define MCR 0x04 /* Mode Control Register */
+#define MCR_MODE_MASK ~(0xd0)
+#define MCR_UART 0x00
+#define MCR_RESERVED 0x20
+#define MCR_SHARP_IR 0x40
+#define MCR_SIR 0x60
+#define MCR_MIR 0x80
+#define MCR_FIR 0xa0
+#define MCR_CEIR 0xb0
+#define MCR_DMA_EN 0x04
+#define MCR_EN_IRQ 0x08
+#define MCR_TX_DFR 0x08
+
+#define LSR 0x05 /* Link status register */
+#define LSR_RXDA 0x01 /* Receiver data available */
+#define LSR_TXRDY 0x20 /* Transmitter ready */
+#define LSR_TXEMP 0x40 /* Transmitter empty */
+
+#define ASCR 0x07 /* Auxillary Status and Control Register */
+#define ASCR_RXF_TOUT 0x01 /* Rx FIFO timeout */
+#define ASCR_FEND_INF 0x02 /* Frame end bytes in rx FIFO */
+#define ASCR_S_EOT 0x04 /* Set end of transmission */
+#define ASCT_RXBSY 0x20 /* Rx busy */
+#define ASCR_TXUR 0x40 /* Transeiver underrun */
+#define ASCR_CTE 0x80 /* Clear timer event */
+
+/* Bank 2 */
+#define BGDL 0x00 /* Baud Generator Divisor Port (Low Byte) */
+#define BGDH 0x01 /* Baud Generator Divisor Port (High Byte) */
+
+#define ECR1 0x02 /* Extended Control Register 1 */
+#define ECR1_EXT_SL 0x01 /* Extended Mode Select */
+#define ECR1_DMANF 0x02 /* DMA Fairness */
+#define ECR1_DMATH 0x04
+#define ECR1_DMASWP 0x08 /* DMA Swap */
+
+#define EXCR2 0x04
+#define EXCR2_TFSIZ 0x01 /* Rx FIFO size = 32 */
+#define EXCR2_RFSIZ 0x04 /* Tx FIFO size = 32 */
+
+#define TXFLV 0x06 /* Tx FIFO level */
+#define RXFLV 0x07 /* Rx FIFO level */
+
+/* Bank 3 */
+#define MID 0x00
+
+/* Bank 4 */
+#define TMRL 0x00 /* Timer low byte */
+#define TMRH 0x01 /* Timer high byte */
+#define IRCR1 0x02 /* Infrared control register 1 */
+#define IRCR1_TMR_EN 0x01 /* Timer enable */
+
+#define TFRLL 0x04
+#define TFRLH 0x05
+#define RFRLL 0x06
+#define RFRLH 0x07
+
+/* Bank 5 */
+#define IRCR2 0x04 /* Infrared control register 2 */
+#define IRCR2_MDRS 0x04 /* MIR data rate select */
+#define IRCR2_FEND_MD 0x20 /* */
+
+#define FRM_ST 0x05 /* Frame status FIFO */
+#define FRM_ST_VLD 0x80 /* Frame status FIFO data valid */
+#define FRM_ST_ERR_MSK 0x5f
+#define FRM_ST_LOST_FR 0x40 /* Frame lost */
+#define FRM_ST_MAX_LEN 0x10 /* Max frame len exceeded */
+#define FRM_ST_PHY_ERR 0x08 /* Physical layer error */
+#define FRM_ST_BAD_CRC 0x04
+#define FRM_ST_OVR2 0x02 /* Receive overrun */
+#define FRM_ST_OVR1 0x01 /* Frame status FIFO overrun */
+
+#define RFLFL 0x06
+#define RFLFH 0x07
+
+/* Bank 6 */
+#define IR_CFG2 0x00
+#define IR_CFG2_DIS_CRC 0x02
+
+/* Bank 7 */
+#define IRM_CR 0x07 /* Infrared module control register */
+#define IRM_CR_IRX_MSL 0x40
+#define IRM_CR_AF_MNT 0x80 /* Automatic format */
+
+/* For storing entries in the status FIFO */
+struct st_fifo_entry {
+ int status;
+ int len;
+};
+
+struct st_fifo {
+ struct st_fifo_entry entries[10];
+ int head;
+ int tail;
+ int len;
+};
+
+/* Private data for each instance */
+struct pc87108 {
+ struct st_fifo st_fifo;
+
+ int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */
+ int tx_len; /* Number of frames in tx_buff */
+
+ struct irda_device idev;
+};
+
+static inline void switch_bank( int iobase, int bank)
+{
+ outb( bank, iobase+BSR);
+}
+
+#endif
diff --git a/include/net/irda/qos.h b/include/net/irda/qos.h
new file mode 100644
index 000000000..39ca2b7b9
--- /dev/null
+++ b/include/net/irda/qos.h
@@ -0,0 +1,104 @@
+/*********************************************************************
+ *
+ * Filename: qos.h
+ * Version: 0.1
+ * Description: Quality of Service definitions
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Fri Sep 19 23:21:09 1997
+ * Modified at: Wed Dec 9 10:32:47 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef QOS_H
+#define QOS_H
+
+#include <linux/config.h>
+#include <linux/skbuff.h>
+
+#define PI_BAUD_RATE 0x01
+#define PI_MAX_TURN_TIME 0x82
+#define PI_DATA_SIZE 0x83
+#define PI_WINDOW_SIZE 0x84
+#define PI_ADD_BOFS 0x85
+#define PI_MIN_TURN_TIME 0x86
+#define PI_LINK_DISC 0x08
+#define PI_COMPRESSION 0x07 /* Just a random pick */
+
+
+#define IR_115200_MAX 0x3f
+
+/* Baud rates (first byte) */
+#define IR_2400 0x01
+#define IR_9600 0x02
+#define IR_19200 0x04
+#define IR_38400 0x08
+#define IR_57600 0x10
+#define IR_115200 0x20
+#define IR_576000 0x40
+#define IR_1152000 0x80
+
+/* Baud rates (second byte) */
+#define IR_4000000 0x01
+
+/* Quality of Service information */
+typedef struct {
+ int value;
+ __u16 bits; /* LSB is first byte, MSB is second byte */
+} qos_value_t;
+
+struct qos_info {
+ int magic;
+
+ qos_value_t baud_rate; /* IR_11520O | ... */
+ qos_value_t max_turn_time;
+ qos_value_t data_size;
+ qos_value_t window_size;
+ qos_value_t additional_bofs;
+ qos_value_t min_turn_time;
+ qos_value_t link_disc_time;
+
+ qos_value_t power;
+#ifdef CONFIG_IRDA_COMPRESSION
+ /* An experimental non IrDA field */
+ qos_value_t compression;
+#endif
+};
+
+extern int baud_rates[];
+extern int data_size[];
+extern int min_turn_time[];
+extern int add_bofs[];
+extern int compression[];
+
+void irda_init_max_qos_capabilies( struct qos_info *qos);
+void irda_qos_compute_intersection( struct qos_info *, struct qos_info *);
+int irda_insert_qos_negotiation_params( struct qos_info *qos, __u8 *fp);
+void irda_qos_negotiate( struct qos_info *qos_rx, struct qos_info *qos_tx,
+ struct sk_buff *skb);
+
+int msb_index ( __u16 byte);
+int byte_value( __u8 byte, int *array);
+int value_index( int value, int *array);
+int index_value( int index, int *array);
+
+void irda_qos_bits_to_value( struct qos_info *qos);
+
+#endif
+
+
+
+
+
diff --git a/include/net/irda/smc_ircc.h b/include/net/irda/smc_ircc.h
new file mode 100644
index 000000000..8750618a7
--- /dev/null
+++ b/include/net/irda/smc_ircc.h
@@ -0,0 +1,123 @@
+#if 0
+static char *rcsid = "$Id: smc_ircc.h,v 1.5 1998/07/27 01:25:29 ratbert Exp $";
+#endif
+
+#ifndef SMC_IRCC_H
+#define SMC_IRCC_H
+
+#define FIR_XMIT 1
+#define FIR_RECEIVE 2
+#define SIR_XMIT 3
+#define SIR_RECEIVE 4
+
+#define MASTER 0x07
+#define MASTER_POWERDOWN 1<<7
+#define MASTER_RESET 1<<6
+#define MASTER_INT_EN 1<<5
+#define MASTER_ERROR_RESET 1<<4
+
+/* Register block 0 */
+
+#define IIR 0x01
+#define IER 0x02
+#define LSR 0x03
+#define LCR_A 0x04
+#define LCR_B 0x05
+#define BSR 0x06
+
+#define IIR_ACTIVE_FRAME 1<<7
+#define IIR_EOM 1<<6
+#define IIR_RAW_MODE 1<<5
+#define IIR_FIFO 1<<4
+
+#define IER_ACTIVE_FRAME 1<<7
+#define IER_EOM 1<<6
+#define IER_RAW_MODE 1<<5
+#define IER_FIFO 1<<4
+
+#define LSR_UNDER_RUN 1<<7
+#define LSR_OVER_RUN 1<<6
+#define LSR_FRAME_ERROR 1<<5
+#define LSR_SIZE_ERROR 1<<4
+#define LSR_CRC_ERROR 1<<3
+#define LSR_FRAME_ABORT 1<<2
+
+#define LCR_A_FIFO_RESET 1<<7
+#define LCR_A_FAST 1<<6
+#define LCR_A_GP_DATA 1<<5
+#define LCR_A_RAW_TX 1<<4
+#define LCR_A_RAW_RX 1<<3
+#define LCR_A_ABORT 1<<2
+#define LCR_A_DATA_DONE 1<<1
+
+#define LCR_B_SCE_MODE_DISABLED 0x00<<6
+#define LCR_B_SCE_MODE_TRANSMIT 0x01<<6
+#define LCR_B_SCE_MODE_RECEIVE 0x02<<6
+#define LCR_B_SCE_MODE_UNDEFINED 0x03<<6
+#define LCR_B_SIP_ENABLE 1<<5
+#define LCR_B_BRICK_WALL 1<<4
+
+#define BSR_NOT_EMPTY 1<<7
+#define BSR_FIFO_FULL 1<<6
+#define BSR_TIMEOUT 1<<5
+
+/* Register block 1 */
+
+#define SCE_CFG_A 0x00
+#define SCE_CFG_B 0x01
+#define FIFO_THRESHOLD 0x02
+
+#define CFG_A_AUX_IR 0x01<<7
+#define CFG_A_HALF_DUPLEX 0x01<<2
+#define CFG_A_TX_POLARITY 0x01<<1
+#define CFG_A_RX_POLARITY 0x01
+
+#define CFG_A_COM 0x00<<3
+#define CFG_A_IRDA_SIR_A 0x01<<3
+#define CFG_A_ASK_SIR 0x02<<3
+#define CFG_A_IRDA_SIR_B 0x03<<3
+#define CFG_A_IRDA_HDLC 0x04<<3
+#define CFG_A_IRDA_4PPM 0x05<<3
+#define CFG_A_CONSUMER 0x06<<3
+#define CFG_A_RAW_IR 0x07<<3
+#define CFG_A_OTHER 0x08<<3
+
+#define IR_HDLC 0x04
+#define IR_4PPM 0x01
+#define IR_CONSUMER 0x02
+
+#define CFG_B_LOOPBACK 0x01<<5
+#define CFG_B_LPBCK_TX_CRC 0x01<<4
+#define CFG_B_NOWAIT 0x01<<3
+#define CFB_B_STRING_MOVE 0x01<<2
+#define CFG_B_DMA_BURST 0x01<<1
+#define CFG_B_DMA_ENABLE 0x01
+
+#define CFG_B_MUX_COM 0x00<<6
+#define CFG_B_MUX_IR 0x01<<6
+#define CFG_B_MUX_AUX 0x02<<6
+#define CFG_B_INACTIVE 0x03<<6
+
+/* Register block 2 - Consumer IR - not used */
+
+/* Register block 3 - Identification Registers! */
+
+#define SMSC_ID_HIGH 0x00 /* 0x10 */
+#define SMSC_ID_LOW 0x01 /* 0xB8 */
+#define CHIP_ID 0x02 /* 0xF1 */
+#define VERSION_NUMBER 0x03 /* 0x01 */
+#define HOST_INTERFACE 0x04 /* low 4 = DMA, high 4 = IRQ */
+
+/* Register block 4 - IrDA */
+#define IR_CONTROL 0x00
+#define BOF_COUNT_LO 0x01
+#define BRICK_WALL_CNT_LO 0x02
+#define BRICK_TX_CNT_HI 0x03
+#define TX_DATA_SIZE_LO 0x04
+#define RX_DATA_SIZE_HI 0x05
+#define RX_DATA_SIZE_LO 0x06
+
+#define SELECT_1152 0x01<<7
+#define CRC_SELECT 0x01<<6
+
+#endif
diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h
new file mode 100644
index 000000000..35a5be260
--- /dev/null
+++ b/include/net/irda/timer.h
@@ -0,0 +1,79 @@
+/*********************************************************************
+ *
+ * Filename: timer.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Aug 16 00:59:29 1997
+ * Modified at: Mon Nov 2 14:31:55 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef TIMER_H
+#define TIMER_H
+
+#include "irda.h"
+#include "irmod.h"
+#include "irlap.h"
+#include "irlmp.h"
+#include "irda_device.h"
+
+/*
+ * Timeout definitions, some defined in IrLAP p. 92
+ */
+#define POLL_TIMEOUT 45 /* Must never exceed 500 ms */
+#define FINAL_TIMEOUT 50 /* Must never exceed 500 ms */
+
+/*
+ * Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice
+ * duration of the P-timer.
+ */
+#define WD_TIMEOUT POLL_TIMEOUT*2
+#define MEDIABUSY_TIMEOUT 50 /* 500 msec */
+
+/*
+ * Slot timer must never exceed 85 ms, and must always be at least 25 ms,
+ * suggested to 75-85 msec by IrDA lite
+ */
+#define SLOT_TIMEOUT 8
+#define QUERY_TIMEOUT 100
+
+#define WATCHDOG_TIMEOUT 2000 /* 20 sec */
+#define RETRY_TIMEOUT 51
+
+typedef void (*TIMER_CALLBACK)( unsigned long);
+
+void irda_start_timer( struct timer_list *ptimer, int timeout, int data,
+ TIMER_CALLBACK callback);
+
+inline void irlap_start_slot_timer( struct irlap_cb *self, int timeout);
+inline void irlap_start_query_timer( struct irlap_cb *self, int timeout);
+inline void irlap_start_final_timer( struct irlap_cb *self, int timeout);
+inline void irlap_start_wd_timer( struct irlap_cb *self, int timeout);
+inline void irlap_start_backoff_timer( struct irlap_cb *self, int timeout);
+
+inline void irda_device_start_mbusy_timer( struct irda_device *self);
+
+struct lsap_cb;
+inline void irlmp_start_watchdog_timer( struct lsap_cb *, int timeout);
+inline void irlmp_start_discovery_timer( struct irlmp_cb *, int timeout);
+
+struct irobex_cb;
+inline void irobex_start_watchdog_timer( struct irobex_cb *, int timeout);
+
+#endif
+
diff --git a/include/net/irda/uircc.h b/include/net/irda/uircc.h
new file mode 100644
index 000000000..a8b4c02dd
--- /dev/null
+++ b/include/net/irda/uircc.h
@@ -0,0 +1,121 @@
+/*********************************************************************
+ *
+ * Filename: uircc.h
+ * Version: 0.1
+ * Description: Driver for the Sharp Universal Infrared
+ * Communications Controller (UIRCC)
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sat Dec 26 11:00:49 1998
+ * Modified at: Tue Jan 19 23:52:46 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef UIRCC_H
+#define UIRCC_H
+
+/* Control registers (write only) */
+#define UIRCC_CR0 0x00 /* Control register 0 */
+#define UIRCC_CR0_XMIT_RST 0x20 /* Transmit reset */
+#define UIRCC_CR0_RECV_RST 0x10 /* Receive reset */
+#define UIRCC_CR0_TMR_RST 0x08 /* Timer reset */
+#define UIRCC_CR0_SYS_RST 0x04 /* System reset */
+#define UIRCC_CR0_CARR_RST 0x02 /* Carrier latch reset */
+#define UIRCC_CR0_CNT_SWT 0x01 /* Transmit/receive length counter reset */
+
+#define UIRCC_CR1 0x01 /* Transmit/receive mode setting register */
+#define UIRCC_CR1_RX_DMA 0x80 /* Rx DMA mode */
+#define UIRCC_CR1_TX_DMA 0x20 /* Tx DMA mode */
+#define UIRCC_CR1_DMA_BRST 0x10 /* DMA burst mode */
+#define UIRCC_CR1_MUST_SET 0x0c /* Must be set */
+
+#define UIRCC_CR2 0x02 /* Interrupt mask register */
+#define UIRCC_CR2_RECV_OVR 0x40 /* Receive overrun error */
+#define UIRCC_CR2_RECV_FRM 0x20 /* Receive frame error */
+#define UIRCC_CR2_RECV_END 0x10 /* Receive end */
+#define UIRCC_CR2_TMR_OUT 0x08 /* Timer time-out */
+#define UIRCC_CR2_XMIT_UNR 0x04 /* Transmit under-run error */
+#define UIRCC_CR2_XMIT_END 0x01 /* Transmit end */
+#define UIRCC_CR2_RECV_MASK 0x70
+#define UIRCC_CR2_XMIT_MASK 0x05
+
+#define UIRCC_CR3 0x03 /* Transmit/receive control */
+#define UIRCC_CR3_XMIT_EN 0x80 /* Transmit enable */
+#define UIRCC_CR3_TX_CRC_EN 0x40 /* Transmit UIRCC_CRC enable */
+#define UIRCC_CR3_RECV_EN 0x20 /* Receive enable */
+#define UIRCC_CR3_RX_CRC_EN 0x10 /* Receive CRC enable */
+#define UIRCC_CR3_ADDR_CMP 0x08 /* Address comparison enable */
+#define UIRCC_CR3_MCAST_EN 0x04 /* Multicast enable */
+
+#define UIRCC_CR4 0x04 /* Transmit data length low byte */
+#define UIRCC_CR5 0x05 /* Transmit data length high byte */
+#define UIRCC_CR6 0x06 /* Transmit data writing low byte */
+#define UIRCC_CR7 0x07 /* Transmit data writing high byte */
+
+#define UIRCC_CR8 0x08 /* Self pole address */
+
+#define UIRCC_CR9 0x09 /* System control 1 */
+
+#define UIRCC_CR10 0x0a /* Modem selection */
+#define UIRCC_CR10_SIR 0x22 /* Set SIR mode */
+#define UIRCC_CR10_FIR 0x88 /* Set FIR mode */
+
+#define UIRCC_CR11 0x0b /* System control 2 (same as SR11) */
+#define UIRCC_CR11_TMR_EN 0x08
+
+#define UIRCC_CR12 0x0c /* Timer counter initial value (low byte) */
+#define UIRCC_CR13 0x0d /* Timer counter initial value (high byte) */
+
+/* Status registers (read only) */
+#define UIRCC_SR0 0x00 /* Transmit/receive status register */
+#define UIRCC_SR0_RX_RDY 0x80 /* Received data ready */
+#define UIRCC_SR0_RX_OVR 0x40 /* Receive overrun error */
+#define UIRCC_SR0_RX_CRCFRM 0x20 /* Receive CRC or framing error */
+
+#define UIRCC_SR2 0x02 /* Interrupt mask status */
+
+#define UIRCC_SR3 0x03 /* Interrupt factor register */
+#define UIRCC_SR3_RX_OVR_ER 0x40 /* Receive overrun error */
+#define UIRCC_SR3_RX_FRM_ER 0x20 /* Receive frameing error */
+#define UIRCC_SR3_RX_EOF 0x10 /* Receive end of frame */
+#define UIRCC_SR3_TMR_OUT 0x08 /* Timer timeout */
+#define UIRCC_SR3_TXUR 0x04 /* Transmit underrun */
+#define UIRCC_SR3_TX_DONE 0x01 /* Transmit all sent */
+
+#define UIRCC_SR4 0x04 /* TX/RX data length counter low byte */
+#define UIRCC_SR5 0x05 /* TX/RX data length counter high byte */
+
+#define UIRCC_SR8 0x08 /* Chip version */
+
+#define UIRCC_SR9 0x09 /* System status 1 */
+
+#define UIRCC_SR10 0x0a /* Modem select status */
+
+#define UIRCC_SR12 0x0c /* Timer counter status (low byte) */
+#define UIRCC_SR13 0x0d /* Timer counter status (high byte) */
+
+/* Private data for each instance */
+struct uircc_cb {
+ struct irda_device idev;
+
+ __u8 cr3; /* Copy of register sr3 */
+};
+
+#define CR3_SET
+
+#endif
+
+
+
diff --git a/include/net/irda/w83977af.h b/include/net/irda/w83977af.h
new file mode 100644
index 000000000..dda084ab7
--- /dev/null
+++ b/include/net/irda/w83977af.h
@@ -0,0 +1,54 @@
+#ifndef W83977AF_H
+#define W83977AF_H
+
+#define W977_EFER 0x370
+#define W977_EFIR 0x370
+#define W977_EFDR 0x371
+#define W977_DEVICE_IR 0x06
+
+
+/*
+ * Enter extended function mode
+ */
+static inline void w977_efm_enter(void)
+{
+ outb(0x87, W977_EFER);
+ outb(0x87, W977_EFER);
+}
+
+/*
+ * Select a device to configure
+ */
+
+static inline void w977_select_device(__u8 devnum)
+{
+ outb(0x07, W977_EFIR);
+ outb(devnum, W977_EFDR);
+}
+
+/*
+ * Write a byte to a register
+ */
+static inline void w977_write_reg(__u8 reg, __u8 value)
+{
+ outb(reg, W977_EFIR);
+ outb(value, W977_EFDR);
+}
+
+/*
+ * read a byte from a register
+ */
+static inline __u8 w977_read_reg(__u8 reg)
+{
+ outb(reg, W977_EFIR);
+ return inb(W977_EFDR);
+}
+
+/*
+ * Exit extended function mode
+ */
+static inline void w977_efm_exit(void)
+{
+ outb(0xAA, W977_EFER);
+}
+#endif
diff --git a/include/net/irda/w83977af_ir.h b/include/net/irda/w83977af_ir.h
new file mode 100644
index 000000000..3e3200b2d
--- /dev/null
+++ b/include/net/irda/w83977af_ir.h
@@ -0,0 +1,158 @@
+/*********************************************************************
+ *
+ * Filename: w83977af_ir.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Paul VanderSpek
+ * Created at: Thu Nov 19 13:55:34 1998
+ * Modified at: Thu Dec 10 14:06:18 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef W83977AF_IR_H
+#define W83977AF_IR_H
+
+#include <asm/io.h>
+
+/* Flags for configuration register CRF0 */
+#define ENBNKSEL 0x01
+#define APEDCRC 0x02
+#define TXW4C 0x04
+#define RXW4C 0x08
+
+/* Bank 0 */
+#define RBR 0x00 /* Receiver buffer register */
+#define TBR 0x00 /* Transmitter buffer register */
+
+#define ICR 0x01 /* Interrupt configuration register */
+#define ICR_ERBRI 0x01 /* Receiver buffer register interrupt */
+#define ICR_ETBREI 0x02 /* Transeiver empty interrupt */
+#define ICR_EUSRI 0x04//* IR status interrupt */
+#define ICR_EHSRI 0x04
+#define ICR_ETXURI 0x04 /* Tx underrun */
+#define ICR_EDMAI 0x10 /* DMA interrupt */
+#define ICR_ETXTHI 0x20 /* Transmitter threshold interrupt */
+#define ICR_EFSFI 0x40 /* Frame status FIFO interrupt */
+#define ICR_ETMRI 0x80 /* Timer interrupt */
+
+#define UFR 0x02 /* FIFO control register */
+#define UFR_EN_FIFO 0x01 /* Enable FIFO's */
+#define UFR_RXF_RST 0x02 /* Reset Rx FIFO */
+#define UFR_TXF_RST 0x04 /* Reset Tx FIFO */
+#define UFR_RXTL 0x80 /* Rx FIFO threshold (set to 16) */
+#define UFR_TXTL 0x20 /* Tx FIFO threshold (set to 17) */
+
+#define ISR 0x02 /* Interrupt status register */
+#define ISR_RXTH_I 0x01 /* Receive threshold interrupt */
+#define ISR_TXEMP_I 0x02 /* Transmitter empty interrupt */
+#define ISR_FEND_I 0x04
+#define ISR_DMA_I 0x10
+#define ISR_TXTH_I 0x20 /* Transmitter threshold interrupt */
+#define ISR_FSF_I 0x40
+#define ISR_TMR_I 0x80 /* Timer interrupt */
+
+#define UCR 0x03 /* Uart control register */
+#define UCR_DLS8 0x03 /* 8N1 */
+
+#define SSR 0x03 /* Sets select register */
+#define SET0 UCR_DLS8 /* Make sure we keep 8N1 */
+#define SET1 (0x80|UCR_DLS8) /* Make sure we keep 8N1 */
+#define SET2 0xE0
+#define SET3 0xE4
+#define SET4 0xE8
+#define SET5 0xEC
+#define SET6 0xF0
+#define SET7 0xF4
+
+#define HCR 0x04
+#define HCR_MODE_MASK ~(0xD0)
+#define HCR_SIR 0x60
+#define HCR_MIR_576 0x20
+#define HCR_MIR_1152 0x80
+#define HCR_FIR 0xA0
+#define HCR_EN_DMA 0x04
+#define HCR_EN_IRQ 0x08
+#define HCR_TX_WT 0x08
+
+#define USR 0x05 /* IR status register */
+#define USR_RDR 0x01 /* Receive data ready */
+#define USR_TSRE 0x40 /* Transmitter empty? */
+
+#define AUDR 0x07
+#define AUDR_SFEND 0x08 /* Set a frame end */
+#define AUDR_RXBSY 0x20 /* Rx busy */
+#define AUDR_UNDR 0x40 /* Transeiver underrun */
+
+/* Set 2 */
+#define ABLL 0x00 /* Advanced baud rate divisor latch (low byte) */
+#define ABHL 0x01 /* Advanced baud rate divisor latch (high byte) */
+
+#define ADCR1 0x02
+#define ADCR1_ADV_SL 0x01
+#define ADCR1_D_CHSW 0x08 /* the specs are wrong. its bit 3, not 4 */
+#define ADCR1_DMA_F 0x02
+
+#define ADCR2 0x04
+#define ADCR2_TXFS32 0x01
+#define ADCR2_RXFS32 0x04
+
+#define RXFDTH 0x07
+
+/* Set 3 */
+#define AUID 0x00
+
+/* Set 4 */
+#define TMRL 0x00 /* Timer value register (low byte) */
+#define TMRH 0x01 /* Timer value register (high byte) */
+
+#define IR_MSL 0x02 /* Infrared mode select */
+#define IR_MSL_EN_TMR 0x01 /* Enable timer */
+
+#define TFRLL 0x04 /* Transmitter frame length (low byte) */
+#define TFRLH 0x05 /* Transmitter frame length (high byte) */
+#define RFRLL 0x06 /* Receiver frame length (low byte) */
+#define RFRLH 0x07 /* Receiver frame length (high byte) */
+
+/* Set 5 */
+
+#define FS_FO 0x05 /* Frame status FIFO */
+#define FS_FO_FSFDR 0x80 /* Frame status FIFO data ready */
+#define FS_FO_LST_FR 0x40 /* Frame lost */
+#define FS_FO_MX_LEX 0x10 /* Max frame len exceeded */
+#define FS_FO_PHY_ERR 0x08 /* Physical layer error */
+#define FS_FO_CRC_ERR 0x04
+#define FS_FO_RX_OV 0x02 /* Receive overrun */
+#define FS_FO_FSF_OV 0x01 /* Frame status FIFO overrun */
+#define FS_FO_ERR_MSK 0x5f /* Error mask */
+
+#define RFLFL 0x06
+#define RFLFH 0x07
+
+/* Set 6 */
+#define IR_CFG2 0x00
+#define IR_CFG2_DIS_CRC 0x02
+
+/* Set 7 */
+#define IRM_CR 0x07 /* Infrared module control register */
+#define IRM_CR_IRX_MSL 0x40
+#define IRM_CR_AF_MNT 0x80 /* Automatic format */
+
+static inline void switch_bank( int iobase, int set)
+{
+ outb( set, iobase+SSR);
+}
+
+#endif
diff --git a/include/net/irda/wrapper.h b/include/net/irda/wrapper.h
new file mode 100644
index 000000000..838713f31
--- /dev/null
+++ b/include/net/irda/wrapper.h
@@ -0,0 +1,57 @@
+/*********************************************************************
+ *
+ * Filename: wrapper.h
+ * Version:
+ * Description: IrDA Wrapper layer
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Aug 4 20:40:53 1997
+ * Modified at: Thu Nov 19 13:17:56 1998
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * Neither Dag Brattli nor University of Tromsų admit liability nor
+ * provide warranty for any of this software. This material is
+ * provided "AS-IS" and at no charge.
+ *
+ ********************************************************************/
+
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#include "irda_device.h"
+
+#define BOF 0xc0 /* Beginning of frame */
+#define XBOF 0xff
+#define EOF 0xc1 /* End of frame */
+#define CE 0x7d /* Control escape */
+
+#define STA BOF /* Start flag */
+#define STO EOF /* End flag */
+
+#define IR_TRANS 0x20 /* Asynchronous transparency modifier */
+
+#define SOP BOF /* Start of */
+#define EOP EOF /* End of */
+
+enum {
+ OUTSIDE_FRAME = 1,
+ BEGIN_FRAME,
+ LINK_ESCAPE,
+ INSIDE_FRAME
+};
+
+/* Proto definitions */
+int async_wrap_skb( struct sk_buff *skb, __u8 *tx_buff, int buffsize);
+void async_unwrap_char( struct irda_device *, __u8 byte);
+
+#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index a9cc39260..c03168f4b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -128,6 +128,11 @@ struct ipx_opt {
unsigned char node[IPX_NODE_LEN];
#endif
unsigned short type;
+/*
+ * To handle special ncp connection-handling sockets for mars_nwe,
+ * the connection number must be stored in the socket.
+ */
+ unsigned short ipx_ncp_conn;
};
#endif
@@ -273,6 +278,7 @@ struct tcp_opt {
char saw_tstamp; /* Saw TIMESTAMP on last packet */
__u8 snd_wscale; /* Window scaling received from sender */
__u8 rcv_wscale; /* Window scaling to send to receiver */
+ __u8 rexmt_done; /* Retransmitted up to send head? */
__u32 rcv_tsval; /* Time stamp value */
__u32 rcv_tsecr; /* Time stamp echo reply */
__u32 ts_recent; /* Time stamp to echo next */
@@ -905,7 +911,7 @@ extern void net_timer (unsigned long);
* Enable debug/info messages
*/
-#if 0
+#if 1
#define NETDEBUG(x) do { } while (0)
#else
#define NETDEBUG(x) do { x; } while (0)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 2ebee4e0d..5da07ba9d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -813,8 +813,9 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb)
/* This tells the input processing path that an ACK should go out
* right now.
*/
-#define tcp_enter_quickack_mode(__tp) ((__tp)->ato = (HZ/100))
-#define tcp_in_quickack_mode(__tp) ((__tp)->ato == (HZ/100))
+#define tcp_enter_quickack_mode(__tp) ((__tp)->ato |= (1<<31))
+#define tcp_exit_quickack_mode(__tp) ((__tp)->ato &= ~(1<<31))
+#define tcp_in_quickack_mode(__tp) (((__tp)->ato & (1 << 31)) != 0)
/*
* List all states of a TCP socket that can be viewed as a "connected"