irmod.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*********************************************************************
  2. *
  3. * Filename: irmod.h
  4. * Version: 0.3
  5. * Description: IrDA module and utilities functions
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  8. * Created at: Mon Dec 15 13:58:52 1997
  9. * Modified at: Fri Jan 28 13:15:24 2000
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
  13. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
  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 charg.
  23. *
  24. ********************************************************************/
  25. #ifndef IRMOD_H
  26. #define IRMOD_H
  27. /* Misc status information */
  28. typedef enum {
  29. STATUS_OK,
  30. STATUS_ABORTED,
  31. STATUS_NO_ACTIVITY,
  32. STATUS_NOISY,
  33. STATUS_REMOTE,
  34. } LINK_STATUS;
  35. typedef enum {
  36. LOCK_NO_CHANGE,
  37. LOCK_LOCKED,
  38. LOCK_UNLOCKED,
  39. } LOCK_STATUS;
  40. typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
  41. /*
  42. * IrLMP disconnect reasons. The order is very important, since they
  43. * correspond to disconnect reasons sent in IrLMP disconnect frames, so
  44. * please do not touch :-)
  45. */
  46. typedef enum {
  47. LM_USER_REQUEST = 1, /* User request */
  48. LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */
  49. LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */
  50. LM_LAP_RESET, /* IrLAP reset */
  51. LM_INIT_DISCONNECT, /* Link Management initiated disconnect */
  52. LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */
  53. LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */
  54. LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */
  55. LM_CONN_HALF_OPEN, /* Connection is half open */
  56. LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */
  57. } LM_REASON;
  58. #define LM_UNKNOWN 0xff /* Unspecified disconnect reason */
  59. /* A few forward declarations (to make compiler happy) */
  60. struct qos_info; /* in <net/irda/qos.h> */
  61. /*
  62. * Notify structure used between transport and link management layers
  63. */
  64. typedef struct {
  65. int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
  66. int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
  67. void (*connect_confirm)(void *instance, void *sap,
  68. struct qos_info *qos, __u32 max_sdu_size,
  69. __u8 max_header_size, struct sk_buff *skb);
  70. void (*connect_indication)(void *instance, void *sap,
  71. struct qos_info *qos, __u32 max_sdu_size,
  72. __u8 max_header_size, struct sk_buff *skb);
  73. void (*disconnect_indication)(void *instance, void *sap,
  74. LM_REASON reason, struct sk_buff *);
  75. void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
  76. void (*status_indication)(void *instance,
  77. LINK_STATUS link, LOCK_STATUS lock);
  78. void *instance; /* Layer instance pointer */
  79. char name[16]; /* Name of layer */
  80. } notify_t;
  81. #define NOTIFY_MAX_NAME 16
  82. /* Zero the notify structure */
  83. void irda_notify_init(notify_t *notify);
  84. /* Locking wrapper - Note the inverted logic on irda_lock().
  85. * Those function basically return false if the lock is already in the
  86. * position you want to set it. - Jean II */
  87. #define irda_lock(lock) (! test_and_set_bit(0, (void *) (lock)))
  88. #define irda_unlock(lock) (test_and_clear_bit(0, (void *) (lock)))
  89. #endif /* IRMOD_H */