files
simple-httpd/module_api.inc
Doczom 00abdb31f0 Update to 0.2.2 version
Added new features:
- begin_send_response
- finish_send_response

The close_server function has been updated and support for many flags for creating a response has been added
Added a "chunked" type transmission

New test modules have been added:
- a module for server management
- a module for test chunked transmission
2024-03-10 00:59:52 +05:00

88 lines
3.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;*****************************************************************************;
; ;
; Structures and constants for modules of simple-httpd ;
; ;
;*****************************************************************************;
API_VERSION = 0x100 ; 0.1.0
FLAG_KEEP_ALIVE = 0x01
FLAG_NO_CONNECTION = 0x02
FLAG_NO_SERVER_HEADER = 0x04
FLAG_NO_CONTENT_ENCODING = 0x08
FLAG_NO_DATE = 0x10 ;(not supported)
FLAG_NO_CONTENT_LENGTH = 0x20
FLAG_NO_CONTENT_TYPE = 0x40
FLAG_NO_CACHE_CONTROL = 0x80
FLAG_TRANSFER_CHUNKED = 0x100
FLAG_RAW_STREAM = 0x200
struct CONNECT_DATA ; 16*4 = 64 bytes
socket dd 0 ; номер сокета подключения
sockaddr dd 16/4 ; socaddr connection
buffer_request dd 0 ; pointer to buffer for geting message socket
request_size dd 0 ; size geted data from client
end_buffer_request dd 0 ; для парсера
buffer_response dd 0 ; pointer to buffwr for resp message
http_method dd 0 ; указатель на строку
http_verion dd 0 ; указатель на строку
num_headers dd 0 ; number items in REQUEST_DATA
http_headers dd 0 ; указатель на массив REQUEST_DATA
uri_scheme dd 0 ; указатель на схему
uri_authority dd 0 ; pointer to struct ?
uri_path dd 0 ; указатель на декодированный путь к ресурсу(без параметров)
num_uri_args dd 0 ;
uri_arg dd 0 ; pointer to array REQUEST_DATA аргументов uri строк
uri_fragment dd 0 ; указатель на строку
message_body dd 0 ; указатель на тело http запроса
ends
struct IMPORT_DATA
version rd 1 ; dword for check api
sizeof rd 1 ; size struct
netfunc_socket rd 1
netfunc_close rd 1
netfunc_bind rd 1
netfunc_accept rd 1
netfunc_listen rd 1
netfunc_recv rd 1
netfunc_send rd 1
FileInfo rd 1
FileRead rd 1
Alloc rd 1
Free rd 1
parse_http_query rd 1 ; not standart calling, not using this function
send_resp rd 1
; send_resp(RESPD* ptr, char* content, uint32_t length);
create_resp rd 1
; RESPD* create_resp(CONNECT_DATA* session, uint32_t flags);
destruct_resp rd 1
; void stdcall destruct_resp(RESPD* ptr);
set_http_status rd 1
; void set_http_status(RESPD* ptr, uint32_t status);
; status in '200' format
add_http_header rd 1
; uint32_t add_http_header(RESPD* ptr, char* ptr_header, uint32_t length);
del_http_header rd 1
; uint32_t del_http_header(RESPD* ptr, char* ptr_header);
; no del std header
set_http_ver rd 1
; void set_http_ver(RESPD* ptr, char* version, uint32_t length);
; example: 'RTSP/1.1'
find_uri_arg rd 1
;char* find_uri_arg(CONNECT_DATA* session, char* key);
find_header rd 1
;char* find_header(CONNECT_DATA* session, char* key);
close_server rd 1
;void close_server();
begin_send_resp rd 1
;uint32_t begin_send_resp(RESPD* ptr, uint64_t content_length);
finish_send_resp rd 1
;uint32_t finish_send_resp(RESPD* ptr);
base_response rd 1
GLOBAL_DATA rd 1
ends