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 
34 #ifndef IRLAP_EVENT_H
35 #define IRLAP_EVENT_H
36 
37 #include <net/irda/irda.h>
38 
39 /* A few forward declarations (to make compiler happy) */
40 struct irlap_cb;
41 struct irlap_info;
42 
43 /* IrLAP States */
44 typedef enum {
45 	LAP_NDM,         /* Normal disconnected mode */
46 	LAP_QUERY,
47 	LAP_REPLY,
48 	LAP_CONN,        /* Connect indication */
49 	LAP_SETUP,       /* Setting up connection */
50 	LAP_OFFLINE,     /* A really boring state */
51 	LAP_XMIT_P,
52 	LAP_PCLOSE,
53 	LAP_NRM_P,       /* Normal response mode as primary */
54 	LAP_RESET_WAIT,
55 	LAP_RESET,
56 	LAP_NRM_S,       /* Normal response mode as secondary */
57 	LAP_XMIT_S,
58 	LAP_SCLOSE,
59 	LAP_RESET_CHECK,
60 } IRLAP_STATE;
61 
62 /* IrLAP Events */
63 typedef enum {
64 	/* Services events */
65 	DISCOVERY_REQUEST,
66 	CONNECT_REQUEST,
67 	CONNECT_RESPONSE,
68 	DISCONNECT_REQUEST,
69 	DATA_REQUEST,
70 	RESET_REQUEST,
71 	RESET_RESPONSE,
72 
73 	/* Send events */
74 	SEND_I_CMD,
75 	SEND_UI_FRAME,
76 
77 	/* Receive events */
78 	RECV_DISCOVERY_XID_CMD,
79 	RECV_DISCOVERY_XID_RSP,
80 	RECV_SNRM_CMD,
81 	RECV_TEST_CMD,
82 	RECV_TEST_RSP,
83 	RECV_UA_RSP,
84 	RECV_DM_RSP,
85 	RECV_RD_RSP,
86 	RECV_I_CMD,
87 	RECV_I_RSP,
88 	RECV_UI_FRAME,
89 	RECV_FRMR_RSP,
90 	RECV_RR_CMD,
91 	RECV_RR_RSP,
92 	RECV_RNR_CMD,
93 	RECV_RNR_RSP,
94 	RECV_REJ_CMD,
95 	RECV_REJ_RSP,
96 	RECV_SREJ_CMD,
97 	RECV_SREJ_RSP,
98 	RECV_DISC_CMD,
99 
100 	/* Timer events */
101 	SLOT_TIMER_EXPIRED,
102 	QUERY_TIMER_EXPIRED,
103 	FINAL_TIMER_EXPIRED,
104 	POLL_TIMER_EXPIRED,
105 	DISCOVERY_TIMER_EXPIRED,
106 	WD_TIMER_EXPIRED,
107 	BACKOFF_TIMER_EXPIRED,
108 	MEDIA_BUSY_TIMER_EXPIRED,
109 } IRLAP_EVENT;
110 
111 /*
112  * Disconnect reason code
113  */
114 typedef enum { /* FIXME check the two first reason codes */
115 	LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
116 	LAP_NO_RESPONSE,       /* To many retransmits without response */
117 	LAP_RESET_INDICATION,  /* To many retransmits, or invalid nr/ns */
118 	LAP_FOUND_NONE,        /* No devices were discovered */
119 	LAP_MEDIA_BUSY,
120 	LAP_PRIMARY_CONFLICT,
121 } LAP_REASON;
122 
123 extern const char *const irlap_state[];
124 
125 void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 		    struct sk_buff *skb, struct irlap_info *info);
127 void irlap_print_event(IRLAP_EVENT event);
128 
129 extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
130 
131 #endif
132