ircomm_core.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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, see <http://www.gnu.org/licenses/>.
  26. *
  27. ********************************************************************/
  28. #ifndef IRCOMM_CORE_H
  29. #define IRCOMM_CORE_H
  30. #include <net/irda/irda.h>
  31. #include <net/irda/irqueue.h>
  32. #include <net/irda/ircomm_event.h>
  33. #define IRCOMM_MAGIC 0x98347298
  34. #define IRCOMM_HEADER_SIZE 1
  35. struct ircomm_cb; /* Forward decl. */
  36. /*
  37. * A small call-table, so we don't have to check the service-type whenever
  38. * we want to do something
  39. */
  40. typedef struct {
  41. int (*data_request)(struct ircomm_cb *, struct sk_buff *, int clen);
  42. int (*connect_request)(struct ircomm_cb *, struct sk_buff *,
  43. struct ircomm_info *);
  44. int (*connect_response)(struct ircomm_cb *, struct sk_buff *);
  45. int (*disconnect_request)(struct ircomm_cb *, struct sk_buff *,
  46. struct ircomm_info *);
  47. } call_t;
  48. struct ircomm_cb {
  49. irda_queue_t queue;
  50. magic_t magic;
  51. notify_t notify;
  52. call_t issue;
  53. int state;
  54. int line; /* Which TTY line we are using */
  55. struct tsap_cb *tsap;
  56. struct lsap_cb *lsap;
  57. __u8 dlsap_sel; /* Destination LSAP/TSAP selector */
  58. __u8 slsap_sel; /* Source LSAP/TSAP selector */
  59. __u32 saddr; /* Source device address (link we are using) */
  60. __u32 daddr; /* Destination device address */
  61. int max_header_size; /* Header space we must reserve for each frame */
  62. int max_data_size; /* The amount of data we can fill in each frame */
  63. LOCAL_FLOW flow_status; /* Used by ircomm_lmp */
  64. int pkt_count; /* Number of frames we have sent to IrLAP */
  65. __u8 service_type;
  66. };
  67. extern hashbin_t *ircomm;
  68. struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line);
  69. int ircomm_close(struct ircomm_cb *self);
  70. int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb);
  71. void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb);
  72. void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb);
  73. int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb);
  74. int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel,
  75. __u32 saddr, __u32 daddr, struct sk_buff *skb,
  76. __u8 service_type);
  77. void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
  78. struct ircomm_info *info);
  79. void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
  80. struct ircomm_info *info);
  81. int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata);
  82. int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata);
  83. void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
  84. struct ircomm_info *info);
  85. void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow);
  86. #define ircomm_is_connected(self) (self->state == IRCOMM_CONN)
  87. #endif