blob: 641f88e848bd3d57ff446517afb1d596652ebf22 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*********************************************************************
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
33#ifndef IRLAP_FRAME_H
34#define IRLAP_FRAME_H
35
36#include <linux/skbuff.h>
37
38#include <net/irda/irda.h>
39
40/* A few forward declarations (to make compiler happy) */
41struct irlap_cb;
42struct discovery_t;
43
44/* Frame types and templates */
45#define INVALID 0xff
46
47/* Unnumbered (U) commands */
48#define SNRM_CMD 0x83 /* Set Normal Response Mode */
49#define DISC_CMD 0x43 /* Disconnect */
50#define XID_CMD 0x2f /* Exchange Station Identification */
51#define TEST_CMD 0xe3 /* Test */
52
53/* Unnumbered responses */
54#define RNRM_RSP 0x83 /* Request Normal Response Mode */
55#define UA_RSP 0x63 /* Unnumbered Acknowledgement */
56#define FRMR_RSP 0x87 /* Frame Reject */
57#define DM_RSP 0x0f /* Disconnect Mode */
58#define RD_RSP 0x43 /* Request Disconnection */
59#define XID_RSP 0xaf /* Exchange Station Identification */
60#define TEST_RSP 0xe3 /* Test frame */
61
62/* Supervisory (S) */
63#define RR 0x01 /* Receive Ready */
64#define REJ 0x09 /* Reject */
65#define RNR 0x05 /* Receive Not Ready */
66#define SREJ 0x0d /* Selective Reject */
67
68/* Information (I) */
69#define I_FRAME 0x00 /* Information Format */
70#define UI_FRAME 0x03 /* Unnumbered Information */
71
72#define CMD_FRAME 0x01
73#define RSP_FRAME 0x00
74
75#define PF_BIT 0x10 /* Poll/final bit */
76
Samuel Ortiz1b0fee72006-09-27 20:06:44 -070077/* Some IrLAP field lengths */
78/*
79 * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
80 * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
81 */
82#define IRLAP_NEGOCIATION_PARAMS_LEN 25
83#define IRLAP_DISCOVERY_INFO_LEN 32
84
85struct disc_frame {
86 __u8 caddr; /* Connection address */
87 __u8 control;
88} IRDA_PACK;
89
Linus Torvalds1da177e2005-04-16 15:20:36 -070090struct xid_frame {
91 __u8 caddr; /* Connection address */
92 __u8 control;
93 __u8 ident; /* Should always be XID_FORMAT */
Al Viro448c31a2006-11-14 20:47:46 -080094 __le32 saddr; /* Source device address */
95 __le32 daddr; /* Destination device address */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 __u8 flags; /* Discovery flags */
97 __u8 slotnr;
98 __u8 version;
99} IRDA_PACK;
100
101struct test_frame {
102 __u8 caddr; /* Connection address */
103 __u8 control;
Al Viro448c31a2006-11-14 20:47:46 -0800104 __le32 saddr; /* Source device address */
105 __le32 daddr; /* Destination device address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106} IRDA_PACK;
107
108struct ua_frame {
109 __u8 caddr;
110 __u8 control;
Al Viro448c31a2006-11-14 20:47:46 -0800111 __le32 saddr; /* Source device address */
112 __le32 daddr; /* Dest device address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113} IRDA_PACK;
Samuel Ortiz1b0fee72006-09-27 20:06:44 -0700114
115struct dm_frame {
116 __u8 caddr; /* Connection address */
117 __u8 control;
118} IRDA_PACK;
119
120struct rd_frame {
121 __u8 caddr; /* Connection address */
122 __u8 control;
123} IRDA_PACK;
124
125struct rr_frame {
126 __u8 caddr; /* Connection address */
127 __u8 control;
128} IRDA_PACK;
129
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130struct i_frame {
131 __u8 caddr;
132 __u8 control;
133} IRDA_PACK;
134
135struct snrm_frame {
136 __u8 caddr;
137 __u8 control;
Al Viro448c31a2006-11-14 20:47:46 -0800138 __le32 saddr;
139 __le32 daddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 __u8 ncaddr;
141} IRDA_PACK;
142
143void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb);
144void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s,
145 __u8 command,
146 struct discovery_t *discovery);
147void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *);
148void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
149 struct sk_buff *cmd);
150void irlap_send_ua_response_frame(struct irlap_cb *, struct qos_info *);
151void irlap_send_dm_frame(struct irlap_cb *self);
152void irlap_send_rd_frame(struct irlap_cb *self);
153void irlap_send_disc_frame(struct irlap_cb *self);
154void irlap_send_rr_frame(struct irlap_cb *self, int command);
155
156void irlap_send_data_primary(struct irlap_cb *, struct sk_buff *);
157void irlap_send_data_primary_poll(struct irlap_cb *, struct sk_buff *);
158void irlap_send_data_secondary(struct irlap_cb *, struct sk_buff *);
159void irlap_send_data_secondary_final(struct irlap_cb *, struct sk_buff *);
160void irlap_resend_rejected_frames(struct irlap_cb *, int command);
161void irlap_resend_rejected_frame(struct irlap_cb *self, int command);
162
163void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
164 __u8 caddr, int command);
165
166extern int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
167 struct sk_buff *skb);
168
169#endif