Advertisement
Guest User

libnetctl.h [PS3 SDK LIB]

a guest
Dec 28th, 2020
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.03 KB | None | 0 0
  1. /* SCE CONFIDENTIAL
  2. PlayStation(R)3 Programmer Tool Runtime Library 400.001
  3. *
  4. * Copyright (C) 2008 Sony Computer Entertainment Inc.
  5. * All Rights Reserved.
  6. *
  7. */
  8.  
  9. #ifndef _CELL_NETCTL_H_
  10. #define _CELL_NETCTL_H_
  11.  
  12. #include <sys/types.h>
  13. #include <netinet/in.h>
  14.  
  15. /* 0x80130100 - 0x8013011f: libnetctl */
  16. #define CELL_NET_CTL_ERROR_NOT_INITIALIZED 0x80130101
  17. /* Library module is not initialized. */
  18. #define CELL_NET_CTL_ERROR_NOT_TERMINATED 0x80130102
  19. /* Not Terminated */
  20. #define CELL_NET_CTL_ERROR_HANDLER_MAX 0x80130103
  21. /* there is no space for new handler */
  22. #define CELL_NET_CTL_ERROR_ID_NOT_FOUND 0x80130104
  23. /* specified ID is not found */
  24. #define CELL_NET_CTL_ERROR_INVALID_ID 0x80130105
  25. /* specified ID is invalid */
  26. #define CELL_NET_CTL_ERROR_INVALID_CODE 0x80130106
  27. /* specified code is invalid */
  28. #define CELL_NET_CTL_ERROR_INVALID_ADDR 0x80130107
  29. /* specified addr is invalid */
  30. #define CELL_NET_CTL_ERROR_NOT_CONNECTED 0x80130108
  31. /* Not connected */
  32. #define CELL_NET_CTL_ERROR_NOT_AVAIL 0x80130109
  33. /* Not available */
  34. #define CELL_NET_CTL_ERROR_INVALID_TYPE 0x8013010a
  35. /* specified type is invalid */
  36. #define CELL_NET_CTL_ERROR_INVALID_SIZE 0x8013010b
  37. /* specified size is invalid */
  38.  
  39. /* 0x80130180 - 0x8013019f: libnetctl NetStart dialog */
  40. #define CELL_NET_CTL_ERROR_NET_DISABLED 0x80130181
  41. /* Internet Connection is disabled */
  42. #define CELL_NET_CTL_ERROR_NET_NOT_CONNECTED 0x80130182
  43. /* does not have IP addr */
  44. #define CELL_NET_CTL_ERROR_NP_NO_ACCOUNT 0x80130183
  45. /* do not have NP account */
  46. #define CELL_NET_CTL_ERROR_NP_RESERVED1 0x80130184
  47. /* reserved for internal use */
  48. #define CELL_NET_CTL_ERROR_NP_RESERVED2 0x80130185
  49. /* reserved for internal use */
  50. #define CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED 0x80130186
  51. /* Ethernet cable is not connected */
  52.  
  53. #define CELL_NET_CTL_ERROR_DIALOG_CANCELED 0x80130190
  54. /* dialog is closed by user */
  55. #define CELL_NET_CTL_ERROR_DIALOG_ABORTED 0x80130191
  56. /* dialog is aborted by API */
  57.  
  58. /* network error code which comes from libnetctl handler */
  59. /* WLAN error */
  60. #define CELL_NET_CTL_ERROR_WLAN_DEAUTHED 0x80130137
  61. /* Deauthed/Disassociated from AP */
  62. #define CELL_NET_CTL_ERROR_WLAN_KEYINFO_EXCHNAGE_TIMEOUT 0x8013013d
  63. /* WPA key information exchaning has been timed out */
  64. #define CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED 0x8013013e
  65. /* StatusCode of Association Response means Assoc failed */
  66. #define CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED 0x8013013f
  67. /* Access Point is disappered. */
  68.  
  69. /* PPPoE error */
  70. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT 0x80130409
  71. /* Init error. */
  72. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO 0x8013040a
  73. /* Can't get PADO. */
  74. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS 0x8013040b
  75. /* Can't get PADS. */
  76. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT 0x8013040d
  77. /* PADT received. */
  78. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME 0x8013040f
  79. /* Service name error. */
  80. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM 0x80130410
  81. /* AC system error. */
  82. #define CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC 0x80130411
  83. /* Generic error. */
  84. #define CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH 0x80130412
  85. /* Authentication error. */
  86. #define CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK 0x80130413
  87. /* Network error. */
  88. #define CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE 0x80130414
  89. /* Terminate error. */
  90.  
  91. /* DHCP error */
  92. #define CELL_NET_CTL_ERROR_DHCP_LEASE_TIME 0x80130504
  93. /* Lease time expired. */
  94.  
  95. #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
  96. extern "C" {
  97. #endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */
  98.  
  99. /* state */
  100. #define CELL_NET_CTL_STATE_Disconnected 0
  101. #define CELL_NET_CTL_STATE_Connecting 1
  102. #define CELL_NET_CTL_STATE_IPObtaining 2
  103. #define CELL_NET_CTL_STATE_IPObtained 3
  104.  
  105. /* event */
  106. #define CELL_NET_CTL_EVENT_CONNECT_REQ 0
  107. #define CELL_NET_CTL_EVENT_ESTABLISH 1
  108. #define CELL_NET_CTL_EVENT_GET_IP 2
  109. #define CELL_NET_CTL_EVENT_DISCONNECT_REQ 3
  110. #define CELL_NET_CTL_EVENT_ERROR 4
  111. #define CELL_NET_CTL_EVENT_LINK_DISCONNECTED 5
  112. #define CELL_NET_CTL_EVENT_AUTO_RETRY 6
  113.  
  114. /* info code */
  115. #define CELL_NET_CTL_INFO_DEVICE 1
  116. #define CELL_NET_CTL_INFO_ETHER_ADDR 2
  117. #define CELL_NET_CTL_INFO_MTU 3
  118. #define CELL_NET_CTL_INFO_LINK 4
  119. #define CELL_NET_CTL_INFO_LINK_TYPE 5
  120. #define CELL_NET_CTL_INFO_BSSID 6
  121. #define CELL_NET_CTL_INFO_SSID 7
  122. #define CELL_NET_CTL_INFO_WLAN_SECURITY 8
  123. #define CELL_NET_CTL_INFO_8021X_TYPE 9
  124. #define CELL_NET_CTL_INFO_8021X_AUTH_NAME 10
  125. #define CELL_NET_CTL_INFO_RSSI 11
  126. #define CELL_NET_CTL_INFO_CHANNEL 12
  127. #define CELL_NET_CTL_INFO_IP_CONFIG 13
  128. #define CELL_NET_CTL_INFO_DHCP_HOSTNAME 14
  129. #define CELL_NET_CTL_INFO_PPPOE_AUTH_NAME 15
  130. #define CELL_NET_CTL_INFO_IP_ADDRESS 16
  131. #define CELL_NET_CTL_INFO_NETMASK 17
  132. #define CELL_NET_CTL_INFO_DEFAULT_ROUTE 18
  133. #define CELL_NET_CTL_INFO_PRIMARY_DNS 19
  134. #define CELL_NET_CTL_INFO_SECONDARY_DNS 20
  135. #define CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG 21
  136. #define CELL_NET_CTL_INFO_HTTP_PROXY_SERVER 22
  137. #define CELL_NET_CTL_INFO_HTTP_PROXY_PORT 23
  138. #define CELL_NET_CTL_INFO_UPNP_CONFIG 24
  139. #define CELL_NET_CTL_INFO_RESERVED1 25
  140. #define CELL_NET_CTL_INFO_RESERVED2 26
  141.  
  142. /* device */
  143. #define CELL_NET_CTL_DEVICE_WIRED 0
  144. #define CELL_NET_CTL_DEVICE_WIRELESS 1
  145.  
  146. /* link_type */
  147. #define CELL_NET_CTL_LINK_TYPE_AUTO 0
  148. #define CELL_NET_CTL_LINK_TYPE_10BASE_HALF 1
  149. #define CELL_NET_CTL_LINK_TYPE_10BASE_FULL 2
  150. #define CELL_NET_CTL_LINK_TYPE_100BASE_HALF 3
  151. #define CELL_NET_CTL_LINK_TYPE_100BASE_FULL 4
  152. #define CELL_NET_CTL_LINK_TYPE_1000BASE_HALF 5
  153. #define CELL_NET_CTL_LINK_TYPE_1000BASE_FULL 6
  154.  
  155. /* link */
  156. #define CELL_NET_CTL_LINK_DISCONNECTED 0
  157. #define CELL_NET_CTL_LINK_CONNECTED 1
  158.  
  159. /* wlan_security */
  160. #define CELL_NET_CTL_WLAN_SECURITY_NOAUTH 0
  161. #define CELL_NET_CTL_WLAN_SECURITY_WEP 1
  162. #define CELL_NET_CTL_WLAN_SECURITY_WPAPSK_TKIP 2
  163. #define CELL_NET_CTL_WLAN_SECURITY_WPAPSK_AES 3
  164. #define CELL_NET_CTL_WLAN_SECURITY_UNSUPPORTED 4 /* reserved */
  165. #define CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_TKIP 5
  166. #define CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_AES 6
  167. #define CELL_NET_CTL_WLAN_SECURITY_WPAPSK_WPA2PSK 7
  168.  
  169. /* 8021x_type */
  170. #define CELL_NET_CTL_8021X_NONE 0
  171. #define CELL_NET_CTL_8021X_EAP_MD5 1
  172.  
  173. /* ip_config */
  174. #define CELL_NET_CTL_IP_DHCP 0
  175. #define CELL_NET_CTL_IP_STATIC 1
  176. #define CELL_NET_CTL_IP_PPPOE 2
  177.  
  178. /* http_proxy_config */
  179. #define CELL_NET_CTL_HTTP_PROXY_OFF 0
  180. #define CELL_NET_CTL_HTTP_PROXY_ON 1
  181.  
  182. /* upnp_config */
  183. #define CELL_NET_CTL_UPNP_ON 0
  184. #define CELL_NET_CTL_UPNP_OFF 1
  185.  
  186. #define CELL_NET_CTL_ETHER_ADDR_LEN 6
  187. #define CELL_NET_CTL_BSSID_LEN 6
  188. #define CELL_NET_CTL_SSID_LEN 32
  189. #define CELL_NET_CTL_WLAN_SECURITY_KEY_LEN (64 + 1)
  190. #define CELL_NET_CTL_AUTH_NAME_LEN (127 + 1)
  191. #define CELL_NET_CTL_AUTH_KEY_LEN (127 + 1)
  192. #define CELL_NET_CTL_DHCP_HOSTNAME_LEN (254 + 1)
  193. #define CELL_NET_CTL_HOSTNAME_LEN (255 + 1)
  194. #define CELL_NET_CTL_IPV4_ADDR_STR_LEN 16
  195.  
  196. struct CellNetCtlEtherAddr {
  197. uint8_t data[CELL_NET_CTL_ETHER_ADDR_LEN];
  198. uint8_t padding[2];
  199. };
  200.  
  201. struct CellNetCtlSSID {
  202. uint8_t data[CELL_NET_CTL_SSID_LEN];
  203. uint8_t term;
  204. uint8_t padding[3];
  205. };
  206.  
  207. union CellNetCtlInfo {
  208. uint32_t device;
  209. struct CellNetCtlEtherAddr ether_addr;
  210. uint32_t mtu;
  211. uint32_t link;
  212. uint32_t link_type;
  213. struct CellNetCtlEtherAddr bssid;
  214. struct CellNetCtlSSID ssid;
  215. uint32_t wlan_security;
  216. uint32_t auth_8021x_type;
  217. char auth_8021x_auth_name[CELL_NET_CTL_AUTH_NAME_LEN];
  218. uint8_t rssi;
  219. uint8_t channel;
  220. uint32_t ip_config;
  221. char dhcp_hostname[CELL_NET_CTL_HOSTNAME_LEN];
  222. char pppoe_auth_name[CELL_NET_CTL_AUTH_NAME_LEN];
  223. char ip_address[CELL_NET_CTL_IPV4_ADDR_STR_LEN];
  224. char netmask[CELL_NET_CTL_IPV4_ADDR_STR_LEN];
  225. char default_route[CELL_NET_CTL_IPV4_ADDR_STR_LEN];
  226. char primary_dns[CELL_NET_CTL_IPV4_ADDR_STR_LEN];
  227. char secondary_dns[CELL_NET_CTL_IPV4_ADDR_STR_LEN];
  228. uint32_t http_proxy_config;
  229. char http_proxy_server[CELL_NET_CTL_HOSTNAME_LEN];
  230. uint16_t http_proxy_port;
  231. uint32_t upnp_config;
  232. };
  233.  
  234. struct CellNetCtlNatInfo {
  235. size_t size;
  236. int upnp_status;
  237. int stun_status;
  238. int nat_type;
  239. struct in_addr mapped_addr;
  240. };
  241.  
  242. /* upnp status */
  243. #define CELL_NET_CTL_NATINFO_UPNP_UNCHECKED 0
  244. #define CELL_NET_CTL_NATINFO_UPNP_NO 1
  245. #define CELL_NET_CTL_NATINFO_UPNP_USED 2
  246. /* stun staus */
  247. #define CELL_NET_CTL_NATINFO_STUN_UNCHECKED 0
  248. #define CELL_NET_CTL_NATINFO_STUN_FAILED 1
  249. #define CELL_NET_CTL_NATINFO_STUN_OK 2
  250. /* nat type */
  251. #define CELL_NET_CTL_NATINFO_NAT_TYPE_1 1
  252. #define CELL_NET_CTL_NATINFO_NAT_TYPE_2 2
  253. #define CELL_NET_CTL_NATINFO_NAT_TYPE_3 3
  254.  
  255. struct CellNetCtlNetStartDialogParam {
  256. size_t size;
  257. int type;
  258. uint32_t cid;
  259. };
  260. /* type */
  261. #define CELL_NET_CTL_NETSTART_TYPE_NET 0
  262. #define CELL_NET_CTL_NETSTART_TYPE_NP 1
  263. #define CELL_NET_CTL_NETSTART_TYPE_MAX 2
  264.  
  265. struct CellNetCtlNetStartDialogResult {
  266. size_t size;
  267. int result;
  268. };
  269.  
  270. /* status for sysutil callback */
  271. #define CELL_SYSUTIL_NET_CTL_NETSTART_LOADED (0x0801)
  272. #define CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED (0x0802)
  273. #define CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED (0x0803)
  274.  
  275. int
  276. cellNetCtlInit(
  277. void
  278. );
  279.  
  280. void
  281. cellNetCtlTerm(
  282. void
  283. );
  284.  
  285. int
  286. cellNetCtlGetInfo(
  287. int code,
  288. union CellNetCtlInfo *info
  289. );
  290.  
  291. int
  292. cellNetCtlGetState(
  293. int *state
  294. );
  295.  
  296. typedef void (*cellNetCtlHandler)(
  297. int prev_state,
  298. int new_state,
  299. int event,
  300. int error_code,
  301. void *arg
  302. );
  303.  
  304. int
  305. cellNetCtlAddHandler(
  306. cellNetCtlHandler handler,
  307. void *arg,
  308. int *hid
  309. );
  310.  
  311. int
  312. cellNetCtlDelHandler(
  313. int hid
  314. );
  315.  
  316. int
  317. cellNetCtlGetNatInfo(
  318. struct CellNetCtlNatInfo *natinfo
  319. );
  320.  
  321. int
  322. cellNetCtlNetStartDialogLoadAsync(
  323. const struct CellNetCtlNetStartDialogParam *param
  324. );
  325.  
  326. int
  327. cellNetCtlNetStartDialogAbortAsync(
  328. void
  329. );
  330.  
  331. int
  332. cellNetCtlNetStartDialogUnloadAsync(
  333. struct CellNetCtlNetStartDialogResult *result
  334. );
  335.  
  336. #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
  337. }
  338. #endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */
  339.  
  340. #endif /* _CELL_NETCTL_H_ */
  341.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement