File: irobex.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 (135 lines) | stat: -rw-r--r-- 4,103 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
124
125
126
127
128
129
130
131
132
133
134
135
/*********************************************************************
 *                
 * Filename:      irobex.h
 * Version:       
 * Description:   
 * Status:        Experimental.
 * Author:        Dag Brattli <dagb@cs.uit.no>
 * Created at:    Sat Jul  4 22:43:57 1998
 * Modified at:   Wed Jan 13 15:55:28 1999
 * Modified by:   Dag Brattli <dagb@cs.uit.no>
 * 
 *     Copyright (c) 1998 Dag Brattli, 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 IROBEX_H
#define IROBEX_H

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/skbuff.h>
/* #include <linux/netdevice.h> */
#include <linux/miscdevice.h>

#include <net/irda/timer.h>
#include <net/irda/qos.h>
#include <net/irda/irmod.h>

#define LOW_THRESHOLD      4
#define HIGH_THRESHOLD     8
#define IROBEX_MAX_QUEUE  12

/* Small structure to be used by the IOCTL call */
struct irobex_ioc_t {
     __u32 daddr;
};

#define IROBEX_IOC_MAGIC 'k'

#define IROBEX_IOCSCONNECT    _IOW(IROBEX_IOC_MAGIC, 1, 4)
#define IROBEX_IOCSDISCONNECT _IOW(IROBEX_IOC_MAGIC, 2, 4)
#define IROBEX_IOC_MAXNR 2

#define IROBEX_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER)

typedef enum {
	OBEX_IDLE,       /* Doing nothing */
	OBEX_DISCOVER,   /* Trying to discovery remote device */
	OBEX_QUERY,      /* Querying remote LM-IAS */
	OBEX_CONN,       /* Trying to connect to remote device */
	OBEX_DATA,       /* Data transfer ready */
} OBEX_STATE;

struct irobex_cb {
	QUEUE queue;        /* Must be first! */

        int magic;          /* magic used to detect corruption of the struct */

	OBEX_STATE state;   /* Current state */

	__u32 saddr;        /* my local address */
	__u32 daddr;        /* peer address */
	unsigned long time_discovered;

        char devname[9];    /* name of the registered device */
	struct tsap_cb *tsap;
	int eof;

	__u8 dtsap_sel;         /* remote TSAP address */
	__u8 stsap_sel;         /* local TSAP address */

	int irlap_data_size;

	struct miscdevice dev;

	int count;                /* open count */

	struct sk_buff_head rx_queue; /* Receive queue */

	struct wait_queue *read_wait;
	struct wait_queue *write_wait;

	struct fasync_struct *async;

	struct timer_list watchdog_timer;

	LOCAL_FLOW tx_flow;
	LOCAL_FLOW rx_flow;
};

int    irobex_init(void);
void   irobex_cleanup(void);
struct irobex_cb *irobex_open(void);
void   irobex_close( struct irobex_cb *self);

void irobex_discovery_indication( DISCOVERY *);

void irobex_data_request( int handle, struct sk_buff *skb);
void irobex_data_indication( void *instance, void *sap, struct sk_buff *skb);
void irobex_control_data_indication( void *instance, void *sap, 
				     struct sk_buff *skb);

void irobex_connect_request( struct irobex_cb *self);
void irobex_connect(struct irobex_cb *self, struct sk_buff *skb);
void irobex_connect_confirm( void *instance, void *sap, struct qos_info *qos,
			     int max_sdu_size, struct sk_buff *skb);
void irobex_disconnect_indication( void *instance, void *sap, LM_REASON reason,
				   struct sk_buff *skb);
void irobex_flow_indication( void *instance, void *sap, LOCAL_FLOW flow);

void irobex_extract_params( struct sk_buff *skb);
void irobex_get_value_confirm(__u16 obj_id, struct ias_value *value, 
			      void *priv);
void irobex_register_server( struct irobex_cb *self);

void irobex_watchdog_timer_expired( unsigned long data);

inline void irobex_start_watchdog_timer( struct irobex_cb *self, int timeout) 
{
	irda_start_timer( &self->watchdog_timer, timeout, (unsigned long) self,
			  irobex_watchdog_timer_expired);
}

extern struct irobex_cb *irobex;

#endif