irnet.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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 collegues 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 <asm/uaccess.h>
  248. #include <linux/init.h>
  249. #include <linux/ppp_defs.h>
  250. #include <linux/if_ppp.h>
  251. #include <linux/ppp_channel.h>
  252. #include <net/irda/irda.h>
  253. #include <net/irda/iriap.h>
  254. #include <net/irda/irias_object.h>
  255. #include <net/irda/irlmp.h>
  256. #include <net/irda/irttp.h>
  257. #include <net/irda/discovery.h>
  258. /***************************** OPTIONS *****************************/
  259. /*
  260. * Define or undefine to compile or not some optional part of the
  261. * IrNET driver...
  262. * Note : the present defaults make sense, play with that at your
  263. * own risk...
  264. */
  265. /* IrDA side of the business... */
  266. #define DISCOVERY_NOMASK /* To enable W2k compatibility... */
  267. #define ADVERTISE_HINT /* Advertise IrLAN hint bit */
  268. #define ALLOW_SIMULT_CONNECT /* This seem to work, cross fingers... */
  269. #define DISCOVERY_EVENTS /* Query the discovery log to post events */
  270. #define INITIAL_DISCOVERY /* Dump current discovery log as events */
  271. #undef STREAM_COMPAT /* Not needed - potentially messy */
  272. #undef CONNECT_INDIC_KICK /* Might mess IrDA, not needed */
  273. #undef FAIL_SEND_DISCONNECT /* Might mess IrDA, not needed */
  274. #undef PASS_CONNECT_PACKETS /* Not needed ? Safe */
  275. #undef MISSING_PPP_API /* Stuff I wish I could do */
  276. /* PPP side of the business */
  277. #define BLOCK_WHEN_CONNECT /* Block packets when connecting */
  278. #define CONNECT_IN_SEND /* Retry IrDA connection procedure */
  279. #undef FLUSH_TO_PPP /* Not sure about this one, let's play safe */
  280. #undef SECURE_DEVIRNET /* Bah... */
  281. /****************************** DEBUG ******************************/
  282. /*
  283. * This set of flags enable and disable all the various warning,
  284. * error and debug message of this driver.
  285. * Each section can be enabled and disabled independently
  286. */
  287. /* In the PPP part */
  288. #define DEBUG_CTRL_TRACE 0 /* Control channel */
  289. #define DEBUG_CTRL_INFO 0 /* various info */
  290. #define DEBUG_CTRL_ERROR 1 /* problems */
  291. #define DEBUG_FS_TRACE 0 /* filesystem callbacks */
  292. #define DEBUG_FS_INFO 0 /* various info */
  293. #define DEBUG_FS_ERROR 1 /* problems */
  294. #define DEBUG_PPP_TRACE 0 /* PPP related functions */
  295. #define DEBUG_PPP_INFO 0 /* various info */
  296. #define DEBUG_PPP_ERROR 1 /* problems */
  297. #define DEBUG_MODULE_TRACE 0 /* module insertion/removal */
  298. #define DEBUG_MODULE_ERROR 1 /* problems */
  299. /* In the IrDA part */
  300. #define DEBUG_IRDA_SR_TRACE 0 /* IRDA subroutines */
  301. #define DEBUG_IRDA_SR_INFO 0 /* various info */
  302. #define DEBUG_IRDA_SR_ERROR 1 /* problems */
  303. #define DEBUG_IRDA_SOCK_TRACE 0 /* IRDA main socket functions */
  304. #define DEBUG_IRDA_SOCK_INFO 0 /* various info */
  305. #define DEBUG_IRDA_SOCK_ERROR 1 /* problems */
  306. #define DEBUG_IRDA_SERV_TRACE 0 /* The IrNET server */
  307. #define DEBUG_IRDA_SERV_INFO 0 /* various info */
  308. #define DEBUG_IRDA_SERV_ERROR 1 /* problems */
  309. #define DEBUG_IRDA_TCB_TRACE 0 /* IRDA IrTTP callbacks */
  310. #define DEBUG_IRDA_CB_INFO 0 /* various info */
  311. #define DEBUG_IRDA_CB_ERROR 1 /* problems */
  312. #define DEBUG_IRDA_OCB_TRACE 0 /* IRDA other callbacks */
  313. #define DEBUG_IRDA_OCB_INFO 0 /* various info */
  314. #define DEBUG_IRDA_OCB_ERROR 1 /* problems */
  315. #define DEBUG_ASSERT 0 /* Verify all assertions */
  316. /*
  317. * These are the macros we are using to actually print the debug
  318. * statements. Don't look at it, it's ugly...
  319. *
  320. * One of the trick is that, as the DEBUG_XXX are constant, the
  321. * compiler will optimise away the if() in all cases.
  322. */
  323. /* All error messages (will show up in the normal logs) */
  324. #define DERROR(dbg, format, args...) \
  325. {if(DEBUG_##dbg) \
  326. printk(KERN_INFO "irnet: %s(): " format, __FUNCTION__ , ##args);}
  327. /* Normal debug message (will show up in /var/log/debug) */
  328. #define DEBUG(dbg, format, args...) \
  329. {if(DEBUG_##dbg) \
  330. printk(KERN_DEBUG "irnet: %s(): " format, __FUNCTION__ , ##args);}
  331. /* Entering a function (trace) */
  332. #define DENTER(dbg, format, args...) \
  333. {if(DEBUG_##dbg) \
  334. printk(KERN_DEBUG "irnet: -> %s" format, __FUNCTION__ , ##args);}
  335. /* Entering and exiting a function in one go (trace) */
  336. #define DPASS(dbg, format, args...) \
  337. {if(DEBUG_##dbg) \
  338. printk(KERN_DEBUG "irnet: <>%s" format, __FUNCTION__ , ##args);}
  339. /* Exiting a function (trace) */
  340. #define DEXIT(dbg, format, args...) \
  341. {if(DEBUG_##dbg) \
  342. printk(KERN_DEBUG "irnet: <-%s()" format, __FUNCTION__ , ##args);}
  343. /* Exit a function with debug */
  344. #define DRETURN(ret, dbg, args...) \
  345. {DEXIT(dbg, ": " args);\
  346. return ret; }
  347. /* Exit a function on failed condition */
  348. #define DABORT(cond, ret, dbg, args...) \
  349. {if(cond) {\
  350. DERROR(dbg, args);\
  351. return ret; }}
  352. /* Invalid assertion, print out an error and exit... */
  353. #define DASSERT(cond, ret, dbg, args...) \
  354. {if((DEBUG_ASSERT) && !(cond)) {\
  355. DERROR(dbg, "Invalid assertion: " args);\
  356. return ret; }}
  357. /************************ CONSTANTS & MACROS ************************/
  358. /* Paranoia */
  359. #define IRNET_MAGIC 0xB00754
  360. /* Number of control events in the control channel buffer... */
  361. #define IRNET_MAX_EVENTS 8 /* Should be more than enough... */
  362. /****************************** TYPES ******************************/
  363. /*
  364. * This is the main structure where we store all the data pertaining to
  365. * one instance of irnet.
  366. * Note : in irnet functions, a pointer this structure is usually called
  367. * "ap" or "self". If the code is borrowed from the IrDA stack, it tend
  368. * to be called "self", and if it is borrowed from the PPP driver it is
  369. * "ap". Apart from that, it's exactly the same structure ;-)
  370. */
  371. typedef struct irnet_socket
  372. {
  373. /* ------------------- Instance management ------------------- */
  374. /* We manage a linked list of IrNET socket instances */
  375. irda_queue_t q; /* Must be first - for hasbin */
  376. int magic; /* Paranoia */
  377. /* --------------------- FileSystem part --------------------- */
  378. /* "pppd" interact directly with us on a /dev/ file */
  379. struct file * file; /* File descriptor of this instance */
  380. /* TTY stuff - to keep "pppd" happy */
  381. struct termios termios; /* Various tty flags */
  382. /* Stuff for the control channel */
  383. int event_index; /* Last read in the event log */
  384. /* ------------------------- PPP part ------------------------- */
  385. /* We interface directly to the ppp_generic driver in the kernel */
  386. int ppp_open; /* registered with ppp_generic */
  387. struct ppp_channel chan; /* Interface to generic ppp layer */
  388. int mru; /* Max size of PPP payload */
  389. u32 xaccm[8]; /* Asynchronous character map (just */
  390. u32 raccm; /* to please pppd - dummy) */
  391. unsigned int flags; /* PPP flags (compression, ...) */
  392. unsigned int rbits; /* Unused receive flags ??? */
  393. struct work_struct disconnect_work; /* Process context disconnection */
  394. /* ------------------------ IrTTP part ------------------------ */
  395. /* We create a pseudo "socket" over the IrDA tranport */
  396. unsigned long ttp_open; /* Set when IrTTP is ready */
  397. unsigned long ttp_connect; /* Set when IrTTP is connecting */
  398. struct tsap_cb * tsap; /* IrTTP instance (the connection) */
  399. char rname[NICKNAME_MAX_LEN + 1];
  400. /* IrDA nickname of destination */
  401. __u32 rdaddr; /* Requested peer IrDA address */
  402. __u32 rsaddr; /* Requested local IrDA address */
  403. __u32 daddr; /* actual peer IrDA address */
  404. __u32 saddr; /* my local IrDA address */
  405. __u8 dtsap_sel; /* Remote TSAP selector */
  406. __u8 stsap_sel; /* Local TSAP selector */
  407. __u32 max_sdu_size_rx;/* Socket parameters used for IrTTP */
  408. __u32 max_sdu_size_tx;
  409. __u32 max_data_size;
  410. __u8 max_header_size;
  411. LOCAL_FLOW tx_flow; /* State of the Tx path in IrTTP */
  412. /* ------------------- IrLMP and IrIAS part ------------------- */
  413. /* Used for IrDA Discovery and socket name resolution */
  414. void * ckey; /* IrLMP client handle */
  415. __u16 mask; /* Hint bits mask (filter discov.)*/
  416. int nslots; /* Number of slots for discovery */
  417. struct iriap_cb * iriap; /* Used to query remote IAS */
  418. int errno; /* status of the IAS query */
  419. /* -------------------- Discovery log part -------------------- */
  420. /* Used by initial discovery on the control channel
  421. * and by irnet_discover_daddr_and_lsap_sel() */
  422. struct irda_device_info *discoveries; /* Copy of the discovery log */
  423. int disco_index; /* Last read in the discovery log */
  424. int disco_number; /* Size of the discovery log */
  425. } irnet_socket;
  426. /*
  427. * This is the various event that we will generate on the control channel
  428. */
  429. typedef enum irnet_event
  430. {
  431. IRNET_DISCOVER, /* New IrNET node discovered */
  432. IRNET_EXPIRE, /* IrNET node expired */
  433. IRNET_CONNECT_TO, /* IrNET socket has connected to other node */
  434. IRNET_CONNECT_FROM, /* Other node has connected to IrNET socket */
  435. IRNET_REQUEST_FROM, /* Non satisfied connection request */
  436. IRNET_NOANSWER_FROM, /* Failed connection request */
  437. IRNET_BLOCKED_LINK, /* Link (IrLAP) is blocked for > 3s */
  438. IRNET_DISCONNECT_FROM, /* IrNET socket has disconnected */
  439. IRNET_DISCONNECT_TO /* Closing IrNET socket */
  440. } irnet_event;
  441. /*
  442. * This is the storage for an event and its arguments
  443. */
  444. typedef struct irnet_log
  445. {
  446. irnet_event event;
  447. int unit;
  448. __u32 saddr;
  449. __u32 daddr;
  450. char name[NICKNAME_MAX_LEN + 1]; /* 21 + 1 */
  451. __u16_host_order hints; /* Discovery hint bits */
  452. } irnet_log;
  453. /*
  454. * This is the storage for all events and related stuff...
  455. */
  456. typedef struct irnet_ctrl_channel
  457. {
  458. irnet_log log[IRNET_MAX_EVENTS]; /* Event log */
  459. int index; /* Current index in log */
  460. spinlock_t spinlock; /* Serialize access to the event log */
  461. wait_queue_head_t rwait; /* processes blocked on read (or poll) */
  462. } irnet_ctrl_channel;
  463. /**************************** PROTOTYPES ****************************/
  464. /*
  465. * Global functions of the IrNET module
  466. * Note : we list here also functions called from one file to the other.
  467. */
  468. /* -------------------------- IRDA PART -------------------------- */
  469. extern int
  470. irda_irnet_create(irnet_socket *); /* Initialise a IrNET socket */
  471. extern int
  472. irda_irnet_connect(irnet_socket *); /* Try to connect over IrDA */
  473. extern void
  474. irda_irnet_destroy(irnet_socket *); /* Teardown a IrNET socket */
  475. extern int
  476. irda_irnet_init(void); /* Initialise IrDA part of IrNET */
  477. extern void
  478. irda_irnet_cleanup(void); /* Teardown IrDA part of IrNET */
  479. /**************************** VARIABLES ****************************/
  480. /* Control channel stuff - allocated in irnet_irda.h */
  481. extern struct irnet_ctrl_channel irnet_events;
  482. #endif /* IRNET_H */