Subversion Repositories Kolibri OS

Rev

Rev 5598 | Rev 5626 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4163 hidnplayr 1
//HTTP library
5598 pavelyakov 2
#ifndef INCLUDE_LIBHTTP_H
3
#define INCLUDE_LIBHTTP_H
4163 hidnplayr 4
 
5598 pavelyakov 5
#ifndef INCLUDE_KOLIBRI_H
6
#include "../lib/kolibri.h"
7
#endif
8
 
9
#ifndef INCLUDE_DLL_H
10
#include "../lib/dll.h"
11
#endif
12
 
4165 hidnplayr 13
dword libHTTP = #alibHTTP;
14
char alibHTTP[23] = "/sys/lib/http.obj\0";
5621 leency 15
?define LIB_HTTP_LOAD_ERR "Error while loading library /rd/1/lib/http.obj"
4165 hidnplayr 16
 
5576 pavelyakov 17
dword http_lib_init          = #aLib_init;
18
dword http_get               = #aHTTPget;
19
dword http_head              = #aHTTPhead;
20
dword http_post              = #aHTTPpost;
4235 leency 21
dword http_find_header_field = #aFHF;
5576 pavelyakov 22
dword http_send              = #aHTTPsend;
23
dword http_receive           = #aHTTPreceive;
24
dword http_disconnect        = #aHTTPdisconnect;
25
dword http_free              = #aHTTPfree;
26
dword uri_escape             = #aURIescape;
27
dword uri_unescape           = #aURIunescape;
4163 hidnplayr 28
$DD 2 dup 0
29
 
30
char aLib_init[9]              = "lib_init\0";
31
char aHTTPget[4]               = "get\0";
4235 leency 32
char aHTTPhead[5]              = "head\0";
33
char aHTTPpost[5]              = "post\0";
34
char aFHF[18]                  = "find_header_field\0";
5534 hidnplayr 35
char aHTTPsend[5]              = "send\0";
36
char aHTTPreceive[8]           = "receive\0";
37
char aHTTPdisconnect[11]       = "disconnect\0";
4235 leency 38
char aHTTPfree[5]              = "free\0";
39
char aURIescape[7]             = "escape\0";
40
char aURIunescape[9]           = "unescape\0";
4163 hidnplayr 41
 
5534 hidnplayr 42
// status flags
4163 hidnplayr 43
#define FLAG_HTTP11             1 << 0
44
#define FLAG_GOT_HEADER         1 << 1
4536 leency 45
#define FLAG_GOT_ALL_DATA       1 << 2
4163 hidnplayr 46
#define FLAG_CONTENT_LENGTH     1 << 3
47
#define FLAG_CHUNKED            1 << 4
4235 leency 48
#define FLAG_CONNECTED          1 << 5
4163 hidnplayr 49
 
5534 hidnplayr 50
// user flags
51
#define FLAG_KEEPALIVE          1 << 8
52
#define FLAG_MULTIBUFF			1 << 9
53
 
54
// error flags
4163 hidnplayr 55
#define FLAG_INVALID_HEADER     1 << 16
56
#define FLAG_NO_RAM             1 << 17
57
#define FLAG_SOCKET_ERROR       1 << 18
4235 leency 58
#define FLAG_TIMEOUT_ERROR      1 << 19
4536 leency 59
#define FLAG_TRANSFER_FAILED    1 << 20
4163 hidnplayr 60
 
61
struct  http_msg{
62
        dword   socket;
63
        dword   flags;
64
        dword   write_ptr;
65
        dword   buffer_length;
66
        dword   chunk_ptr;
4235 leency 67
        dword   timestamp;
4163 hidnplayr 68
        dword   status;
69
        dword   header_length;
4536 leency 70
		dword	content_ptr;
4163 hidnplayr 71
        dword   content_length;
4168 hidnplayr 72
        dword   content_received;
4536 leency 73
        char    http_header;
5576 pavelyakov 74
};
75
 
76
:dword file_get_contents(dword url,...)
77
{
78
	http_get(url,FLAG_HTTP11,"");
5598 pavelyakov 79
}
80
 
81
#endif