PSPSDK 2024-10-31
Loading...
Searching...
No Matches
pspnet_adhoc.h File Reference

Go to the source code of this file.

Data Structures

struct  pdpStatStruct
 PDP status structure. More...
 
struct  ptpStatStruct
 PTP status structure. More...
 

Typedefs

typedef struct pdpStatStruct pdpStatStruct
 PDP status structure.
 
typedef struct ptpStatStruct ptpStatStruct
 PTP status structure.
 

Functions

int sceNetAdhocInit (void)
 Initialise the adhoc library.
 
int sceNetAdhocTerm (void)
 Terminate the adhoc library.
 
int sceNetAdhocPdpCreate (unsigned char *mac, unsigned short port, unsigned int bufsize, int unk1)
 Create a PDP object.
 
int sceNetAdhocPdpDelete (int id, int unk1)
 Delete a PDP object.
 
int sceNetAdhocPdpSend (int id, unsigned char *destMacAddr, unsigned short port, void *data, unsigned int len, unsigned int timeout, int nonblock)
 Set a PDP packet to a destination.
 
int sceNetAdhocPdpRecv (int id, unsigned char *srcMacAddr, unsigned short *port, void *data, void *dataLength, unsigned int timeout, int nonblock)
 Receive a PDP packet.
 
int sceNetAdhocGetPdpStat (int *size, pdpStatStruct *stat)
 Get the status of all PDP objects.
 
int sceNetAdhocGameModeCreateMaster (void *data, int size)
 Create own game object type data.
 
int sceNetAdhocGameModeCreateReplica (unsigned char *mac, void *data, int size)
 Create peer game object type data.
 
int sceNetAdhocGameModeUpdateMaster (void)
 Update own game object type data.
 
int sceNetAdhocGameModeUpdateReplica (int id, int unk1)
 Update peer game object type data.
 
int sceNetAdhocGameModeDeleteMaster (void)
 Delete own game object type data.
 
int sceNetAdhocGameModeDeleteReplica (int id)
 Delete peer game object type data.
 
int sceNetAdhocPtpOpen (unsigned char *srcmac, unsigned short srcport, unsigned char *destmac, unsigned short destport, unsigned int bufsize, unsigned int delay, int count, int unk1)
 Open a PTP connection.
 
int sceNetAdhocPtpConnect (int id, unsigned int timeout, int nonblock)
 Wait for connection created by sceNetAdhocPtpOpen()
 
int sceNetAdhocPtpListen (unsigned char *srcmac, unsigned short srcport, unsigned int bufsize, unsigned int delay, int count, int queue, int unk1)
 Wait for an incoming PTP connection.
 
int sceNetAdhocPtpAccept (int id, unsigned char *mac, unsigned short *port, unsigned int timeout, int nonblock)
 Accept an incoming PTP connection.
 
int sceNetAdhocPtpSend (int id, void *data, int *datasize, unsigned int timeout, int nonblock)
 Send data.
 
int sceNetAdhocPtpRecv (int id, void *data, int *datasize, unsigned int timeout, int nonblock)
 Receive data.
 
int sceNetAdhocPtpFlush (int id, unsigned int timeout, int nonblock)
 Wait for data in the buffer to be sent.
 
int sceNetAdhocPtpClose (int id, int unk1)
 Close a socket.
 
int sceNetAdhocGetPtpStat (int *size, ptpStatStruct *stat)
 Get the status of all PTP objects.
 

Typedef Documentation

◆ pdpStatStruct

PDP status structure.

◆ ptpStatStruct

PTP status structure.

Function Documentation

◆ sceNetAdhocGameModeCreateMaster()

int sceNetAdhocGameModeCreateMaster ( void data,
int  size 
)

Create own game object type data.

Parameters
data- A pointer to the game object data.
size- Size of the game data.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocGameModeCreateReplica()

int sceNetAdhocGameModeCreateReplica ( unsigned char mac,
void data,
int  size 
)

Create peer game object type data.

Parameters
mac- The mac address of the peer.
data- A pointer to the game object data.
size- Size of the game data.
Returns
The id of the replica on success, < 0 on error.

◆ sceNetAdhocGameModeDeleteMaster()

int sceNetAdhocGameModeDeleteMaster ( void  )

Delete own game object type data.

Returns
0 on success, < 0 on error.

◆ sceNetAdhocGameModeDeleteReplica()

int sceNetAdhocGameModeDeleteReplica ( int  id)

Delete peer game object type data.

Parameters
id- The id of the replica.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocGameModeUpdateMaster()

int sceNetAdhocGameModeUpdateMaster ( void  )

Update own game object type data.

Returns
0 on success, < 0 on error.

◆ sceNetAdhocGameModeUpdateReplica()

int sceNetAdhocGameModeUpdateReplica ( int  id,
int  unk1 
)

Update peer game object type data.

Parameters
id- The id of the replica returned by sceNetAdhocGameModeCreateReplica.
unk1- Pass 0.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocGetPdpStat()

int sceNetAdhocGetPdpStat ( int size,
pdpStatStruct stat 
)

Get the status of all PDP objects.

Parameters
size- Pointer to the size of the stat array (e.g 20 for one structure)
stat- Pointer to a list of pdpStatStruct structures.
Returns
0 on success, < 0 on error

◆ sceNetAdhocGetPtpStat()

int sceNetAdhocGetPtpStat ( int size,
ptpStatStruct stat 
)

Get the status of all PTP objects.

Parameters
size- Pointer to the size of the stat array (e.g 20 for one structure)
stat- Pointer to a list of ptpStatStruct structures.
Returns
0 on success, < 0 on error

◆ sceNetAdhocInit()

int sceNetAdhocInit ( void  )

Initialise the adhoc library.

Returns
0 on success, < 0 on error

◆ sceNetAdhocPdpCreate()

int sceNetAdhocPdpCreate ( unsigned char mac,
unsigned short  port,
unsigned int  bufsize,
int  unk1 
)

Create a PDP object.

Parameters
mac- Your MAC address (from sceWlanGetEtherAddr)
port- Port to use, lumines uses 0x309
bufsize- Socket buffer size, lumines sets to 0x400
unk1- Unknown, lumines sets to 0
Returns
The ID of the PDP object (< 0 on error)

◆ sceNetAdhocPdpDelete()

int sceNetAdhocPdpDelete ( int  id,
int  unk1 
)

Delete a PDP object.

Parameters
id- The ID returned from sceNetAdhocPdpCreate
unk1- Unknown, set to 0
Returns
0 on success, < 0 on error

◆ sceNetAdhocPdpRecv()

int sceNetAdhocPdpRecv ( int  id,
unsigned char srcMacAddr,
unsigned short port,
void data,
void dataLength,
unsigned int  timeout,
int  nonblock 
)

Receive a PDP packet.

Parameters
id- The ID of the PDP object, as returned by sceNetAdhocPdpCreate
srcMacAddr- Buffer to hold the source mac address of the sender
port- Buffer to hold the port number of he received data
data- Data buffer
dataLength- The length of the data buffer
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
Number of bytes received, < 0 on error.

◆ sceNetAdhocPdpSend()

int sceNetAdhocPdpSend ( int  id,
unsigned char destMacAddr,
unsigned short  port,
void data,
unsigned int  len,
unsigned int  timeout,
int  nonblock 
)

Set a PDP packet to a destination.

Parameters
id- The ID as returned by sceNetAdhocPdpCreate
destMacAddr- The destination MAC address, can be set to all 0xFF for broadcast
port- The port to send to
data- The data to send
len- The length of the data.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
Bytes sent, < 0 on error

◆ sceNetAdhocPtpAccept()

int sceNetAdhocPtpAccept ( int  id,
unsigned char mac,
unsigned short port,
unsigned int  timeout,
int  nonblock 
)

Accept an incoming PTP connection.

Parameters
id- A socket ID.
mac- Connecting peers mac.
port- Connecting peers port.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocPtpClose()

int sceNetAdhocPtpClose ( int  id,
int  unk1 
)

Close a socket.

Parameters
id- A socket ID.
unk1- Pass 0.
Returns
A socket ID on success, < 0 on error.

◆ sceNetAdhocPtpConnect()

int sceNetAdhocPtpConnect ( int  id,
unsigned int  timeout,
int  nonblock 
)

Wait for connection created by sceNetAdhocPtpOpen()

Parameters
id- A socket ID.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocPtpFlush()

int sceNetAdhocPtpFlush ( int  id,
unsigned int  timeout,
int  nonblock 
)

Wait for data in the buffer to be sent.

Parameters
id- A socket ID.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
A socket ID on success, < 0 on error.

◆ sceNetAdhocPtpListen()

int sceNetAdhocPtpListen ( unsigned char srcmac,
unsigned short  srcport,
unsigned int  bufsize,
unsigned int  delay,
int  count,
int  queue,
int  unk1 
)

Wait for an incoming PTP connection.

Parameters
srcmac- Local mac address.
srcport- Local port.
bufsize- Socket buffer size
delay- Interval between retrying (microseconds).
count- Number of retries.
queue- Connection queue length.
unk1- Pass 0.
Returns
A socket ID on success, < 0 on error.

◆ sceNetAdhocPtpOpen()

int sceNetAdhocPtpOpen ( unsigned char srcmac,
unsigned short  srcport,
unsigned char destmac,
unsigned short  destport,
unsigned int  bufsize,
unsigned int  delay,
int  count,
int  unk1 
)

Open a PTP connection.

Parameters
srcmac- Local mac address.
srcport- Local port.
destmac- Destination mac.
destport- Destination port
bufsize- Socket buffer size
delay- Interval between retrying (microseconds).
count- Number of retries.
unk1- Pass 0.
Returns
A socket ID on success, < 0 on error.

◆ sceNetAdhocPtpRecv()

int sceNetAdhocPtpRecv ( int  id,
void data,
int datasize,
unsigned int  timeout,
int  nonblock 
)

Receive data.

Parameters
id- A socket ID.
data- Buffer for the received data.
datasize- Size of the data received.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
0 on success, < 0 on error.

◆ sceNetAdhocPtpSend()

int sceNetAdhocPtpSend ( int  id,
void data,
int datasize,
unsigned int  timeout,
int  nonblock 
)

Send data.

Parameters
id- A socket ID.
data- Data to send.
datasize- Size of the data.
timeout- Timeout in microseconds.
nonblock- Set to 0 to block, 1 for non-blocking.
Returns
0 success, < 0 on error.

◆ sceNetAdhocTerm()

int sceNetAdhocTerm ( void  )

Terminate the adhoc library.

Returns
0 on success, < 0 on error