PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
include/psp2/net/netctl.h
Go to the documentation of this file.
00001 
00012 #ifndef _PSP2_NET_CTL_H_
00013 #define _PSP2_NET_CTL_H_
00014 
00015 #include <psp2/net/net.h>
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 /* defines */
00022 
00023 #define PSP2_NETCTL_INFO_CONFIG_NAME_LEN_MAX 64
00024 #define PSP2_NETCTL_INFO_SSID_LEN_MAX        32
00025 
00026 enum {
00027     PSP2_NETCTL_INFO_GET_CNF_NAME = 1,
00028     PSP2_NETCTL_INFO_GET_DEVICE,
00029     PSP2_NETCTL_INFO_GET_ETHER_ADDR,
00030     PSP2_NETCTL_INFO_GET_MTU,
00031     PSP2_NETCTL_INFO_GET_LINK,
00032     PSP2_NETCTL_INFO_GET_BSSID,
00033     PSP2_NETCTL_INFO_GET_SSID,
00034     PSP2_NETCTL_INFO_GET_WIFI_SECURITY,
00035     PSP2_NETCTL_INFO_GET_RSSI_DBM,
00036     PSP2_NETCTL_INFO_GET_RSSI_PERCENTAGE,
00037     PSP2_NETCTL_INFO_GET_CHANNEL,
00038     PSP2_NETCTL_INFO_GET_IP_CONFIG,
00039     PSP2_NETCTL_INFO_GET_DHCP_HOSTNAME,
00040     PSP2_NETCTL_INFO_GET_PPPOE_AUTH_NAME,
00041     PSP2_NETCTL_INFO_GET_IP_ADDRESS,
00042     PSP2_NETCTL_INFO_GET_NETMASK,
00043     PSP2_NETCTL_INFO_GET_DEFAULT_ROUTE,
00044     PSP2_NETCTL_INFO_GET_PRIMARY_DNS,
00045     PSP2_NETCTL_INFO_GET_SECONDARY_DNS,
00046     PSP2_NETCTL_INFO_GET_HTTP_PROXY_CONFIG,
00047     PSP2_NETCTL_INFO_GET_HTTP_PROXY_SERVER,
00048     PSP2_NETCTL_INFO_GET_HTTP_PROXY_PORT,
00049 };
00050 
00051 /* callback */
00052 
00053 typedef void *(*SceNetCtlCallback)(
00054     int event_type,
00055     void *arg);
00056 
00057 /* struct/union */
00058 
00059 typedef union SceNetCtlInfo {
00060     char cnf_name[PSP2_NETCTL_INFO_CONFIG_NAME_LEN_MAX + 1];
00061     unsigned int device;
00062     SceNetEtherAddr ether_addr;
00063     unsigned int mtu;
00064     unsigned int link;
00065     SceNetEtherAddr bssid;
00066     char ssid[PSP2_NETCTL_INFO_SSID_LEN_MAX + 1];
00067     unsigned int wifi_security;
00068     unsigned int rssi_dbm;
00069     unsigned int rssi_percentage;
00070     unsigned int channel;
00071     unsigned int ip_config;
00072     char dhcp_hostname[256];
00073     char pppoe_auth_name[128];
00074     char ip_address[16];
00075     char netmask[16];
00076     char default_route[16];
00077     char primary_dns[16];
00078     char secondary_dns[16];
00079     unsigned int http_proxy_config;
00080     char http_proxy_server[256];
00081     unsigned int http_proxy_port;
00082 } SceNetCtlInfo;
00083 
00084 
00085 typedef struct SceNetCtlNatInfo {
00086     unsigned int size;
00087     int stun_status;
00088     int nat_type;
00089     SceNetInAddr mapped_addr;
00090 } SceNetCtlNatInfo;
00091 
00092 typedef struct SceNetCtlAdhocPeerInfo {
00093     struct SceNetCtlAdhocPeerInfo *next;
00094     SceNetInAddr inet_addr;
00095 } SceNetCtlAdhocPeerInfo;
00096 
00097 /* prototypes */
00098 
00099 int sceNetCtlInit();
00100 void sceNetCtlTerm();
00101 
00102 int sceNetCtlCheckCallback();
00103 
00104 int sceNetCtlInetGetResult(int eventType, int *errorCode);
00105 int sceNetCtlAdhocGetResult(int eventType, int *errorCode);
00106 
00107 int sceNetCtlInetGetInfo(int code, SceNetCtlInfo *info);
00108 int sceNetCtlInetGetState(int *state);
00109 int sceNetCtlGetNatInfo(SceNetCtlNatInfo *natinfo);
00110 
00111 int sceNetCtlInetRegisterCallback(SceNetCtlCallback func, void *arg, int *cid);
00112 int sceNetCtlInetUnregisterCallback(int cid);
00113 
00114 int sceNetCtlAdhocRegisterCallback(SceNetCtlCallback func, void *arg, int *cid);
00115 int sceNetCtlAdhocUnregisterCallback(int cid);
00116 int sceNetCtlAdhocGetState(int *state);
00117 int sceNetCtlAdhocDisconnect();
00118 int sceNetCtlAdhocGetPeerList(unsigned int *buflen, void *buf);
00119 int sceNetCtlAdhocGetInAddr(SceNetInAddr *inaddr);
00120 
00121 #ifdef __cplusplus
00122 }
00123 #endif
00124 
00125 #endif /* _PSP2_NET_CTL_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines