~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/net/irda/irda.h

Version: ~ [ 2.2.5 ] ~ [ 2.4.1 ] ~ [ 2.4.9 ] ~ [ 2.6.17.10 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*********************************************************************
  2  *                
  3  * Filename:      irda.h
  4  * Version:       1.0
  5  * Description:   IrDA common include file for kernel internal use
  6  * Status:        Stable
  7  * Author:        Dag Brattli <dagb@cs.uit.no>
  8  * Created at:    Tue Dec  9 21:13:12 1997
  9  * Modified at:   Fri Jan 28 13:16:32 2000
 10  * Modified by:   Dag Brattli <dagb@cs.uit.no>
 11  * 
 12  *     Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
 13  *      
 14  *     This program is free software; you can redistribute it and/or 
 15  *     modify it under the terms of the GNU General Public License as 
 16  *     published by the Free Software Foundation; either version 2 of 
 17  *     the License, or (at your option) any later version.
 18  *  
 19  *     Neither Dag Brattli nor University of Tromsų admit liability nor
 20  *     provide warranty for any of this software. This material is 
 21  *     provided "AS-IS" and at no charge.
 22  *     
 23  ********************************************************************/
 24 
 25 #ifndef NET_IRDA_H
 26 #define NET_IRDA_H
 27 
 28 #include <linux/config.h>
 29 #include <linux/skbuff.h>
 30 #include <linux/kernel.h>
 31 #include <linux/if.h>
 32 #include <linux/irda.h>
 33 
 34 typedef __u32 magic_t;
 35 
 36 #include <net/irda/qos.h>
 37 #include <net/irda/irqueue.h>
 38 
 39 #ifndef TRUE
 40 #define TRUE 1
 41 #endif
 42 
 43 #ifndef FALSE 
 44 #define FALSE 0
 45 #endif
 46 
 47 #ifndef IRDA_MIN /* Lets not mix this MIN with other header files */
 48 #define IRDA_MIN(a, b) (((a) < (b)) ? (a) : (b))
 49 #endif
 50 
 51 #ifndef ALIGN
 52 #  define ALIGN __attribute__((aligned))
 53 #endif
 54 #ifndef PACK
 55 #  define PACK __attribute__((packed))
 56 #endif
 57 
 58 
 59 #ifdef CONFIG_IRDA_DEBUG
 60 
 61 extern __u32 irda_debug;
 62 
 63 /* use 0 for production, 1 for verification, >2 for debug */
 64 #define IRDA_DEBUG_LEVEL 0
 65 
 66 #define IRDA_DEBUG(n, args...) (irda_debug >= (n)) ? (printk(KERN_DEBUG args)) : 0
 67 #define ASSERT(expr, func) \
 68 if(!(expr)) { \
 69         printk( "Assertion failed! %s:%s:%d %s\n", \
 70         __FILE__,__FUNCTION__,__LINE__,(#expr));  \
 71         func }
 72 #else
 73 #define IRDA_DEBUG(n, args...)
 74 #define ASSERT(expr, func)
 75 #endif /* CONFIG_IRDA_DEBUG */
 76 
 77 #define WARNING(args...) printk(KERN_WARNING args)
 78 #define MESSAGE(args...) printk(KERN_INFO args)
 79 #define ERROR(args...)   printk(KERN_ERR args)
 80 
 81 #define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
 82 
 83 /*
 84  *  Magic numbers used by Linux-IrDA. Random numbers which must be unique to 
 85  *  give the best protection
 86  */
 87 
 88 #define IRTTY_MAGIC        0x2357
 89 #define LAP_MAGIC          0x1357
 90 #define LMP_MAGIC          0x4321
 91 #define LMP_LSAP_MAGIC     0x69333
 92 #define LMP_LAP_MAGIC      0x3432
 93 #define IRDA_DEVICE_MAGIC  0x63454
 94 #define IAS_MAGIC          0x007
 95 #define TTP_MAGIC          0x241169
 96 #define TTP_TSAP_MAGIC     0x4345
 97 #define IROBEX_MAGIC       0x341324
 98 #define HB_MAGIC           0x64534
 99 #define IRLAN_MAGIC        0x754
100 #define IAS_OBJECT_MAGIC   0x34234
101 #define IAS_ATTRIB_MAGIC   0x45232
102 #define IRDA_TASK_MAGIC    0x38423
103 
104 #define IAS_DEVICE_ID 0x0000 /* Defined by IrDA, IrLMP section 4.1 (page 68) */
105 #define IAS_PNP_ID    0xd342
106 #define IAS_OBEX_ID   0x34323
107 #define IAS_IRLAN_ID  0x34234
108 #define IAS_IRCOMM_ID 0x2343
109 #define IAS_IRLPT_ID  0x9876
110 
111 typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
112 
113 /* A few forward declarations (to make compiler happy) */
114 struct tsap_cb;         /* in <net/irda/irttp.h> */
115 struct lsap_cb;         /* in <net/irda/irlmp.h> */
116 struct iriap_cb;        /* in <net/irda/iriap.h> */
117 struct ias_value;       /* in <net/irda/irias_object.h> */
118 struct discovery_t;     /* in <net/irda/discovery.h> */
119 
120 /* IrDA Socket */
121 struct irda_sock {
122         __u32 saddr;          /* my local address */
123         __u32 daddr;          /* peer address */
124 
125         struct lsap_cb *lsap; /* LSAP used by Ultra */
126         __u8  pid;            /* Protocol IP (PID) used by Ultra */
127 
128         struct tsap_cb *tsap; /* TSAP used by this connection */
129         __u8 dtsap_sel;       /* remote TSAP address */
130         __u8 stsap_sel;       /* local TSAP address */
131         
132         __u32 max_sdu_size_rx;
133         __u32 max_sdu_size_tx;
134         __u32 max_data_size;
135         __u8  max_header_size;
136         struct qos_info qos_tx;
137 
138         __u16 mask;           /* Hint bits mask */
139         __u16 hints;          /* Hint bits */
140 
141         __u32 ckey;           /* IrLMP client handle */
142         __u32 skey;           /* IrLMP service handle */
143 
144         struct ias_object *ias_obj;   /* Our service name + lsap in IAS */
145         struct iriap_cb *iriap;       /* Used to query remote IAS */
146         struct ias_value *ias_result; /* Result of remote IAS query */
147 
148         hashbin_t *cachelog;            /* Result of discovery query */
149         struct discovery_t *cachediscovery;     /* Result of selective discovery query */
150 
151         int nslots;           /* Number of slots to use for discovery */
152 
153         int errno;            /* status of the IAS query */
154 
155         struct sock *sk;
156         wait_queue_head_t query_wait;   /* Wait for the answer to a query */
157         struct timer_list watchdog;     /* Timeout for discovery */
158 
159         LOCAL_FLOW tx_flow;
160         LOCAL_FLOW rx_flow;
161 };
162 
163 /*
164  *  This type is used by the protocols that transmit 16 bits words in 
165  *  little endian format. A little endian machine stores MSB of word in
166  *  byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] 
167  *  and LSB in byte[1].
168  */
169 typedef union {
170         __u16 word;
171         __u8  byte[2];
172 } __u16_host_order;
173 
174 /* 
175  * Per-packet information we need to hide inside sk_buff 
176  * (must not exceed 48 bytes, check with struct sk_buff) 
177  */
178 struct irda_skb_cb {
179         magic_t magic;       /* Be sure that we can trust the information */
180         __u32   speed;       /* The Speed this frame should be sent with */
181         __u16   mtt;         /* Minimum turn around time */
182         __u16   xbofs;       /* Number of xbofs required, used by SIR mode */
183         void    *context;    /* May be used by drivers */
184         void    (*destructor)(struct sk_buff *skb); /* Used for flow control */
185         __u16   xbofs_delay; /* Number of xbofs used for generating the mtt */
186         __u8    line;        /* Used by IrCOMM in IrLPT mode */
187 };
188 
189 /* Misc status information */
190 typedef enum {
191         STATUS_OK,
192         STATUS_ABORTED,
193         STATUS_NO_ACTIVITY,
194         STATUS_NOISY,
195         STATUS_REMOTE,
196 } LINK_STATUS;
197 
198 typedef enum {
199         LOCK_NO_CHANGE,
200         LOCK_LOCKED,
201         LOCK_UNLOCKED,
202 } LOCK_STATUS;
203 
204 typedef enum { /* FIXME check the two first reason codes */
205         LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
206         LAP_NO_RESPONSE,       /* To many retransmits without response */
207         LAP_RESET_INDICATION,  /* To many retransmits, or invalid nr/ns */
208         LAP_FOUND_NONE,        /* No devices were discovered */
209         LAP_MEDIA_BUSY,
210         LAP_PRIMARY_CONFLICT,
211 } LAP_REASON;
212 
213 /*  
214  *  IrLMP disconnect reasons. The order is very important, since they 
215  *  correspond to disconnect reasons sent in IrLMP disconnect frames, so
216  *  please do not touch :-)
217  */
218 typedef enum {
219         LM_USER_REQUEST = 1,  /* User request */
220         LM_LAP_DISCONNECT,    /* Unexpected IrLAP disconnect */
221         LM_CONNECT_FAILURE,   /* Failed to establish IrLAP connection */
222         LM_LAP_RESET,         /* IrLAP reset */
223         LM_INIT_DISCONNECT,   /* Link Management initiated disconnect */
224         LM_LSAP_NOTCONN,      /* Data delivered on unconnected LSAP */
225         LM_NON_RESP_CLIENT,   /* Non responsive LM-MUX client */
226         LM_NO_AVAIL_CLIENT,   /* No available LM-MUX client */
227         LM_CONN_HALF_OPEN,    /* Connection is half open */
228         LM_BAD_SOURCE_ADDR,   /* Illegal source address (i.e 0x00) */
229 } LM_REASON;
230 #define LM_UNKNOWN 0xff       /* Unspecified disconnect reason */
231 
232 /*
233  *  Notify structure used between transport and link management layers
234  */
235 typedef struct {
236         int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
237         int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
238         void (*connect_confirm)(void *instance, void *sap, 
239                                 struct qos_info *qos, __u32 max_sdu_size,
240                                 __u8 max_header_size, struct sk_buff *skb);
241         void (*connect_indication)(void *instance, void *sap, 
242                                    struct qos_info *qos, __u32 max_sdu_size, 
243                                    __u8 max_header_size, struct sk_buff *skb);
244         void (*disconnect_indication)(void *instance, void *sap, 
245                                       LM_REASON reason, struct sk_buff *);
246         void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
247         void (*status_indication)(void *instance,
248                                   LINK_STATUS link, LOCK_STATUS lock);
249         void *instance; /* Layer instance pointer */
250         char name[16];  /* Name of layer */
251 } notify_t;
252 
253 #define NOTIFY_MAX_NAME 16
254 
255 #endif /* NET_IRDA_H */
256 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.