File: iriap.h

package info (click to toggle)
kernel-source-2.2.1 2.2.1-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 61,788 kB
  • ctags: 188,316
  • sloc: ansic: 1,114,164; asm: 49,922; makefile: 8,185; sh: 1,745; perl: 856; tcl: 409; lisp: 218; cpp: 186; awk: 133; sed: 72
file content (123 lines) | stat: -rw-r--r-- 3,468 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*********************************************************************
 *                
 * Filename:      iriap.h
 * Version:       
 * Description:   Information Access Protocol (IAP)
 * Status:        Experimental.
 * Author:        Dag Brattli <dagb@cs.uit.no>
 * Created at:    Thu Aug 21 00:02:07 1997
 * Modified at:   Sat Dec  5 13:45:37 1998
 * Modified by:   Dag Brattli <dagb@cs.uit.no>
 * 
 *     Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
 *     
 *     This program is free software; you can redistribute it and/or 
 *     modify it under the terms of the GNU General Public License as 
 *     published by the Free Software Foundation; either version 2 of 
 *     the License, or (at your option) any later version.
 *
 *     Neither Dag Brattli nor University of Troms admit liability nor
 *     provide warranty for any of this software. This material is 
 *     provided "AS-IS" and at no charge.
 *
 ********************************************************************/

#ifndef IRIAP_H
#define IRIAP_H

#include <linux/types.h>
#include <linux/skbuff.h>

#include <net/irda/qos.h>
#include <net/irda/iriap_event.h>
#include <net/irda/irias_object.h>
#include <net/irda/irqueue.h>
#include <net/irda/timer.h>

#define LST 0x80
#define ACK 0x40

#define IAS_SERVER 0
#define IAS_CLIENT 1

/* IrIAP Op-codes */
#define GET_INFO_BASE      0x01
#define GET_OBJECTS        0x02
#define GET_VALUE          0x03
#define GET_VALUE_BY_CLASS 0x04
#define GET_OBJECT_INFO    0x05
#define GET_ATTRIB_NAMES   0x06

#define IAS_SUCCESS        0
#define IAS_CLASS_UNKNOWN  1
#define IAS_ATTRIB_UNKNOWN 2

typedef void (*CONFIRM_CALLBACK)( __u16 obj_id, struct ias_value *value,
				  void *priv);

struct iap_value {
	char *full;
        char *name;
        char *attr;
        __u16   obj_id;
        __u8    ret_code;
        __u8    type;
        int     len;
        int value_int;
        char *value_char;
};

struct iriap_cb {
	QUEUE queue; /* Must be first */
	
	int          magic;  /* Magic cookie */
	int          mode;   /* Client or server */
	__u32        daddr;
	__u8         operation;

	struct sk_buff *skb;
	struct lsap_cb *lsap;
	__u8 slsap_sel;

	/* Client states */
	IRIAP_STATE client_state;
	IRIAP_STATE call_state;
	
	/* Server states */
	IRIAP_STATE server_state;
	IRIAP_STATE r_connect_state;
	
	CONFIRM_CALLBACK confirm;
	void *priv;

	struct timer_list watchdog_timer;
};

int  iriap_init(void);
void iriap_cleanup(void);
void iriap_getvaluebyclass_request( __u32 addr, char *name, char *attr, 
				    CONFIRM_CALLBACK callback, void *priv);
void iriap_getvaluebyclass_confirm( struct iriap_cb *self, 
				    struct sk_buff *skb);

void iriap_send_ack( struct iriap_cb *self);
void iriap_data_indication( void *instance, void *sap, struct sk_buff *skb);
void iriap_connect_confirm( void *instance, void *sap, struct qos_info *qos, 
			    int max_sdu_size, struct sk_buff *skb);
void iriap_connect_indication( void *instance, void *sap, 
			       struct qos_info *qos, int max_sdu_size,
			       struct sk_buff *skb);
void iriap_call_indication( struct iriap_cb *self, struct sk_buff *skb);

void iriap_register_server(void);

void iriap_watchdog_timer_expired( unsigned long data);

static inline void iriap_start_watchdog_timer( struct iriap_cb *self, 
					       int timeout) 
{
	irda_start_timer( &self->watchdog_timer, timeout, 
			  (unsigned long) self, iriap_watchdog_timer_expired);
}

#endif