00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef NET_IRDA_H
00026 #define NET_IRDA_H
00027
00028 #include <linux/config.h>
00029 #include <linux/skbuff.h>
00030 #include <linux/kernel.h>
00031 #include <linux/if.h>
00032 #include <linux/irda.h>
00033
00034 typedef __u32 magic_t;
00035
00036 #include <net/irda/qos.h>
00037 #include <net/irda/irqueue.h>
00038
00039 #ifndef TRUE
00040 #define TRUE 1
00041 #endif
00042
00043 #ifndef FALSE
00044 #define FALSE 0
00045 #endif
00046
00047 #ifndef IRDA_MIN
00048 #define IRDA_MIN(a, b) (((a) < (b)) ? (a) : (b))
00049 #endif
00050
00051 #ifndef ALIGN
00052 # define ALIGN __attribute__((aligned))
00053 #endif
00054 #ifndef PACK
00055 # define PACK __attribute__((packed))
00056 #endif
00057
00058
00059 #ifdef CONFIG_IRDA_DEBUG
00060
00061 extern __u32 irda_debug;
00062
00063
00064 #define IRDA_DEBUG_LEVEL 0
00065
00066 #define IRDA_DEBUG(n, args...) (irda_debug >= (n)) ? (printk(KERN_DEBUG args)) : 0
00067 #define ASSERT(expr, func) \
00068 if(!(expr)) { \
00069 printk( "Assertion failed! %s,%s,%s,line=%d\n",\
00070 #expr,__FILE__,__FUNCTION__,__LINE__); \
00071 ##func}
00072 #else
00073 #define IRDA_DEBUG(n, args...)
00074 #define ASSERT(expr, func)
00075 #endif
00076
00077 #define WARNING(args...) printk(KERN_WARNING args)
00078 #define MESSAGE(args...) printk(KERN_INFO args)
00079 #define ERROR(args...) printk(KERN_ERR args)
00080
00081 #define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
00082
00083
00084
00085
00086
00087
00088 #define IRTTY_MAGIC 0x2357
00089 #define LAP_MAGIC 0x1357
00090 #define LMP_MAGIC 0x4321
00091 #define LMP_LSAP_MAGIC 0x69333
00092 #define LMP_LAP_MAGIC 0x3432
00093 #define IRDA_DEVICE_MAGIC 0x63454
00094 #define IAS_MAGIC 0x007
00095 #define TTP_MAGIC 0x241169
00096 #define TTP_TSAP_MAGIC 0x4345
00097 #define IROBEX_MAGIC 0x341324
00098 #define HB_MAGIC 0x64534
00099 #define IRLAN_MAGIC 0x754
00100 #define IAS_OBJECT_MAGIC 0x34234
00101 #define IAS_ATTRIB_MAGIC 0x45232
00102 #define IRDA_TASK_MAGIC 0x38423
00103
00104 #define IAS_DEVICE_ID 0x0000
00105 #define IAS_PNP_ID 0xd342
00106 #define IAS_OBEX_ID 0x34323
00107 #define IAS_IRLAN_ID 0x34234
00108 #define IAS_IRCOMM_ID 0x2343
00109 #define IAS_IRLPT_ID 0x9876
00110
00111 typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
00112
00113
00114 struct tsap_cb;
00115 struct irda_sock {
00116 __u32 saddr;
00117 __u32 daddr;
00118
00119 struct lsap_cb *lsap;
00120 __u8 pid;
00121
00122 struct tsap_cb *tsap;
00123 __u8 dtsap_sel;
00124 __u8 stsap_sel;
00125
00126 __u32 max_sdu_size_rx;
00127 __u32 max_sdu_size_tx;
00128 __u32 max_data_size;
00129 __u8 max_header_size;
00130 struct qos_info qos_tx;
00131
00132 __u16 mask;
00133 __u16 hints;
00134
00135 __u32 ckey;
00136 __u32 skey;
00137
00138 struct ias_object *ias_obj;
00139 struct iriap_cb *iriap;
00140 struct ias_value *ias_result;
00141
00142 int nslots;
00143
00144 int errno;
00145
00146 struct sock *sk;
00147 struct wait_queue *ias_wait;
00148
00149 LOCAL_FLOW tx_flow;
00150 LOCAL_FLOW rx_flow;
00151 };
00152
00153
00154
00155
00156
00157
00158
00159 typedef union {
00160 __u16 word;
00161 __u8 byte[2];
00162 } __u16_host_order;
00163
00164
00165
00166
00167
00168 struct irda_skb_cb {
00169 magic_t magic;
00170 __u32 speed;
00171 __u16 mtt;
00172 int xbofs;
00173 __u8 line;
00174 void (*destructor)(struct sk_buff *skb);
00175 };
00176
00177
00178 typedef enum {
00179 STATUS_OK,
00180 STATUS_ABORTED,
00181 STATUS_NO_ACTIVITY,
00182 STATUS_NOISY,
00183 STATUS_REMOTE,
00184 } LINK_STATUS;
00185
00186 typedef enum {
00187 LOCK_NO_CHANGE,
00188 LOCK_LOCKED,
00189 LOCK_UNLOCKED,
00190 } LOCK_STATUS;
00191
00192 typedef enum {
00193 LAP_DISC_INDICATION=1,
00194 LAP_NO_RESPONSE,
00195 LAP_RESET_INDICATION,
00196 LAP_FOUND_NONE,
00197 LAP_MEDIA_BUSY,
00198 LAP_PRIMARY_CONFLICT,
00199 } LAP_REASON;
00200
00201
00202
00203
00204
00205
00206 typedef enum {
00207 LM_USER_REQUEST = 1,
00208 LM_LAP_DISCONNECT,
00209 LM_CONNECT_FAILURE,
00210 LM_LAP_RESET,
00211 LM_INIT_DISCONNECT,
00212 LM_LSAP_NOTCONN,
00213 LM_NON_RESP_CLIENT,
00214 LM_NO_AVAIL_CLIENT,
00215 LM_CONN_HALF_OPEN,
00216 LM_BAD_SOURCE_ADDR,
00217 } LM_REASON;
00218 #define LM_UNKNOWN 0xff
00219
00220
00221
00222
00223 typedef struct {
00224 int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
00225 int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
00226 void (*connect_confirm)(void *instance, void *sap,
00227 struct qos_info *qos, __u32 max_sdu_size,
00228 __u8 max_header_size, struct sk_buff *skb);
00229 void (*connect_indication)(void *instance, void *sap,
00230 struct qos_info *qos, __u32 max_sdu_size,
00231 __u8 max_header_size, struct sk_buff *skb);
00232 void (*disconnect_indication)(void *instance, void *sap,
00233 LM_REASON reason, struct sk_buff *);
00234 void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
00235 void *instance;
00236 char name[16];
00237 } notify_t;
00238
00239 #define NOTIFY_MAX_NAME 16
00240
00241 #endif