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