Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

irlap_event.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  *                
00004  * Filename:      irlap_event.h
00005  * Version:       0.1
00006  * Description:   
00007  * Status:        Experimental.
00008  * Author:        Dag Brattli <dagb@cs.uit.no>
00009  * Created at:    Sat Aug 16 00:59:29 1997
00010  * Modified at:   Tue Dec 21 11:20:30 1999
00011  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00012  * 
00013  *     Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 
00014  *     All Rights Reserved.
00015  *     
00016  *     This program is free software; you can redistribute it and/or 
00017  *     modify it under the terms of the GNU General Public License as 
00018  *     published by the Free Software Foundation; either version 2 of 
00019  *     the License, or (at your option) any later version.
00020  * 
00021  *     This program is distributed in the hope that it will be useful,
00022  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00024  *     GNU General Public License for more details.
00025  * 
00026  *     You should have received a copy of the GNU General Public License 
00027  *     along with this program; if not, write to the Free Software 
00028  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00029  *     MA 02111-1307 USA
00030  *     
00031  ********************************************************************/
00032 
00033 #ifndef IRLAP_EVENT_H
00034 #define IRLAP_EVENT_H
00035 
00036 #include <net/irda/irda.h>
00037 #include <net/irda/discovery.h>
00038 
00039 struct irlap_cb;
00040 
00041 /* IrLAP States */
00042 typedef enum {
00043         LAP_NDM,         /* Normal disconnected mode */
00044         LAP_QUERY,
00045         LAP_REPLY,
00046         LAP_CONN,        /* Connect indication */
00047         LAP_SETUP,       /* Setting up connection */
00048         LAP_OFFLINE,     /* A really boring state */
00049         LAP_XMIT_P,
00050         LAP_PCLOSE,
00051         LAP_NRM_P,       /* Normal response mode as primary */
00052         LAP_RESET_WAIT,
00053         LAP_RESET,
00054         LAP_NRM_S,       /* Normal response mode as secondary */
00055         LAP_XMIT_S,
00056         LAP_SCLOSE,
00057         LAP_RESET_CHECK,
00058 } IRLAP_STATE;
00059 
00060 /* IrLAP Events */
00061 typedef enum {
00062         /* Services events */
00063         DISCOVERY_REQUEST,
00064         CONNECT_REQUEST,
00065         CONNECT_RESPONSE,
00066         DISCONNECT_REQUEST,
00067         DATA_REQUEST,
00068         RESET_REQUEST,
00069         RESET_RESPONSE,
00070 
00071         /* Send events */
00072         SEND_I_CMD,
00073         SEND_UI_FRAME,
00074 
00075         /* Receive events */
00076         RECV_DISCOVERY_XID_CMD,
00077         RECV_DISCOVERY_XID_RSP,
00078         RECV_SNRM_CMD,
00079         RECV_TEST_CMD,
00080         RECV_TEST_RSP,
00081         RECV_UA_RSP,
00082         RECV_DM_RSP,
00083         RECV_RD_RSP,
00084         RECV_I_CMD,
00085         RECV_I_RSP,
00086         RECV_UI_FRAME,
00087         RECV_FRMR_RSP,
00088         RECV_RR_CMD,
00089         RECV_RR_RSP,
00090         RECV_RNR_CMD,
00091         RECV_RNR_RSP,
00092         RECV_REJ_CMD,
00093         RECV_REJ_RSP,
00094         RECV_SREJ_CMD,
00095         RECV_SREJ_RSP,
00096         RECV_DISC_CMD,
00097 
00098         /* Timer events */
00099         SLOT_TIMER_EXPIRED,
00100         QUERY_TIMER_EXPIRED,
00101         FINAL_TIMER_EXPIRED,
00102         POLL_TIMER_EXPIRED,
00103         DISCOVERY_TIMER_EXPIRED,
00104         WD_TIMER_EXPIRED,
00105         BACKOFF_TIMER_EXPIRED,
00106 } IRLAP_EVENT;
00107 
00108 /*
00109  *  Various things used by the IrLAP state machine
00110  */
00111 struct irlap_info {
00112         __u8 caddr;   /* Connection address */
00113         __u8 control; /* Frame type */
00114         __u8 cmd;
00115 
00116         __u32 saddr;
00117         __u32 daddr;
00118         
00119         int pf;        /* Poll/final bit set */
00120 
00121         __u8  nr;      /* Sequence number of next frame expected */
00122         __u8  ns;      /* Sequence number of frame sent */
00123 
00124         int  S;        /* Number of slots */
00125         int  slot;     /* Random chosen slot */
00126         int  s;        /* Current slot */
00127 
00128         discovery_t *discovery; /* Discovery information */
00129 };
00130 
00131 extern const char *irlap_state[];
00132 
00133 void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, 
00134                     struct sk_buff *skb, struct irlap_info *info);
00135 void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state);
00136 void irlap_print_event(IRLAP_EVENT event);
00137 
00138 extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
00139 
00140 #endif