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

ircomm_core.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      ircomm_core.h
00004  * Version:       
00005  * Description:   
00006  * Status:        Experimental.
00007  * Author:        Dag Brattli <dagb@cs.uit.no>
00008  * Created at:    Wed Jun  9 08:58:43 1999
00009  * Modified at:   Mon Dec 13 11:52:29 1999
00010  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00011  * 
00012  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
00013  *     
00014  *     This program is free software; you can redistribute it and/or 
00015  *     modify it under the terms of the GNU General Public License as 
00016  *     published by the Free Software Foundation; either version 2 of 
00017  *     the License, or (at your option) any later version.
00018  * 
00019  *     This program is distributed in the hope that it will be useful,
00020  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00022  *     GNU General Public License for more details.
00023  * 
00024  *     You should have received a copy of the GNU General Public License 
00025  *     along with this program; if not, write to the Free Software 
00026  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00027  *     MA 02111-1307 USA
00028  *     
00029  ********************************************************************/
00030 
00031 #ifndef IRCOMM_CORE_H
00032 #define IRCOMM_CORE_H
00033 
00034 #include <net/irda/irda.h>
00035 #include <net/irda/ircomm_event.h>
00036 
00037 #define IRCOMM_MAGIC 0x98347298
00038 #define IRCOMM_HEADER_SIZE 1
00039 
00040 struct ircomm_cb;   /* Forward decl. */
00041 
00042 /*
00043  * A small call-table, so we don't have to check the service-type whenever
00044  * we want to do something
00045  */
00046 typedef struct {
00047         int (*data_request)(struct ircomm_cb *, struct sk_buff *, int clen);
00048         int (*connect_request)(struct ircomm_cb *, struct sk_buff *, 
00049                                struct ircomm_info *);
00050         int (*connect_response)(struct ircomm_cb *, struct sk_buff *);
00051         int (*disconnect_request)(struct ircomm_cb *, struct sk_buff *, 
00052                                   struct ircomm_info *);        
00053 } call_t;
00054 
00055 struct ircomm_cb {
00056         queue_t queue;
00057         magic_t magic;
00058 
00059         notify_t notify;
00060         call_t   issue;
00061 
00062         int state;
00063         int line;            /* Which TTY line we are using */
00064 
00065         struct tsap_cb *tsap;
00066         struct lsap_cb *lsap;
00067         
00068         __u8 dlsap_sel;      /* Destination LSAP/TSAP selector */
00069         __u8 slsap_sel;      /* Source LSAP/TSAP selector */
00070 
00071         __u32 saddr;         /* Source device address (link we are using) */
00072         __u32 daddr;         /* Destination device address */
00073 
00074         int max_header_size; /* Header space we must reserve for each frame */
00075         int max_data_size;   /* The amount of data we can fill in each frame */
00076 
00077         LOCAL_FLOW flow_status; /* Used by ircomm_lmp */
00078         int pkt_count;          /* Number of frames we have sent to IrLAP */
00079 
00080         __u8 service_type;
00081 };
00082 
00083 extern hashbin_t *ircomm;
00084 
00085 struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line);
00086 int ircomm_close(struct ircomm_cb *self);
00087 
00088 int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb);
00089 void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb);
00090 void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb);
00091 int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb);
00092 int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, 
00093                            __u32 saddr, __u32 daddr, struct sk_buff *skb,
00094                            __u8 service_type);
00095 void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
00096                                struct ircomm_info *info);
00097 void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
00098                             struct ircomm_info *info);
00099 int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata);
00100 int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata);
00101 void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
00102                                   struct ircomm_info *info);
00103 void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow);
00104 
00105 #define ircomm_is_connected(self) (self->state == IRCOMM_CONN)
00106 
00107 #endif