My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
httpc.h
Go to the documentation of this file.
1 #pragma once
2 
3 typedef struct {
7 
8 typedef enum{
12 
13 #define HTTPC_RESULTCODE_DOWNLOADPENDING 0xd840a02b
14 
16 void httpcExit();
17 
18 Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy);//use_defaultproxy should be zero normally, unless you don't want HTTPC_SetProxyDefault() to be used automatically.
21 Result httpcReceiveData(httpcContext *context, u8* buffer, u32 size);
23 Result httpcGetDownloadSizeState(httpcContext *context, u32* downloadedsize, u32* contentsize);
24 Result httpcGetResponseStatusCode(httpcContext *context, u32* out, u64 delay);//delay isn't used yet. This writes the HTTP status code from the server to out.
25 
26 Result httpcDownloadData(httpcContext *context, u8* buffer, u32 size, u32 *downloadedsize);//The *entire* content must be downloaded before using httpcCloseContext(), otherwise httpcCloseContext() will hang.
27 
28 //Using the below functions directly is not recommended, use the above functions. See also the http example.
29 
32 Result HTTPC_CreateContext(Handle handle, char* url, Handle* contextHandle);
33 Result HTTPC_CloseContext(Handle handle, Handle contextHandle);
34 Result HTTPC_SetProxyDefault(Handle handle, Handle contextHandle);
35 Result HTTPC_AddRequestHeaderField(Handle handle, Handle contextHandle, char* name, char* value);
36 Result HTTPC_BeginRequest(Handle handle, Handle contextHandle);
37 Result HTTPC_ReceiveData(Handle handle, Handle contextHandle, u8* buffer, u32 size);
38 Result HTTPC_GetRequestState(Handle handle, Handle contextHandle, httpcReqStatus* out);
39 Result HTTPC_GetDownloadSizeState(Handle handle, Handle contextHandle, u32* downloadedsize, u32* contentsize);
40 Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32* out);
41 
Result httpcGetRequestState(httpcContext *context, httpcReqStatus *out)
Definition: httpc.c:74
Result HTTPC_AddRequestHeaderField(Handle handle, Handle contextHandle, char *name, char *value)
Definition: httpc.c:201
s32 Result
Definition: types.h:42
Result HTTPC_SetProxyDefault(Handle handle, Handle contextHandle)
Definition: httpc.c:175
Result httpcDownloadData(httpcContext *context, u8 *buffer, u32 size, u32 *downloadedsize)
Definition: httpc.c:89
u32 Handle
Definition: types.h:41
Result httpcInit()
Definition: httpc.c:5
uint8_t u8
Definition: types.h:21
uint64_t u64
Definition: types.h:24
Result HTTPC_BeginRequest(Handle handle, Handle contextHandle)
Definition: httpc.c:223
Result httpcGetDownloadSizeState(httpcContext *context, u32 *downloadedsize, u32 *contentsize)
Definition: httpc.c:79
uint32_t u32
Definition: types.h:23
void httpcExit()
Definition: httpc.c:20
Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32 *out)
Definition: httpc.c:283
Result httpcCloseContext(httpcContext *context)
Definition: httpc.c:48
Result httpcOpenContext(httpcContext *context, char *url, u32 use_defaultproxy)
Definition: httpc.c:27
Result HTTPC_ReceiveData(Handle handle, Handle contextHandle, u8 *buffer, u32 size)
Definition: httpc.c:236
Result HTTPC_CreateContext(Handle handle, char *url, Handle *contextHandle)
Definition: httpc.c:142
Result HTTPC_InitializeConnectionSession(Handle handle, Handle contextHandle)
Definition: httpc.c:161
Handle servhandle
Definition: httpc.h:4
Result HTTPC_Initialize(Handle handle)
Definition: httpc.c:126
httpcReqStatus
Definition: httpc.h:8
Result HTTPC_GetRequestState(Handle handle, Handle contextHandle, httpcReqStatus *out)
Definition: httpc.c:252
Result httpcGetResponseStatusCode(httpcContext *context, u32 *out, u64 delay)
Definition: httpc.c:84
Result httpcReceiveData(httpcContext *context, u8 *buffer, u32 size)
Definition: httpc.c:69
Result HTTPC_CloseContext(Handle handle, Handle contextHandle)
Definition: httpc.c:188
Result HTTPC_GetDownloadSizeState(Handle handle, Handle contextHandle, u32 *downloadedsize, u32 *contentsize)
Definition: httpc.c:267
Result httpcBeginRequest(httpcContext *context)
Definition: httpc.c:64
u32 httphandle
Definition: httpc.h:5