1
10
13
14
21
22
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
68
69
70
71
72
73
74
75
76
77
78
81
82
83
84
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
185
186
187
192
193
194
195
198
199
200
201
202
203
204
205
206
207
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
296
297
298
299
300
301
302
303
304
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
336
337
338
339
340
341
342
343
344
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
438
439
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
681
682
683
684
685
...
...
...
...
...
#ifndef NXD_HTTP_SERVER_H
#define NXD_HTTP_SERVER_H
/* ... */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef NX_WEB_HTTPS_ENABLE
#ifndef NX_TCPSERVER_ENABLE_TLS
#define NX_TCPSERVER_ENABLE_TLS
#endif/* ... */
#endif
#include "nx_api.h"
/* ... */
#ifndef NX_WEB_HTTP_NO_FILEX
#include "fx_api.h"
#else
#include "filex_stub.h"
#endif
#include "nx_web_http_common.h"
#include "nx_tcpserver.h"
#define NX_WEB_HTTP_SERVER_ID 0x48545451UL
/* ... */
#ifndef NX_WEB_HTTP_SERVER_PRIORITY
#define NX_WEB_HTTP_SERVER_PRIORITY 4
#endif
#ifndef NX_WEB_HTTP_SERVER_WINDOW_SIZE
#define NX_WEB_HTTP_SERVER_WINDOW_SIZE 8192
#endif
#ifndef NX_WEB_HTTP_SERVER_TIMEOUT_ACCEPT
#define NX_WEB_HTTP_SERVER_TIMEOUT_ACCEPT (1 * NX_IP_PERIODIC_RATE)
#endif
#ifndef NX_WEB_HTTP_SERVER_TIMEOUT_RECEIVE
#define NX_WEB_HTTP_SERVER_TIMEOUT_RECEIVE (10 * NX_IP_PERIODIC_RATE)
#endif
#ifndef NX_WEB_HTTP_SERVER_TIMEOUT_SEND
#define NX_WEB_HTTP_SERVER_TIMEOUT_SEND (10 * NX_IP_PERIODIC_RATE)
#endif
#ifndef NX_WEB_HTTP_SERVER_TIMEOUT_DISCONNECT
#define NX_WEB_HTTP_SERVER_TIMEOUT_DISCONNECT (10 * NX_IP_PERIODIC_RATE)
#endif
#ifndef NX_WEB_HTTP_SERVER_TIMEOUT
#define NX_WEB_HTTP_SERVER_TIMEOUT (10 * NX_IP_PERIODIC_RATE)
#endif
#ifndef NX_WEB_HTTP_SERVER_SESSION_MAX
#define NX_WEB_HTTP_SERVER_SESSION_MAX 2
#endif
#ifndef NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE
#define NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE (sizeof(NX_TCP_SESSION) * NX_WEB_HTTP_SERVER_SESSION_MAX)
#endif
#ifndef NX_WEB_HTTP_SERVER_MAX_PENDING
#define NX_WEB_HTTP_SERVER_MAX_PENDING (NX_WEB_HTTP_SERVER_SESSION_MAX << 1)
#endif
#ifndef NX_WEB_HTTP_SERVER_THREAD_TIME_SLICE
#define NX_WEB_HTTP_SERVER_THREAD_TIME_SLICE 2
#endif
#ifndef NX_WEB_HTTP_SERVER_MIN_PACKET_SIZE
#define NX_WEB_HTTP_SERVER_MIN_PACKET_SIZE 600
#endif
#ifndef NX_WEB_HTTP_SERVER_RETRY_SECONDS
#define NX_WEB_HTTP_SERVER_RETRY_SECONDS 2
#endif
#ifndef NX_WEB_HTTP_SERVER_TRANSMIT_QUEUE_DEPTH
#define NX_WEB_HTTP_SERVER_TRANSMIT_QUEUE_DEPTH 20
#endif
#ifndef NX_WEB_HTTP_SERVER_RETRY_MAX
#define NX_WEB_HTTP_SERVER_RETRY_MAX 10
#endif
#ifndef NX_WEB_HTTP_SERVER_RETRY_SHIFT
#define NX_WEB_HTTP_SERVER_RETRY_SHIFT 1
#endif
#define NX_WEB_HTTP_SERVER_UNKNOWN_REQUEST 0
#define NX_WEB_HTTP_SERVER_GET_REQUEST 1
#define NX_WEB_HTTP_SERVER_POST_REQUEST 2
#define NX_WEB_HTTP_SERVER_HEAD_REQUEST 3
#define NX_WEB_HTTP_SERVER_PUT_REQUEST 4
#define NX_WEB_HTTP_SERVER_DELETE_REQUEST 5
6 defines
#ifdef NX_WEB_HTTP_DIGEST_ENABLE
#include "nx_md5.h"
/* ... */
#endif
#ifdef NX_WEB_HTTPS_ENABLE
#include "nx_secure_tls_api.h"
/* ... */#endif
#define NX_WEB_HTTP_SERVER_DEFAULT_MIME "text/plain"
typedef struct NX_WEB_HTTP_SERVER_MIME_MAP_STRUCT
{
CHAR *nx_web_http_server_mime_map_extension;
CHAR *nx_web_http_server_mime_map_type;
...} NX_WEB_HTTP_SERVER_MIME_MAP;
typedef struct NX_WEB_HTTP_SERVER_DATE_STRUCT
{
USHORT nx_web_http_server_year;
UCHAR nx_web_http_server_month;
UCHAR nx_web_http_server_day;
UCHAR nx_web_http_server_hour;
UCHAR nx_web_http_server_minute;
UCHAR nx_web_http_server_second;
UCHAR nx_web_http_server_weekday;
...} NX_WEB_HTTP_SERVER_DATE;
typedef struct NX_WEB_HTTP_SERVER_MULTIPART_STRUCT
{
UCHAR nx_web_http_server_multipart_boundary[NX_WEB_HTTP_MAX_HEADER_FIELD + 1];
UINT nx_web_http_server_multipart_available_offset;
UINT nx_web_http_server_multipart_available_length;
volatile UINT nx_web_http_server_multipart_boundary_find;
NX_PACKET *nx_web_http_server_multipart_next_packet;
UINT nx_web_http_server_multipart_next_available_offset;
NX_PACKET *nx_web_http_server_multipart_last_packet;
...} NX_WEB_HTTP_SERVER_MULTIPART;
typedef struct NX_WEB_HTTP_SERVER_STRUCT
{
ULONG nx_web_http_server_id;
CHAR *nx_web_http_server_name;
NX_IP *nx_web_http_server_ip_ptr;
CHAR nx_web_http_server_request_resource[NX_WEB_HTTP_MAX_RESOURCE + 1];
NX_PACKET_POOL *nx_web_http_server_packet_pool_ptr;
FX_MEDIA *nx_web_http_server_media_ptr;
ULONG nx_web_http_server_get_requests;
ULONG nx_web_http_server_head_requests;
ULONG nx_web_http_server_put_requests;
ULONG nx_web_http_server_delete_requests;
ULONG nx_web_http_server_post_requests;
ULONG nx_web_http_server_unknown_requests;
ULONG nx_web_http_server_total_bytes_sent;
ULONG nx_web_http_server_total_bytes_received;
ULONG nx_web_http_server_allocation_errors;
ULONG nx_web_http_server_invalid_http_headers;
FX_FILE nx_web_http_server_file;
NX_TCPSERVER nx_web_http_server_tcpserver;
NX_TCP_SESSION *nx_web_http_server_current_session_ptr;
UCHAR nx_web_http_server_session_buffer[NX_WEB_HTTP_SERVER_SESSION_BUFFER_SIZE];
NX_TCP_SOCKET nx_web_http_server_socket;
UINT nx_web_http_server_listen_port;
#ifdef NX_WEB_HTTPS_ENABLE
UINT nx_web_http_is_https_server;
#endif
#ifdef NX_WEB_HTTP_DIGEST_ENABLE
NX_MD5 nx_web_http_server_md5data;
#endif
#ifdef NX_WEB_HTTP_MULTIPART_ENABLE
NX_WEB_HTTP_SERVER_MULTIPART
nx_web_http_server_multipart; /* ... */
#endif
UINT nx_web_http_server_request_type;
NX_WEB_HTTP_SERVER_MIME_MAP
*nx_web_http_server_mime_maps_additional;
UINT nx_web_http_server_mime_maps_additional_num;
#ifndef NX_WEB_HTTP_KEEPALIVE_DISABLE
UCHAR nx_web_http_server_keepalive;
UCHAR nx_web_http_server_reserved; /* ... */
#else
UCHAR nx_web_http_server_reserved[2];
#endif
UCHAR nx_web_http_server_response_chunked;
UCHAR nx_web_http_server_request_chunked;
UINT nx_web_http_server_expect_transfer_bytes;
UINT nx_web_http_server_actual_bytes_transferred;
UINT nx_web_http_server_expect_receive_bytes;
UINT nx_web_http_server_actual_bytes_received;
UINT nx_web_http_server_chunked_request_remaining_size;
NX_PACKET *nx_web_http_server_request_packet;
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);
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);
UINT (*nx_web_http_server_request_notify)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr);
#ifdef __PRODUCT_NETXDUO__
UINT (*nx_web_http_server_invalid_username_password_callback)(CHAR *resource, NXD_ADDRESS *client_nxd_address, UINT request_type);
#else
UINT (*nx_web_http_server_invalid_username_password_callback)(CHAR *resource, ULONG client_address, UINT request_type);
#endif
VOID (*nx_web_http_server_gmt_get)(NX_WEB_HTTP_SERVER_DATE *date);
UINT (*nx_web_http_server_cache_info_get)(CHAR *resource, UINT *max_age, NX_WEB_HTTP_SERVER_DATE *last_modified);
#ifdef NX_WEB_HTTP_DIGEST_ENABLE
UINT (*nx_web_http_server_digest_authenticate_callback)(struct NX_WEB_HTTP_SERVER_STRUCT *server_ptr, CHAR *name_ptr,
CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
CHAR *authorization_uri, CHAR *authorization_nc,
CHAR *authorization_cnonce);/* ... */
#endif
...} NX_WEB_HTTP_SERVER;
#ifndef NX_WEB_HTTP_SERVER_SOURCE_CODE
/* ... */
#ifdef NX_DISABLE_ERROR_CHECKING
#define nx_web_http_server_callback_data_send _nx_web_http_server_callback_data_send
#define nx_web_http_server_callback_response_send _nx_web_http_server_callback_response_send
#define nx_web_http_server_callback_response_send_extended _nx_web_http_server_callback_response_send_extended
#define nx_web_http_server_content_get _nx_web_http_server_content_get
#define nx_web_http_server_create _nx_web_http_server_create
#define nx_web_http_server_delete _nx_web_http_server_delete
#define nx_web_http_server_param_get _nx_web_http_server_param_get
#define nx_web_http_server_query_get _nx_web_http_server_query_get
#define nx_web_http_server_start _nx_web_http_server_start
#define nx_web_http_server_secure_configure _nx_web_http_server_secure_configure
#define nx_web_http_server_stop _nx_web_http_server_stop
#define nx_web_http_server_content_get_extended _nx_web_http_server_content_get_extended
#define nx_web_http_server_content_length_get _nx_web_http_server_content_length_get
#define nx_web_http_server_get_entity_header _nx_web_http_server_get_entity_header
#define nx_web_http_server_get_entity_content _nx_web_http_server_get_entity_content
#define nx_web_http_server_callback_generate_response_header _nx_web_http_server_callback_generate_response_header
#define nx_web_http_server_callback_generate_response_header_extended _nx_web_http_server_callback_generate_response_header_extended
#define nx_web_http_server_callback_packet_send _nx_web_http_server_callback_packet_send
#define nx_web_http_server_gmt_callback_set _nx_web_http_server_gmt_callback_set
#define nx_web_http_server_cache_info_callback_set _nx_web_http_server_cache_info_callback_set
#define nx_web_http_server_mime_maps_additional_set _nx_web_http_server_mime_maps_additional_set
#define nx_web_http_server_type_get _nx_web_http_server_type_get
#define nx_web_http_server_type_get_extended _nx_web_http_server_type_get_extended
#define nx_web_http_server_packet_content_find _nx_web_http_server_packet_content_find
#define nx_web_http_server_packet_get _nx_web_http_server_packet_get
#define nx_web_http_server_invalid_userpassword_notify_set _nx_web_http_server_invalid_userpassword_notify_set
#define nx_web_http_server_response_chunked_set _nx_web_http_server_response_chunked_set
#define nx_web_http_server_response_packet_allocate _nx_web_http_server_response_packet_allocate
#define nx_web_http_server_digest_authenticate_notify_set _nx_web_http_server_digest_authenticate_notify_set
#define nx_web_http_server_authentication_check_set _nx_web_http_server_authentication_check_set
30 defines
/* ... */#else
#define nx_web_http_server_callback_data_send _nxe_web_http_server_callback_data_send
#define nx_web_http_server_callback_response_send _nxe_web_http_server_callback_response_send
#define nx_web_http_server_callback_response_send_extended _nxe_web_http_server_callback_response_send_extended
#define nx_web_http_server_content_get _nxe_web_http_server_content_get
#define nx_web_http_server_content_length_get _nxe_web_http_server_content_length_get
#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))
#define nx_web_http_server_delete _nxe_web_http_server_delete
#define nx_web_http_server_param_get _nxe_web_http_server_param_get
#define nx_web_http_server_query_get _nxe_web_http_server_query_get
#define nx_web_http_server_start _nxe_web_http_server_start
#define nx_web_http_server_secure_configure _nxe_web_http_server_secure_configure
#define nx_web_http_server_stop _nxe_web_http_server_stop
#define nx_web_http_server_content_get_extended _nxe_web_http_server_content_get_extended
#define nx_web_http_server_get_entity_header _nxe_web_http_server_get_entity_header
#define nx_web_http_server_get_entity_content _nxe_web_http_server_get_entity_content
#define nx_web_http_server_callback_generate_response_header _nxe_web_http_server_callback_generate_response_header
#define nx_web_http_server_callback_generate_response_header_extended _nxe_web_http_server_callback_generate_response_header_extended
#define nx_web_http_server_callback_packet_send _nxe_web_http_server_callback_packet_send
#define nx_web_http_server_gmt_callback_set _nxe_web_http_server_gmt_callback_set
#define nx_web_http_server_cache_info_callback_set _nxe_web_http_server_cache_info_callback_set
#define nx_web_http_server_mime_maps_additional_set _nxe_web_http_server_mime_maps_additional_set
#define nx_web_http_server_type_get _nxe_web_http_server_type_get
#define nx_web_http_server_type_get_extended _nxe_web_http_server_type_get_extended
#define nx_web_http_server_packet_content_find _nxe_web_http_server_packet_content_find
#define nx_web_http_server_packet_get _nxe_web_http_server_packet_get
#define nx_web_http_server_invalid_userpassword_notify_set _nxe_web_http_server_invalid_userpassword_notify_set
#define nx_web_http_server_response_chunked_set _nxe_web_http_server_response_chunked_set
#define nx_web_http_server_response_packet_allocate _nxe_web_http_server_response_packet_allocate
#define nx_web_http_server_digest_authenticate_notify_set _nxe_web_http_server_digest_authenticate_notify_set
#define nx_web_http_server_authentication_check_set _nxe_web_http_server_authentication_check_set
30 defines
/* ... */#endif
UINT nx_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
UINT nx_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
UINT nx_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
UINT status_code_length, CHAR *information,
UINT information_length, CHAR *additional_info,
UINT additional_info_length);
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);
UINT nx_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
UINT nx_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
#ifdef NX_DISABLE_ERROR_CHECKING
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,
UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr));/* ... */
#else
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,
UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr), UINT http_server_size);/* ... */
#endif
UINT nx_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
UINT nx_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
UINT nx_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
UINT nx_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
#ifdef NX_WEB_HTTPS_ENABLE
UINT nx_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
VOID *metadata_buffer, ULONG metadata_size,
UCHAR* packet_buffer, UINT packet_buffer_size,
NX_SECURE_X509_CERT *identity_certificate,
NX_SECURE_X509_CERT *trusted_certificates[],
UINT trusted_certs_num,
NX_SECURE_X509_CERT *remote_certificates[],
UINT remote_certs_num,
UCHAR *remote_certificate_buffer,
UINT remote_cert_buffer_size);/* ... */
#endif
UINT nx_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
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);
UINT nx_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *length);
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);
UINT nx_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
UINT nx_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
CHAR *status_code, UINT content_length, CHAR *content_type,
CHAR* additional_header);
UINT nx_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
NX_PACKET **packet_pptr, CHAR *status_code,
UINT status_code_length, UINT content_length,
CHAR *content_type, UINT content_type_length,
CHAR *additional_header, UINT additional_header_length);
UINT nx_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
UINT nx_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_get)(NX_WEB_HTTP_SERVER_DATE *));
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 *));
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);
UINT nx_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
UINT nx_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
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 ));
UINT nx_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
UINT nx_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
UINT nx_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
CHAR *authorization_uri, CHAR *authorization_nc,
CHAR *authorization_cnonce));
UINT nx_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
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));
/* ... */
#else
UINT _nx_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
UINT _nx_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
UINT _nx_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
UINT status_code_length, CHAR *information,
UINT information_length, CHAR *additional_info,
UINT additional_info_length);
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);
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,
UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr));
UINT _nx_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
UINT _nx_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
UINT _nx_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
UINT _nx_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
#ifdef NX_WEB_HTTPS_ENABLE
UINT _nx_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
VOID *metadata_buffer, ULONG metadata_size,
UCHAR* packet_buffer, UINT packet_buffer_size,
NX_SECURE_X509_CERT *identity_certificate,
NX_SECURE_X509_CERT *trusted_certificates[],
UINT trusted_certs_num,
NX_SECURE_X509_CERT *remote_certificates[],
UINT remote_certs_num,
UCHAR *remote_certificate_buffer,
UINT remote_cert_buffer_size);/* ... */
#endif
UINT _nx_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
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);
UINT _nx_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *length);
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);
UINT _nx_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
UINT _nx_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
CHAR *status_code, UINT content_length, CHAR *content_type,
CHAR* additional_header);
UINT _nx_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
NX_PACKET **packet_pptr, CHAR *status_code,
UINT status_code_length, UINT content_length,
CHAR *content_type, UINT content_type_length,
CHAR *additional_header, UINT additional_header_length);
UINT _nx_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
UINT _nx_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_callback)(NX_WEB_HTTP_SERVER_DATE *));
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 *));
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);
UINT _nx_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
UINT _nx_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
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 ));
UINT _nx_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
CHAR *authorization_uri, CHAR *authorization_nc,
CHAR *authorization_cnonce));
UINT _nx_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
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));
VOID _nx_web_http_server_connection_present(NX_TCP_SOCKET *socket_ptr, UINT port);
UINT _nx_web_http_server_get_client_request(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
VOID _nx_web_http_server_get_process(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, NX_PACKET *packet_ptr);
VOID _nx_web_http_server_put_process(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
VOID _nx_web_http_server_delete_process(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
UINT _nx_web_http_server_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
UINT status_code_length, CHAR *information,
UINT information_length, CHAR *additional_information,
UINT additional_information_length);
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);
UINT _nx_web_http_server_retrieve_basic_authorization(NX_PACKET *packet_ptr, CHAR *authorization_request_ptr);
UINT _nx_web_http_server_retrieve_resource(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, CHAR *destination, UINT max_size);
UINT _nx_web_http_server_calculate_content_offset(NX_PACKET *packet_ptr);
UINT _nx_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
UINT _nx_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
UINT _nx_web_http_server_receive(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG wait_option);
UINT _nx_web_http_server_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr, ULONG wait_option);
VOID _nx_web_http_server_connection_reset(NX_WEB_HTTP_SERVER *server_ptr, NX_TCP_SESSION *session_ptr, UINT wait_option);
VOID _nx_web_http_server_connection_disconnect(NX_WEB_HTTP_SERVER *server_ptr, NX_TCP_SESSION *session_ptr, UINT wait_option);
#ifdef NX_WEB_HTTP_DIGEST_ENABLE
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);
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);
UINT _nx_web_http_server_retrieve_digest_authorization(NX_PACKET *packet_ptr, CHAR *response, CHAR *uri, CHAR *nc, CHAR *cnonce);
VOID _nx_web_http_server_hex_ascii_convert(CHAR *source, UINT source_length, CHAR *destination);/* ... */
#endif
#ifdef NX_WEB_HTTP_MULTIPART_ENABLE
UINT _nx_web_http_server_boundary_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr);
#endif
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);
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);
UINT _nx_web_http_server_memicmp(UCHAR *src, ULONG src_length, UCHAR *dest, ULONG dest_length);
UINT _nx_web_http_server_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
CHAR *status_code, UINT status_code_length,
UINT content_length, CHAR *content_type,
UINT content_type_length, CHAR* additional_header,
UINT additional_header_length);
UINT _nx_web_http_server_date_to_string(NX_WEB_HTTP_SERVER_DATE *date, CHAR *string);
VOID _nx_web_http_server_date_convert(UINT date, UINT count, CHAR *string);
VOID _nx_web_http_server_receive_data(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
VOID _nx_web_http_server_connection_end(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
VOID _nx_web_http_server_connection_timeout(NX_TCPSERVER *tcpserver_ptr, NX_TCP_SESSION *session_ptr);
#ifndef NX_WEB_HTTP_KEEPALIVE_DISABLE
VOID _nx_web_http_server_get_client_keepalive(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
#endif
UINT _nx_web_http_server_chunked_check(NX_PACKET *packet_ptr);
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);
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);
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);
UINT _nx_web_http_server_request_chunked_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG wait_option);
UINT _nx_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
UINT _nx_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
UINT _nxe_web_http_server_response_chunked_set(NX_WEB_HTTP_SERVER *server_ptr, UINT chunk_size, NX_PACKET *packet_ptr);
UINT _nxe_web_http_server_response_packet_allocate(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, UINT wait_option);
UINT _nxe_web_http_server_callback_data_send(NX_WEB_HTTP_SERVER *server_ptr, VOID *data_ptr, ULONG data_length);
UINT _nxe_web_http_server_callback_response_send(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code, CHAR *information, CHAR *additional_info);
UINT _nxe_web_http_server_callback_response_send_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *status_code,
UINT status_code_length, CHAR *information,
UINT information_length, CHAR *additional_info,
UINT additional_info_length);
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);
UINT _nxe_web_http_server_packet_content_find(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr, ULONG *content_length);
UINT _nxe_web_http_server_packet_get(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_ptr);
UINT _nxe_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);
UINT _nxe_web_http_server_content_length_get(NX_PACKET *packet_ptr, ULONG *content_length);
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,
UINT (*authentication_check)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm),
UINT (*request_notify)(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr), UINT http_server_size);
UINT _nxe_web_http_server_delete(NX_WEB_HTTP_SERVER *http_server_ptr);
UINT _nxe_web_http_server_param_get(NX_PACKET *packet_ptr, UINT param_number, CHAR *param_ptr, UINT *param_size, UINT max_param_size);
UINT _nxe_web_http_server_query_get(NX_PACKET *packet_ptr, UINT query_number, CHAR *query_ptr, UINT *query_size, UINT max_query_size);
UINT _nxe_web_http_server_start(NX_WEB_HTTP_SERVER *http_server_ptr);
#ifdef NX_WEB_HTTPS_ENABLE
UINT _nxe_web_http_server_secure_configure(NX_WEB_HTTP_SERVER *http_server_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table,
VOID *metadata_buffer, ULONG metadata_size,
UCHAR* packet_buffer, UINT packet_buffer_size,
NX_SECURE_X509_CERT *identity_certificate,
NX_SECURE_X509_CERT *trusted_certificates[],
UINT trusted_certs_num,
NX_SECURE_X509_CERT *remote_certificates[],
UINT remote_certs_num,
UCHAR *remote_certificate_buffer,
UINT remote_cert_buffer_size);/* ... */
#endif
UINT _nxe_web_http_server_stop(NX_WEB_HTTP_SERVER *http_server_ptr);
UINT _nxe_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));
UINT _nxe_web_http_server_type_get(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, CHAR *http_type_string, UINT *string_size);
UINT _nxe_web_http_server_type_get_extended(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name, UINT name_length,
CHAR *http_type_string, UINT http_type_string_max_size, UINT *string_size);
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);
UINT _nxe_web_http_server_get_entity_content(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr, ULONG *available_offset, ULONG *available_length);
UINT _nxe_web_http_server_callback_generate_response_header(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET **packet_pptr,
CHAR *status_code, UINT content_length, CHAR *content_type,
CHAR* additional_header);
UINT _nxe_web_http_server_callback_generate_response_header_extended(NX_WEB_HTTP_SERVER *server_ptr,
NX_PACKET **packet_pptr, CHAR *status_code,
UINT status_code_length, UINT content_length,
CHAR *content_type, UINT content_type_length,
CHAR *additional_header, UINT additional_header_length);
UINT _nxe_web_http_server_callback_packet_send(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET *packet_ptr);
UINT _nxe_web_http_server_gmt_callback_set(NX_WEB_HTTP_SERVER *server_ptr, VOID (*gmt_get)(NX_WEB_HTTP_SERVER_DATE *));
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 *));
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);
UINT _nxe_web_http_server_digest_authenticate_notify_set(NX_WEB_HTTP_SERVER *http_server_ptr,
UINT (*digest_authenticate_callback)(NX_WEB_HTTP_SERVER *server_ptr, CHAR *name_ptr,
CHAR *realm_ptr, CHAR *password_ptr, CHAR *method,
CHAR *authorization_uri, CHAR *authorization_nc,
CHAR *authorization_cnonce));
UINT _nxe_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_server_ptr,
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));
/* ... */
#endif
/* ... */
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
...#endif