1 |
1275 |
phoenix |
/*********************************************************************
|
2 |
|
|
*
|
3 |
|
|
* Filename: ircomm_tty.h
|
4 |
|
|
* Version:
|
5 |
|
|
* Description:
|
6 |
|
|
* Status: Experimental.
|
7 |
|
|
* Author: Dag Brattli <dagb@cs.uit.no>
|
8 |
|
|
* Created at: Sun Jun 6 23:24:22 1999
|
9 |
|
|
* Modified at: Fri Jan 28 13:16:57 2000
|
10 |
|
|
* Modified by: Dag Brattli <dagb@cs.uit.no>
|
11 |
|
|
*
|
12 |
|
|
* Copyright (c) 1999-2000 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_TTY_H
|
32 |
|
|
#define IRCOMM_TTY_H
|
33 |
|
|
|
34 |
|
|
#include <linux/serial.h>
|
35 |
|
|
#include <linux/termios.h>
|
36 |
|
|
#include <linux/timer.h>
|
37 |
|
|
|
38 |
|
|
#include <net/irda/irias_object.h>
|
39 |
|
|
#include <net/irda/ircomm_core.h>
|
40 |
|
|
#include <net/irda/ircomm_param.h>
|
41 |
|
|
|
42 |
|
|
#define IRCOMM_TTY_PORTS 32
|
43 |
|
|
#define IRCOMM_TTY_MAGIC 0x3432
|
44 |
|
|
#define IRCOMM_TTY_MAJOR 161
|
45 |
|
|
#define IRCOMM_TTY_MINOR 0
|
46 |
|
|
|
47 |
|
|
/* This is used as an initial value to max_header_size before the proper
|
48 |
|
|
* value is filled in (5 for ttp, 4 for lmp). This allow us to detect
|
49 |
|
|
* the state of the underlying connection. - Jean II */
|
50 |
|
|
#define IRCOMM_TTY_HDR_UNINITIALISED 16
|
51 |
|
|
/* Same for payload size. See qos.c for the smallest max data size */
|
52 |
|
|
#define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED)
|
53 |
|
|
|
54 |
|
|
/*
|
55 |
|
|
* IrCOMM TTY driver state
|
56 |
|
|
*/
|
57 |
|
|
struct ircomm_tty_cb {
|
58 |
|
|
irda_queue_t queue; /* Must be first */
|
59 |
|
|
magic_t magic;
|
60 |
|
|
|
61 |
|
|
int state; /* Connect state */
|
62 |
|
|
|
63 |
|
|
struct tty_struct *tty;
|
64 |
|
|
struct ircomm_cb *ircomm; /* IrCOMM layer instance */
|
65 |
|
|
|
66 |
|
|
struct sk_buff *tx_skb; /* Transmit buffer */
|
67 |
|
|
struct sk_buff *ctrl_skb; /* Control data buffer */
|
68 |
|
|
|
69 |
|
|
/* Parameters */
|
70 |
|
|
struct ircomm_params settings;
|
71 |
|
|
|
72 |
|
|
__u8 service_type; /* The service that we support */
|
73 |
|
|
int client; /* True if we are a client */
|
74 |
|
|
LOCAL_FLOW flow; /* IrTTP flow status */
|
75 |
|
|
|
76 |
|
|
int line;
|
77 |
|
|
__u32 flags;
|
78 |
|
|
|
79 |
|
|
__u8 dlsap_sel;
|
80 |
|
|
__u8 slsap_sel;
|
81 |
|
|
|
82 |
|
|
__u32 saddr;
|
83 |
|
|
__u32 daddr;
|
84 |
|
|
|
85 |
|
|
__u32 max_data_size; /* Max data we can transmit in one packet */
|
86 |
|
|
__u32 max_header_size; /* The amount of header space we must reserve */
|
87 |
|
|
__u32 tx_data_size; /* Max data size of current tx_skb */
|
88 |
|
|
|
89 |
|
|
struct iriap_cb *iriap; /* Instance used for querying remote IAS */
|
90 |
|
|
struct ias_object* obj;
|
91 |
|
|
int skey;
|
92 |
|
|
int ckey;
|
93 |
|
|
|
94 |
|
|
struct termios normal_termios;
|
95 |
|
|
struct termios callout_termios;
|
96 |
|
|
|
97 |
|
|
wait_queue_head_t open_wait;
|
98 |
|
|
wait_queue_head_t close_wait;
|
99 |
|
|
struct timer_list watchdog_timer;
|
100 |
|
|
struct tq_struct tqueue;
|
101 |
|
|
|
102 |
|
|
unsigned short close_delay;
|
103 |
|
|
unsigned short closing_wait; /* time to wait before closing */
|
104 |
|
|
|
105 |
|
|
long session; /* Session of opening process */
|
106 |
|
|
long pgrp; /* pgrp of opening process */
|
107 |
|
|
int open_count;
|
108 |
|
|
int blocked_open; /* # of blocked opens */
|
109 |
|
|
};
|
110 |
|
|
|
111 |
|
|
void ircomm_tty_start(struct tty_struct *tty);
|
112 |
|
|
void ircomm_tty_stop(struct tty_struct *tty);
|
113 |
|
|
void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
|
114 |
|
|
|
115 |
|
|
extern void ircomm_tty_change_speed(struct ircomm_tty_cb *self);
|
116 |
|
|
extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
|
117 |
|
|
unsigned int cmd, unsigned long arg);
|
118 |
|
|
extern void ircomm_tty_set_termios(struct tty_struct *tty,
|
119 |
|
|
struct termios *old_termios);
|
120 |
|
|
extern hashbin_t *ircomm_tty;
|
121 |
|
|
|
122 |
|
|
#endif
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|