irlap_frame.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*********************************************************************
  2. *
  3. * Filename: irlap_frame.h
  4. * Version: 0.9
  5. * Description: IrLAP frame declarations
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  8. * Created at: Tue Aug 19 10:27:26 1997
  9. * Modified at: Sat Dec 25 21:07:26 1999
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>,
  13. * All Rights Reserved.
  14. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; either version 2 of
  19. * the License, or (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  29. * MA 02111-1307 USA
  30. *
  31. ********************************************************************/
  32. #ifndef IRLAP_FRAME_H
  33. #define IRLAP_FRAME_H
  34. #include <linux/skbuff.h>
  35. #include <net/irda/irda.h>
  36. /* A few forward declarations (to make compiler happy) */
  37. struct irlap_cb;
  38. struct discovery_t;
  39. /* Frame types and templates */
  40. #define INVALID 0xff
  41. /* Unnumbered (U) commands */
  42. #define SNRM_CMD 0x83 /* Set Normal Response Mode */
  43. #define DISC_CMD 0x43 /* Disconnect */
  44. #define XID_CMD 0x2f /* Exchange Station Identification */
  45. #define TEST_CMD 0xe3 /* Test */
  46. /* Unnumbered responses */
  47. #define RNRM_RSP 0x83 /* Request Normal Response Mode */
  48. #define UA_RSP 0x63 /* Unnumbered Acknowledgement */
  49. #define FRMR_RSP 0x87 /* Frame Reject */
  50. #define DM_RSP 0x0f /* Disconnect Mode */
  51. #define RD_RSP 0x43 /* Request Disconnection */
  52. #define XID_RSP 0xaf /* Exchange Station Identification */
  53. #define TEST_RSP 0xe3 /* Test frame */
  54. /* Supervisory (S) */
  55. #define RR 0x01 /* Receive Ready */
  56. #define REJ 0x09 /* Reject */
  57. #define RNR 0x05 /* Receive Not Ready */
  58. #define SREJ 0x0d /* Selective Reject */
  59. /* Information (I) */
  60. #define I_FRAME 0x00 /* Information Format */
  61. #define UI_FRAME 0x03 /* Unnumbered Information */
  62. #define CMD_FRAME 0x01
  63. #define RSP_FRAME 0x00
  64. #define PF_BIT 0x10 /* Poll/final bit */
  65. /* Some IrLAP field lengths */
  66. /*
  67. * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
  68. * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
  69. */
  70. #define IRLAP_NEGOCIATION_PARAMS_LEN 25
  71. #define IRLAP_DISCOVERY_INFO_LEN 32
  72. struct disc_frame {
  73. __u8 caddr; /* Connection address */
  74. __u8 control;
  75. } __packed;
  76. struct xid_frame {
  77. __u8 caddr; /* Connection address */
  78. __u8 control;
  79. __u8 ident; /* Should always be XID_FORMAT */
  80. __le32 saddr; /* Source device address */
  81. __le32 daddr; /* Destination device address */
  82. __u8 flags; /* Discovery flags */
  83. __u8 slotnr;
  84. __u8 version;
  85. } __packed;
  86. struct test_frame {
  87. __u8 caddr; /* Connection address */
  88. __u8 control;
  89. __le32 saddr; /* Source device address */
  90. __le32 daddr; /* Destination device address */
  91. } __packed;
  92. struct ua_frame {
  93. __u8 caddr;
  94. __u8 control;
  95. __le32 saddr; /* Source device address */
  96. __le32 daddr; /* Dest device address */
  97. } __packed;
  98. struct dm_frame {
  99. __u8 caddr; /* Connection address */
  100. __u8 control;
  101. } __packed;
  102. struct rd_frame {
  103. __u8 caddr; /* Connection address */
  104. __u8 control;
  105. } __packed;
  106. struct rr_frame {
  107. __u8 caddr; /* Connection address */
  108. __u8 control;
  109. } __packed;
  110. struct i_frame {
  111. __u8 caddr;
  112. __u8 control;
  113. } __packed;
  114. struct snrm_frame {
  115. __u8 caddr;
  116. __u8 control;
  117. __le32 saddr;
  118. __le32 daddr;
  119. __u8 ncaddr;
  120. } __packed;
  121. void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb);
  122. void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s,
  123. __u8 command,
  124. struct discovery_t *discovery);
  125. void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *);
  126. void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
  127. struct sk_buff *cmd);
  128. void irlap_send_ua_response_frame(struct irlap_cb *, struct qos_info *);
  129. void irlap_send_dm_frame(struct irlap_cb *self);
  130. void irlap_send_rd_frame(struct irlap_cb *self);
  131. void irlap_send_disc_frame(struct irlap_cb *self);
  132. void irlap_send_rr_frame(struct irlap_cb *self, int command);
  133. void irlap_send_data_primary(struct irlap_cb *, struct sk_buff *);
  134. void irlap_send_data_primary_poll(struct irlap_cb *, struct sk_buff *);
  135. void irlap_send_data_secondary(struct irlap_cb *, struct sk_buff *);
  136. void irlap_send_data_secondary_final(struct irlap_cb *, struct sk_buff *);
  137. void irlap_resend_rejected_frames(struct irlap_cb *, int command);
  138. void irlap_resend_rejected_frame(struct irlap_cb *self, int command);
  139. void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
  140. __u8 caddr, int command);
  141. extern int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
  142. struct sk_buff *skb);
  143. #endif