Create initial skeleton
This commit is contained in:
commit
ea3483263d
7 changed files with 190 additions and 0 deletions
5
src/lib.rs
Normal file
5
src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
mod nss_api;
|
123
src/nss_api.rs
Normal file
123
src/nss_api.rs
Normal file
|
@ -0,0 +1,123 @@
|
|||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
use {
|
||||
core::ffi::{c_char, c_int, c_void},
|
||||
libc::{hostent, size_t, socklen_t, AF_INET},
|
||||
std::ptr,
|
||||
};
|
||||
|
||||
// -------------- by host ---------------
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyname4_r(
|
||||
name: *const c_char,
|
||||
pat: *mut *mut gaih_addrtuple,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
ttlp: *mut i32,
|
||||
) -> nss_status {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyname3_r(
|
||||
name: *const c_char,
|
||||
af: c_int,
|
||||
host: *mut hostent,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
ttlp: *mut i32,
|
||||
canonp: *mut *mut char,
|
||||
) -> nss_status {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyname2_r(
|
||||
name: *const c_char,
|
||||
af: c_int,
|
||||
host: *mut hostent,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
) -> nss_status {
|
||||
_nss_malcontent_gethostbyname3_r(
|
||||
name,
|
||||
af,
|
||||
host,
|
||||
buffer,
|
||||
buflen,
|
||||
errnop,
|
||||
h_errnop,
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyname_r(
|
||||
name: *const c_char,
|
||||
host: *mut hostent,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
) -> nss_status {
|
||||
_nss_malcontent_gethostbyname3_r(
|
||||
name,
|
||||
AF_INET,
|
||||
host,
|
||||
buffer,
|
||||
buflen,
|
||||
errnop,
|
||||
h_errnop,
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
)
|
||||
}
|
||||
|
||||
// ----------------- by addr -----------------
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyaddr2_r(
|
||||
addr: *const c_void,
|
||||
len: socklen_t,
|
||||
af: c_int,
|
||||
host: *mut hostent,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
ttlp: *mut i32,
|
||||
) -> nss_status {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _nss_malcontent_gethostbyaddr_r(
|
||||
addr: *const c_void,
|
||||
len: socklen_t,
|
||||
af: c_int,
|
||||
host: *mut hostent,
|
||||
buffer: *mut c_char,
|
||||
buflen: size_t,
|
||||
errnop: *mut c_int,
|
||||
h_errnop: *mut c_int,
|
||||
) -> nss_status {
|
||||
_nss_malcontent_gethostbyaddr2_r(
|
||||
addr,
|
||||
len,
|
||||
af,
|
||||
host,
|
||||
buffer,
|
||||
buflen,
|
||||
errnop,
|
||||
h_errnop,
|
||||
ptr::null_mut(),
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue