pspnet_adhocmatching.h

Go to the documentation of this file.
00001 /*
00002  * PSP Software Development Kit - http://www.pspdev.org
00003  * -----------------------------------------------------------------------
00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
00005  *
00006  * pspnet_adhocmatching.h - PSP Adhoc matching networking libraries.
00007  *
00008  * Copyright (c) 2006 James F.
00009  * Copyright (c) 2008 InsertWittyName <tias_dp@hotmail.com>
00010  *
00011  * Based on the adhoc code in SMS Plus
00012  * 
00013  * $Id: pspnet_adhocmatching.h 2433 2008-10-15 10:00:27Z iwn $
00014  */
00015 #ifndef __PSPNETMATCHING_ADHOC_H__
00016 #define __PSPNETMATCHING_ADHOC_H__
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00025 enum pspAdhocMatchingEvents
00026 {
00028         PSP_ADHOC_MATCHING_EVENT_HELLO =                1,
00030         PSP_ADHOC_MATCHING_EVENT_JOIN =                 2,
00032         PSP_ADHOC_MATCHING_EVENT_LEFT =                 3,
00034         PSP_ADHOC_MATCHING_EVENT_REJECT =               4,
00036         PSP_ADHOC_MATCHING_EVENT_CANCEL =               5,
00038         PSP_ADHOC_MATCHING_EVENT_ACCEPT =               6,
00040         PSP_ADHOC_MATCHING_EVENT_COMPLETE =             7,
00042         PSP_ADHOC_MATCHING_EVENT_TIMEOUT =              8,
00044         PSP_ADHOC_MATCHING_EVENT_ERROR =                9,
00046         PSP_ADHOC_MATCHING_EVENT_DISCONNECT =   10,
00048         PSP_ADHOC_MATCHING_EVENT_DATA =                 11,
00050         PSP_ADHOC_MATCHING_EVENT_DATA_CONFIRM = 12,
00052         PSP_ADHOC_MATCHING_EVENT_DATA_TIMEOUT = 13
00053 };
00054 
00058 enum pspAdhocMatchingModes
00059 {
00061         PSP_ADHOC_MATCHING_MODE_HOST =          1,
00063         PSP_ADHOC_MATCHING_MODE_CLIENT =        2,
00065         PSP_ADHOC_MATCHING_MODE_PTP =           3
00066 };
00067 
00071 struct pspAdhocMatchingMember
00072 {
00073         struct pspAdhocMatchingMember *next;
00074         unsigned char mac[6];
00075         char unknown[2];
00076 };
00077 
00081 struct pspAdhocPoolStat
00082 {
00084         int size;
00086         int maxsize;
00088         int freesize;
00089 };
00090 
00098 int sceNetAdhocMatchingInit(int memsize);
00099 
00105 int sceNetAdhocMatchingTerm(void);
00106 
00108 typedef void (*pspAdhocMatchingCallback)(int matchingid, int event, unsigned char *mac, int optlen, void *optdata);
00109 
00125 int sceNetAdhocMatchingCreate(int mode, int maxpeers, unsigned short port, int bufsize, unsigned int hellodelay, unsigned int pingdelay, int initcount, unsigned int msgdelay, pspAdhocMatchingCallback callback);
00126 
00134 int sceNetAdhocMatchingDelete(int matchingid);
00135 
00149 int sceNetAdhocMatchingStart(int matchingid, int evthpri, int evthstack, int inthpri, int inthstack, int optlen, void *optdata);
00150 
00158 int sceNetAdhocMatchingStop(int matchingid);
00159 
00170 int sceNetAdhocMatchingSelectTarget(int matchingid, unsigned char *mac, int optlen, void *optdata);
00171 
00180 int sceNetAdhocMatchingCancelTarget(int matchingid, unsigned char *mac);
00181 
00192 int sceNetAdhocMatchingCancelTargetWithOpt(int matchingid, unsigned char *mac, int optlen, void *optdata);
00193 
00204 int sceNetAdhocMatchingSendData(int matchingid, unsigned char *mac, int datalen, void *data);
00205 
00214 int sceNetAdhocMatchingAbortSendData(int matchingid, unsigned char *mac);
00215 
00225 int sceNetAdhocMatchingSetHelloOpt(int matchingid, int optlen, void *optdata);
00226 
00236 int sceNetAdhocMatchingGetHelloOpt(int matchingid, int *optlen, void *optdata);
00237 
00247 int sceNetAdhocMatchingGetMembers(int matchingid, int *length, void *buf);
00248 
00254 int sceNetAdhocMatchingGetPoolMaxAlloc(void);
00255 
00263 int sceNetAdhocMatchingGetPoolStat(struct pspAdhocPoolStat *poolstat);
00264 
00265 #ifdef __cplusplus
00266 }
00267 #endif
00268 
00269 #endif