1 /*********************************************************************
2  *
3  * Filename:      irlmp_event.h
4  * Version:       0.1
5  * Description:   IrDA-LMP event handling
6  * Status:        Experimental.
7  * Author:        Dag Brattli <dagb@cs.uit.no>
8  * Created at:    Mon Aug  4 20:40:53 1997
9  * Modified at:   Thu Jul  8 12:18:54 1999
10  * Modified by:   Dag Brattli <dagb@cs.uit.no>
11  *
12  *     Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
13  *     All Rights Reserved.
14  *     Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
15  *
16  *     This program is free software; you can redistribute it and/or
17  *     modify it under the terms of the GNU General Public License as
18  *     published by the Free Software Foundation; either version 2 of
19  *     the License, or (at your option) any later version.
20  *
21  *     Neither Dag Brattli nor University of Troms� admit liability nor
22  *     provide warranty for any of this software. This material is
23  *     provided "AS-IS" and at no charge.
24  *
25  ********************************************************************/
26 
27 #ifndef IRLMP_EVENT_H
28 #define IRLMP_EVENT_H
29 
30 struct irlmp_cb;
31 struct lsap_cb;
32 struct lap_cb;
33 
34 /* LAP states */
35 typedef enum {
36 	/* IrLAP connection control states */
37 	LAP_STANDBY,             /* No LAP connection */
38 	LAP_U_CONNECT,           /* Starting LAP connection */
39 	LAP_ACTIVE,              /* LAP connection is active */
40 } IRLMP_STATE;
41 
42 /* LSAP connection control states */
43 typedef enum {
44 	LSAP_DISCONNECTED,        /* No LSAP connection */
45 	LSAP_CONNECT,             /* Connect indication from peer */
46 	LSAP_CONNECT_PEND,        /* Connect request from service user */
47 	LSAP_DATA_TRANSFER_READY, /* LSAP connection established */
48 	LSAP_SETUP,               /* Trying to set up LSAP connection */
49 	LSAP_SETUP_PEND,          /* Request to start LAP connection */
50 } LSAP_STATE;
51 
52 typedef enum {
53 	/* LSAP events */
54  	LM_CONNECT_REQUEST,
55  	LM_CONNECT_CONFIRM,
56 	LM_CONNECT_RESPONSE,
57  	LM_CONNECT_INDICATION,
58 
59 	LM_DISCONNECT_INDICATION,
60 	LM_DISCONNECT_REQUEST,
61 
62  	LM_DATA_REQUEST,
63 	LM_UDATA_REQUEST,
64  	LM_DATA_INDICATION,
65 	LM_UDATA_INDICATION,
66 
67 	LM_WATCHDOG_TIMEOUT,
68 
69 	/* IrLAP events */
70 	LM_LAP_CONNECT_REQUEST,
71  	LM_LAP_CONNECT_INDICATION,
72  	LM_LAP_CONNECT_CONFIRM,
73  	LM_LAP_DISCONNECT_INDICATION,
74 	LM_LAP_DISCONNECT_REQUEST,
75 	LM_LAP_DISCOVERY_REQUEST,
76  	LM_LAP_DISCOVERY_CONFIRM,
77 	LM_LAP_IDLE_TIMEOUT,
78 } IRLMP_EVENT;
79 
80 /*
81  *  Information which is used by the current thread, when executing in the
82  *  state machine.
83  */
84 struct irlmp_event {
85 	IRLMP_EVENT *event;
86 	struct sk_buff *skb;
87 
88 	__u8 hint;
89 	__u32 daddr;
90 	__u32 saddr;
91 
92 	__u8 slsap;
93 	__u8 dlsap;
94 
95 	int reason;
96 
97 	discovery_t *discovery;
98 };
99 
100 extern const char *irlmp_state[];
101 extern const char *irlsap_state[];
102 
103 void irlmp_watchdog_timer_expired(void *data);
104 void irlmp_discovery_timer_expired(void *data);
105 void irlmp_idle_timer_expired(void *data);
106 
107 void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
108 			struct sk_buff *skb);
109 int irlmp_do_lsap_event(struct lsap_cb *self, IRLMP_EVENT event,
110 			struct sk_buff *skb);
111 
112 #endif /* IRLMP_EVENT_H */
113 
114 
115 
116 
117