pspnet_apctl.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_apctl.h - PSP networking libraries.
00007  *
00008  * Copyright (c) 2005 Marcus R. Brown <mrbrown@0xd6.org>
00009  * Copyright (c) 2008 David Perry <tias_dp@hotmail.com>
00010  *
00011  * Portions based on PspPet's wifi_03 sample code.
00012  * 
00013  * $Id: pspnet_apctl.h 2434 2008-10-15 17:37:25Z iwn $
00014  */
00015 
00016 #ifndef PSPNET_APCTL_H
00017 #define PSPNET_APCTL_H
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022         
00023 #define PSP_NET_APCTL_STATE_DISCONNECTED        0
00024 #define PSP_NET_APCTL_STATE_SCANNING            1
00025 #define PSP_NET_APCTL_STATE_JOINING                     2
00026 #define PSP_NET_APCTL_STATE_GETTING_IP      3
00027 #define PSP_NET_APCTL_STATE_GOT_IP                      4
00028 #define PSP_NET_APCTL_STATE_EAP_AUTH            5
00029 #define PSP_NET_APCTL_STATE_KEY_EXCHANGE        6
00030         
00031 #define PSP_NET_APCTL_EVENT_CONNECT_REQUEST             0
00032 #define PSP_NET_APCTL_EVENT_SCAN_REQUEST                1
00033 #define PSP_NET_APCTL_EVENT_SCAN_COMPLETE               2
00034 #define PSP_NET_APCTL_EVENT_ESTABLISHED                 3
00035 #define PSP_NET_APCTL_EVENT_GET_IP                              4
00036 #define PSP_NET_APCTL_EVENT_DISCONNECT_REQUEST  5
00037 #define PSP_NET_APCTL_EVENT_ERROR                               6
00038 #define PSP_NET_APCTL_EVENT_INFO                                7
00039 #define PSP_NET_APCTL_EVENT_EAP_AUTH                    8
00040 #define PSP_NET_APCTL_EVENT_KEY_EXCHANGE                9
00041 #define PSP_NET_APCTL_EVENT_RECONNECT                   10
00042         
00043 #define PSP_NET_APCTL_INFO_PROFILE_NAME         0
00044 #define PSP_NET_APCTL_INFO_BSSID                        1
00045 #define PSP_NET_APCTL_INFO_SSID                         2
00046 #define PSP_NET_APCTL_INFO_SSID_LENGTH          3
00047 #define PSP_NET_APCTL_INFO_SECURITY_TYPE        4
00048 #define PSP_NET_APCTL_INFO_STRENGTH                     5
00049 #define PSP_NET_APCTL_INFO_CHANNEL                      6
00050 #define PSP_NET_APCTL_INFO_POWER_SAVE           7
00051 #define PSP_NET_APCTL_INFO_IP                           8
00052 #define PSP_NET_APCTL_INFO_SUBNETMASK           9
00053 #define PSP_NET_APCTL_INFO_GATEWAY                      10
00054 #define PSP_NET_APCTL_INFO_PRIMDNS                      11
00055 #define PSP_NET_APCTL_INFO_SECDNS                       12
00056 #define PSP_NET_APCTL_INFO_USE_PROXY            13
00057 #define PSP_NET_APCTL_INFO_PROXY_URL            14
00058 #define PSP_NET_APCTL_INFO_PROXY_PORT           15
00059 #define PSP_NET_APCTL_INFO_8021_EAP_TYPE        16
00060 #define PSP_NET_APCTL_INFO_START_BROWSER        17
00061 #define PSP_NET_APCTL_INFO_WIFISP                       18
00062         
00063 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_NONE   0
00064 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_WEP    1
00065 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_WPA    2
00066         
00067 union SceNetApctlInfo 
00068 { 
00069         char name[64];                          /* Name of the config used */ 
00070         unsigned char bssid[6];         /* MAC address of the access point */ 
00071         unsigned char ssid[32];         /* ssid */                      
00072         unsigned int ssidLength;        /* ssid string length*/ 
00073         unsigned int securityType;      /* 0 for none, 1 for WEP, 2 for WPA) */ 
00074         unsigned char strength;         /* Signal strength in % */ 
00075         unsigned char channel;          /* Channel */ 
00076         unsigned char powerSave;        /* 1 on, 0 off */ 
00077         char ip[16];                            /* PSP's ip */ 
00078         char subNetMask[16];            /* Subnet mask */ 
00079         char gateway[16];                       /* Gateway */ 
00080         char primaryDns[16];            /* Primary DNS */ 
00081         char secondaryDns[16];          /* Secondary DNS */ 
00082         unsigned int useProxy;          /* 1 for proxy, 0 for no proxy */ 
00083         char proxyUrl[128];                     /* Proxy url */ 
00084         unsigned short proxyPort;       /* Proxy port */ 
00085         unsigned int eapType;           /* 0 is none, 1 is EAP-MD5 */ 
00086         unsigned int startBrowser;      /* Should browser be started */ 
00087         unsigned int wifisp;            /* 1 if connection is for Wifi service providers (WISP) */ 
00088 
00089 };
00090         
00091 typedef void (*sceNetApctlHandler)(int oldState, int newState, int event, int error, void *pArg);
00092 
00102 int sceNetApctlInit(int stackSize, int initPriority);
00103 
00109 int sceNetApctlTerm(void);
00110 
00120 int sceNetApctlGetInfo(int code, union SceNetApctlInfo *pInfo);
00121 
00131 int sceNetApctlAddHandler(sceNetApctlHandler handler, void *pArg);
00132         
00140 int sceNetApctlDelHandler(int handlerId);
00141 
00149 int sceNetApctlConnect(int connIndex);
00150 
00156 int sceNetApctlDisconnect(void);
00157 
00165 int sceNetApctlGetState(int *pState);
00166 
00167 #ifdef __cplusplus
00168 }
00169 #endif
00170 
00171 #endif /* PSPNET_APCTL_H */