pspsdk-1.0+beta2
pspnet_apctl.h
Go to the documentation of this file.
1 /*
2  * PSP Software Development Kit - http://www.pspdev.org
3  * -----------------------------------------------------------------------
4  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5  *
6  * pspnet_apctl.h - PSP networking libraries.
7  *
8  * Copyright (c) 2005 Marcus R. Brown <mrbrown@0xd6.org>
9  * Copyright (c) 2008 David Perry <tias_dp@hotmail.com>
10  *
11  * Portions based on PspPet's wifi_03 sample code.
12  *
13  * $Id: pspnet_apctl.h 2434 2008-10-15 17:37:25Z iwn $
14  */
15 
16 #ifndef PSPNET_APCTL_H
17 #define PSPNET_APCTL_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define PSP_NET_APCTL_STATE_DISCONNECTED 0
24 #define PSP_NET_APCTL_STATE_SCANNING 1
25 #define PSP_NET_APCTL_STATE_JOINING 2
26 #define PSP_NET_APCTL_STATE_GETTING_IP 3
27 #define PSP_NET_APCTL_STATE_GOT_IP 4
28 #define PSP_NET_APCTL_STATE_EAP_AUTH 5
29 #define PSP_NET_APCTL_STATE_KEY_EXCHANGE 6
30 
31 #define PSP_NET_APCTL_EVENT_CONNECT_REQUEST 0
32 #define PSP_NET_APCTL_EVENT_SCAN_REQUEST 1
33 #define PSP_NET_APCTL_EVENT_SCAN_COMPLETE 2
34 #define PSP_NET_APCTL_EVENT_ESTABLISHED 3
35 #define PSP_NET_APCTL_EVENT_GET_IP 4
36 #define PSP_NET_APCTL_EVENT_DISCONNECT_REQUEST 5
37 #define PSP_NET_APCTL_EVENT_ERROR 6
38 #define PSP_NET_APCTL_EVENT_INFO 7
39 #define PSP_NET_APCTL_EVENT_EAP_AUTH 8
40 #define PSP_NET_APCTL_EVENT_KEY_EXCHANGE 9
41 #define PSP_NET_APCTL_EVENT_RECONNECT 10
42 
43 #define PSP_NET_APCTL_INFO_PROFILE_NAME 0
44 #define PSP_NET_APCTL_INFO_BSSID 1
45 #define PSP_NET_APCTL_INFO_SSID 2
46 #define PSP_NET_APCTL_INFO_SSID_LENGTH 3
47 #define PSP_NET_APCTL_INFO_SECURITY_TYPE 4
48 #define PSP_NET_APCTL_INFO_STRENGTH 5
49 #define PSP_NET_APCTL_INFO_CHANNEL 6
50 #define PSP_NET_APCTL_INFO_POWER_SAVE 7
51 #define PSP_NET_APCTL_INFO_IP 8
52 #define PSP_NET_APCTL_INFO_SUBNETMASK 9
53 #define PSP_NET_APCTL_INFO_GATEWAY 10
54 #define PSP_NET_APCTL_INFO_PRIMDNS 11
55 #define PSP_NET_APCTL_INFO_SECDNS 12
56 #define PSP_NET_APCTL_INFO_USE_PROXY 13
57 #define PSP_NET_APCTL_INFO_PROXY_URL 14
58 #define PSP_NET_APCTL_INFO_PROXY_PORT 15
59 #define PSP_NET_APCTL_INFO_8021_EAP_TYPE 16
60 #define PSP_NET_APCTL_INFO_START_BROWSER 17
61 #define PSP_NET_APCTL_INFO_WIFISP 18
62 
63 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_NONE 0
64 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_WEP 1
65 #define PSP_NET_APCTL_INFO_SECURITY_TYPE_WPA 2
66 
68 {
69  char name[64]; /* Name of the config used */
70  unsigned char bssid[6]; /* MAC address of the access point */
71  unsigned char ssid[32]; /* ssid */
72  unsigned int ssidLength; /* ssid string length*/
73  unsigned int securityType; /* 0 for none, 1 for WEP, 2 for WPA) */
74  unsigned char strength; /* Signal strength in % */
75  unsigned char channel; /* Channel */
76  unsigned char powerSave; /* 1 on, 0 off */
77  char ip[16]; /* PSP's ip */
78  char subNetMask[16]; /* Subnet mask */
79  char gateway[16]; /* Gateway */
80  char primaryDns[16]; /* Primary DNS */
81  char secondaryDns[16]; /* Secondary DNS */
82  unsigned int useProxy; /* 1 for proxy, 0 for no proxy */
83  char proxyUrl[128]; /* Proxy url */
84  unsigned short proxyPort; /* Proxy port */
85  unsigned int eapType; /* 0 is none, 1 is EAP-MD5 */
86  unsigned int startBrowser; /* Should browser be started */
87  unsigned int wifisp; /* 1 if connection is for Wifi service providers (WISP) */
88 
89 };
90 
91 typedef void (*sceNetApctlHandler)(int oldState, int newState, int event, int error, void *pArg);
92 
102 int sceNetApctlInit(int stackSize, int initPriority);
103 
109 int sceNetApctlTerm(void);
110 
120 int sceNetApctlGetInfo(int code, union SceNetApctlInfo *pInfo);
121 
131 int sceNetApctlAddHandler(sceNetApctlHandler handler, void *pArg);
132 
140 int sceNetApctlDelHandler(int handlerId);
141 
149 int sceNetApctlConnect(int connIndex);
150 
156 int sceNetApctlDisconnect(void);
157 
165 int sceNetApctlGetState(int *pState);
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* PSPNET_APCTL_H */