aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys/src/services/soc.rs
blob: 94ac6323bcb6fedfe029f69aecfbc58761f36f24 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* automatically generated by rust-bindgen */

#![allow(dead_code,
         non_camel_case_types,
         non_upper_case_globals,
         non_snake_case)]
#[derive(Copy, Clone)]
#[repr(u32)]
#[derive(Debug)]
pub enum NetworkOpt {
    NETOPT_MAC_ADDRESS = 4100,
    NETOPT_ARP_TABLE = 12290,
    NETOPT_IP_INFO = 16387,
    NETOPT_IP_MTU = 16388,
    NETOPT_ROUTING_TABLE = 16390,
    NETOPT_UDP_NUMBER = 32770,
    NETOPT_UDP_TABLE = 32771,
    NETOPT_TCP_NUMBER = 36866,
    NETOPT_TCP_TABLE = 36867,
    NETOPT_DNS_TABLE = 45059,
    NETOPT_DHCP_LEASE_TIME = 49153,
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_ARPTableEntry {
    pub unk0: u32_,
    pub ip: in_addr,
    pub mac: [u8_; 6usize],
    pub padding: [u8_; 2usize],
}
impl ::core::default::Default for SOCU_ARPTableEntry {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_IPInfo {
    pub ip: in_addr,
    pub netmask: in_addr,
    pub broadcast: in_addr,
}
impl ::core::default::Default for SOCU_IPInfo {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_RoutingTableEntry {
    pub dest_ip: in_addr,
    pub netmask: in_addr,
    pub gateway: in_addr,
    pub flags: u32_,
    pub time: u64_,
}
impl ::core::default::Default for SOCU_RoutingTableEntry {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_UDPTableEntry {
    pub local: sockaddr_storage,
    pub remote: sockaddr_storage,
}
impl ::core::default::Default for SOCU_UDPTableEntry {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_TCPTableEntry {
    pub state: u32_,
    pub local: sockaddr_storage,
    pub remote: sockaddr_storage,
}
impl ::core::default::Default for SOCU_TCPTableEntry {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SOCU_DNSTableEntry {
    pub family: u32_,
    pub ip: in_addr,
    pub padding: [u8_; 12usize],
}
impl ::core::default::Default for SOCU_DNSTableEntry {
    fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
extern "C" {
    pub fn socInit(context_addr: *mut u32_, context_size: u32_) -> Result;
    pub fn socExit() -> Result;
    pub fn gethostid() -> ::libc::c_long;
    pub fn gethostname(name: *mut ::libc::c_char, namelen: ::libc::size_t)
     -> ::libc::c_int;
    pub fn SOCU_ShutdownSockets() -> ::libc::c_int;
    pub fn SOCU_CloseSockets() -> ::libc::c_int;
    pub fn SOCU_GetNetworkOpt(level: ::libc::c_int, optname: NetworkOpt,
                              optval: *mut ::libc::c_void,
                              optlen: *mut socklen_t) -> ::libc::c_int;
    pub fn SOCU_GetIPInfo(ip: *mut in_addr, netmask: *mut in_addr,
                          broadcast: *mut in_addr) -> ::libc::c_int;
    pub fn SOCU_AddGlobalSocket(sockfd: ::libc::c_int) -> ::libc::c_int;
}
use ::types::*;
use sys::socket::*;
use sys::inaddr::*;