Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Jeff Kirsher | a6227e2 | 2013-12-06 09:13:40 -0800 | [diff] [blame] | 27 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | * |
| 29 | ********************************************************************/ |
| 30 | |
| 31 | #ifndef IRLAP_FRAME_H |
| 32 | #define IRLAP_FRAME_H |
| 33 | |
| 34 | #include <linux/skbuff.h> |
| 35 | |
| 36 | #include <net/irda/irda.h> |
| 37 | |
| 38 | /* A few forward declarations (to make compiler happy) */ |
| 39 | struct irlap_cb; |
| 40 | struct discovery_t; |
| 41 | |
| 42 | /* Frame types and templates */ |
| 43 | #define INVALID 0xff |
| 44 | |
| 45 | /* Unnumbered (U) commands */ |
| 46 | #define SNRM_CMD 0x83 /* Set Normal Response Mode */ |
| 47 | #define DISC_CMD 0x43 /* Disconnect */ |
| 48 | #define XID_CMD 0x2f /* Exchange Station Identification */ |
| 49 | #define TEST_CMD 0xe3 /* Test */ |
| 50 | |
| 51 | /* Unnumbered responses */ |
| 52 | #define RNRM_RSP 0x83 /* Request Normal Response Mode */ |
| 53 | #define UA_RSP 0x63 /* Unnumbered Acknowledgement */ |
| 54 | #define FRMR_RSP 0x87 /* Frame Reject */ |
| 55 | #define DM_RSP 0x0f /* Disconnect Mode */ |
| 56 | #define RD_RSP 0x43 /* Request Disconnection */ |
| 57 | #define XID_RSP 0xaf /* Exchange Station Identification */ |
| 58 | #define TEST_RSP 0xe3 /* Test frame */ |
| 59 | |
| 60 | /* Supervisory (S) */ |
| 61 | #define RR 0x01 /* Receive Ready */ |
| 62 | #define REJ 0x09 /* Reject */ |
| 63 | #define RNR 0x05 /* Receive Not Ready */ |
| 64 | #define SREJ 0x0d /* Selective Reject */ |
| 65 | |
| 66 | /* Information (I) */ |
| 67 | #define I_FRAME 0x00 /* Information Format */ |
| 68 | #define UI_FRAME 0x03 /* Unnumbered Information */ |
| 69 | |
| 70 | #define CMD_FRAME 0x01 |
| 71 | #define RSP_FRAME 0x00 |
| 72 | |
| 73 | #define PF_BIT 0x10 /* Poll/final bit */ |
| 74 | |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 75 | /* Some IrLAP field lengths */ |
| 76 | /* |
| 77 | * Only baud rate triplet is 4 bytes (PV can be 2 bytes). |
| 78 | * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes. |
| 79 | */ |
| 80 | #define IRLAP_NEGOCIATION_PARAMS_LEN 25 |
| 81 | #define IRLAP_DISCOVERY_INFO_LEN 32 |
| 82 | |
| 83 | struct disc_frame { |
| 84 | __u8 caddr; /* Connection address */ |
| 85 | __u8 control; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 86 | } __packed; |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 87 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | struct xid_frame { |
| 89 | __u8 caddr; /* Connection address */ |
| 90 | __u8 control; |
| 91 | __u8 ident; /* Should always be XID_FORMAT */ |
Al Viro | 448c31a | 2006-11-14 20:47:46 -0800 | [diff] [blame] | 92 | __le32 saddr; /* Source device address */ |
| 93 | __le32 daddr; /* Destination device address */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | __u8 flags; /* Discovery flags */ |
| 95 | __u8 slotnr; |
| 96 | __u8 version; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 97 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | struct test_frame { |
| 100 | __u8 caddr; /* Connection address */ |
| 101 | __u8 control; |
Al Viro | 448c31a | 2006-11-14 20:47:46 -0800 | [diff] [blame] | 102 | __le32 saddr; /* Source device address */ |
| 103 | __le32 daddr; /* Destination device address */ |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 104 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | |
| 106 | struct ua_frame { |
| 107 | __u8 caddr; |
| 108 | __u8 control; |
Al Viro | 448c31a | 2006-11-14 20:47:46 -0800 | [diff] [blame] | 109 | __le32 saddr; /* Source device address */ |
| 110 | __le32 daddr; /* Dest device address */ |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 111 | } __packed; |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 112 | |
| 113 | struct dm_frame { |
| 114 | __u8 caddr; /* Connection address */ |
| 115 | __u8 control; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 116 | } __packed; |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 117 | |
| 118 | struct rd_frame { |
| 119 | __u8 caddr; /* Connection address */ |
| 120 | __u8 control; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 121 | } __packed; |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 122 | |
| 123 | struct rr_frame { |
| 124 | __u8 caddr; /* Connection address */ |
| 125 | __u8 control; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 126 | } __packed; |
Samuel Ortiz | 1b0fee7 | 2006-09-27 20:06:44 -0700 | [diff] [blame] | 127 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | struct i_frame { |
| 129 | __u8 caddr; |
| 130 | __u8 control; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 131 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
| 133 | struct snrm_frame { |
| 134 | __u8 caddr; |
| 135 | __u8 control; |
Al Viro | 448c31a | 2006-11-14 20:47:46 -0800 | [diff] [blame] | 136 | __le32 saddr; |
| 137 | __le32 daddr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | __u8 ncaddr; |
Gustavo F. Padovan | 942875f | 2010-07-21 10:59:57 +0000 | [diff] [blame] | 139 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
| 141 | void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); |
| 142 | void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, |
| 143 | __u8 command, |
| 144 | struct discovery_t *discovery); |
| 145 | void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *); |
| 146 | void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, |
| 147 | struct sk_buff *cmd); |
| 148 | void irlap_send_ua_response_frame(struct irlap_cb *, struct qos_info *); |
| 149 | void irlap_send_dm_frame(struct irlap_cb *self); |
| 150 | void irlap_send_rd_frame(struct irlap_cb *self); |
| 151 | void irlap_send_disc_frame(struct irlap_cb *self); |
| 152 | void irlap_send_rr_frame(struct irlap_cb *self, int command); |
| 153 | |
| 154 | void irlap_send_data_primary(struct irlap_cb *, struct sk_buff *); |
| 155 | void irlap_send_data_primary_poll(struct irlap_cb *, struct sk_buff *); |
| 156 | void irlap_send_data_secondary(struct irlap_cb *, struct sk_buff *); |
| 157 | void irlap_send_data_secondary_final(struct irlap_cb *, struct sk_buff *); |
| 158 | void irlap_resend_rejected_frames(struct irlap_cb *, int command); |
| 159 | void irlap_resend_rejected_frame(struct irlap_cb *self, int command); |
| 160 | |
| 161 | void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb, |
| 162 | __u8 caddr, int command); |
| 163 | |
Joe Perches | 0e418f9 | 2013-09-23 11:37:44 -0700 | [diff] [blame] | 164 | int irlap_insert_qos_negotiation_params(struct irlap_cb *self, |
| 165 | struct sk_buff *skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
| 167 | #endif |