1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Web Component                                                    */
17 /**                                                                       */
18 /**   Hypertext Transfer Protocol (HTTP)                                  */
19 /**   Hypertext Transfer Protocol Secure (HTTPS using TLS)                */
20 /**                                                                       */
21 /**************************************************************************/
22 /**************************************************************************/
23 
24 
25 /**************************************************************************/
26 /*                                                                        */
27 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
28 /*                                                                        */
29 /*    nx_web_http_server.h                                PORTABLE C      */
30 /*                                                           6.2.0        */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Yuxin Zhou, Microsoft Corporation                                   */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This file defines the NetX Hypertext Transfer Protocol (HTTP)       */
38 /*    component, including all data types and external references.        */
39 /*    It is assumed that nx_api.h and nx_port.h have already been         */
40 /*    included, along with fx_api.h and fx_port.h.                        */
41 /*                                                                        */
42 /*  RELEASE HISTORY                                                       */
43 /*                                                                        */
44 /*    DATE              NAME                      DESCRIPTION             */
45 /*                                                                        */
46 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
47 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
48 /*                                            resulting in version 6.1    */
49 /*  04-02-2021     Yuxin Zhou               Modified comment(s), and      */
50 /*                                            improved the logic of       */
51 /*                                            parsing base64,             */
52 /*                                            resulting in version 6.1.6  */
53 /*  08-02-2021     Yuxin Zhou               Modified comment(s), and      */
54 /*                                            improved the logic of       */
55 /*                                            converting number to string,*/
56 /*                                            resulting in version 6.1.8  */
57 /*  10-15-2021     Yuxin Zhou               Modified comment(s), and      */
58 /*                                            deprecated unused macros,   */
59 /*                                            resulting in version 6.1.9  */
60 /*  04-25-2022     Yuxin Zhou               Modified comment(s), and      */
61 /*                                            supported ECC configuration,*/
62 /*                                            resulting in version 6.1.11 */
63 /*  10-31-2022     Yuxin Zhou               Modified comment(s), and      */
64 /*                                            supported random nonce,     */
65 /*                                            resulting in version 6.2.0  */
66 /*                                                                        */
67 /**************************************************************************/
68 
69 #ifndef NXD_HTTP_SERVER_H
70 #define NXD_HTTP_SERVER_H
71 
72 /* Determine if a C++ compiler is being used.  If so, ensure that standard
73    C is used to process the API information.  */
74 
75 #ifdef   __cplusplus
76 
77 /* Yes, C++ compiler is present.  Use standard C.  */
78 extern   "C" {
79 
80 #endif
81 
82 /* If HTTPS is enabled, make sure TLS is enabled in the TCP server. */
83 #ifdef NX_WEB_HTTPS_ENABLE
84 #ifndef NX_TCPSERVER_ENABLE_TLS
85 #define NX_TCPSERVER_ENABLE_TLS
86 #endif
87 #endif
88 
89 #include    "nx_api.h"
90 /* If not using FileX, define this option and define the file writing services
91    declared in filex_stub.h.  */
92 /* #define      NX_WEB_HTTP_NO_FILEX  */
93 
94 #ifndef      NX_WEB_HTTP_NO_FILEX
95 #include    "fx_api.h"
96 #else
97 #include    "filex_stub.h"
98 #endif
99 
100 /* Include common HTTP definitions. */
101 #include "nx_web_http_common.h"
102 
103 /* Include multiple-socket TCP/TLS support. */
104 #include "nx_tcpserver.h"
105 
106 /* Define the HTTP Server ID.  */
107 #define NX_WEB_HTTP_SERVER_ID               0x48545451UL
108 
109 /* Enable Digest authentication.
110 #define NX_WEB_HTTP_DIGEST_ENABLE
111 */
112 
113 /* Define HTTP TCP socket create options.  */
114 #ifndef NX_WEB_HTTP_SERVER_PRIORITY
115 #define NX_WEB_HTTP_SERVER_PRIORITY             4
116 #endif
117 
118 #ifndef NX_WEB_HTTP_SERVER_WINDOW_SIZE
119 #define NX_WEB_HTTP_SERVER_WINDOW_SIZE          8192
120 #endif
121 
122 #ifndef NX_WEB_HTTP_SERVER_TIMEOUT_ACCEPT
123 #define NX_WEB_HTTP_SERVER_TIMEOUT_ACCEPT       (1 * NX_IP_PERIODIC_RATE)
124 #endif
125 
126 #ifndef NX_WEB_HTTP_SERVER_TIMEOUT_RECEIVE
127 #define NX_WEB_HTTP_SERVER_TIMEOUT_RECEIVE      (10 * NX_IP_PERIODIC_RATE)
128 #endif
129 
130 #ifndef NX_WEB_HTTP_SERVER_TIMEOUT_SEND
131 #define NX_WEB_HTTP_SERVER_TIMEOUT_SEND         (10 * NX_IP_PERIODIC_RATE)
132 #endif
133 
134 #ifndef NX_WEB_HTTP_SERVER_TIMEOUT_DISCONNECT
135 #define NX_WEB_HTTP_SERVER_TIMEOUT_DISCONNECT   (10 * NX_IP_PERIODIC_RATE)
136 #endif
137 
138 #ifndef NX_WEB_HTTP_SERVER_TIMEOUT
139 #define NX_WEB_HTTP_SERVER_TIMEOUT              (10 * NX_IP_PERIODIC_RATE)
140 #endif
141 
142 #ifndef NX_WEB_HTTP_SERVER_SESSION_MAX
143 #define NX_WEB_HTTP_SERVER_SESSION_MAX          2
144 #endif
145 
146 #ifndef NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE
147 #define NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE  (sizeof(NX_TCP_SESSION) * NX_WEB_HTTP_SERVER_SESSION_MAX)
148 #endif
149 
150 #ifndef NX_WEB_HTTP_SERVER_MAX_PENDING
151 #define NX_WEB_HTTP_SERVER_MAX_PENDING          (NX_WEB_HTTP_SERVER_SESSION_MAX << 1)
152 #endif
153 
154 /* Deprecated. This symbol is defined for compatibility. */
155 #ifndef NX_WEB_HTTP_SERVER_THREAD_TIME_SLICE
156 #define NX_WEB_HTTP_SERVER_THREAD_TIME_SLICE    2
157 #endif
158 
159 #ifndef NX_WEB_HTTP_SERVER_MIN_PACKET_SIZE
160 #define NX_WEB_HTTP_SERVER_MIN_PACKET_SIZE      600
161 #endif
162 
163 /* Define the HTTP server retry parameters.  */
164 
165 #ifndef NX_WEB_HTTP_SERVER_RETRY_SECONDS
166 #define NX_WEB_HTTP_SERVER_RETRY_SECONDS        2           /* 2 second initial timeout                            */
167 #endif
168 
169 #ifndef NX_WEB_HTTP_SERVER_TRANSMIT_QUEUE_DEPTH
170 #define NX_WEB_HTTP_SERVER_TRANSMIT_QUEUE_DEPTH 20          /* Maximum of 20 queued transmit packets               */
171 #endif
172 
173 #ifndef NX_WEB_HTTP_SERVER_RETRY_MAX
174 #define NX_WEB_HTTP_SERVER_RETRY_MAX            10          /* Maximum of 10 retries per packet                    */
175 #endif
176 
177 #ifndef NX_WEB_HTTP_SERVER_RETRY_SHIFT
178 #define NX_WEB_HTTP_SERVER_RETRY_SHIFT          1           /* Every retry is twice as long                        */
179 #endif
180 
181 #ifndef NX_WEB_HTTP_SERVER_NONCE_MAX
182 #define NX_WEB_HTTP_SERVER_NONCE_MAX            (NX_WEB_HTTP_SERVER_SESSION_MAX << 1)
183 #endif
184 
185 #ifndef NX_WEB_HTTP_SERVER_NONCE_SIZE
186 #define NX_WEB_HTTP_SERVER_NONCE_SIZE           32
187 #endif
188 
189 #ifndef NX_WEB_HTTP_SERVER_NONCE_TIMEOUT
190 #define NX_WEB_HTTP_SERVER_NONCE_TIMEOUT        (10 * NX_IP_PERIODIC_RATE)
191 #endif
192 
193 /* Define the state of the nonce.  */
194 
195 #define NX_WEB_HTTP_SERVER_NONCE_INVALID        0
196 #define NX_WEB_HTTP_SERVER_NONCE_VALID          1
197 #define NX_WEB_HTTP_SERVER_NONCE_ACCEPTED       2
198 
199 /* Define HTTP Server request types.  */
200 
201 #define NX_WEB_HTTP_SERVER_UNKNOWN_REQUEST      0
202 #define NX_WEB_HTTP_SERVER_GET_REQUEST          1
203 #define NX_WEB_HTTP_SERVER_POST_REQUEST         2
204 #define NX_WEB_HTTP_SERVER_HEAD_REQUEST         3
205 #define NX_WEB_HTTP_SERVER_PUT_REQUEST          4
206 #define NX_WEB_HTTP_SERVER_DELETE_REQUEST       5
207 
208 
209 #ifdef  NX_WEB_HTTP_DIGEST_ENABLE
210 
211 /* Include the MD5 digest header file.  */
212 
213 #include "nx_md5.h"
214 
215 #endif
216 
217 #ifdef NX_WEB_HTTPS_ENABLE
218 /* Include TLS for HTTPS support. */
219 #include "nx_secure_tls_api.h"
220 #endif
221 
222 /* Define default MIME type. */
223 /* Page 14, Section 5.2, RFC 2045 */
224 #define NX_WEB_HTTP_SERVER_DEFAULT_MIME         "text/plain"
225 
226 
227 /* Define the MIME map structure. */
228 
229 typedef struct NX_WEB_HTTP_SERVER_MIME_MAP_STRUCT
230 {
231     CHAR           *nx_web_http_server_mime_map_extension;              /* Extension of file    */
232     CHAR           *nx_web_http_server_mime_map_type;                   /* MIME type of file    */
233 } NX_WEB_HTTP_SERVER_MIME_MAP;
234 
235 
236 /* Define the date structure. */
237 
238 typedef struct NX_WEB_HTTP_SERVER_DATE_STRUCT
239 {
240     USHORT          nx_web_http_server_year;                            /* Year                 */
241     UCHAR           nx_web_http_server_month;                           /* Month                */
242     UCHAR           nx_web_http_server_day;                             /* Day                  */
243     UCHAR           nx_web_http_server_hour;                            /* Hour                 */
244     UCHAR           nx_web_http_server_minute;                          /* Minute               */
245     UCHAR           nx_web_http_server_second;                          /* Second               */
246     UCHAR           nx_web_http_server_weekday;                         /* Weekday              */
247 } NX_WEB_HTTP_SERVER_DATE;
248 
249 /* Define the nonce structure.  */
250 
251 typedef struct NX_WEB_HTTP_SERVER_NONCE_STRUCT
252 {
253     UINT            nonce_state;                                        /* The state of the nonce               */
254     ULONG           nonce_timestamp;                                    /* The time when the nonce is created   */
255     NX_TCP_SESSION  *nonce_session_ptr;                                 /* The session accepted with this nonce */
256     UCHAR           nonce_buffer[NX_WEB_HTTP_SERVER_NONCE_SIZE];        /* Nonce for digest authetication       */
257 } NX_WEB_HTTP_SERVER_NONCE;
258 
259 /* Define the multipart context data structure.  */
260 
261 typedef struct NX_WEB_HTTP_SERVER_MULTIPART_STRUCT
262 {
263 
264     /* Boundary string.  */
265     UCHAR           nx_web_http_server_multipart_boundary[NX_WEB_HTTP_MAX_HEADER_FIELD + 1];
266 
267     /* Offset of available data. */
268     UINT            nx_web_http_server_multipart_available_offset;
269 
270     /* Length of available data. */
271     UINT            nx_web_http_server_multipart_available_length;
272 
273     /* Boundary find status. */
274     volatile UINT   nx_web_http_server_multipart_boundary_find;
275 
276     /* The next packet to process. */
277     NX_PACKET      *nx_web_http_server_multipart_next_packet;
278 
279     /* Offset of next available data. */
280     UINT            nx_web_http_server_multipart_next_available_offset;
281 
282     /* The packet returned at last. */
283     NX_PACKET      *nx_web_http_server_multipart_last_packet;
284 
285 } NX_WEB_HTTP_SERVER_MULTIPART;
286 
287 
288 /* Define the HTTP Server data structure.  */
289 
290 typedef struct NX_WEB_HTTP_SERVER_STRUCT
291 {
292     ULONG           nx_web_http_server_id;                              /* HTTP Server ID                       */
293     CHAR           *nx_web_http_server_name;                            /* Name of this HTTP Server             */
294     NX_IP          *nx_web_http_server_ip_ptr;                          /* Pointer to associated IP structure   */
295     CHAR            nx_web_http_server_request_resource[NX_WEB_HTTP_MAX_RESOURCE + 1];
296                                                                         /* Uniform Resource Locator (URL)       */
297     NX_PACKET_POOL *nx_web_http_server_packet_pool_ptr;                 /* Pointer to HTTP Server packet pool   */
298     FX_MEDIA       *nx_web_http_server_media_ptr;                       /* Pointer to media control block       */
299     ULONG           nx_web_http_server_get_requests;                    /* Number of get requests               */
300     ULONG           nx_web_http_server_head_requests;                   /* Number of head requests              */
301     ULONG           nx_web_http_server_put_requests;                    /* Number of put requests               */
302     ULONG           nx_web_http_server_delete_requests;                 /* Number of delete requests            */
303     ULONG           nx_web_http_server_post_requests;                   /* Number of post requests              */
304     ULONG           nx_web_http_server_unknown_requests;                /* Number of unknown requests           */
305     ULONG           nx_web_http_server_total_bytes_sent;                /* Number of total bytes sent           */
306     ULONG           nx_web_http_server_total_bytes_received;            /* Number of total bytes received       */
307     ULONG           nx_web_http_server_allocation_errors;               /* Number of allocation errors          */
308     ULONG           nx_web_http_server_invalid_http_headers;            /* Number of invalid http headers       */
309     FX_FILE         nx_web_http_server_file;                            /* HTTP file control block              */
310 
311     NX_TCPSERVER    nx_web_http_server_tcpserver;                       /* TCP server with multiple sessions    */
312     NX_TCP_SESSION *nx_web_http_server_current_session_ptr;             /* Current session in process           */
313     UCHAR           nx_web_http_server_session_buffer[NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE];
314                                                                     /* Size of session buffer               */
315 
316     NX_TCP_SOCKET   nx_web_http_server_socket;                          /* HTTP Server TCP socket               */
317     UINT            nx_web_http_server_listen_port;                     /* HTTP(S) listening port.              */
318 #ifdef NX_WEB_HTTPS_ENABLE
319     UINT            nx_web_http_is_https_server;                        /* If using TLS for HTTPS, set to true. */
320 #endif
321 
322 #ifdef  NX_WEB_HTTP_DIGEST_ENABLE
323     NX_MD5          nx_web_http_server_md5data;                         /* HTTP server MD5 work area            */
324     NX_WEB_HTTP_SERVER_NONCE
325                     nx_web_http_server_nonces[NX_WEB_HTTP_SERVER_NONCE_MAX];
326                                                                         /* Nonce for digest authetication       */
327 #endif /* NX_WEB_HTTP_DIGEST_ENABLE */
328 
329 #ifdef  NX_WEB_HTTP_MULTIPART_ENABLE
330     NX_WEB_HTTP_SERVER_MULTIPART
331                     nx_web_http_server_multipart;                       /* HTTP multipart area                  */
332 #endif /* NX_WEB_HTTP_MULTIPART_ENABLE */
333 
334     UINT            nx_web_http_server_request_type;                    /* HTTP request type                    */
335     NX_WEB_HTTP_SERVER_MIME_MAP
336                    *nx_web_http_server_mime_maps_additional;            /* Additional HTTP MIME maps            */
337     UINT            nx_web_http_server_mime_maps_additional_num;        /* Number of additional HTTP MIME maps  */
338 
339 #ifndef NX_WEB_HTTP_KEEPALIVE_DISABLE
340     UCHAR           nx_web_http_server_keepalive;                       /* HTTP keepalive flag                  */
341     UCHAR           nx_web_http_server_reserved;                        /* Reserved                             */
342 #else
343     UCHAR           nx_web_http_server_reserved[2];                     /* Reserved                             */
344 #endif /* NX_WEB_HTTP_KEEPALIVE_DISABLE */
345 
346     UCHAR           nx_web_http_server_response_chunked;                /* Flag for chunked response            */
347     UCHAR           nx_web_http_server_request_chunked;                 /* Flag for chunked request             */
348     UINT            nx_web_http_server_expect_transfer_bytes;           /* The bytes expected to transfer       */
349     UINT            nx_web_http_server_actual_bytes_transferred;        /* The actual transferred bytes         */
350     UINT            nx_web_http_server_expect_receive_bytes;            /* The bytes expected to receive        */
351     UINT            nx_web_http_server_actual_bytes_received;           /* The actual received bytes            */
352     UINT            nx_web_http_server_chunked_request_remaining_size;  /* Remaining size of the chunked request*/
353     NX_PACKET      *nx_web_http_server_request_packet;                  /* Pointer to the received request      */
354 
355     /* Define the user supplied routines that are used to inform the application of particular server requests.  */
356 
357     UINT (*nx_web_http_server_authentication_check)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm);
358     UINT (*nx_web_http_server_authentication_check_extended)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, UINT request_type, CHAR *resource, CHAR **name, UINT *name_length, CHAR **password, UINT *password_length, CHAR **realm, UINT *realm_length);
359     UINT (*nx_web_http_server_request_notify)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr);
360 #ifdef __PRODUCT_NETXDUO__
361     UINT (*nx_web_http_server_invalid_username_password_callback)(CHAR *resource, NXD_ADDRESS *client_nxd_address, UINT request_type);
362 #else
363     UINT (*nx_web_http_server_invalid_username_password_callback)(CHAR *resource, ULONG client_address, UINT request_type);
364 #endif
365     VOID (*nx_web_http_server_gmt_get)(NX_WEB_HTTP_SERVER_DATE *date);
366     UINT (*nx_web_http_server_cache_info_get)(CHAR *resource, UINT *max_age, NX_WEB_HTTP_SERVER_DATE *last_modified);
367 #ifdef  NX_WEB_HTTP_DIGEST_ENABLE
368     UINT (*nx_web_http_server_digest_authenticate_callback)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, CHAR *name_ptr,
369                                                             CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
370                                                             CHAR *authorization_uri, CHAR *authorization_nc,
371                                                             CHAR *authorization_cnonce);
372 #endif
373 } NX_WEB_HTTP_SERVER;
374 
375 
376 #ifndef NX_WEB_HTTP_SERVER_SOURCE_CODE
377 
378 /* Application caller is present, perform API mapping.  */
379 
380 /* Determine if error checking is desired.  If so, map API functions
381    to the appropriate error checking front-ends.  Otherwise, map API
382    functions to the core functions that actually perform the work.
383    Note: error checking is enabled by default.  */
384 
385 #ifdef NX_DISABLE_ERROR_CHECKING
386 
387 /* Services without error checking.  */
388 
389 #define nx_web_http_server_callback_data_send                _nx_web_http_server_callback_data_send
390 #define nx_web_http_server_callback_response_send            _nx_web_http_server_callback_response_send
391 #define nx_web_http_server_callback_response_send_extended   _nx_web_http_server_callback_response_send_extended
392 #define nx_web_http_server_content_get                       _nx_web_http_server_content_get
393 #define nx_web_http_server_create                            _nx_web_http_server_create
394 #define nx_web_http_server_delete                            _nx_web_http_server_delete
395 #define nx_web_http_server_param_get                         _nx_web_http_server_param_get
396 #define nx_web_http_server_query_get                         _nx_web_http_server_query_get
397 #define nx_web_http_server_start                             _nx_web_http_server_start
398 #define nx_web_http_server_secure_configure                  _nx_web_http_server_secure_configure
399 #define nx_web_http_server_secure_ecc_configure              _nx_web_http_server_secure_ecc_configure
400 #define nx_web_http_server_stop                              _nx_web_http_server_stop
401 #define nx_web_http_server_content_get_extended              _nx_web_http_server_content_get_extended
402 #define nx_web_http_server_content_length_get                _nx_web_http_server_content_length_get
403 #define nx_web_http_server_get_entity_header                 _nx_web_http_server_get_entity_header
404 #define nx_web_http_server_get_entity_content                _nx_web_http_server_get_entity_content
405 #define nx_web_http_server_callback_generate_response_header _nx_web_http_server_callback_generate_response_header
406 #define nx_web_http_server_callback_generate_response_header_extended _nx_web_http_server_callback_generate_response_header_extended
407 #define nx_web_http_server_callback_packet_send              _nx_web_http_server_callback_packet_send
408 #define nx_web_http_server_gmt_callback_set                  _nx_web_http_server_gmt_callback_set
409 #define nx_web_http_server_cache_info_callback_set           _nx_web_http_server_cache_info_callback_set
410 #define nx_web_http_server_mime_maps_additional_set          _nx_web_http_server_mime_maps_additional_set
411 #define nx_web_http_server_type_get                          _nx_web_http_server_type_get
412 #define nx_web_http_server_type_get_extended                 _nx_web_http_server_type_get_extended
413 #define nx_web_http_server_packet_content_find               _nx_web_http_server_packet_content_find
414 #define nx_web_http_server_packet_get                        _nx_web_http_server_packet_get
415 #define nx_web_http_server_invalid_userpassword_notify_set   _nx_web_http_server_invalid_userpassword_notify_set
416 #define nx_web_http_server_response_chunked_set              _nx_web_http_server_response_chunked_set
417 #define nx_web_http_server_response_packet_allocate          _nx_web_http_server_response_packet_allocate
418 #define nx_web_http_server_digest_authenticate_notify_set    _nx_web_http_server_digest_authenticate_notify_set
419 #define nx_web_http_server_authentication_check_set          _nx_web_http_server_authentication_check_set
420 
421 #else
422 
423 /* Services with error checking.  */
424 
425 #define nx_web_http_server_callback_data_send                _nxe_web_http_server_callback_data_send
426 #define nx_web_http_server_callback_response_send            _nxe_web_http_server_callback_response_send
427 #define nx_web_http_server_callback_response_send_extended   _nxe_web_http_server_callback_response_send_extended
428 #define nx_web_http_server_content_get                       _nxe_web_http_server_content_get
429 #define nx_web_http_server_content_length_get                _nxe_web_http_server_content_length_get
430 #define nx_web_http_server_create(p,n,i,pn,m,sp,ss,pp,a,r)   _nxe_web_http_server_create(p,n,i,pn,m,sp,ss,pp,a,r,sizeof(NX_WEB_HTTP_SERVER))
431 #define nx_web_http_server_delete                            _nxe_web_http_server_delete
432 #define nx_web_http_server_param_get                         _nxe_web_http_server_param_get
433 #define nx_web_http_server_query_get                         _nxe_web_http_server_query_get
434 #define nx_web_http_server_start                             _nxe_web_http_server_start
435 #define nx_web_http_server_secure_configure                  _nxe_web_http_server_secure_configure
436 #define nx_web_http_server_secure_ecc_configure              _nxe_web_http_server_secure_ecc_configure
437 #define nx_web_http_server_stop                              _nxe_web_http_server_stop
438 #define nx_web_http_server_content_get_extended              _nxe_web_http_server_content_get_extended
439 #define nx_web_http_server_get_entity_header                 _nxe_web_http_server_get_entity_header
440 #define nx_web_http_server_get_entity_content                _nxe_web_http_server_get_entity_content
441 #define nx_web_http_server_callback_generate_response_header _nxe_web_http_server_callback_generate_response_header
442 #define nx_web_http_server_callback_generate_response_header_extended _nxe_web_http_server_callback_generate_response_header_extended
443 #define nx_web_http_server_callback_packet_send              _nxe_web_http_server_callback_packet_send
444 #define nx_web_http_server_gmt_callback_set                  _nxe_web_http_server_gmt_callback_set
445 #define nx_web_http_server_cache_info_callback_set           _nxe_web_http_server_cache_info_callback_set
446 #define nx_web_http_server_mime_maps_additional_set          _nxe_web_http_server_mime_maps_additional_set
447 #define nx_web_http_server_type_get                          _nxe_web_http_server_type_get
448 #define nx_web_http_server_type_get_extended                 _nxe_web_http_server_type_get_extended
449 #define nx_web_http_server_packet_content_find               _nxe_web_http_server_packet_content_find
450 #define nx_web_http_server_packet_get                        _nxe_web_http_server_packet_get
451 #define nx_web_http_server_invalid_userpassword_notify_set   _nxe_web_http_server_invalid_userpassword_notify_set
452 #define nx_web_http_server_response_chunked_set              _nxe_web_http_server_response_chunked_set
453 #define nx_web_http_server_response_packet_allocate          _nxe_web_http_server_response_packet_allocate
454 #define nx_web_http_server_digest_authenticate_notify_set    _nxe_web_http_server_digest_authenticate_notify_set
455 #define nx_web_http_server_authentication_check_set          _nxe_web_http_server_authentication_check_set
456 
457 #endif
458 
459 /* Define the prototypes accessible to the application software.  */
460 
461 
462 UINT        nx_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
463 UINT        nx_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
464 UINT        nx_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
465                                                                UINT status_code_length, CHAR *information,
466                                                                UINT information_length, CHAR *additional_info,
467                                                                UINT additional_info_length);
468 UINT        nx_web_http_server_content_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset, CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
469 UINT        nx_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
470 UINT        nx_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
471 
472 #ifdef NX_DISABLE_ERROR_CHECKING
473 UINT        _nx_web_http_server_create(NX_WEB_HTTP_SERVER *http_server_ptr, CHAR *http_server_name, NX_IP *ip_ptr, UINT server_port, FX_MEDIA *media_ptr, VOID *stack_ptr, ULONG stack_size, NX_PACKET_POOL *pool_ptr,
474                                    UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
475                                    UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr));
476 #else
477 UINT        _nxe_web_http_server_create(NX_WEB_HTTP_SERVER *http_server_ptr, CHAR *http_server_name, NX_IP *ip_ptr, UINT server_port, FX_MEDIA *media_ptr, VOID *stack_ptr, ULONG stack_size, NX_PACKET_POOL *pool_ptr,
478                                     UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
479                                     UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr), UINT http_server_size);
480 #endif /* NX_DISABLE_ERROR_CHECKING */
481 
482 UINT        nx_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
483 UINT        nx_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
484 UINT        nx_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
485 UINT        nx_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
486 #ifdef NX_WEB_HTTPS_ENABLE
487 UINT        nx_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
488                                             VOID *metadata_buffer, ULONG metadata_size,
489                                             UCHAR* packet_buffer, UINT packet_buffer_size,
490                                             NX_SECURE_X509_CERT *identity_certificate,
491                                             NX_SECURE_X509_CERT *trusted_certificates[],
492                                             UINT trusted_certs_num,
493                                             NX_SECURE_X509_CERT *remote_certificates[],
494                                             UINT remote_certs_num,
495                                             UCHAR *remote_certificate_buffer,
496                                             UINT remote_cert_buffer_size);
497 #ifdef NX_SECURE_ENABLE_ECC_CIPHERSUITE
498 UINT        nx_web_http_server_secure_ecc_configure(NX_WEB_HTTP_SERVER *http_server_ptr,
499                                                     const USHORT *supported_groups, USHORT supported_group_count,
500                                                     const NX_CRYPTO_METHOD **curves);
501 #endif /* NX_SECURE_ENABLE_ECC_CIPHERSUITE */
502 #endif /* NX_WEB_HTTPS_ENABLE */
503 UINT        nx_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
504 UINT        nx_web_http_server_content_get_extended(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset, CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
505 UINT        nx_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *length);
506 UINT        nx_web_http_server_get_entity_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, UCHAR *entity_header_buffer, ULONG buffer_size);
507 UINT        nx_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
508 UINT        nx_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
509                                                              CHAR *status_code, UINT content_length, CHAR *content_type,
510                                                              CHAR* additional_header);
511 UINT        nx_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
512                                                                           NX_PACKET **packet_pptr, CHAR *status_code,
513                                                                           UINT status_code_length, UINT content_length,
514                                                                           CHAR *content_type, UINT content_type_length,
515                                                                           CHAR *additional_header, UINT additional_header_length);
516 UINT        nx_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
517 UINT        nx_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_get)(NX_WEB_HTTP_SERVER_DATE *));
518 UINT        nx_web_http_server_cache_info_callback_set(NX_WEB_HTTP_SERVER *server_ptr, UINT (*cache_info_get)(CHAR *, UINT *, NX_WEB_HTTP_SERVER_DATE *));
519 UINT        nx_web_http_server_mime_maps_additional_set(NX_WEB_HTTP_SERVER *server_ptr, NX_WEB_HTTP_SERVER_MIME_MAP *mime_maps, UINT mime_maps_num);
520 UINT        nx_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
521 UINT        nx_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
522                                                  CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
523 
524 UINT        nx_web_http_server_invalid_userpassword_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr, UINT (*invalid_username_password_callback)(CHAR *resource, NXD_ADDRESS *client_nxd_address, UINT request_type ));
525 
526 UINT        nx_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
527 UINT        nx_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
528 UINT        nx_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
529                                                               UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
530                                                               CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
531                                                               CHAR *authorization_uri, CHAR *authorization_nc,
532                                                               CHAR *authorization_cnonce));
533 UINT        nx_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
534                                                         UINT (*authentication_check_extended)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, UINT *name_length, CHAR **password, UINT *password_length, CHAR **realm, UINT *realm_length));
535 
536 
537 #else
538 
539 /* HTTP source code is being compiled, do not perform any API mapping.  */
540 
541 UINT        _nx_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
542 UINT        _nx_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
543 UINT        _nx_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
544                                                                 UINT status_code_length, CHAR *information,
545                                                                 UINT information_length, CHAR *additional_info,
546                                                                 UINT additional_info_length);
547 UINT        _nx_web_http_server_content_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset, CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
548 UINT        _nx_web_http_server_create(NX_WEB_HTTP_SERVER *http_server_ptr, CHAR *http_server_name, NX_IP *ip_ptr, UINT server_port, FX_MEDIA *media_ptr, VOID *stack_ptr, ULONG stack_size, NX_PACKET_POOL *pool_ptr,
549                                 UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
550                                 UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr));
551 UINT        _nx_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
552 UINT        _nx_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
553 UINT        _nx_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
554 UINT        _nx_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
555 #ifdef NX_WEB_HTTPS_ENABLE
556 UINT        _nx_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
557                                             VOID *metadata_buffer, ULONG metadata_size,
558                                             UCHAR* packet_buffer, UINT packet_buffer_size,
559                                             NX_SECURE_X509_CERT *identity_certificate,
560                                             NX_SECURE_X509_CERT *trusted_certificates[],
561                                             UINT trusted_certs_num,
562                                             NX_SECURE_X509_CERT *remote_certificates[],
563                                             UINT remote_certs_num,
564                                             UCHAR *remote_certificate_buffer,
565                                             UINT remote_cert_buffer_size);
566 #ifdef NX_SECURE_ENABLE_ECC_CIPHERSUITE
567 UINT        _nx_web_http_server_secure_ecc_configure(NX_WEB_HTTP_SERVER *http_server_ptr,
568                                                      const USHORT *supported_groups, USHORT supported_group_count,
569                                                      const NX_CRYPTO_METHOD **curves);
570 #endif /* NX_SECURE_ENABLE_ECC_CIPHERSUITE */
571 #endif /* NX_WEB_HTTPS_ENABLE */
572 UINT        _nx_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
573 UINT        _nx_web_http_server_content_get_extended(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset, CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
574 UINT        _nx_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *length);
575 UINT        _nx_web_http_server_get_entity_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, UCHAR *entity_header_buffer, ULONG buffer_size);
576 UINT        _nx_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
577 UINT        _nx_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
578                                                               CHAR *status_code, UINT content_length, CHAR *content_type,
579                                                               CHAR* additional_header);
580 UINT        _nx_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
581                                                                            NX_PACKET **packet_pptr, CHAR *status_code,
582                                                                            UINT status_code_length, UINT content_length,
583                                                                            CHAR *content_type, UINT content_type_length,
584                                                                            CHAR *additional_header, UINT additional_header_length);
585 UINT        _nx_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
586 UINT        _nx_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_callback)(NX_WEB_HTTP_SERVER_DATE *));
587 UINT        _nx_web_http_server_cache_info_callback_set(NX_WEB_HTTP_SERVER *server_ptr, UINT (*cache_info_get)(CHAR *, UINT *, NX_WEB_HTTP_SERVER_DATE *));
588 UINT        _nx_web_http_server_mime_maps_additional_set(NX_WEB_HTTP_SERVER *server_ptr, NX_WEB_HTTP_SERVER_MIME_MAP *mime_maps, UINT mime_maps_num);
589 UINT        _nx_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
590 UINT        _nx_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
591 UINT        _nx_web_http_server_invalid_userpassword_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr, UINT (*invalid_username_password_callback)(CHAR *resource, NXD_ADDRESS *client_nxd_address, UINT request_type ));
592 UINT        _nx_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
593                                                                UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
594                                                                CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
595                                                                CHAR *authorization_uri, CHAR *authorization_nc,
596                                                                CHAR *authorization_cnonce));
597 UINT        _nx_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
598                                                          UINT (*authentication_check_extended)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, UINT *name_length, CHAR **password, UINT *password_length, CHAR **realm, UINT *realm_length));
599 
600 
601 /* Define internal HTTP Server functions.  */
602 
603 UINT        _nx_web_http_server_get_client_request(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
604 VOID        _nx_web_http_server_get_process(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, NX_PACKET *packet_ptr);
605 VOID        _nx_web_http_server_put_process(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
606 VOID        _nx_web_http_server_delete_process(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
607 UINT        _nx_web_http_server_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
608                                               UINT status_code_length, CHAR *information,
609                                               UINT information_length, CHAR *additional_information,
610                                               UINT additional_information_length);
611 UINT        _nx_web_http_server_basic_authenticate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, CHAR *name_ptr, CHAR *password_ptr, CHAR *realm_ptr, UINT *auth_request_present);
612 UINT        _nx_web_http_server_retrieve_basic_authorization(NX_PACKET *packet_ptr, CHAR *authorization_request_ptr);
613 UINT        _nx_web_http_server_retrieve_resource(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, CHAR *destination, UINT max_size);
614 UINT        _nx_web_http_server_calculate_content_offset(NX_PACKET *packet_ptr);
615 UINT        _nx_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
616 UINT        _nx_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
617                                                   CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
618 
619 UINT        _nx_web_http_server_receive(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG wait_option);
620 UINT        _nx_web_http_server_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG wait_option);
621 VOID        _nx_web_http_server_connection_reset(NX_WEB_HTTP_SERVER *server_ptr, NX_TCP_SESSION *session_ptr, UINT wait_option);
622 VOID        _nx_web_http_server_connection_disconnect(NX_WEB_HTTP_SERVER *server_ptr, NX_TCP_SESSION *session_ptr, UINT wait_option);
623 
624 #ifdef  NX_WEB_HTTP_DIGEST_ENABLE
625 UINT        _nx_web_http_server_digest_authenticate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, CHAR *name_ptr, CHAR *password_ptr, CHAR *realm_ptr, UINT *auth_request_present);
626 VOID        _nx_web_http_server_digest_response_calculate(NX_WEB_HTTP_SERVER *server_ptr, CHAR *username, CHAR *realm, CHAR *password, CHAR *nonce, CHAR *method, CHAR *uri, CHAR *nc, CHAR *cnonce, CHAR *result);
627 UINT        _nx_web_http_server_retrieve_digest_authorization(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, CHAR *response, CHAR *uri, CHAR *nc, CHAR *cnonce, NX_WEB_HTTP_SERVER_NONCE **nonce_ptr);
628 VOID        _nx_web_http_server_hex_ascii_convert(CHAR *source, UINT source_length, CHAR *destination);
629 UINT        _nx_web_http_server_nonce_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_WEB_HTTP_SERVER_NONCE **nonce_ptr);
630 #endif
631 
632 #ifdef  NX_WEB_HTTP_MULTIPART_ENABLE
633 UINT        _nx_web_http_server_boundary_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr);
634 #endif /* NX_WEB_HTTP_MULTIPART_ENABLE */
635 
636 UINT        _nx_web_http_server_match_string(UCHAR *src_start, UCHAR *src_end, UCHAR *target, ULONG target_length, ULONG *match_count, UCHAR **match_end_ptr);
637 UINT        _nx_web_http_server_field_value_get(NX_PACKET *packet_ptr, UCHAR *field_name, ULONG name_length, UCHAR *field_value, ULONG field_value_size);
638 UINT        _nx_web_http_server_memicmp(UCHAR *src, ULONG src_length, UCHAR *dest, ULONG dest_length);
639 
640 UINT        _nx_web_http_server_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
641                                                          CHAR *status_code, UINT status_code_length,
642                                                          UINT content_length, CHAR *content_type,
643                                                          UINT content_type_length, CHAR* additional_header,
644                                                          UINT additional_header_length);
645 UINT        _nx_web_http_server_date_to_string(NX_WEB_HTTP_SERVER_DATE *date, CHAR *string);
646 VOID        _nx_web_http_server_date_convert(UINT date, UINT count, CHAR *string);
647 
648 VOID        _nx_web_http_server_receive_data(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
649 VOID        _nx_web_http_server_connection_end(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
650 VOID        _nx_web_http_server_connection_timeout(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
651 
652 
653 #ifndef NX_WEB_HTTP_KEEPALIVE_DISABLE
654 VOID        _nx_web_http_server_get_client_keepalive(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
655 #endif /* NX_WEB_HTTP_KEEPALIVE_DISABLE */
656 
657 UINT        _nx_web_http_server_chunked_check(NX_PACKET *packet_ptr);
658 UINT        _nx_web_http_server_request_read(NX_WEB_HTTP_SERVER *server_ptr, UCHAR *data, ULONG wait_option, NX_PACKET **current_packet_pptr, UCHAR **current_data_pptr);
659 UINT        _nx_web_http_server_request_byte_expect(NX_WEB_HTTP_SERVER *server_ptr, UCHAR data, ULONG wait_option, NX_PACKET **current_packet_pptr, UCHAR **current_data_pptr);
660 UINT        _nx_web_http_server_chunked_size_get(NX_WEB_HTTP_SERVER *server_ptr, UINT *chunk_size, ULONG wait_option, NX_PACKET **current_packet_pptr, UCHAR **current_data_pptr);
661 UINT        _nx_web_http_server_request_chunked_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG wait_option);
662 UINT        _nx_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
663 UINT        _nx_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
664 UINT        _nxe_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
665 UINT        _nxe_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
666 UINT        _nxe_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
667 UINT        _nxe_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
668 UINT        _nxe_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
669                                                                  UINT status_code_length, CHAR *information,
670                                                                  UINT information_length, CHAR *additional_info,
671                                                                  UINT additional_info_length);
672 UINT        _nxe_web_http_server_content_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset, CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
673 UINT        _nxe_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
674 UINT        _nxe_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
675 UINT        _nxe_web_http_server_content_get_extended(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG byte_offset,
676                                                   CHAR *destination_ptr, UINT destination_size, UINT *actual_size);
677 UINT        _nxe_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *content_length);
678 UINT        _nxe_web_http_server_create(NX_WEB_HTTP_SERVER *http_server_ptr, CHAR *http_server_name, NX_IP *ip_ptr, UINT server_port, FX_MEDIA *media_ptr, VOID *stack_ptr, ULONG stack_size, NX_PACKET_POOL *pool_ptr,
679                                     UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
680                                     UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr), UINT http_server_size);
681 UINT        _nxe_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
682 UINT        _nxe_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
683 UINT        _nxe_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
684 UINT        _nxe_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
685 #ifdef NX_WEB_HTTPS_ENABLE
686 UINT        _nxe_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
687                                             VOID *metadata_buffer, ULONG metadata_size,
688                                             UCHAR* packet_buffer, UINT packet_buffer_size,
689                                             NX_SECURE_X509_CERT *identity_certificate,
690                                             NX_SECURE_X509_CERT *trusted_certificates[],
691                                             UINT trusted_certs_num,
692                                             NX_SECURE_X509_CERT *remote_certificates[],
693                                             UINT remote_certs_num,
694                                             UCHAR *remote_certificate_buffer,
695                                             UINT remote_cert_buffer_size);
696 #ifdef NX_SECURE_ENABLE_ECC_CIPHERSUITE
697 UINT        _nxe_web_http_server_secure_ecc_configure(NX_WEB_HTTP_SERVER *http_server_ptr,
698                                                       const USHORT *supported_groups, USHORT supported_group_count,
699                                                       const NX_CRYPTO_METHOD **curves);
700 #endif /* NX_SECURE_ENABLE_ECC_CIPHERSUITE */
701 #endif /* NX_WEB_HTTPS_ENABLE */
702 UINT        _nxe_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
703 UINT        _nxe_web_http_server_invalid_userpassword_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
704                                                              UINT (*invalid_username_password_callback)(CHAR *resource, NXD_ADDRESS *client_nxd_address, UINT request_type));
705 UINT        _nxe_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
706 UINT        _nxe_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
707                                                    CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
708 UINT        _nxe_web_http_server_get_entity_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, UCHAR *entity_header_buffer, ULONG buffer_size);
709 UINT        _nxe_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
710 UINT        _nxe_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
711                                                                    CHAR *status_code, UINT content_length, CHAR *content_type,
712                                                                    CHAR* additional_header);
713 UINT        _nxe_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
714                                                                             NX_PACKET **packet_pptr, CHAR *status_code,
715                                                                             UINT status_code_length, UINT content_length,
716                                                                             CHAR *content_type, UINT content_type_length,
717                                                                             CHAR *additional_header, UINT additional_header_length);
718 UINT        _nxe_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
719 UINT        _nxe_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_get)(NX_WEB_HTTP_SERVER_DATE *));
720 UINT        _nxe_web_http_server_cache_info_callback_set(NX_WEB_HTTP_SERVER *server_ptr, UINT (*cache_info_get)(CHAR *, UINT *, NX_WEB_HTTP_SERVER_DATE *));
721 UINT        _nxe_web_http_server_mime_maps_additional_set(NX_WEB_HTTP_SERVER *server_ptr, NX_WEB_HTTP_SERVER_MIME_MAP *mime_maps, UINT mime_maps_num);
722 UINT        _nxe_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
723                                                                 UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
724                                                                                                      CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
725                                                                                                      CHAR *authorization_uri, CHAR *authorization_nc,
726                                                                                                      CHAR *authorization_cnonce));
727 UINT        _nxe_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
728                                                           UINT (*authentication_check_extended)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, UINT *name_length, CHAR **password, UINT *password_length, CHAR **realm, UINT *realm_length));
729 
730 #endif /* NX_WEB_HTTP_SERVER_SOURCE_CODE */
731 
732 /* Determine if a C++ compiler is being used.  If so, complete the standard
733    C conditional started above.  */
734 #ifdef   __cplusplus
735         }
736 #endif
737 
738 #endif  /* NXD_HTTP_SERVER_H */
739