summaryrefslogtreecommitdiffstats
path: root/include/net/irda/irda.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/irda/irda.h')
-rw-r--r--include/net/irda/irda.h214
1 files changed, 150 insertions, 64 deletions
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 22458aa0b..35c15fadc 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -6,7 +6,7 @@
* 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 at: Wed Apr 21 17:49:00 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998 Dag Brattli, All Rights Reserved.
@@ -22,11 +22,15 @@
*
********************************************************************/
-#ifndef IRDA_H
-#define IRDA_H
+#ifndef NET_IRDA_H
+#define NET_IRDA_H
#include <linux/config.h>
#include <linux/skbuff.h>
+#include <linux/kernel.h>
+
+#include <net/irda/qos.h>
+#include <net/irda/irqueue.h>
#ifndef TRUE
#define TRUE 1
@@ -39,14 +43,15 @@
#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
+/* use 0 for production, 1 for verification, >2 for debug */
+#define IRDA_DEBUG_LEVEL 0
-#define DEBUG(n, args...) if (irda_debug >= (n)) printk( KERN_DEBUG args)
+#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",\
@@ -57,46 +62,11 @@ if(!(expr)) { \
#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 WARNING(args...) printk(KERN_WARNING args)
+#define MESSAGE(args...) printk(KERN_INFO args)
+#define ERROR(args...) printk(KERN_ERR args)
-#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 */
+#define MSECS_TO_JIFFIES(ms) (ms*HZ/1000)
/*
* Magic numbers used by Linux/IR. Random numbers which must be unique to
@@ -117,39 +87,155 @@ if( check_skb) {\
#define IAS_OBJECT_MAGIC 0x34234
#define IAS_ATTRIB_MAGIC 0x45232
-#define IAS_DEVICE_ID 0x5342
+#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 */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
+/* IrDA Socket */
+struct tsap_cb;
+struct irda_sock {
+ __u32 saddr; /* my local address */
+ __u32 daddr; /* peer address */
+ struct ias_object *ias_obj;
+ struct tsap_cb *tsap; /* TSAP used by this connection */
+ __u8 dtsap_sel; /* remote TSAP address */
+ __u8 stsap_sel; /* local TSAP address */
+
+ __u32 max_sdu_size_rx;
+ __u32 max_sdu_size_tx;
+ struct qos_info qos_tx;
+ __u16 mask; /* Hint bits mask */
+ __u16 hints; /* Hint bits */
+ __u32 ckey; /* IrLMP client handle */
+ __u32 skey; /* IrLMP service handle */
+ int nslots; /* Number of slots to use for discovery */
+ int errno;
+ struct sock *sk;
+ struct wait_queue *ias_wait; /* Wait for LM-IAS answer */
+ LOCAL_FLOW tx_flow;
+ LOCAL_FLOW rx_flow;
+};
+/*
+ * 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;
+};
+
+/* Misc status information */
+typedef enum {
+ STATUS_OK,
+ STATUS_ABORTED,
+ STATUS_NO_ACTIVITY,
+ STATUS_NOISY,
+ STATUS_REMOTE,
+} LINK_STATUS;
+
+typedef enum {
+ LOCK_NO_CHANGE,
+ LOCK_LOCKED,
+ LOCK_UNLOCKED,
+} LOCK_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_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */
+ LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */
+ LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */
+ LM_CONN_HALF_OPEN, /* Connection is half open */
+ LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */
+} LM_REASON;
+#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */
+/*
+ * Notify structure used between transport and link management layers
+ */
+struct notify_t {
+ int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
+ int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
+ void (*connect_confirm)(void *instance, void *sap,
+ struct qos_info *qos, __u32 max_sdu_size,
+ struct sk_buff *skb);
+ void (*connect_indication)(void *instance, void *sap,
+ struct qos_info *qos, __u32 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
+
+#endif /* NET_IRDA_H */