irlap_event.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*********************************************************************
  2. *
  3. *
  4. * Filename: irlap_event.h
  5. * Version: 0.1
  6. * Description:
  7. * Status: Experimental.
  8. * Author: Dag Brattli <dagb@cs.uit.no>
  9. * Created at: Sat Aug 16 00:59:29 1997
  10. * Modified at: Tue Dec 21 11:20:30 1999
  11. * Modified by: Dag Brattli <dagb@cs.uit.no>
  12. *
  13. * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
  14. * All Rights Reserved.
  15. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
  16. *
  17. * This program is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU General Public License as
  19. * published by the Free Software Foundation; either version 2 of
  20. * the License, or (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  30. * MA 02111-1307 USA
  31. *
  32. ********************************************************************/
  33. #ifndef IRLAP_EVENT_H
  34. #define IRLAP_EVENT_H
  35. #include <net/irda/irda.h>
  36. /* A few forward declarations (to make compiler happy) */
  37. struct irlap_cb;
  38. struct irlap_info;
  39. /* IrLAP States */
  40. typedef enum {
  41. LAP_NDM, /* Normal disconnected mode */
  42. LAP_QUERY,
  43. LAP_REPLY,
  44. LAP_CONN, /* Connect indication */
  45. LAP_SETUP, /* Setting up connection */
  46. LAP_OFFLINE, /* A really boring state */
  47. LAP_XMIT_P,
  48. LAP_PCLOSE,
  49. LAP_NRM_P, /* Normal response mode as primary */
  50. LAP_RESET_WAIT,
  51. LAP_RESET,
  52. LAP_NRM_S, /* Normal response mode as secondary */
  53. LAP_XMIT_S,
  54. LAP_SCLOSE,
  55. LAP_RESET_CHECK,
  56. } IRLAP_STATE;
  57. /* IrLAP Events */
  58. typedef enum {
  59. /* Services events */
  60. DISCOVERY_REQUEST,
  61. CONNECT_REQUEST,
  62. CONNECT_RESPONSE,
  63. DISCONNECT_REQUEST,
  64. DATA_REQUEST,
  65. RESET_REQUEST,
  66. RESET_RESPONSE,
  67. /* Send events */
  68. SEND_I_CMD,
  69. SEND_UI_FRAME,
  70. /* Receive events */
  71. RECV_DISCOVERY_XID_CMD,
  72. RECV_DISCOVERY_XID_RSP,
  73. RECV_SNRM_CMD,
  74. RECV_TEST_CMD,
  75. RECV_TEST_RSP,
  76. RECV_UA_RSP,
  77. RECV_DM_RSP,
  78. RECV_RD_RSP,
  79. RECV_I_CMD,
  80. RECV_I_RSP,
  81. RECV_UI_FRAME,
  82. RECV_FRMR_RSP,
  83. RECV_RR_CMD,
  84. RECV_RR_RSP,
  85. RECV_RNR_CMD,
  86. RECV_RNR_RSP,
  87. RECV_REJ_CMD,
  88. RECV_REJ_RSP,
  89. RECV_SREJ_CMD,
  90. RECV_SREJ_RSP,
  91. RECV_DISC_CMD,
  92. /* Timer events */
  93. SLOT_TIMER_EXPIRED,
  94. QUERY_TIMER_EXPIRED,
  95. FINAL_TIMER_EXPIRED,
  96. POLL_TIMER_EXPIRED,
  97. DISCOVERY_TIMER_EXPIRED,
  98. WD_TIMER_EXPIRED,
  99. BACKOFF_TIMER_EXPIRED,
  100. MEDIA_BUSY_TIMER_EXPIRED,
  101. } IRLAP_EVENT;
  102. /*
  103. * Disconnect reason code
  104. */
  105. typedef enum { /* FIXME check the two first reason codes */
  106. LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
  107. LAP_NO_RESPONSE, /* To many retransmits without response */
  108. LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */
  109. LAP_FOUND_NONE, /* No devices were discovered */
  110. LAP_MEDIA_BUSY,
  111. LAP_PRIMARY_CONFLICT,
  112. } LAP_REASON;
  113. extern const char *const irlap_state[];
  114. void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
  115. struct sk_buff *skb, struct irlap_info *info);
  116. void irlap_print_event(IRLAP_EVENT event);
  117. extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
  118. #endif