more debug output
[linux-2.4.git] / include / net / irda / ircomm_core.h
1 /*********************************************************************
2  *                
3  * Filename:      ircomm_core.h
4  * Version:       
5  * Description:   
6  * Status:        Experimental.
7  * Author:        Dag Brattli <dagb@cs.uit.no>
8  * Created at:    Wed Jun  9 08:58:43 1999
9  * Modified at:   Mon Dec 13 11:52:29 1999
10  * Modified by:   Dag Brattli <dagb@cs.uit.no>
11  * 
12  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13  *     
14  *     This program is free software; you can redistribute it and/or 
15  *     modify it under the terms of the GNU General Public License as 
16  *     published by the Free Software Foundation; either version 2 of 
17  *     the License, or (at your option) any later version.
18  * 
19  *     This program is distributed in the hope that it will be useful,
20  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  *     GNU General Public License for more details.
23  * 
24  *     You should have received a copy of the GNU General Public License 
25  *     along with this program; if not, write to the Free Software 
26  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
27  *     MA 02111-1307 USA
28  *     
29  ********************************************************************/
30
31 #ifndef IRCOMM_CORE_H
32 #define IRCOMM_CORE_H
33
34 #include <net/irda/irda.h>
35 #include <net/irda/ircomm_event.h>
36
37 #define IRCOMM_MAGIC 0x98347298
38 #define IRCOMM_HEADER_SIZE 1
39
40 struct ircomm_cb;   /* Forward decl. */
41
42 /*
43  * A small call-table, so we don't have to check the service-type whenever
44  * we want to do something
45  */
46 typedef struct {
47         int (*data_request)(struct ircomm_cb *, struct sk_buff *, int clen);
48         int (*connect_request)(struct ircomm_cb *, struct sk_buff *, 
49                                struct ircomm_info *);
50         int (*connect_response)(struct ircomm_cb *, struct sk_buff *);
51         int (*disconnect_request)(struct ircomm_cb *, struct sk_buff *, 
52                                   struct ircomm_info *);        
53 } call_t;
54
55 struct ircomm_cb {
56         irda_queue_t queue;
57         magic_t magic;
58
59         notify_t notify;
60         call_t   issue;
61
62         int state;
63         int line;            /* Which TTY line we are using */
64
65         struct tsap_cb *tsap;
66         struct lsap_cb *lsap;
67         
68         __u8 dlsap_sel;      /* Destination LSAP/TSAP selector */
69         __u8 slsap_sel;      /* Source LSAP/TSAP selector */
70
71         __u32 saddr;         /* Source device address (link we are using) */
72         __u32 daddr;         /* Destination device address */
73
74         int max_header_size; /* Header space we must reserve for each frame */
75         int max_data_size;   /* The amount of data we can fill in each frame */
76
77         LOCAL_FLOW flow_status; /* Used by ircomm_lmp */
78         int pkt_count;          /* Number of frames we have sent to IrLAP */
79
80         __u8 service_type;
81 };
82
83 extern hashbin_t *ircomm;
84
85 struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line);
86 int ircomm_close(struct ircomm_cb *self);
87
88 int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb);
89 void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb);
90 void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb);
91 int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb);
92 int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, 
93                            __u32 saddr, __u32 daddr, struct sk_buff *skb,
94                            __u8 service_type);
95 void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
96                                struct ircomm_info *info);
97 void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
98                             struct ircomm_info *info);
99 int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata);
100 int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata);
101 void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
102                                   struct ircomm_info *info);
103 void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow);
104
105 #define ircomm_is_connected(self) (self->state == IRCOMM_CONN)
106
107 #endif