Subversion Repositories Kolibri OS

Rev

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