1 /*********************************************************************
2 *
3 * Filename: iriap.h
4 * Version: 0.5
5 * Description: Information Access Protocol (IAP)
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Thu Aug 21 00:02:07 1997
9 * Modified at: Sat Dec 25 16:42:09 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 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * Neither Dag Brattli nor University of Troms� admit liability nor
21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge.
23 *
24 ********************************************************************/
25
26 #ifndef IRIAP_H
27 #define IRIAP_H
28
29 #include <linux/types.h>
30 #include <linux/skbuff.h>
31
32 #include <net/irda/qos.h>
33 #include <net/irda/iriap_event.h>
34 #include <net/irda/irias_object.h>
35 #include <net/irda/irqueue.h>
36 #include <net/irda/timer.h>
37
38 #define IAP_LST 0x80
39 #define IAP_ACK 0x40
40
41 #define IAS_SERVER 0
42 #define IAS_CLIENT 1
43
44 /* IrIAP Op-codes */
45 #define GET_INFO_BASE 0x01
46 #define GET_OBJECTS 0x02
47 #define GET_VALUE 0x03
48 #define GET_VALUE_BY_CLASS 0x04
49 #define GET_OBJECT_INFO 0x05
50 #define GET_ATTRIB_NAMES 0x06
51
52 #define IAS_SUCCESS 0
53 #define IAS_CLASS_UNKNOWN 1
54 #define IAS_ATTRIB_UNKNOWN 2
55 #define IAS_DISCONNECT 10
56
57 typedef void (*CONFIRM_CALLBACK)(int result, __u16 obj_id,
58 struct ias_value *value, void *priv);
59
60 struct iriap_cb {
61 irda_queue_t q; /* Must be first */
62 magic_t magic; /* Magic cookie */
63
64 int mode; /* Client or server */
65
66 __u32 saddr;
67 __u32 daddr;
68 __u8 operation;
69
70 struct sk_buff *skb;
71 struct lsap_cb *lsap;
72 __u8 slsap_sel;
73
74 /* Client states */
75 IRIAP_STATE client_state;
76 IRIAP_STATE call_state;
77
78 /* Server states */
79 IRIAP_STATE server_state;
80 IRIAP_STATE r_connect_state;
81
82 CONFIRM_CALLBACK confirm;
83 void *priv; /* Used to identify client */
84
85 __u8 max_header_size;
86 __u32 max_data_size;
87
88 struct timer_list watchdog_timer;
89 };
90
91 int iriap_init(void);
92 void iriap_cleanup(void);
93
94 struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
95 CONFIRM_CALLBACK callback);
96 void iriap_close(struct iriap_cb *self);
97
98 int iriap_getvaluebyclass_request(struct iriap_cb *self,
99 __u32 saddr, __u32 daddr,
100 char *name, char *attr);
101 void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb);
102 void iriap_connect_request(struct iriap_cb *self);
103 void iriap_send_ack( struct iriap_cb *self);
104 void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb);
105
106 void iriap_register_server(void);
107
108 void iriap_watchdog_timer_expired(void *data);
109
iriap_start_watchdog_timer(struct iriap_cb * self,int timeout)110 static inline void iriap_start_watchdog_timer(struct iriap_cb *self,
111 int timeout)
112 {
113 irda_start_timer(&self->watchdog_timer, timeout, self,
114 iriap_watchdog_timer_expired);
115 }
116
117 #endif
118
119
120