1#[allow(unused_imports)]
2use self::super::root;
3
4extern "C" {
5 #[link_name = "\u{1}_ZN2nn3ssl10InitializeEv"]
6 pub fn Initialize() -> root::Result;
7
8 #[link_name = "\u{1}_ZN2nn3ssl8FinalizeEv"]
9 pub fn Finalize() -> root::Result;
10}
11pub mod Context {
12
13 pub enum CertificateFormat {
14 PEM = 0x1,
15 DER = 0x2,
16 }
17
18 #[repr(C)]
19 pub enum SslVersion {
20 Auto = 0x1,
21 Tls10 = 0x8,
22 Tls11 = 0x10,
23 Tls12 = 0x20,
24 }
25
26 #[repr(C)]
28 #[derive(Clone, Copy)]
29 pub struct Context {
30 _x: u64,
31 }
32
33 impl Context {
34 pub fn new() -> Self {
35 Self {
36 _x: 0,
37 }
38 }
39 }
40
41 extern "C" {
42 #[link_name = "\u{1}_ZN2nn3ssl7ContextC1Ev"]
43 pub fn Context(this: *mut Context);
44 }
45 extern "C" {
46 #[link_name = "\u{1}_ZN2nn3ssl7Context6CreateENS1_10SslVersionE"]
47 pub fn Create(this: *mut Context, version: SslVersion) -> i32;
48 }
49 extern "C" {
50 #[link_name = "\u{1}_ZN2nn3ssl7Context15ImportClientPkiEPmPKcS4_jj"]
51 pub fn ImportClientPki(this: *mut Context, out_store_id: &mut u64, p12_buf: *const u8, password_buf: *const u8, p12_buf_len: u32, password_buf_len: u32) -> i32;
52 }
53 extern "C" {
54 #[link_name = "\u{1}_ZN2nn3ssl7Context15ImportServerPkiEPmPKcjNS0_17CertificateFormatE"]
55 pub fn ImportServerPki(
56 this: *mut Context,
57 arg1: *mut u64,
58 certData: *const u8,
59 certSize: u32,
60 certFormat: CertificateFormat,
61 ) -> super::root::Result;
62 }
63 extern "C" {
64 #[link_name = "\u{1}_ZN2nn3ssl7Context9ImportCrlEPmPKcj"]
65 pub fn ImportCrl(this: *mut Context, out_store_id: &mut u64, crl_der_buf: *const u8, crl_der_buf_len: u32) -> i32;
66 }
67 extern "C" {
68 #[link_name = "\u{1}_ZN2nn3ssl7Context7DestroyEv"]
69 pub fn Destroy(this: *const Context) -> u32;
70 }
71}
72mod Connection {
73 #[repr(C)]
75 #[derive(Clone, Copy)]
76 pub struct Connection {
77 _x: [u8;0x24],
78 }
79
80 impl Connection {
81 pub fn new() -> Self {
82 Self {
83 _x: [0;0x24],
84 }
85 }
86 }
87
88 extern "C" {
89 #[link_name = "\u{1}_ZN2nn3ssl10ConnectionC1Ev"]
90 pub fn Connection(this: *mut Connection);
91 }
92 extern "C" {
93 #[link_name = "\u{1}_ZN2nn3ssl10Connection6CreateEPNS0_7ContextE"]
94 pub fn Create(this: *mut Connection, context: *const super::Context::Context) -> u32;
95 }
96 extern "C" {
97 #[link_name = "\u{1}_ZN2nn3ssl10Connection19SetSocketDescriptorEi"]
98 pub fn SetSocketDescriptor(this: *mut Connection, socket_desc: u32) -> u32;
99 }
100 extern "C" {
101 #[link_name = "\u{1}_ZN2nn3ssl10Connection11SetHostNameEPKcj"]
102 pub fn SetHostName(this: *mut Connection, host_name: *const u8, name_len: u32) -> i32;
103 }
104 extern "C" {
105 #[link_name = "\u{1}_ZN2nn3ssl10Connection11DoHandshakeEv"]
106 pub fn DoHandshake(this: *mut Connection) -> u32;
107 }
108 extern "C" {
109 #[link_name = "\u{1}_ZN2nn3ssl10Connection4ReadEPcj"]
110 pub fn Read(this: *const Connection, out_buf: *mut u8, buf_len: usize) -> i32;
111 }
112 extern "C" {
113 #[link_name = "\u{1}_ZN2nn3ssl10Connection4ReadEPcPij"]
114 pub fn Read1(this: *const Connection, out_buf: *mut u8, out_size_read: *mut i32, buf_len: usize) -> i32;
115 }
116 extern "C" {
117 #[link_name = "\u{1}_ZN2nn3ssl10Connection5WriteEPKcj"]
118 pub fn Write(this: *const Connection, buf: *const u8, buf_len: usize) -> i32;
119 }
120 extern "C" {
121 #[link_name = "\u{1}_ZN2nn3ssl10Connection5WriteEPKcPij"]
122 pub fn Write1(this: *const Connection, buf: *const u8, out_size_write: *mut i32, buf_len: usize) -> i32;
123 }
124 extern "C" {
125 #[link_name = "\u{1}_ZN2nn3ssl10Connection7PendingEv"]
126 pub fn Pending(this: *const Connection) -> usize;
127 }
128 extern "C" {
129 #[link_name = "\u{1}_ZN2nn3ssl10Connection17FlushSessionCacheEv"]
130 pub fn FlushSessionCache(this: *mut Connection) -> u32;
131 }
132 extern "C" {
133 #[link_name = "\u{1}_ZN2nn3ssl10Connection9SetOptionENS1_10OptionTypeEb"]
134 pub fn SetOption(this: *mut Connection, option: u32, enable: bool) -> u32;
135 }
136 extern "C" {
137 #[link_name = "\u{1}_ZN2nn3ssl10Connection15SetVerifyOptionENS1_12VerifyOptionE"]
138 pub fn SetVerifyOption(this: *mut Connection, options: u32) -> u32;
139 }
140 extern "C" {
141 #[link_name = "\u{1}_ZN2nn3ssl10Connection12GetLastErrorEPNS_6ResultE"]
142 pub fn GetLastError(this: *const Connection, out_result: *mut u32) -> u32;
143 }
144 extern "C" {
145 #[link_name = "\u{1}_ZN2nn3ssl10Connection7DestroyEv"]
146 pub fn Destroy(this: *const Connection) -> u32;
147 }
148}