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

Linux Cross Reference
Linux/include/net/irda/irlap.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:      irlap.h
  4  * Version:       0.8
  5  * Description:   An IrDA LAP driver for Linux
  6  * Status:        Experimental.
  7  * Author:        Dag Brattli <dagb@cs.uit.no>
  8  * Created at:    Mon Aug  4 20:40:53 1997
  9  * Modified at:   Fri Dec 10 13:21:17 1999
 10  * Modified by:   Dag Brattli <dagb@cs.uit.no>
 11  * 
 12  *     Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 
 13  *     All Rights Reserved.
 14  *     
 15  *     This program is free software; you can redistribute it and/or 
 16  *     modify it under the terms of the GNU General Public License as 
 17  *     published by the Free Software Foundation; either version 2 of 
 18  *     the License, or (at your option) any later version.
 19  *
 20  *     Neither Dag Brattli nor University of Tromsų admit liability nor
 21  *     provide warranty for any of this software. This material is 
 22  *     provided "AS-IS" and at no charge.
 23  *
 24  ********************************************************************/
 25 
 26 #ifndef IRLAP_H
 27 #define IRLAP_H
 28 
 29 #include <linux/config.h>
 30 #include <linux/types.h>
 31 #include <linux/skbuff.h>
 32 #include <linux/netdevice.h>
 33 #include <linux/ppp_defs.h>
 34 #include <linux/ppp-comp.h>
 35 #include <linux/timer.h>
 36 
 37 #include <net/irda/irlap_event.h>
 38 
 39 #define CONFIG_IRDA_DYNAMIC_WINDOW 1
 40 
 41 #define LAP_RELIABLE   1
 42 #define LAP_UNRELIABLE 0
 43 
 44 #define LAP_ADDR_HEADER 1  /* IrLAP Address Header */
 45 #define LAP_CTRL_HEADER 1  /* IrLAP Control Header */
 46 #define LAP_COMP_HEADER 1  /* IrLAP Compression Header */
 47 
 48 #ifdef CONFIG_IRDA_COMPRESSION
 49 #  define LAP_MAX_HEADER  (LAP_ADDR_HEADER + LAP_CTRL_HEADER + LAP_COMP_HEADER)
 50 #  define IRDA_COMPRESSED 1
 51 #  define IRDA_NORMAL     0
 52 #else
 53 #define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER)
 54 #endif
 55 
 56 #define BROADCAST  0xffffffff /* Broadcast device address */
 57 #define CBROADCAST 0xfe       /* Connection broadcast address */
 58 #define XID_FORMAT 0x01       /* Discovery XID format */
 59 
 60 #define LAP_WINDOW_SIZE 8
 61 #define LAP_MAX_QUEUE  10
 62 
 63 #define NR_EXPECTED     1
 64 #define NR_UNEXPECTED   0
 65 #define NR_INVALID     -1
 66 
 67 #define NS_EXPECTED     1
 68 #define NS_UNEXPECTED   0
 69 #define NS_INVALID     -1
 70 
 71 #ifdef CONFIG_IRDA_COMPRESSION
 72 
 73 /*  
 74  *  Just some shortcuts (may give you strange compiler errors if you change 
 75  *  them :-)
 76  */
 77 #define irda_compress    (*self->compessor.cp->compress)
 78 #define irda_comp_free   (*self->compressor.cp->comp_free)
 79 #define irda_decompress  (*self->decompressor.cp->decompress)
 80 #define irda_decomp_free (*self->decompressor.cp->decomp_free)
 81 #define irda_incomp      (*self->decompressor.cp->incomp)
 82 
 83 struct irda_compressor {
 84         irda_queue_t q;
 85 
 86         struct compressor *cp;
 87         void *state; /* Not used by IrDA */
 88 };
 89 #endif
 90 
 91 /* Main structure of IrLAP */
 92 struct irlap_cb {
 93         irda_queue_t q;     /* Must be first */
 94         magic_t magic;
 95 
 96         struct net_device  *netdev;
 97 
 98         /* Connection state */
 99         volatile IRLAP_STATE state;       /* Current state */
100 
101         /* Timers used by IrLAP */
102         struct timer_list query_timer;
103         struct timer_list slot_timer;
104         struct timer_list discovery_timer;
105         struct timer_list final_timer;
106         struct timer_list poll_timer;
107         struct timer_list wd_timer;
108         struct timer_list backoff_timer;
109 
110         /* Media busy stuff */
111         struct timer_list media_busy_timer;
112         int media_busy;
113 
114         /* Timeouts which will be different with different turn time */
115         int slot_timeout;
116         int poll_timeout;
117         int final_timeout;
118         int wd_timeout;
119 
120         struct sk_buff_head txq;  /* Frames to be transmitted */
121         struct sk_buff_head txq_ultra;
122 
123         __u8    caddr;        /* Connection address */
124         __u32   saddr;        /* Source device address */
125         __u32   daddr;        /* Destination device address */
126 
127         int     retry_count;  /* Times tried to establish connection */
128         int     add_wait;     /* True if we are waiting for frame */
129 
130         __u8    connect_pending;
131         __u8    disconnect_pending;
132 
133         /*  To send a faster RR if tx queue empty */
134 #ifdef CONFIG_IRDA_FAST_RR
135         int     fast_RR_timeout;
136         int     fast_RR;      
137 #endif /* CONFIG_IRDA_FAST_RR */
138         
139         int N1; /* N1 * F-timer = Negitiated link disconnect warning threshold */
140         int N2; /* N2 * F-timer = Negitiated link disconnect time */
141         int N3; /* Connection retry count */
142 
143         int     local_busy;
144         int     remote_busy;
145         int     xmitflag;
146 
147         __u8    vs;            /* Next frame to be sent */
148         __u8    vr;            /* Next frame to be received */
149         __u8    va;            /* Last frame acked */
150         int     window;        /* Nr of I-frames allowed to send */
151         int     window_size;   /* Current negotiated window size */
152 
153 #ifdef CONFIG_IRDA_DYNAMIC_WINDOW
154         __u32   line_capacity; /* Number of bytes allowed to send */
155         __u32   bytes_left;    /* Number of bytes still allowed to transmit */
156 #endif /* CONFIG_IRDA_DYNAMIC_WINDOW */
157 
158         struct sk_buff_head wx_list;
159 
160         __u8    ack_required;
161         
162         /* XID parameters */
163         __u8    S;           /* Number of slots */
164         __u8    slot;        /* Random chosen slot */
165         __u8    s;           /* Current slot */
166         int     frame_sent;  /* Have we sent reply? */
167 
168         hashbin_t   *discovery_log;
169         discovery_t *discovery_cmd;
170 
171         __u32 speed; 
172 
173         struct qos_info  qos_tx;   /* QoS requested by peer */
174         struct qos_info  qos_rx;   /* QoS requested by self */
175         struct qos_info *qos_dev;  /* QoS supported by device */
176 
177         notify_t notify; /* Callbacks to IrLMP */
178 
179         int    mtt_required;  /* Minumum turnaround time required */
180         int    xbofs_delay;   /* Nr of XBOF's used to MTT */
181         int    bofs_count;    /* Negotiated extra BOFs */
182 
183 #ifdef CONFIG_IRDA_COMPRESSION
184         struct irda_compressor compressor;
185         struct irda_compressor decompressor;
186 #endif /* CONFIG_IRDA_COMPRESSION */
187 };
188 
189 extern hashbin_t *irlap;
190 
191 /* 
192  *  Function prototypes 
193  */
194 int irlap_init(void);
195 void irlap_cleanup(void);
196 
197 struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos);
198 void irlap_close(struct irlap_cb *self);
199 
200 void irlap_connect_request(struct irlap_cb *self, __u32 daddr, 
201                            struct qos_info *qos, int sniff);
202 void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb);
203 void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb);
204 void irlap_connect_confirm(struct irlap_cb *, struct sk_buff *skb);
205 
206 void irlap_data_indication(struct irlap_cb *, struct sk_buff *, int unreliable);
207 void irlap_data_request(struct irlap_cb *, struct sk_buff *, int unreliable);
208 
209 #ifdef CONFIG_IRDA_ULTRA
210 void irlap_unitdata_request(struct irlap_cb *, struct sk_buff *);
211 void irlap_unitdata_indication(struct irlap_cb *, struct sk_buff *);
212 #endif /* CONFIG_IRDA_ULTRA */
213 
214 void irlap_disconnect_request(struct irlap_cb *);
215 void irlap_disconnect_indication(struct irlap_cb *, LAP_REASON reason);
216 
217 void irlap_status_indication(struct irlap_cb *, int quality_of_link);
218 
219 void irlap_test_request(__u8 *info, int len);
220 
221 void irlap_discovery_request(struct irlap_cb *, discovery_t *discovery);
222 void irlap_discovery_confirm(struct irlap_cb *, hashbin_t *discovery_log);
223 void irlap_discovery_indication(struct irlap_cb *, discovery_t *discovery);
224 
225 void irlap_reset_indication(struct irlap_cb *self);
226 void irlap_reset_confirm(void);
227 
228 void irlap_update_nr_received(struct irlap_cb *, int nr);
229 int irlap_validate_nr_received(struct irlap_cb *, int nr);
230 int irlap_validate_ns_received(struct irlap_cb *, int ns);
231 
232 int  irlap_generate_rand_time_slot(int S, int s);
233 void irlap_initiate_connection_state(struct irlap_cb *);
234 void irlap_flush_all_queues(struct irlap_cb *);
235 void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now);
236 void irlap_wait_min_turn_around(struct irlap_cb *, struct qos_info *);
237 
238 void irlap_init_qos_capabilities(struct irlap_cb *, struct qos_info *);
239 void irlap_apply_default_connection_parameters(struct irlap_cb *self);
240 void irlap_apply_connection_parameters(struct irlap_cb *self);
241 void irlap_set_local_busy(struct irlap_cb *self, int status);
242 
243 #define IRLAP_GET_HEADER_SIZE(self) 2 /* Will be different when we get VFIR */
244 #define IRLAP_GET_TX_QUEUE_LEN(self) skb_queue_len(&self->txq)
245 
246 #endif
247 

~ [ 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.