irnet.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. /*
  2. * IrNET protocol module : Synchronous PPP over an IrDA socket.
  3. *
  4. * Jean II - HPL `00 - <jt@hpl.hp.com>
  5. *
  6. * This file contains definitions and declarations global to the IrNET module,
  7. * all grouped in one place...
  8. * This file is a *private* header, so other modules don't want to know
  9. * what's in there...
  10. *
  11. * Note : as most part of the Linux kernel, this module is available
  12. * under the GNU General Public License (GPL).
  13. */
  14. #ifndef IRNET_H
  15. #define IRNET_H
  16. /************************** DOCUMENTATION ***************************/
  17. /*
  18. * What is IrNET
  19. * -------------
  20. * IrNET is a protocol allowing to carry TCP/IP traffic between two
  21. * IrDA peers in an efficient fashion. It is a thin layer, passing PPP
  22. * packets to IrTTP and vice versa. It uses PPP in synchronous mode,
  23. * because IrTTP offer a reliable sequenced packet service (as opposed
  24. * to a byte stream). In fact, you could see IrNET as carrying TCP/IP
  25. * in a IrDA socket, using PPP to provide the glue.
  26. *
  27. * The main difference with traditional PPP over IrCOMM is that we
  28. * avoid the framing and serial emulation which are a performance
  29. * bottleneck. It also allows multipoint communications in a sensible
  30. * fashion.
  31. *
  32. * The main difference with IrLAN is that we use PPP for the link
  33. * management, which is more standard, interoperable and flexible than
  34. * the IrLAN protocol. For example, PPP adds authentication,
  35. * encryption, compression, header compression and automated routing
  36. * setup. And, as IrNET let PPP do the hard work, the implementation
  37. * is much simpler than IrLAN.
  38. *
  39. * The Linux implementation
  40. * ------------------------
  41. * IrNET is written on top of the Linux-IrDA stack, and interface with
  42. * the generic Linux PPP driver. Because IrNET depend on recent
  43. * changes of the PPP driver interface, IrNET will work only with very
  44. * recent kernel (2.3.99-pre6 and up).
  45. *
  46. * The present implementation offer the following features :
  47. * o simple user interface using pppd
  48. * o efficient implementation (interface directly to PPP and IrTTP)
  49. * o addressing (you can specify the name of the IrNET recipient)
  50. * o multipoint operation (limited by IrLAP specification)
  51. * o information in /proc/net/irda/irnet
  52. * o IrNET events on /dev/irnet (for user space daemon)
  53. * o IrNET daemon (irnetd) to automatically handle incoming requests
  54. * o Windows 2000 compatibility (tested, but need more work)
  55. * Currently missing :
  56. * o Lot's of testing (that's your job)
  57. * o Connection retries (may be too hard to do)
  58. * o Check pppd persist mode
  59. * o User space daemon (to automatically handle incoming requests)
  60. *
  61. * The setup is not currently the most easy, but this should get much
  62. * better when everything will get integrated...
  63. *
  64. * Acknowledgements
  65. * ----------------
  66. * This module is based on :
  67. * o The PPP driver (ppp_synctty/ppp_generic) by Paul Mackerras
  68. * o The IrLAN protocol (irlan_common/XXX) by Dag Brattli
  69. * o The IrSock interface (af_irda) by Dag Brattli
  70. * o Some other bits from the kernel and my drivers...
  71. * Infinite thanks to those brave souls for providing the infrastructure
  72. * upon which IrNET is built.
  73. *
  74. * Thanks to all my colleagues in HP for helping me. In particular,
  75. * thanks to Salil Pradhan and Bill Serra for W2k testing...
  76. * Thanks to Luiz Magalhaes for irnetd and much testing...
  77. *
  78. * Thanks to Alan Cox for answering lot's of my stupid questions, and
  79. * to Paul Mackerras answering my questions on how to best integrate
  80. * IrNET and pppd.
  81. *
  82. * Jean II
  83. *
  84. * Note on some implementations choices...
  85. * ------------------------------------
  86. * 1) Direct interface vs tty/socket
  87. * I could have used a tty interface to hook to ppp and use the full
  88. * socket API to connect to IrDA. The code would have been easier to
  89. * maintain, and maybe the code would have been smaller...
  90. * Instead, we hook directly to ppp_generic and to IrTTP, which make
  91. * things more complicated...
  92. *
  93. * The first reason is flexibility : this allow us to create IrNET
  94. * instances on demand (no /dev/ircommX crap) and to allow linkname
  95. * specification on pppd command line...
  96. *
  97. * Second reason is speed optimisation. If you look closely at the
  98. * transmit and receive paths, you will notice that they are "super lean"
  99. * (that's why they look ugly), with no function calls and as little data
  100. * copy and modification as I could...
  101. *
  102. * 2) irnetd in user space
  103. * irnetd is implemented in user space, which is necessary to call pppd.
  104. * This also give maximum benefits in term of flexibility and customability,
  105. * and allow to offer the event channel, useful for other stuff like debug.
  106. *
  107. * On the other hand, this require a loose coordination between the
  108. * present module and irnetd. One critical area is how incoming request
  109. * are handled.
  110. * When irnet receive an incoming request, it send an event to irnetd and
  111. * drop the incoming IrNET socket.
  112. * irnetd start a pppd instance, which create a new IrNET socket. This new
  113. * socket is then connected in the originating node to the pppd instance.
  114. * At this point, in the originating node, the first socket is closed.
  115. *
  116. * I admit, this is a bit messy and waste some resources. The alternative
  117. * is caching incoming socket, and that's also quite messy and waste
  118. * resources.
  119. * We also make connection time slower. For example, on a 115 kb/s link it
  120. * adds 60ms to the connection time (770 ms). However, this is slower than
  121. * the time it takes to fire up pppd on my P133...
  122. *
  123. *
  124. * History :
  125. * -------
  126. *
  127. * v1 - 15.5.00 - Jean II
  128. * o Basic IrNET (hook to ppp_generic & IrTTP - incl. multipoint)
  129. * o control channel on /dev/irnet (set name/address)
  130. * o event channel on /dev/irnet (for user space daemon)
  131. *
  132. * v2 - 5.6.00 - Jean II
  133. * o Enable DROP_NOT_READY to avoid PPP timeouts & other weirdness...
  134. * o Add DISCONNECT_TO event and rename DISCONNECT_FROM.
  135. * o Set official device number alloaction on /dev/irnet
  136. *
  137. * v3 - 30.8.00 - Jean II
  138. * o Update to latest Linux-IrDA changes :
  139. * - queue_t => irda_queue_t
  140. * o Update to ppp-2.4.0 :
  141. * - move irda_irnet_connect from PPPIOCATTACH to TIOCSETD
  142. * o Add EXPIRE event (depend on new IrDA-Linux patch)
  143. * o Switch from `hashbin_remove' to `hashbin_remove_this' to fix
  144. * a multilink bug... (depend on new IrDA-Linux patch)
  145. * o fix a self->daddr to self->raddr in irda_irnet_connect to fix
  146. * another multilink bug (darn !)
  147. * o Remove LINKNAME_IOCTL cruft
  148. *
  149. * v3b - 31.8.00 - Jean II
  150. * o Dump discovery log at event channel startup
  151. *
  152. * v4 - 28.9.00 - Jean II
  153. * o Fix interaction between poll/select and dump discovery log
  154. * o Add IRNET_BLOCKED_LINK event (depend on new IrDA-Linux patch)
  155. * o Add IRNET_NOANSWER_FROM event (mostly to help support)
  156. * o Release flow control in disconnect_indication
  157. * o Block packets while connecting (speed up connections)
  158. *
  159. * v5 - 11.01.01 - Jean II
  160. * o Init self->max_header_size, just in case...
  161. * o Set up ap->chan.hdrlen, to get zero copy on tx side working.
  162. * o avoid tx->ttp->flow->ppp->tx->... loop, by checking flow state
  163. * Thanks to Christian Gennerat for finding this bug !
  164. * ---
  165. * o Declare the proper MTU/MRU that we can support
  166. * (but PPP doesn't read the MTU value :-()
  167. * o Declare hashbin HB_NOLOCK instead of HB_LOCAL to avoid
  168. * disabling and enabling irq twice
  169. *
  170. * v6 - 31.05.01 - Jean II
  171. * o Print source address in Found, Discovery, Expiry & Request events
  172. * o Print requested source address in /proc/net/irnet
  173. * o Change control channel input. Allow multiple commands in one line.
  174. * o Add saddr command to change ap->rsaddr (and use that in IrDA)
  175. * ---
  176. * o Make the IrDA connection procedure totally asynchronous.
  177. * Heavy rewrite of the IAS query code and the whole connection
  178. * procedure. Now, irnet_connect() no longer need to be called from
  179. * a process context...
  180. * o Enable IrDA connect retries in ppp_irnet_send(). The good thing
  181. * is that IrDA connect retries are directly driven by PPP LCP
  182. * retries (we retry for each LCP packet), so that everything
  183. * is transparently controlled from pppd lcp-max-configure.
  184. * o Add ttp_connect flag to prevent rentry on the connect procedure
  185. * o Test and fixups to eliminate side effects of retries
  186. *
  187. * v7 - 22.08.01 - Jean II
  188. * o Cleanup : Change "saddr = 0x0" to "saddr = DEV_ADDR_ANY"
  189. * o Fix bug in BLOCK_WHEN_CONNECT introduced in v6 : due to the
  190. * asynchronous IAS query, self->tsap is NULL when PPP send the
  191. * first packet. This was preventing "connect-delay 0" to work.
  192. * Change the test in ppp_irnet_send() to self->ttp_connect.
  193. *
  194. * v8 - 1.11.01 - Jean II
  195. * o Tighten the use of self->ttp_connect and self->ttp_open to
  196. * prevent various race conditions.
  197. * o Avoid leaking discovery log and skb
  198. * o Replace "self" with "server" in irnet_connect_indication() to
  199. * better detect cut'n'paste error ;-)
  200. *
  201. * v9 - 29.11.01 - Jean II
  202. * o Fix event generation in disconnect indication that I broke in v8
  203. * It was always generation "No-Answer" because I was testing ttp_open
  204. * just after clearing it. *blush*.
  205. * o Use newly created irttp_listen() to fix potential crash when LAP
  206. * destroyed before irnet module removed.
  207. *
  208. * v10 - 4.3.2 - Jean II
  209. * o When receiving a disconnect indication, don't reenable the
  210. * PPP Tx queue, this will trigger a reconnect. Instead, close
  211. * the channel, which will kill pppd...
  212. *
  213. * v11 - 20.3.02 - Jean II
  214. * o Oops ! v10 fix disabled IrNET retries and passive behaviour.
  215. * Better fix in irnet_disconnect_indication() :
  216. * - if connected, kill pppd via hangup.
  217. * - if not connected, reenable ppp Tx, which trigger IrNET retry.
  218. *
  219. * v12 - 10.4.02 - Jean II
  220. * o Fix race condition in irnet_connect_indication().
  221. * If the socket was already trying to connect, drop old connection
  222. * and use new one only if acting as primary. See comments.
  223. *
  224. * v13 - 30.5.02 - Jean II
  225. * o Update module init code
  226. *
  227. * v14 - 20.2.03 - Jean II
  228. * o Add discovery hint bits in the control channel.
  229. * o Remove obsolete MOD_INC/DEC_USE_COUNT in favor of .owner
  230. *
  231. * v15 - 7.4.03 - Jean II
  232. * o Replace spin_lock_irqsave() with spin_lock_bh() so that we can
  233. * use ppp_unit_number(). It's probably also better overall...
  234. * o Disable call to ppp_unregister_channel(), because we can't do it.
  235. */
  236. /***************************** INCLUDES *****************************/
  237. #include <linux/module.h>
  238. #include <linux/kernel.h>
  239. #include <linux/skbuff.h>
  240. #include <linux/tty.h>
  241. #include <linux/proc_fs.h>
  242. #include <linux/netdevice.h>
  243. #include <linux/miscdevice.h>
  244. #include <linux/poll.h>
  245. #include <linux/capability.h>
  246. #include <linux/ctype.h> /* isspace() */
  247. #include <linux/string.h> /* skip_spaces() */
  248. #include <asm/uaccess.h>
  249. #include <linux/init.h>
  250. #include <linux/ppp_defs.h>
  251. #include <linux/ppp-ioctl.h>
  252. #include <linux/ppp_channel.h>
  253. #include <net/irda/irda.h>
  254. #include <net/irda/iriap.h>
  255. #include <net/irda/irias_object.h>
  256. #include <net/irda/irlmp.h>
  257. #include <net/irda/irttp.h>
  258. #include <net/irda/discovery.h>
  259. /***************************** OPTIONS *****************************/
  260. /*
  261. * Define or undefine to compile or not some optional part of the
  262. * IrNET driver...
  263. * Note : the present defaults make sense, play with that at your
  264. * own risk...
  265. */
  266. /* IrDA side of the business... */
  267. #define DISCOVERY_NOMASK /* To enable W2k compatibility... */
  268. #define ADVERTISE_HINT /* Advertise IrLAN hint bit */
  269. #define ALLOW_SIMULT_CONNECT /* This seem to work, cross fingers... */
  270. #define DISCOVERY_EVENTS /* Query the discovery log to post events */
  271. #define INITIAL_DISCOVERY /* Dump current discovery log as events */
  272. #undef STREAM_COMPAT /* Not needed - potentially messy */
  273. #undef CONNECT_INDIC_KICK /* Might mess IrDA, not needed */
  274. #undef FAIL_SEND_DISCONNECT /* Might mess IrDA, not needed */
  275. #undef PASS_CONNECT_PACKETS /* Not needed ? Safe */
  276. #undef MISSING_PPP_API /* Stuff I wish I could do */
  277. /* PPP side of the business */
  278. #define BLOCK_WHEN_CONNECT /* Block packets when connecting */
  279. #define CONNECT_IN_SEND /* Retry IrDA connection procedure */
  280. #undef FLUSH_TO_PPP /* Not sure about this one, let's play safe */
  281. #undef SECURE_DEVIRNET /* Bah... */
  282. /****************************** DEBUG ******************************/
  283. /*
  284. * This set of flags enable and disable all the various warning,
  285. * error and debug message of this driver.
  286. * Each section can be enabled and disabled independently
  287. */
  288. /* In the PPP part */
  289. #define DEBUG_CTRL_TRACE 0 /* Control channel */
  290. #define DEBUG_CTRL_INFO 0 /* various info */
  291. #define DEBUG_CTRL_ERROR 1 /* problems */
  292. #define DEBUG_FS_TRACE 0 /* filesystem callbacks */
  293. #define DEBUG_FS_INFO 0 /* various info */
  294. #define DEBUG_FS_ERROR 1 /* problems */
  295. #define DEBUG_PPP_TRACE 0 /* PPP related functions */
  296. #define DEBUG_PPP_INFO 0 /* various info */
  297. #define DEBUG_PPP_ERROR 1 /* problems */
  298. #define DEBUG_MODULE_TRACE 0 /* module insertion/removal */
  299. #define DEBUG_MODULE_ERROR 1 /* problems */
  300. /* In the IrDA part */
  301. #define DEBUG_IRDA_SR_TRACE 0 /* IRDA subroutines */
  302. #define DEBUG_IRDA_SR_INFO 0 /* various info */
  303. #define DEBUG_IRDA_SR_ERROR 1 /* problems */
  304. #define DEBUG_IRDA_SOCK_TRACE 0 /* IRDA main socket functions */
  305. #define DEBUG_IRDA_SOCK_INFO 0 /* various info */
  306. #define DEBUG_IRDA_SOCK_ERROR 1 /* problems */
  307. #define DEBUG_IRDA_SERV_TRACE 0 /* The IrNET server */
  308. #define DEBUG_IRDA_SERV_INFO 0 /* various info */
  309. #define DEBUG_IRDA_SERV_ERROR 1 /* problems */
  310. #define DEBUG_IRDA_TCB_TRACE 0 /* IRDA IrTTP callbacks */
  311. #define DEBUG_IRDA_CB_INFO 0 /* various info */
  312. #define DEBUG_IRDA_CB_ERROR 1 /* problems */
  313. #define DEBUG_IRDA_OCB_TRACE 0 /* IRDA other callbacks */
  314. #define DEBUG_IRDA_OCB_INFO 0 /* various info */
  315. #define DEBUG_IRDA_OCB_ERROR 1 /* problems */
  316. #define DEBUG_ASSERT 0 /* Verify all assertions */
  317. /*
  318. * These are the macros we are using to actually print the debug
  319. * statements. Don't look at it, it's ugly...
  320. *
  321. * One of the trick is that, as the DEBUG_XXX are constant, the
  322. * compiler will optimise away the if() in all cases.
  323. */
  324. /* All error messages (will show up in the normal logs) */
  325. #define DERROR(dbg, format, args...) \
  326. {if(DEBUG_##dbg) \
  327. printk(KERN_INFO "irnet: %s(): " format, __func__ , ##args);}
  328. /* Normal debug message (will show up in /var/log/debug) */
  329. #define DEBUG(dbg, format, args...) \
  330. {if(DEBUG_##dbg) \
  331. printk(KERN_DEBUG "irnet: %s(): " format, __func__ , ##args);}
  332. /* Entering a function (trace) */
  333. #define DENTER(dbg, format, args...) \
  334. {if(DEBUG_##dbg) \
  335. printk(KERN_DEBUG "irnet: -> %s" format, __func__ , ##args);}
  336. /* Entering and exiting a function in one go (trace) */
  337. #define DPASS(dbg, format, args...) \
  338. {if(DEBUG_##dbg) \
  339. printk(KERN_DEBUG "irnet: <>%s" format, __func__ , ##args);}
  340. /* Exiting a function (trace) */
  341. #define DEXIT(dbg, format, args...) \
  342. {if(DEBUG_##dbg) \
  343. printk(KERN_DEBUG "irnet: <-%s()" format, __func__ , ##args);}
  344. /* Exit a function with debug */
  345. #define DRETURN(ret, dbg, args...) \
  346. {DEXIT(dbg, ": " args);\
  347. return ret; }
  348. /* Exit a function on failed condition */
  349. #define DABORT(cond, ret, dbg, args...) \
  350. {if(cond) {\
  351. DERROR(dbg, args);\
  352. return ret; }}
  353. /* Invalid assertion, print out an error and exit... */
  354. #define DASSERT(cond, ret, dbg, args...) \
  355. {if((DEBUG_ASSERT) && !(cond)) {\
  356. DERROR(dbg, "Invalid assertion: " args);\
  357. return ret; }}
  358. /************************ CONSTANTS & MACROS ************************/
  359. /* Paranoia */
  360. #define IRNET_MAGIC 0xB00754
  361. /* Number of control events in the control channel buffer... */
  362. #define IRNET_MAX_EVENTS 8 /* Should be more than enough... */
  363. /****************************** TYPES ******************************/
  364. /*
  365. * This is the main structure where we store all the data pertaining to
  366. * one instance of irnet.
  367. * Note : in irnet functions, a pointer this structure is usually called
  368. * "ap" or "self". If the code is borrowed from the IrDA stack, it tend
  369. * to be called "self", and if it is borrowed from the PPP driver it is
  370. * "ap". Apart from that, it's exactly the same structure ;-)
  371. */
  372. typedef struct irnet_socket
  373. {
  374. /* ------------------- Instance management ------------------- */
  375. /* We manage a linked list of IrNET socket instances */
  376. irda_queue_t q; /* Must be first - for hasbin */
  377. int magic; /* Paranoia */
  378. /* --------------------- FileSystem part --------------------- */
  379. /* "pppd" interact directly with us on a /dev/ file */
  380. struct file * file; /* File descriptor of this instance */
  381. /* TTY stuff - to keep "pppd" happy */
  382. struct ktermios termios; /* Various tty flags */
  383. /* Stuff for the control channel */
  384. int event_index; /* Last read in the event log */
  385. /* ------------------------- PPP part ------------------------- */
  386. /* We interface directly to the ppp_generic driver in the kernel */
  387. int ppp_open; /* registered with ppp_generic */
  388. struct ppp_channel chan; /* Interface to generic ppp layer */
  389. int mru; /* Max size of PPP payload */
  390. u32 xaccm[8]; /* Asynchronous character map (just */
  391. u32 raccm; /* to please pppd - dummy) */
  392. unsigned int flags; /* PPP flags (compression, ...) */
  393. unsigned int rbits; /* Unused receive flags ??? */
  394. struct work_struct disconnect_work; /* Process context disconnection */
  395. /* ------------------------ IrTTP part ------------------------ */
  396. /* We create a pseudo "socket" over the IrDA tranport */
  397. unsigned long ttp_open; /* Set when IrTTP is ready */
  398. unsigned long ttp_connect; /* Set when IrTTP is connecting */
  399. struct tsap_cb * tsap; /* IrTTP instance (the connection) */
  400. char rname[NICKNAME_MAX_LEN + 1];
  401. /* IrDA nickname of destination */
  402. __u32 rdaddr; /* Requested peer IrDA address */
  403. __u32 rsaddr; /* Requested local IrDA address */
  404. __u32 daddr; /* actual peer IrDA address */
  405. __u32 saddr; /* my local IrDA address */
  406. __u8 dtsap_sel; /* Remote TSAP selector */
  407. __u8 stsap_sel; /* Local TSAP selector */
  408. __u32 max_sdu_size_rx;/* Socket parameters used for IrTTP */
  409. __u32 max_sdu_size_tx;
  410. __u32 max_data_size;
  411. __u8 max_header_size;
  412. LOCAL_FLOW tx_flow; /* State of the Tx path in IrTTP */
  413. /* ------------------- IrLMP and IrIAS part ------------------- */
  414. /* Used for IrDA Discovery and socket name resolution */
  415. void * ckey; /* IrLMP client handle */
  416. __u16 mask; /* Hint bits mask (filter discov.)*/
  417. int nslots; /* Number of slots for discovery */
  418. struct iriap_cb * iriap; /* Used to query remote IAS */
  419. int errno; /* status of the IAS query */
  420. /* -------------------- Discovery log part -------------------- */
  421. /* Used by initial discovery on the control channel
  422. * and by irnet_discover_daddr_and_lsap_sel() */
  423. struct irda_device_info *discoveries; /* Copy of the discovery log */
  424. int disco_index; /* Last read in the discovery log */
  425. int disco_number; /* Size of the discovery log */
  426. struct mutex lock;
  427. } irnet_socket;
  428. /*
  429. * This is the various event that we will generate on the control channel
  430. */
  431. typedef enum irnet_event
  432. {
  433. IRNET_DISCOVER, /* New IrNET node discovered */
  434. IRNET_EXPIRE, /* IrNET node expired */
  435. IRNET_CONNECT_TO, /* IrNET socket has connected to other node */
  436. IRNET_CONNECT_FROM, /* Other node has connected to IrNET socket */
  437. IRNET_REQUEST_FROM, /* Non satisfied connection request */
  438. IRNET_NOANSWER_FROM, /* Failed connection request */
  439. IRNET_BLOCKED_LINK, /* Link (IrLAP) is blocked for > 3s */
  440. IRNET_DISCONNECT_FROM, /* IrNET socket has disconnected */
  441. IRNET_DISCONNECT_TO /* Closing IrNET socket */
  442. } irnet_event;
  443. /*
  444. * This is the storage for an event and its arguments
  445. */
  446. typedef struct irnet_log
  447. {
  448. irnet_event event;
  449. int unit;
  450. __u32 saddr;
  451. __u32 daddr;
  452. char name[NICKNAME_MAX_LEN + 1]; /* 21 + 1 */
  453. __u16_host_order hints; /* Discovery hint bits */
  454. } irnet_log;
  455. /*
  456. * This is the storage for all events and related stuff...
  457. */
  458. typedef struct irnet_ctrl_channel
  459. {
  460. irnet_log log[IRNET_MAX_EVENTS]; /* Event log */
  461. int index; /* Current index in log */
  462. spinlock_t spinlock; /* Serialize access to the event log */
  463. wait_queue_head_t rwait; /* processes blocked on read (or poll) */
  464. } irnet_ctrl_channel;
  465. /**************************** PROTOTYPES ****************************/
  466. /*
  467. * Global functions of the IrNET module
  468. * Note : we list here also functions called from one file to the other.
  469. */
  470. /* -------------------------- IRDA PART -------------------------- */
  471. int irda_irnet_create(irnet_socket *); /* Initialise an IrNET socket */
  472. int irda_irnet_connect(irnet_socket *); /* Try to connect over IrDA */
  473. void irda_irnet_destroy(irnet_socket *); /* Teardown an IrNET socket */
  474. int irda_irnet_init(void); /* Initialise IrDA part of IrNET */
  475. void irda_irnet_cleanup(void); /* Teardown IrDA part of IrNET */
  476. /**************************** VARIABLES ****************************/
  477. /* Control channel stuff - allocated in irnet_irda.h */
  478. extern struct irnet_ctrl_channel irnet_events;
  479. #endif /* IRNET_H */