SimpleLink Host Driver  1.0.0.1
 All Data Structures Functions Variables Groups Pages
netapp.h
1 /*
2  * netapp.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 #ifndef __NETAPP_H__
38 #define __NETAPP_H__
39 
40 /*****************************************************************************/
41 /* Include files */
42 /*****************************************************************************/
43 
44 #include "simplelink.h"
45 
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
58 /*****************************************************************************/
59 /* Macro declarations */
60 /*****************************************************************************/
61 
62 /*ERROR code*/
63 #define SL_ERROR_NETAPP_RX_BUFFER_LENGTH_ERROR (-230)
64 
65 /* Http Server interface */
66 #define MAX_INPUT_STRING (64) /* because of WPA */
67 
68 #define MAX_AUTH_NAME_LEN (20)
69 #define MAX_AUTH_PASSWORD_LEN (20)
70 #define MAX_AUTH_REALM_LEN (20)
71 
72 #define MAX_DEVICE_URN_LEN (15+1)
73 #define MAX_DOMAIN_NAME_LEN (24+1)
74 
75 #define MAX_ACTION_LEN (30)
76 /* Important: in case the max len is changed, make sure the struct sl_NetAppHttpServerSendToken_t in protocol.h is padded correctly! */
77 #define MAX_TOKEN_NAME_LEN (20)
78 #define MAX_TOKEN_VALUE_LEN MAX_INPUT_STRING
79 
80 #define NETAPP_MAX_SERVICE_TEXT_SIZE (256)
81 #define NETAPP_MAX_SERVICE_NAME_SIZE (60)
82 #define NETAPP_MAX_SERVICE_HOST_NAME_SIZE (64)
83 
84 
85 /* Server Responses */
86 #define SL_NETAPP_RESPONSE_NONE (0)
87 #define SL_NETAPP_HTTPSETTOKENVALUE (1)
88 
89 #define SL_NETAPP_FAMILY_MASK (0x80)
90 
91 /* mDNS types */
92 #define SL_NET_APP_MASK_IPP_TYPE_OF_SERVICE (0x00000001)
93 #define SL_NET_APP_MASK_DEVICE_INFO_TYPE_OF_SERVICE (0x00000002)
94 #define SL_NET_APP_MASK_HTTP_TYPE_OF_SERVICE (0x00000004)
95 #define SL_NET_APP_MASK_HTTPS_TYPE_OF_SERVICE (0x00000008)
96 #define SL_NET_APP_MASK_WORKSATION_TYPE_OF_SERVICE (0x00000010)
97 #define SL_NET_APP_MASK_GUID_TYPE_OF_SERVICE (0x00000020)
98 #define SL_NET_APP_MASK_H323_TYPE_OF_SERVICE (0x00000040)
99 #define SL_NET_APP_MASK_NTP_TYPE_OF_SERVICE (0x00000080)
100 #define SL_NET_APP_MASK_OBJECITVE_TYPE_OF_SERVICE (0x00000100)
101 #define SL_NET_APP_MASK_RDP_TYPE_OF_SERVICE (0x00000200)
102 #define SL_NET_APP_MASK_REMOTE_TYPE_OF_SERVICE (0x00000400)
103 #define SL_NET_APP_MASK_RTSP_TYPE_OF_SERVICE (0x00000800)
104 #define SL_NET_APP_MASK_SIP_TYPE_OF_SERVICE (0x00001000)
105 #define SL_NET_APP_MASK_SMB_TYPE_OF_SERVICE (0x00002000)
106 #define SL_NET_APP_MASK_SOAP_TYPE_OF_SERVICE (0x00004000)
107 #define SL_NET_APP_MASK_SSH_TYPE_OF_SERVICE (0x00008000)
108 #define SL_NET_APP_MASK_TELNET_TYPE_OF_SERVICE (0x00010000)
109 #define SL_NET_APP_MASK_TFTP_TYPE_OF_SERVICE (0x00020000)
110 #define SL_NET_APP_MASK_XMPP_CLIENT_TYPE_OF_SERVICE (0x00040000)
111 #define SL_NET_APP_MASK_RAOP_TYPE_OF_SERVICE (0x00080000)
112 #define SL_NET_APP_MASK_ALL_TYPE_OF_SERVICE (0xFFFFFFFF)
113 
114 /********************************************************************************************************/
115 /* sl_NetAppDnsGetHostByName error codes */
116 
117 #define SL_NET_APP_DNS_QUERY_NO_RESPONSE (-159) /* DNS query failed, no response */
118 #define SL_NET_APP_DNS_NO_SERVER (-161) /* No DNS server was specified */
119 #define SL_NET_APP_DNS_PARAM_ERROR (-162) /* mDNS parameters error */
120 #define SL_NET_APP_DNS_QUERY_FAILED (-163) /* DNS query failed; no DNS server sent an 'answer' */
121 #define SL_NET_APP_DNS_INTERNAL_1 (-164)
122 #define SL_NET_APP_DNS_INTERNAL_2 (-165)
123 #define SL_NET_APP_DNS_MALFORMED_PACKET (-166) /* Improperly formed or corrupted DNS packet received */
124 #define SL_NET_APP_DNS_INTERNAL_3 (-167)
125 #define SL_NET_APP_DNS_INTERNAL_4 (-168)
126 #define SL_NET_APP_DNS_INTERNAL_5 (-169)
127 #define SL_NET_APP_DNS_INTERNAL_6 (-170)
128 #define SL_NET_APP_DNS_INTERNAL_7 (-171)
129 #define SL_NET_APP_DNS_INTERNAL_8 (-172)
130 #define SL_NET_APP_DNS_INTERNAL_9 (-173)
131 #define SL_NET_APP_DNS_MISMATCHED_RESPONSE (-174) /* Server response type does not match the query request*/
132 #define SL_NET_APP_DNS_INTERNAL_10 (-175)
133 #define SL_NET_APP_DNS_INTERNAL_11 (-176)
134 #define SL_NET_APP_DNS_NO_ANSWER (-177) /* No response for one-shot query */
135 #define SL_NET_APP_DNS_NO_KNOWN_ANSWER (-178) /* No known answer for query */
136 #define SL_NET_APP_DNS_NAME_MISMATCH (-179) /* Illegal service name according to the RFC */
137 #define SL_NET_APP_DNS_NOT_STARTED (-180) /* mDNS is not running */
138 #define SL_NET_APP_DNS_HOST_NAME_ERROR (-181) /* Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763 */
139 #define SL_NET_APP_DNS_NO_MORE_ENTRIES (-182) /* No more entries be found. */
140 
141 #define SL_NET_APP_DNS_MAX_SERVICES_ERROR (-200) /* Maximum advertise services are already configured */
142 #define SL_NET_APP_DNS_IDENTICAL_SERVICES_ERROR (-201) /* Trying to register a service that is already exists */
143 #define SL_NET_APP_DNS_NOT_EXISTED_SERVICE_ERROR (-203) /* Trying to delete service that does not existed */
144 #define SL_NET_APP_DNS_ERROR_SERVICE_NAME_ERROR (-204) /* Illegal service name according to the RFC */
145 #define SL_NET_APP_DNS_RX_PACKET_ALLOCATION_ERROR (-205) /* Retry request */
146 #define SL_NET_APP_DNS_BUFFER_SIZE_ERROR (-206) /* List size buffer is bigger than internally allowed in the NWP */
147 #define SL_NET_APP_DNS_NET_APP_SET_ERROR (-207) /* Illegal length of one of the mDNS Set functions */
148 #define SL_NET_APP_DNS_GET_SERVICE_LIST_FLAG_ERROR (-208)
149 #define SL_NET_APP_DNS_NO_CONFIGURATION_ERROR (-209)
150 
151 /* Set Dev name error codes (NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN) */
152 #define SL_ERROR_DEVICE_NAME_LEN_ERR (-117)
153 #define SL_ERROR_DEVICE_NAME_INVALID (-118)
154 /* Set domain name error codes (NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME) */
155 #define SL_ERROR_DOMAIN_NAME_LEN_ERR (-119)
156 #define SL_ERROR_DOMAIN_NAME_INVALID (-120)
157 
158 /********************************************************************************************************/
159 
160 /* NetApp application IDs */
161 #define SL_NET_APP_HTTP_SERVER_ID (1)
162 #define SL_NET_APP_DHCP_SERVER_ID (2)
163 #define SL_NET_APP_MDNS_ID (4)
164 #define SL_NET_APP_DNS_SERVER_ID (8)
165 #define SL_NET_APP_DEVICE_CONFIG_ID (16)
166 /* NetApp application set/get options */
167 #define NETAPP_SET_DHCP_SRV_BASIC_OPT (0)
168 /* HTTP server set/get options */
169 #define NETAPP_SET_GET_HTTP_OPT_PORT_NUMBER (0)
170 #define NETAPP_SET_GET_HTTP_OPT_AUTH_CHECK (1)
171 #define NETAPP_SET_GET_HTTP_OPT_AUTH_NAME (2)
172 #define NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD (3)
173 #define NETAPP_SET_GET_HTTP_OPT_AUTH_REALM (4)
174 #define NETAPP_SET_GET_HTTP_OPT_ROM_PAGES_ACCESS (5)
175 
176 #define NETAPP_SET_GET_MDNS_CONT_QUERY_OPT (1)
177 #define NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT (2)
178 #define NETAPP_SET_GET_MDNS_TIMING_PARAMS_OPT (3)
179 
180 /* DNS server set/get options */
181 #define NETAPP_SET_GET_DNS_OPT_DOMAIN_NAME (0)
182 
183 /* Device Config set/get options */
184 #define NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN (0)
185 #define NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME (1)
186 
187 
188 /*****************************************************************************/
189 /* Structure/Enum declarations */
190 /*****************************************************************************/
191 
192 typedef struct
193 {
194  _u32 PacketsSent;
195  _u32 PacketsReceived;
196  _u16 MinRoundTime;
197  _u16 MaxRoundTime;
198  _u16 AvgRoundTime;
199  _u32 TestTime;
201 
202 typedef struct
203 {
204  _u32 PingIntervalTime; /* delay between pings, in milliseconds */
205  _u16 PingSize; /* ping packet size in bytes */
206  _u16 PingRequestTimeout; /* timeout time for every ping in milliseconds */
207  _u32 TotalNumberOfAttempts; /* max number of ping requests. 0 - forever */
208  _u32 Flags; /* flag - 0 report only when finished, 1 - return response for every ping, 2 - stop after 1 successful ping. */
209  _u32 Ip; /* IPv4 address or IPv6 first 4 bytes */
210  _u32 Ip1OrPaadding;
211  _u32 Ip2OrPaadding;
212  _u32 Ip3OrPaadding;
214 
215 typedef struct _slHttpServerString_t
216 {
217  _u8 len;
218  _u8 *data;
220 
221 typedef struct _slHttpServerData_t
222 {
223  _u8 value_len;
224  _u8 name_len;
225  _u8 *token_value;
226  _u8 *token_name;
228 
230 {
231  slHttpServerString_t action;
232  slHttpServerString_t token_name;
233  slHttpServerString_t token_value;
235 
236 typedef union
237 {
238  slHttpServerString_t httpTokenName; /* SL_NETAPP_HTTPGETTOKENVALUE */
239  slHttpServerPostData_t httpPostData; /* SL_NETAPP_HTTPPOSTTOKENVALUE */
241 
242 typedef union
243 {
244  slHttpServerString_t token_value;
246 
247 typedef struct
248 {
249  _u32 Event;
250  SlHttpServerEventData_u EventData;
252 
253 typedef struct
254 {
255  _u32 Response;
256  SlHttpServerResponsedata_u ResponseData;
258 
259 
260 typedef struct
261 {
262  _u32 lease_time;
263  _u32 ipv4_addr_start;
264  _u32 ipv4_addr_last;
266 
267 /*mDNS parameters*/
268 typedef enum
269 {
270  SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE = 1,
271  SL_NET_APP_FULL_SERVICE_IPV4_TYPE,
272  SL_NET_APP_SHORT_SERVICE_IPV4_TYPE
273 
274 } SlNetAppGetServiceListType_e;
275 
276 typedef struct
277 {
278  _u32 service_ipv4;
279  _u16 service_port;
280  _u16 Reserved;
282 
283 typedef struct
284 {
285  _u32 service_ipv4;
286  _u16 service_port;
287  _u16 Reserved;
288  _u8 service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
289  _u8 service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
291 
292 typedef struct
293 {
294  _u32 service_ipv4;
295  _u16 service_port;
296  _u16 Reserved;
297  _u8 service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
298  _u8 service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
299  _u8 service_text[NETAPP_MAX_SERVICE_TEXT_SIZE];
301 
302 typedef struct
303 {
304  /*The below parameters are used to configure the advertise times and interval
305  For example:
306  If:
307  Period is set to T
308  Repetitions are set to P
309  Telescopic factor is K=2
310  The transmission shall be:
311  advertise P times
312  wait T
313  advertise P times
314  wait 4 * T
315  advertise P time
316  wait 16 * T ... (till max time reached / configuration changed / query issued)
317  */
318  _u32 t; /* Number of ticks for the initial period. Default is 100 ticks for 1 second. */
319  _u32 p; /* Number of repetitions. Default value is 1 */
320  _u32 k; /* Telescopic factor. Default value is 2. */
321  _u32 RetransInterval;/* Announcing retransmission interval */
322  _u32 Maxinterval; /* Announcing max period interval */
323  _u32 max_time; /* Announcing max time */
325 
326 /*****************************************************************************/
327 /* Types declarations */
328 /*****************************************************************************/
329 typedef void (*P_SL_DEV_PING_CALLBACK)(SlPingReport_t*);
330 
331 /*****************************************************************************/
332 /* Function prototypes */
333 /*****************************************************************************/
334 
335 
358 #if _SL_INCLUDE_FUNC(sl_NetAppStart)
359 _i16 sl_NetAppStart(_u32 AppBitMap);
360 #endif
361 
384 #if _SL_INCLUDE_FUNC(sl_NetAppStop)
385 _i16 sl_NetAppStop(_u32 AppBitMap);
386 #endif
387 
432 #if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
433 _i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_addr,_u8 family );
434 #endif
435 
491 #if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
492 _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all (or only part): name + subtype + service */
493  _u8 ServiceLen,
494  _u8 Family, /* 4-IPv4 , 16-IPv6 */
495  _u32 pAddr[],
496  _u32 *pPort,
497  _u16 *pTextLen, /* in: max len , out: actual len */
498  _i8 *pText
499  );
500 
501 #endif
502 
551 #if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
552 _i16 sl_NetAppGetServiceList(_u8 IndexOffest,
553  _u8 MaxServiceCount,
554  _u8 Flags,
555  _i8 *pBuffer,
556  _u32 RxBufferLength
557  );
558 
559 #endif
560 
584 #if _SL_INCLUDE_FUNC(sl_NetAppMDNSUnRegisterService)
585 _i16 sl_NetAppMDNSUnRegisterService(const _i8 *pServiceName,_u8 ServiceNameLen);
586 #endif
587 
652 #if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterService)
653 _i16 sl_NetAppMDNSRegisterService( const _i8* pServiceName,
654  _u8 ServiceNameLen,
655  const _i8* pText,
656  _u8 TextLen,
657  _u16 Port,
658  _u32 TTL,
659  _u32 Options);
660 #endif
661 
722 #if _SL_INCLUDE_FUNC(sl_NetAppPingStart)
723 _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback);
724 #endif
725 
772 #if _SL_INCLUDE_FUNC(sl_NetAppSet)
773 _i32 sl_NetAppSet(_u8 AppId ,_u8 Option,_u8 OptionLen, _u8 *pOptionValue);
774 #endif
775 
826 #if _SL_INCLUDE_FUNC(sl_NetAppGet)
827 _i32 sl_NetAppGet(_u8 AppId, _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue);
828 #endif
829 
830 
831 
840 #ifdef __cplusplus
841 }
842 #endif /* __cplusplus */
843 
844 #endif /* __NETAPP_H__ */
845 
Definition: netapp.h:260
Definition: netapp.h:236
Definition: netapp.h:221
Definition: netapp.h:247
Definition: netapp.h:276
Definition: netapp.h:202
Definition: netapp.h:215
Definition: netapp.h:253
Definition: netapp.h:242
Definition: netapp.h:192
Definition: netapp.h:229
Definition: netapp.h:283