ircomm_tty.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*********************************************************************
  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. #ifndef IRCOMM_TTY_H
  31. #define IRCOMM_TTY_H
  32. #include <linux/serial.h>
  33. #include <linux/termios.h>
  34. #include <linux/timer.h>
  35. #include <net/irda/irias_object.h>
  36. #include <net/irda/ircomm_core.h>
  37. #include <net/irda/ircomm_param.h>
  38. #define IRCOMM_TTY_PORTS 32
  39. #define IRCOMM_TTY_MAGIC 0x3432
  40. #define IRCOMM_TTY_MAJOR 161
  41. #define IRCOMM_TTY_MINOR 0
  42. /* This is used as an initial value to max_header_size before the proper
  43.  * value is filled in (5 for ttp, 4 for lmp). This allow us to detect
  44.  * the state of the underlying connection. - Jean II */
  45. #define IRCOMM_TTY_HDR_UNITIALISED 32
  46. /*
  47.  * IrCOMM TTY driver state
  48.  */
  49. struct ircomm_tty_cb {
  50. irda_queue_t queue;            /* Must be first */
  51. magic_t magic;
  52. int state;                /* Connect state */
  53. struct tty_struct *tty;
  54. struct ircomm_cb *ircomm; /* IrCOMM layer instance */
  55. struct sk_buff *tx_skb;   /* Transmit buffer */
  56. struct sk_buff *ctrl_skb; /* Control data buffer */
  57. /* Parameters */
  58. struct ircomm_params settings;
  59. __u8 service_type;        /* The service that we support */
  60. int client;               /* True if we are a client */
  61. LOCAL_FLOW flow;          /* IrTTP flow status */
  62. int line;
  63. __u32 flags;
  64. __u8 dlsap_sel;
  65. __u8 slsap_sel;
  66. __u32 saddr;
  67. __u32 daddr;
  68. __u32 max_data_size;   /* Max data we can transmit in one packet */
  69. __u32 max_header_size; /* The amount of header space we must reserve */
  70. struct iriap_cb *iriap; /* Instance used for querying remote IAS */
  71. struct ias_object* obj;
  72. int skey;
  73. int ckey;
  74. struct termios   normal_termios;
  75. struct termios   callout_termios;
  76. wait_queue_head_t open_wait;
  77. wait_queue_head_t close_wait;
  78. struct timer_list watchdog_timer;
  79. struct tq_struct  tqueue;
  80.         unsigned short    close_delay;
  81.         unsigned short    closing_wait; /* time to wait before closing */
  82. long session;           /* Session of opening process */
  83. long pgrp; /* pgrp of opening process */
  84. int  open_count;
  85. int  blocked_open; /* # of blocked opens */
  86. };
  87. void ircomm_tty_start(struct tty_struct *tty);
  88. void ircomm_tty_stop(struct tty_struct *tty);
  89. void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
  90. extern void ircomm_tty_change_speed(struct ircomm_tty_cb *self);
  91. extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, 
  92.     unsigned int cmd, unsigned long arg);
  93. extern void ircomm_tty_set_termios(struct tty_struct *tty, 
  94.    struct termios *old_termios);
  95. extern hashbin_t *ircomm_tty;
  96. #endif