mirror of
https://github.com/IllusionMan1212/vitasdk-odin.git
synced 2026-10-24 02:12:38 +00:00
initial
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package netctl
|
||||
|
||||
import "core:c"
|
||||
|
||||
foreign import netctl "system:SceNetCtl_stub"
|
||||
|
||||
@(link_prefix = "SceNetCtl")
|
||||
foreign netctl {
|
||||
Init :: proc() -> c.int ---
|
||||
Term :: proc() ---
|
||||
|
||||
CheckCallback :: proc() -> c.int ---
|
||||
|
||||
InetGetResult :: proc(eventType: c.int, errorCode: ^c.int) -> c.int ---
|
||||
AdhocGetResult :: proc(eventType: c.int, errorCode: ^c.int) -> c.int ---
|
||||
|
||||
InetGetInfo :: proc(code: c.int, info: ^SceNetCtlInfo) -> c.int ---
|
||||
InetGetState :: proc(state: ^c.int) -> c.int ---
|
||||
GetNatInfo :: proc(natinfo: ^SceNetCtlNatInfo) -> c.int ---
|
||||
|
||||
InetRegisterCallback :: proc(func: SceNetCtlCallback, arg: rawptr, cid: ^c.int) -> c.int ---
|
||||
InetUnregisterCallback :: proc(cid: c.int) -> c.int ---
|
||||
|
||||
AdhocRegisterCallback :: proc(func: SceNetCtlCallback, arg: rawptr, cid: ^c.int) -> c.int ---
|
||||
AdhocUnregisterCallback :: proc(cid: c.int) -> c.int ---
|
||||
AdhocGetState :: proc(state: ^c.int) -> c.int ---
|
||||
AdhocDisconnect :: proc() -> c.int ---
|
||||
AdhocGetPeerList :: proc(buflen: ^c.uint, buf: rawptr) -> c.int ---
|
||||
AdhocGetInAddr :: proc(inaddr: ^SceNetInAddr) -> c.int ---
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package netctl
|
||||
|
||||
import "core:c"
|
||||
|
||||
SCE_NETCTL_INFO_CONFIG_NAME_LEN_MAX :: 64
|
||||
SCE_NETCTL_INFO_SSID_LEN_MAX :: 32
|
||||
|
||||
SceNetCtlInfoType :: enum c.int {
|
||||
GET_CNF_NAME = 1,
|
||||
GET_DEVICE,
|
||||
GET_ETHER_ADDR,
|
||||
GET_MTU,
|
||||
GET_LINK,
|
||||
GET_BSSID,
|
||||
GET_SSID,
|
||||
GET_WIFI_SECURITY,
|
||||
GET_RSSI_DBM,
|
||||
GET_RSSI_PERCENTAGE,
|
||||
GET_CHANNEL,
|
||||
GET_IP_CONFIG,
|
||||
GET_DHCP_HOSTNAME,
|
||||
GET_PPPOE_AUTH_NAME,
|
||||
GET_IP_ADDRESS,
|
||||
GET_NETMASK,
|
||||
GET_DEFAULT_ROUTE,
|
||||
GET_PRIMARY_DNS,
|
||||
GET_SECONDARY_DNS,
|
||||
GET_HTTP_PROXY_CONFIG,
|
||||
GET_HTTP_PROXY_SERVER,
|
||||
GET_HTTP_PROXY_PORT,
|
||||
}
|
||||
|
||||
SceNetCtlState :: enum c.int {
|
||||
DISCONNECTED,
|
||||
CONNECTING,
|
||||
FINALIZING,
|
||||
CONNECTED
|
||||
}
|
||||
|
||||
/* callback */
|
||||
|
||||
SceNetCtlCallback :: #type ^proc(
|
||||
event_type: c.int,
|
||||
arg: rawptr,
|
||||
) -> rawptr
|
||||
|
||||
/* struct/union */
|
||||
|
||||
// TODO: copy-pasted from Net/types.odin. should prob be in common or something
|
||||
SceNetEtherAddr :: struct {
|
||||
data: [6]c.uchar,
|
||||
}
|
||||
#assert(size_of(SceNetEtherAddr) == 6)
|
||||
|
||||
// TODO: copy-pasted from Net/types.odin. should prob be in common or something
|
||||
SceNetInAddr :: struct {
|
||||
s_addr: c.uint,
|
||||
}
|
||||
#assert(size_of(SceNetInAddr) == 4)
|
||||
|
||||
SceNetCtlInfo :: struct #raw_union {
|
||||
cnf_name: [SCE_NETCTL_INFO_CONFIG_NAME_LEN_MAX + 1]c.char,
|
||||
device: c.uint,
|
||||
ether_addr: SceNetEtherAddr,
|
||||
mtu: c.uint,
|
||||
link: c.uint,
|
||||
bssid: SceNetEtherAddr,
|
||||
ssid: [SCE_NETCTL_INFO_SSID_LEN_MAX + 1]c.char,
|
||||
wifi_security: c.uint,
|
||||
rssi_dbm: c.uint,
|
||||
rssi_percentage: c.uint,
|
||||
channel: c.uint,
|
||||
ip_config: c.uint,
|
||||
dhcp_hostname: [256]c.char,
|
||||
pppoe_auth_name: [128]c.char,
|
||||
ip_address: [16]c.char,
|
||||
netmask: [16]c.char,
|
||||
default_route: [16]c.char,
|
||||
primary_dns: [16]c.char,
|
||||
secondary_dns: [16]c.char,
|
||||
http_proxy_config: c.uint,
|
||||
http_proxy_server: [256]c.char,
|
||||
http_proxy_port: c.uint,
|
||||
}
|
||||
#assert(size_of(SceNetCtlInfo) == 0x100)
|
||||
|
||||
|
||||
SceNetCtlNatInfo :: struct {
|
||||
size: c.uint,
|
||||
stun_status: c.int,
|
||||
nat_type: c.int,
|
||||
mapped_addr: SceNetInAddr,
|
||||
}
|
||||
#assert(size_of(SceNetCtlNatInfo) == 0x10)
|
||||
|
||||
SceNetCtlAdhocPeerInfo :: struct {
|
||||
next: ^SceNetCtlAdhocPeerInfo,
|
||||
inet_addr: SceNetInAddr,
|
||||
}
|
||||
when size_of(rawptr) == 4 {
|
||||
#assert(size_of(SceNetCtlAdhocPeerInfo) == 8)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user