irlap_event.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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-2001 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. #include <net/irda/discovery.h>
  37. struct irlap_cb;
  38. /* IrLAP States */
  39. typedef enum {
  40. LAP_NDM,         /* Normal disconnected mode */
  41. LAP_QUERY,
  42. LAP_REPLY,
  43. LAP_CONN,        /* Connect indication */
  44. LAP_SETUP,       /* Setting up connection */
  45. LAP_OFFLINE,     /* A really boring state */
  46. LAP_XMIT_P,
  47. LAP_PCLOSE,
  48. LAP_NRM_P,       /* Normal response mode as primary */
  49. LAP_RESET_WAIT,
  50. LAP_RESET,
  51. LAP_NRM_S,       /* Normal response mode as secondary */
  52. LAP_XMIT_S,
  53. LAP_SCLOSE,
  54. LAP_RESET_CHECK,
  55. } IRLAP_STATE;
  56. /* IrLAP Events */
  57. typedef enum {
  58. /* Services events */
  59. DISCOVERY_REQUEST,
  60. CONNECT_REQUEST,
  61. CONNECT_RESPONSE,
  62. DISCONNECT_REQUEST,
  63. DATA_REQUEST,
  64. RESET_REQUEST,
  65. RESET_RESPONSE,
  66. /* Send events */
  67. SEND_I_CMD,
  68. SEND_UI_FRAME,
  69. /* Receive events */
  70. RECV_DISCOVERY_XID_CMD,
  71. RECV_DISCOVERY_XID_RSP,
  72. RECV_SNRM_CMD,
  73. RECV_TEST_CMD,
  74. RECV_TEST_RSP,
  75. RECV_UA_RSP,
  76. RECV_DM_RSP,
  77. RECV_RD_RSP,
  78. RECV_I_CMD,
  79. RECV_I_RSP,
  80. RECV_UI_FRAME,
  81. RECV_FRMR_RSP,
  82. RECV_RR_CMD,
  83. RECV_RR_RSP,
  84. RECV_RNR_CMD,
  85. RECV_RNR_RSP,
  86. RECV_REJ_CMD,
  87. RECV_REJ_RSP,
  88. RECV_SREJ_CMD,
  89. RECV_SREJ_RSP,
  90. RECV_DISC_CMD,
  91. /* Timer events */
  92. SLOT_TIMER_EXPIRED,
  93. QUERY_TIMER_EXPIRED,
  94. FINAL_TIMER_EXPIRED,
  95. POLL_TIMER_EXPIRED,
  96. DISCOVERY_TIMER_EXPIRED,
  97. WD_TIMER_EXPIRED,
  98. BACKOFF_TIMER_EXPIRED,
  99. MEDIA_BUSY_TIMER_EXPIRED,
  100. } IRLAP_EVENT;
  101. /*
  102.  *  Various things used by the IrLAP state machine
  103.  */
  104. struct irlap_info {
  105. __u8 caddr;   /* Connection address */
  106. __u8 control; /* Frame type */
  107.         __u8 cmd;
  108. __u32 saddr;
  109. __u32 daddr;
  110. int pf;        /* Poll/final bit set */
  111. __u8  nr;      /* Sequence number of next frame expected */
  112. __u8  ns;      /* Sequence number of frame sent */
  113. int  S;        /* Number of slots */
  114. int  slot;     /* Random chosen slot */
  115. int  s;        /* Current slot */
  116. discovery_t *discovery; /* Discovery information */
  117. };
  118. extern const char *irlap_state[];
  119. void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, 
  120.     struct sk_buff *skb, struct irlap_info *info);
  121. void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state);
  122. void irlap_print_event(IRLAP_EVENT event);
  123. extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
  124. #endif