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

iriap.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      iriap.h
00004  * Version:       0.5
00005  * Description:   Information Access Protocol (IAP)
00006  * Status:        Experimental.
00007  * Author:        Dag Brattli <dagb@cs.uit.no>
00008  * Created at:    Thu Aug 21 00:02:07 1997
00009  * Modified at:   Sat Dec 25 16:42:09 1999
00010  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00011  * 
00012  *     Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>, 
00013  *     All Rights Reserved.
00014  *     
00015  *     This program is free software; you can redistribute it and/or 
00016  *     modify it under the terms of the GNU General Public License as 
00017  *     published by the Free Software Foundation; either version 2 of 
00018  *     the License, or (at your option) any later version.
00019  *
00020  *     Neither Dag Brattli nor University of Tromsų admit liability nor
00021  *     provide warranty for any of this software. This material is 
00022  *     provided "AS-IS" and at no charge.
00023  *
00024  ********************************************************************/
00025 
00026 #ifndef IRIAP_H
00027 #define IRIAP_H
00028 
00029 #include <linux/types.h>
00030 #include <linux/skbuff.h>
00031 
00032 #include <net/irda/qos.h>
00033 #include <net/irda/iriap_event.h>
00034 #include <net/irda/irias_object.h>
00035 #include <net/irda/irqueue.h>
00036 #include <net/irda/timer.h>
00037 
00038 #define IAP_LST 0x80
00039 #define IAP_ACK 0x40
00040 
00041 #define IAS_SERVER 0
00042 #define IAS_CLIENT 1
00043 
00044 /* IrIAP Op-codes */
00045 #define GET_INFO_BASE      0x01
00046 #define GET_OBJECTS        0x02
00047 #define GET_VALUE          0x03
00048 #define GET_VALUE_BY_CLASS 0x04
00049 #define GET_OBJECT_INFO    0x05
00050 #define GET_ATTRIB_NAMES   0x06
00051 
00052 #define IAS_SUCCESS        0
00053 #define IAS_CLASS_UNKNOWN  1
00054 #define IAS_ATTRIB_UNKNOWN 2
00055 #define IAS_DISCONNECT     10
00056 
00057 typedef void (*CONFIRM_CALLBACK)(int result, __u16 obj_id, 
00058                                  struct ias_value *value, void *priv);
00059 
00060 struct iriap_cb {
00061         queue_t q;      /* Must be first */     
00062         magic_t magic;  /* Magic cookie */
00063 
00064         int          mode;   /* Client or server */
00065 
00066         __u32        saddr;
00067         __u32        daddr;
00068         __u8         operation;
00069 
00070         struct sk_buff *skb;
00071         struct lsap_cb *lsap;
00072         __u8 slsap_sel;
00073 
00074         /* Client states */
00075         IRIAP_STATE client_state;
00076         IRIAP_STATE call_state;
00077         
00078         /* Server states */
00079         IRIAP_STATE server_state;
00080         IRIAP_STATE r_connect_state;
00081         
00082         CONFIRM_CALLBACK confirm;
00083         void *priv;                /* Used to identify client */
00084 
00085         __u8 max_header_size;
00086         __u32 max_data_size;
00087         
00088         struct timer_list watchdog_timer;
00089 };
00090 
00091 int  iriap_init(void);
00092 void iriap_cleanup(void);
00093 
00094 struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv, 
00095                             CONFIRM_CALLBACK callback);
00096 void iriap_close(struct iriap_cb *self);
00097 
00098 int iriap_getvaluebyclass_request(struct iriap_cb *self, 
00099                                   __u32 saddr, __u32 daddr,
00100                                   char *name, char *attr);
00101 void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb);
00102 void iriap_connect_request(struct iriap_cb *self);
00103 void iriap_send_ack( struct iriap_cb *self);
00104 void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb);
00105 
00106 void iriap_register_server(void);
00107 
00108 void iriap_watchdog_timer_expired(void *data);
00109 
00110 static inline void iriap_start_watchdog_timer(struct iriap_cb *self, 
00111                                               int timeout) 
00112 {
00113         irda_start_timer(&self->watchdog_timer, timeout, self, 
00114                          iriap_watchdog_timer_expired);
00115 }
00116 
00117 #endif
00118 
00119