-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttpftp.h
73 lines (65 loc) · 1.27 KB
/
httpftp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
67
68
69
70
71
72
73
/*
* httpftp.h
* CoD4X17a_testing
*
* Created by Florian on 4/10/14.
* Copyright 2014 Dorg. All rights reserved.
*
*/
#ifndef _HTTPFTP_H_
#define _HTTPFTP_H_
#include "q_shared.h"
#include "qcommon.h"
typedef enum
{
FT_PROTO_HTTP,
FT_PROTO_FTP
}ftprotocols_t;
typedef struct
{
qboolean lock;
qboolean active;
qboolean transferactive;
int transferStartTime;
int socket;
int transfersocket;
int sentBytes;
int finallen;
int totalreceivedbytes;
int transfertotalreceivedbytes;
msg_t *extrecvmsg;
msg_t *extsendmsg;
msg_t sendmsg;
msg_t recvmsg;
msg_t transfermsg;
qboolean complete;
int code;
int version;
char status[32];
char url[MAX_STRING_CHARS];
char address[MAX_STRING_CHARS];
char username[256];
char password[256];
int mode;
int headerLength;
int contentLength;
int contentLengthArrived;
int currentChunkLength;
int currentChunkReadOffset;
int chunkedEncoding;
int startTime;
int stage;
ftprotocols_t protocol;
}ftRequest_t;
typedef enum
{
HTTP_GET,
HTTP_POST,
HTTP_HEAD
}httpMethod_t;
void FileDownloadFreeRequest(ftRequest_t* request);
ftRequest_t* FileDownloadRequest( const char* url);
int FileDownloadSendReceive( ftRequest_t* request );
const char* FileDownloadGenerateProgress( ftRequest_t* request );
void HTTPServer_Init();
#endif