2009-05-03 20:53:31 +02:00
|
|
|
#ifndef _HTTP_H_
|
|
|
|
#define _HTTP_H_
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-07-13 16:26:30 +02:00
|
|
|
|
|
|
|
#define TCP_CONNECT_TIMEOUT 5000
|
|
|
|
#define TCP_BLOCK_SIZE (16 * 1024)
|
|
|
|
#define TCP_BLOCK_RECV_TIMEOUT 4000
|
|
|
|
#define TCP_BLOCK_SEND_TIMEOUT 4000
|
|
|
|
#define HTTP_TIMEOUT 300000
|
|
|
|
|
|
|
|
//The maximum amount of bytes to send per net_write() call
|
|
|
|
#define NET_BUFFER_SIZE 3600
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
HTTPR_OK,
|
|
|
|
HTTPR_ERR_CONNECT,
|
|
|
|
HTTPR_ERR_REQUEST,
|
|
|
|
HTTPR_ERR_STATUS,
|
|
|
|
HTTPR_ERR_TOOBIG,
|
|
|
|
HTTPR_ERR_RECEIVE
|
|
|
|
} http_res;
|
|
|
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
#ifdef __cplusplus
|
2010-09-19 01:16:05 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2009-05-03 20:53:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "dns.h"
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/**
|
|
|
|
* A simple structure to keep track of the size of a malloc()ated block of memory
|
|
|
|
*/
|
|
|
|
struct block
|
|
|
|
{
|
2015-07-13 16:26:30 +02:00
|
|
|
u32 size;
|
|
|
|
unsigned char *data;
|
2011-07-26 00:28:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct block emptyblock;
|
|
|
|
|
|
|
|
struct block downloadfile(const char *url);
|
|
|
|
s32 GetConnection(char * domain);
|
2015-07-13 16:26:30 +02:00
|
|
|
void displayDownloadProgress(bool display);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _HTTP_H_ */
|