Loading...
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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | /********************************************************************* * * Filename: irlpt_common.h * Version: * Description: * Status: Experimental. * Author: Thomas Davis, <ratbert@radiks.net> * Created at: Sat Feb 21 18:54:38 1998 * Modified at: Sun Mar 8 23:44:19 1998 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: irlan.c * * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, * 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. * * I, Thomas Davis, provide no warranty for any of this software. * This material is provided "AS-IS" and at no charge. * ********************************************************************/ #ifndef IRLPT_COMMON_H #define IRLPT_COMMON_H #include <net/irda/qos.h> #include <net/irda/irmod.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/miscdevice.h> #include <linux/poll.h> extern char *irlpt_service_type[]; extern char *irlpt_port_type[]; extern char *irlpt_connected[]; extern char *irlpt_reasons[]; extern char *irlpt_client_fsm_state[]; extern char *irlpt_server_fsm_state[]; extern char *irlpt_fsm_event[]; extern wait_queue_head_t lpt_wait; extern struct irlpt_cb *irlpt_find_handle(unsigned int minor); extern void irlpt_flow_control(struct sk_buff *skb); extern ssize_t irlpt_read( struct file *file, char *buffer, size_t count, loff_t *noidea); extern ssize_t irlpt_write(struct file *file, const char *buffer, size_t count, loff_t *noidea); extern loff_t irlpt_seek(struct file *, loff_t, int); extern int irlpt_open(struct inode * inode, struct file *file); extern int irlpt_close(struct inode *inode, struct file *file); extern u_int irlpt_poll(struct file *file, poll_table *wait); /* FSM definitions */ typedef enum { IRLPT_CLIENT_IDLE, IRLPT_CLIENT_QUERY, IRLPT_CLIENT_READY, IRLPT_CLIENT_WAITI, IRLPT_CLIENT_CONN, } IRLPT_CLIENT_STATE; typedef enum { IRLPT_SERVER_IDLE, IRLPT_SERVER_CONN, } IRLPT_SERVER_STATE; /* IrLPT Events */ typedef enum { QUERY_REMOTE_IAS, IAS_PROVIDER_AVAIL, IAS_PROVIDER_NOT_AVAIL, LAP_DISCONNECT, LMP_CONNECT, LMP_DISCONNECT, LMP_CONNECT_INDICATION, LMP_DISCONNECT_INDICATION, IRLPT_DISCOVERY_INDICATION, IRLPT_CONNECT_REQUEST, IRLPT_DISCONNECT_REQUEST, CLIENT_DATA_INDICATION, } IRLPT_EVENT; struct irlpt_info { struct lsap_cb *lsap; __u8 dlsap_sel; __u32 daddr; __u32 saddr; }; /* Command packet types */ #define IRLPT_MAX_PACKET 1024 #define IRLPT_MAX_HEADER LMP_MAX_HEADER #define IRLPT_MAX_DEVICES 3 #define IRLPT_MAGIC 0x0755 typedef enum { IRLPT_DISCONNECTED, IRLPT_WAITING, IRLPT_CONNECTED, IRLPT_FLUSHED, } IRLPT_SERVER_STATUS; #define IRLPT_LSAP 0x09 #define PI_SERVICE_TYPE 0x00 #define IRLPT_UNKNOWN 0x00 /* not defined yet. */ #define IRLPT_THREE_WIRE_RAW 0x01 /* bit 0 */ #define IRLPT_THREE_WIRE 0x02 /* bit 1 */ #define IRLPT_NINE_WIRE 0x04 /* bit 2 */ #define IRLPT_CENTRONICS 0x08 /* bit 3 */ #define IRLPT_SERVER_MODE 0xFF /* our own flag */ #define PI_PORT_TYPE 0x01 #define IRLPT_SERIAL 0x01 /* bit 0 */ #define IRLPT_PARALLEL 0x02 /* bit 1 */ #define PI_PORT_NAME 0x02 #define PI_CRITICAL 0x80 struct irlpt_cb { QUEUE queue; /* must be first. */ int magic; /* magic used to detect corruption of the struct */ __u32 daddr; /* address of remote printer */ __u32 saddr; /* my local address. */ struct timer_list retry_timer; int volatile state; /* Current state of IrCOMM layer */ int open_retries; int in_use; /* flag to prevent re-use */ char ifname[16]; /* name of the allocated instance, and registered device. */ struct lsap_cb *lsap; /* lmp handle */ __u8 dlsap_sel; /* remote LSAP selector address */ __u8 slsap_sel; /* local LSAP selectoraddress */ __u8 servicetype; /* Type of remote service, ie THREE_WIRE_RAW */ __u8 porttype; /* type of remote port. */ struct miscdevice ir_dev; /* used to register the misc device. */ int count; /* open count */ int max_data_size; /* max frame size we can send */ int max_header_size; /* how much header space is needed */ int pkt_count; /* how many packets are queued up */ wait_queue_head_t read_wait; /* wait queues */ wait_queue_head_t write_wait; wait_queue_head_t ex_wait; /* this is used to remove the printer when it's gone */ struct timer_list lpt_timer; void (*timeout) (unsigned long data); void (*do_event) (struct irlpt_cb *self, IRLPT_EVENT event, struct sk_buff *skb, struct irlpt_info *info); /* this is used by the server side of the system */ IRLPT_SERVER_STATE connected; int eof; int service_LSAP; struct sk_buff_head rx_queue; /* read buffer queue */ }; /* Debug function */ void irlpt_dump_buffer(struct sk_buff *); #endif |