PSPSDK 2025-02-06
Loading...
Searching...
No Matches
psphttp.h File Reference
#include <pspkerneltypes.h>
Include dependency graph for psphttp.h:

Go to the source code of this file.

Typedefs

typedef void *(* PspHttpMallocFunction) (SceSize size)
 
typedef void *(* PspHttpReallocFunction) (void *p, SceSize size)
 
typedef void(* PspHttpFreeFunction) (void *p)
 
typedef int(* PspHttpPasswordCB) (int request, PspHttpAuthType auth_type, const unsigned char *realm, unsigned char *username, unsigned char *password, SceBool need_entity, unsigned char **entity_body, SceSize *entity_size, SceBool *save)
 

Enumerations

enum  PspHttpHttpVersion { PSP_HTTP_VERSION_1_0 , PSP_HTTP_VERSION_1_1 }
 
enum  PspHttpMethod { PSP_HTTP_METHOD_GET , PSP_HTTP_METHOD_POST , PSP_HTTP_METHOD_HEAD }
 
enum  PspHttpAuthType { PSP_HTTP_AUTH_BASIC , PSP_HTTP_AUTH_DIGEST }
 
enum  PspHttpProxyMode { PSP_HTTP_PROXY_AUTO , PSP_HTTP_PROXY_MANUAL }
 
enum  PspHttpAddHeaderMode { PSP_HTTP_HEADER_OVERWRITE , PSP_HTTP_HEADER_ADD }
 

Functions

int sceHttpInit (unsigned int unknown1)
 Init the http library.
 
int sceHttpEnd (void)
 Terminate the http library.
 
int sceHttpCreateTemplate (char *agent, int unknown1, int unknown2)
 Create a http template.
 
int sceHttpDeleteTemplate (int templateid)
 Delete a http template.
 
int sceHttpCreateConnection (int templateid, char *host, char *unknown1, unsigned short port, int unknown2)
 Create a http connection.
 
int sceHttpCreateConnectionWithURL (int templateid, const char *url, int unknown1)
 Create a http connection to a url.
 
int sceHttpDeleteConnection (int connectionid)
 Delete a http connection.
 
int sceHttpCreateRequest (int connectionid, PspHttpMethod method, char *path, SceULong64 contentlength)
 Create a http request.
 
int sceHttpCreateRequestWithURL (int connectionid, PspHttpMethod method, char *url, SceULong64 contentlength)
 Create a http request with url.
 
int sceHttpDeleteRequest (int requestid)
 Delete a http request.
 
int sceHttpSendRequest (int requestid, void *data, unsigned int datasize)
 Send a http request.
 
int sceHttpAbortRequest (int requestid)
 Abort a http request.
 
int sceHttpReadData (int requestid, void *data, unsigned int datasize)
 Read a http request response.
 
int sceHttpGetContentLength (int requestid, SceULong64 *contentlength)
 Get http request response length.
 
int sceHttpGetStatusCode (int requestid, int *statuscode)
 Get http request status code.
 
int sceHttpSetResolveTimeOut (int id, unsigned int timeout)
 Set resolver timeout.
 
int sceHttpSetResolveRetry (int id, int count)
 Set resolver retry.
 
int sceHttpSetConnectTimeOut (int id, unsigned int timeout)
 Set connect timeout.
 
int sceHttpSetSendTimeOut (int id, unsigned int timeout)
 Set send timeout.
 
int sceHttpSetRecvTimeOut (int id, unsigned int timeout)
 Set receive timeout.
 
int sceHttpEnableKeepAlive (int id)
 Enable keep alive.
 
int sceHttpDisableKeepAlive (int id)
 Disable keep alive.
 
int sceHttpEnableRedirect (int id)
 Enable redirect.
 
int sceHttpDisableRedirect (int id)
 Disable redirect.
 
int sceHttpEnableCookie (int id)
 Enable cookie.
 
int sceHttpDisableCookie (int id)
 Disable cookie.
 
int sceHttpSaveSystemCookie (void)
 Save cookie.
 
int sceHttpLoadSystemCookie (void)
 Load cookie.
 
int sceHttpAddExtraHeader (int id, char *name, char *value, int unknown1)
 Add content header.
 
int sceHttpDeleteHeader (int id, const char *name)
 Delete content header.
 
int sceHttpsInit (int unknown1, int unknown2, int unknown3, int unknown4)
 Init the https library.
 
int sceHttpsEnd (void)
 Terminate the https library.
 
int sceHttpsLoadDefaultCert (int unknown1, int unknown2)
 Load default certificate.
 
int sceHttpDisableAuth (int id)
 
int sceHttpDisableCache (int id)
 
int sceHttpEnableAuth (int id)
 
int sceHttpEnableCache (int id)
 
int sceHttpEndCache (void)
 
int sceHttpGetAllHeader (int request, unsigned char **header, unsigned int *header_size)
 
int sceHttpGetNetworkErrno (int request, int *err_num)
 
int sceHttpGetProxy (int id, int *activate_flag, int *mode, unsigned char *proxy_host, SceSize len, unsigned short *proxy_port)
 
int sceHttpInitCache (SceSize max_size)
 
int sceHttpSetAuthInfoCB (int id, PspHttpPasswordCB cbfunc)
 
int sceHttpSetProxy (int id, int activate_flag, int mode, const unsigned char *new_proxy_host, unsigned short new_proxy_port)
 
int sceHttpSetResHeaderMaxSize (int id, unsigned int header_size)
 
int sceHttpSetMallocFunction (PspHttpMallocFunction malloc_func, PspHttpFreeFunction free_func, PspHttpReallocFunction realloc_func)
 

Typedef Documentation

◆ PspHttpFreeFunction

typedef void(* PspHttpFreeFunction) (void *p)

◆ PspHttpMallocFunction

typedef void *(* PspHttpMallocFunction) (SceSize size)

◆ PspHttpPasswordCB

typedef int(* PspHttpPasswordCB) (int request, PspHttpAuthType auth_type, const unsigned char *realm, unsigned char *username, unsigned char *password, SceBool need_entity, unsigned char **entity_body, SceSize *entity_size, SceBool *save)

◆ PspHttpReallocFunction

typedef void *(* PspHttpReallocFunction) (void *p, SceSize size)

Enumeration Type Documentation

◆ PspHttpAddHeaderMode

Enumerator
PSP_HTTP_HEADER_OVERWRITE 
PSP_HTTP_HEADER_ADD 

◆ PspHttpAuthType

Enumerator
PSP_HTTP_AUTH_BASIC 
PSP_HTTP_AUTH_DIGEST 

◆ PspHttpHttpVersion

Enumerator
PSP_HTTP_VERSION_1_0 
PSP_HTTP_VERSION_1_1 

◆ PspHttpMethod

Enumerator
PSP_HTTP_METHOD_GET 
PSP_HTTP_METHOD_POST 
PSP_HTTP_METHOD_HEAD 

◆ PspHttpProxyMode

Enumerator
PSP_HTTP_PROXY_AUTO 
PSP_HTTP_PROXY_MANUAL 

Function Documentation

◆ sceHttpAbortRequest()

int sceHttpAbortRequest ( int requestid)

Abort a http request.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
Returns
0 on success, < 0 on error.

◆ sceHttpAddExtraHeader()

int sceHttpAddExtraHeader ( int id,
char * name,
char * value,
int unknown1 )

Add content header.

Parameters
id- ID of the template, connection or request
name- Name of the content
value- Value of the content
unknown1- Pass 0
Returns
0 on success, < 0 on error.

◆ sceHttpCreateConnection()

int sceHttpCreateConnection ( int templateid,
char * host,
char * unknown1,
unsigned short port,
int unknown2 )

Create a http connection.

Parameters
templateid- ID of the template created by sceHttpCreateTemplate
host- Host to connect to
unknown1- Pass "http"
port- Port to connect on
unknown2- Pass 0
Returns
A connection ID on success, < 0 on error.

◆ sceHttpCreateConnectionWithURL()

int sceHttpCreateConnectionWithURL ( int templateid,
const char * url,
int unknown1 )

Create a http connection to a url.

Parameters
templateid- ID of the template created by sceHttpCreateTemplate
url- url to connect to
unknown1- Pass 0
Returns
A connection ID on success, < 0 on error.

◆ sceHttpCreateRequest()

int sceHttpCreateRequest ( int connectionid,
PspHttpMethod method,
char * path,
SceULong64 contentlength )

Create a http request.

Parameters
connectionid- ID of the connection created by sceHttpCreateConnection or sceHttpCreateConnectionWithURL
method- One of PspHttpMethod
path- Path to access
contentlength- Length of the content (POST method only)
Returns
A request ID on success, < 0 on error.

◆ sceHttpCreateRequestWithURL()

int sceHttpCreateRequestWithURL ( int connectionid,
PspHttpMethod method,
char * url,
SceULong64 contentlength )

Create a http request with url.

Parameters
connectionid- ID of the connection created by sceHttpCreateConnection or sceHttpCreateConnectionWithURL
method- One of PspHttpMethod
url- url to access
contentlength- Length of the content (POST method only)
Returns
A request ID on success, < 0 on error.

◆ sceHttpCreateTemplate()

int sceHttpCreateTemplate ( char * agent,
int unknown1,
int unknown2 )

Create a http template.

Parameters
agent- User agent
unknown1- Pass 1
unknown2- Pass 0
Returns
A template ID on success, < 0 on error.

◆ sceHttpDeleteConnection()

int sceHttpDeleteConnection ( int connectionid)

Delete a http connection.

Parameters
connectionid- ID of the connection created by sceHttpCreateConnection or sceHttpCreateConnectionWithURL
Returns
0 on success, < 0 on error.

◆ sceHttpDeleteHeader()

int sceHttpDeleteHeader ( int id,
const char * name )

Delete content header.

Parameters
id- ID of the template, connection or request
name- Name of the content
Returns
0 on success, < 0 on error.

◆ sceHttpDeleteRequest()

int sceHttpDeleteRequest ( int requestid)

Delete a http request.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
Returns
0 on success, < 0 on error.

◆ sceHttpDeleteTemplate()

int sceHttpDeleteTemplate ( int templateid)

Delete a http template.

Parameters
templateid- ID of the template created by sceHttpCreateTemplate
Returns
0 on success, < 0 on error.

◆ sceHttpDisableAuth()

int sceHttpDisableAuth ( int id)

◆ sceHttpDisableCache()

int sceHttpDisableCache ( int id)

◆ sceHttpDisableCookie()

int sceHttpDisableCookie ( int id)

Disable cookie.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpDisableKeepAlive()

int sceHttpDisableKeepAlive ( int id)

Disable keep alive.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpDisableRedirect()

int sceHttpDisableRedirect ( int id)

Disable redirect.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpEnableAuth()

int sceHttpEnableAuth ( int id)

◆ sceHttpEnableCache()

int sceHttpEnableCache ( int id)

◆ sceHttpEnableCookie()

int sceHttpEnableCookie ( int id)

Enable cookie.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpEnableKeepAlive()

int sceHttpEnableKeepAlive ( int id)

Enable keep alive.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpEnableRedirect()

int sceHttpEnableRedirect ( int id)

Enable redirect.

Parameters
id- ID of the template or connection
Returns
0 on success, < 0 on error.

◆ sceHttpEnd()

int sceHttpEnd ( void )

Terminate the http library.

Returns
0 on success, < 0 on error.

◆ sceHttpEndCache()

int sceHttpEndCache ( void )

◆ sceHttpGetAllHeader()

int sceHttpGetAllHeader ( int request,
unsigned char ** header,
unsigned int * header_size )

◆ sceHttpGetContentLength()

int sceHttpGetContentLength ( int requestid,
SceULong64 * contentlength )

Get http request response length.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
contentlength- The size of the content
Returns
0 on success, < 0 on error.

◆ sceHttpGetNetworkErrno()

int sceHttpGetNetworkErrno ( int request,
int * err_num )

◆ sceHttpGetProxy()

int sceHttpGetProxy ( int id,
int * activate_flag,
int * mode,
unsigned char * proxy_host,
SceSize len,
unsigned short * proxy_port )

◆ sceHttpGetStatusCode()

int sceHttpGetStatusCode ( int requestid,
int * statuscode )

Get http request status code.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
statuscode- The status code from the host (200 is ok, 404 is not found etc)
Returns
0 on success, < 0 on error.

◆ sceHttpInit()

int sceHttpInit ( unsigned int unknown1)

Init the http library.

Parameters
unknown1- Memory pool size? Pass 20000
Returns
0 on success, < 0 on error.

◆ sceHttpInitCache()

int sceHttpInitCache ( SceSize max_size)

◆ sceHttpLoadSystemCookie()

int sceHttpLoadSystemCookie ( void )

Load cookie.

Returns
0 on success, < 0 on error.

◆ sceHttpReadData()

int sceHttpReadData ( int requestid,
void * data,
unsigned int datasize )

Read a http request response.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
data- Buffer for the response data to be stored
datasize- Size of the buffer
Returns
The size read into the data buffer, 0 if there is no more data, < 0 on error.

◆ sceHttpSaveSystemCookie()

int sceHttpSaveSystemCookie ( void )

Save cookie.

Returns
0 on success, < 0 on error.

◆ sceHttpsEnd()

int sceHttpsEnd ( void )

Terminate the https library.

Returns
0 on success, < 0 on error.

◆ sceHttpSendRequest()

int sceHttpSendRequest ( int requestid,
void * data,
unsigned int datasize )

Send a http request.

Parameters
requestid- ID of the request created by sceHttpCreateRequest or sceHttpCreateRequestWithURL
data- For POST methods specify a pointer to the post data, otherwise pass NULL
datasize- For POST methods specify the size of the post data, otherwise pass 0
Returns
0 on success, < 0 on error.

◆ sceHttpSetAuthInfoCB()

int sceHttpSetAuthInfoCB ( int id,
PspHttpPasswordCB cbfunc )

◆ sceHttpSetConnectTimeOut()

int sceHttpSetConnectTimeOut ( int id,
unsigned int timeout )

Set connect timeout.

Parameters
id- ID of the template, connection or request
timeout- Timeout value in microseconds
Returns
0 on success, < 0 on error.

◆ sceHttpSetMallocFunction()

int sceHttpSetMallocFunction ( PspHttpMallocFunction malloc_func,
PspHttpFreeFunction free_func,
PspHttpReallocFunction realloc_func )

◆ sceHttpSetProxy()

int sceHttpSetProxy ( int id,
int activate_flag,
int mode,
const unsigned char * new_proxy_host,
unsigned short new_proxy_port )

◆ sceHttpSetRecvTimeOut()

int sceHttpSetRecvTimeOut ( int id,
unsigned int timeout )

Set receive timeout.

Parameters
id- ID of the template or connection
timeout- Timeout value in microseconds
Returns
0 on success, < 0 on error.

◆ sceHttpSetResHeaderMaxSize()

int sceHttpSetResHeaderMaxSize ( int id,
unsigned int header_size )

◆ sceHttpSetResolveRetry()

int sceHttpSetResolveRetry ( int id,
int count )

Set resolver retry.

Parameters
id- ID of the template or connection
count- Number of retries
Returns
0 on success, < 0 on error.

◆ sceHttpSetResolveTimeOut()

int sceHttpSetResolveTimeOut ( int id,
unsigned int timeout )

Set resolver timeout.

Parameters
id- ID of the template or connection
timeout- Timeout value in microseconds
Returns
0 on success, < 0 on error.

◆ sceHttpSetSendTimeOut()

int sceHttpSetSendTimeOut ( int id,
unsigned int timeout )

Set send timeout.

Parameters
id- ID of the template, connection or request
timeout- Timeout value in microseconds
Returns
0 on success, < 0 on error.

◆ sceHttpsInit()

int sceHttpsInit ( int unknown1,
int unknown2,
int unknown3,
int unknown4 )

Init the https library.

Parameters
unknown1- Pass 0
unknown2- Pass 0
unknown3- Pass 0
unknown4- Pass 0
Returns
0 on success, < 0 on error.

◆ sceHttpsLoadDefaultCert()

int sceHttpsLoadDefaultCert ( int unknown1,
int unknown2 )

Load default certificate.

Parameters
unknown1- Pass 0
unknown2- Pass 0
Returns
0 on success, < 0 on error.