comparison src/g23m-fad/tcpip/rnet/rnet_message.h @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /**
2 * @file rnet_message.h
3 *
4 * Riviera NET.
5 *
6 * Messages that RNET can SEND.
7 *
8 * @author Vincent Oberle (v-oberle@ti.com)
9 * @version 0.1
10 */
11
12 /*
13 * History:
14 *
15 * Date Author Modification
16 * --------------------------------------------------
17 * 01/25/2002 Vincent Oberle Create
18 *
19 * (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved
20 */
21
22 #ifndef __RNET_MESSAGE_H_
23 #define __RNET_MESSAGE_H_
24
25 #include "rv_general.h"
26 #include "rvm_use_id_list.h"
27
28 #include "rnet_api.h"
29 #include "rnet_cfg.h"
30 #include "rnet_ip_addr.h"
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37 /**
38 * The message offset must differ for each SWE in order to have
39 * unique msg_id in the system.
40 */
41 #define RNET_MESSAGE_OFFSET BUILD_MESSAGE_OFFSET(RNET_USE_ID)
42
43 /**
44 * @name RNET_ERROR_IND
45 *
46 * Sent by RNET when an error occured in a connection.
47 *
48 * The following list indicates the values that the error code
49 * can take as well as their meaning depending on the processing
50 *
51 * Connecting:
52 * - RNET_MEMORY_ERR No buffer space is available. The socket cannot be connected.
53 * - RNET_NET_UNREACHABLE The network cannot be reached from this host at this time.
54 * - RNET_TIMEOUT Attempt to connect timed out without establishing a connection
55 * - RNET_CONN_REFUSED The attempt to connect was forcefully rejected.
56 * - RNET_NOT_SUPPORTED Addresses in the specified family cannot be used with this socket.
57 * Closing:
58 * - RNET_INTERNAL_ERR The network subsystem has failed.
59 * - RNET_CONN_RESET The connection was reset by the remote side
60 * - RNET_CONN_ABORTED The connection was terminated due to a time-out or other failure.
61 * - RNET_CONN_CLOSED The connection was gracefully closed (not an error actually)..
62 *
63 * @param desc Connection identifier.
64 * @param error Error code.
65 */
66 /*@{*/
67 /** Message ID. */
68 #define RNET_ERROR_IND (RNET_MESSAGE_OFFSET | 0x001)
69
70 /** Message structure. */
71 typedef struct
72 {
73 T_RV_HDR hdr;
74
75 T_RNET_DESC * desc;
76 T_RNET_RET error;
77
78 } T_RNET_ERROR_IND;
79 /*@}*/
80
81 /**
82 * @name RNET_CONNECT_IND
83 *
84 * Sent to the connection oriented server when a client requests a connection.
85 *
86 * The server gets in this message a new connection identifier that
87 * the one the server was listening with.
88 * The client address and port are also indicated.
89 *
90 * @param new_desc New connection identifier.
91 * @param listen_desc Indicates the descriptor of the connection that server
92 * is using for listening.
93 * @param peer_addr Peer address.
94 * @param peer_port Peer port.
95 */
96 /*@{*/
97 /** Message ID. */
98 #define RNET_CONNECT_IND (RNET_MESSAGE_OFFSET | 0x002)
99
100 /** Message structure. */
101 typedef struct
102 {
103 T_RV_HDR hdr;
104
105 T_RNET_DESC * new_desc;
106 T_RNET_DESC * listen_desc;
107 T_RNET_IP_ADDR peer_addr;
108 T_RNET_PORT peer_port;
109
110 } T_RNET_CONNECT_IND;
111 /*@}*/
112
113 /**
114 * @name RNET_CONNECT_CFM
115 *
116 * Indicates that a connection request was successfully completed.
117 *
118 * @param desc Connection identifier.
119 */
120 /*@{*/
121 /** Message ID. */
122 #define RNET_CONNECT_CFM (RNET_MESSAGE_OFFSET | 0x003)
123
124 /** Message structure. */
125 typedef struct
126 {
127 T_RV_HDR hdr;
128
129 T_RNET_DESC * desc;
130
131 } T_RNET_CONNECT_CFM;
132 /*@}*/
133
134 /**
135 * @name RNET_SEND_RDY
136 *
137 * Indicates that the connection descriptor is ready for sending data.
138 * A first RNET_SEND_RDY message is sent when a connection ID is first
139 * connected (function rnet_connect) or accepted (message RNET_CONNECT_IND)
140 * and then when a call to the function rnet_send couldn't send all
141 * wanted data. The application should then try to send the data again
142 * when receiving RNET_SEND_RDY.
143 *
144 * @param desc Connection identifier.
145 */
146 /*@{*/
147 /** Message ID. */
148 #define RNET_SEND_RDY (RNET_MESSAGE_OFFSET | 0x004)
149
150 /** Message structure. */
151 typedef struct
152 {
153 T_RV_HDR hdr;
154
155 T_RNET_DESC * desc;
156
157 } T_RNET_SEND_RDY;
158 /*@}*/
159
160 /**
161 * @name RNET_RECV_IND
162 *
163 * New data arrived on the connection.
164 *
165 * See the description of the related function rnet_recv.
166 *
167 * @param desc Connection identifier.
168 * @param peer_addr Peer address.
169 * @param peer_port Peer port.
170 */
171 /*@{*/
172 /** Message ID. */
173 #define RNET_RECV_IND (RNET_MESSAGE_OFFSET | 0x005)
174
175 /** Message structure. */
176 typedef struct
177 {
178 T_RV_HDR hdr;
179
180 T_RNET_DESC * desc;
181 T_RNET_IP_ADDR peer_addr;
182 T_RNET_PORT peer_port;
183
184 } T_RNET_RECV_IND;
185 /*@}*/
186
187 /**
188 * @name RNET_HOST_INFO
189 *
190 * Information on a host, names and addresses.
191 *
192 * If error is RNET_OK, no error occured and the host_name, host_addr
193 * and user_data parameters are valid.
194 * If is different from RNET_OK, the host information could not be retrieved
195 * and only user_data is valid.
196 *
197 * @param error Indicates if the host information could be
198 * retrieved or not.
199 * @param host_name Official name of host.
200 * @param host_addr One address for the host.
201 * @param user_data Application specific pointer set by the user
202 * in rnet_get_host_info.
203 */
204 /*@{*/
205 /** Message ID. */
206 #define RNET_HOST_INFO (RNET_MESSAGE_OFFSET | 0x006)
207
208 /** Message structure. */
209 typedef struct
210 {
211 T_RV_HDR hdr;
212
213 T_RNET_RET error;
214
215 T_RNET_IP_ADDR host_addr;
216 char host_name[RNET_MAX_HOST_NAME_LEN];
217
218 void * user_data;
219
220 } T_RNET_HOST_INFO;
221 /*@}*/
222
223 #ifdef __cplusplus
224 }
225 #endif
226
227 #endif /* __RNET_MESSAGE_H_ */
228