1 /*****************************************************************************\
3 dot4.h - 1284.4 support for multi-point transport driver
5 (c) 2005-2007 Copyright Hewlett-Packard Development Company, LP
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 of the Software, and to permit persons to whom the Software is furnished to do
12 so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 \*****************************************************************************/
32 DOT4_OPEN_CHANNEL = MLC_OPEN_CHANNEL,
33 DOT4_CLOSE_CHANNEL = MLC_CLOSE_CHANNEL,
34 DOT4_CREDIT = MLC_CREDIT,
35 DOT4_CREDIT_REQUEST = MLC_CREDIT_REQUEST,
36 DOT4_GET_SOCKET = 0x9,
37 DOT4_GET_SERVICE = 0xa,
39 DOT4_ERROR = MLC_ERROR
43 * Note, following structures must be packed. The "pragma pack" statement is not recognized by all gcc compilers (ie: ARM based),
44 * so we use __attribute__((packed)) instead.
49 unsigned char psid; /* primary socket id (ie: host) */
50 unsigned char ssid; /* secondary socket id (ie: peripheral) */
51 unsigned short length; /* packet length (includes header) */
52 unsigned char credit; /* data packet credit, reserved if command */
53 unsigned char control; /* bit field: 0=normal */
54 } __attribute__((packed)) DOT4Header;
61 } __attribute__((packed)) DOT4Init;
69 } __attribute__((packed)) DOT4InitReply;
75 } __attribute__((packed)) DOT4Exit;
82 } __attribute__((packed)) DOT4ExitReply;
88 unsigned char psocket; /* primary socket id */
89 unsigned char ssocket; /* secondary socket id */
90 unsigned short maxp2s; /* max primary to secondary packet size in bytes */
91 unsigned short maxs2p; /* max secondary to primary packet size in bytes */
92 unsigned short maxcredit; /* max outstanding credit */
93 } __attribute__((packed)) DOT4OpenChannel;
100 unsigned char psocket;
101 unsigned char ssocket;
102 unsigned short maxp2s; /* max primary to secondary packet size in bytes */
103 unsigned short maxs2p; /* max secondary to primary packet size in bytes */
104 unsigned short maxcredit; /* max outstanding credit */
105 unsigned short credit;
106 } __attribute__((packed)) DOT4OpenChannelReply;
112 unsigned char psocket; /* primary socket id */
113 unsigned char ssocket; /* secondary socket id */
114 } __attribute__((packed)) DOT4CloseChannel;
120 unsigned char result;
121 unsigned char psocket; /* primary socket id */
122 unsigned char ssocket; /* secondary socket id */
123 } __attribute__((packed)) DOT4CloseChannelReply;
129 unsigned char result;
130 unsigned char socket;
131 } __attribute__((packed)) DOT4GetSocketReply;
137 unsigned char psocket;
138 unsigned char ssocket;
139 unsigned short credit; /* credit for sender */
140 } __attribute__((packed)) DOT4Credit;
146 unsigned char psocket;
147 unsigned char ssocket;
148 unsigned short maxcredit; /* maximum outstanding credit */
149 } __attribute__((packed)) DOT4CreditRequest;
155 unsigned char result;
156 unsigned char psocket;
157 unsigned char ssocket;
158 unsigned short credit; /* credit for sender */
159 } __attribute__((packed)) DOT4CreditRequestReply;
165 unsigned char psocket; /* primary socket id which contains the error */
166 unsigned char ssocket; /* secondary socket id which contains the error */
168 } __attribute__((packed)) DOT4Error;
170 typedef DOT4ExitReply DOT4Reply;
171 typedef DOT4Exit DOT4Cmd;
172 typedef DOT4CloseChannelReply DOT4CreditReply;
173 typedef DOT4Exit DOT4GetSocket;
175 int __attribute__ ((visibility ("hidden"))) Dot4ReverseCmd(struct _mud_channel *pc, int fd);
176 int __attribute__ ((visibility ("hidden"))) Dot4Init(struct _mud_channel *pc, int fd);
177 int __attribute__ ((visibility ("hidden"))) Dot4Exit(struct _mud_channel *pc, int fd);
178 int __attribute__ ((visibility ("hidden"))) Dot4GetSocket(struct _mud_channel *pc, int fd);
179 int __attribute__ ((visibility ("hidden"))) Dot4ForwardData(struct _mud_channel *pc, int fd, const void *buf, int size, int usec_timeout);
180 int __attribute__ ((visibility ("hidden"))) Dot4ReverseData(struct _mud_channel *pc, int fd, void *buf, int length, int usec_timeout);
181 int __attribute__ ((visibility ("hidden"))) Dot4OpenChannel(struct _mud_channel *pc, int fd);
182 int __attribute__ ((visibility ("hidden"))) Dot4CloseChannel(struct _mud_channel *pc, int fd);
183 int __attribute__ ((visibility ("hidden"))) Dot4Credit(struct _mud_channel *pc, int fd, unsigned short credit);
184 int __attribute__ ((visibility ("hidden"))) Dot4CreditRequest(struct _mud_channel *pc, int fd, unsigned short credit);