refactor: update the function name

This commit is contained in:
Kevin Yue 2023-05-18 09:21:04 +08:00
parent 5a84c99cd9
commit cbd8b0f144
4 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ fn main() {
println!("cargo:rerun-if-changed=src/vpn/vpn.c");
println!("cargo:rerun-if-changed=src/vpn/vpn.h");
// Compile the wrapper.c file
// Compile the vpn.c file
cc::Build::new()
.file("src/vpn/vpn.c")
.include("src/vpn")

View File

@ -12,10 +12,10 @@ pub(crate) struct Options {
#[link(name = "vpn")]
extern "C" {
#[link_name = "start"]
#[link_name = "vpn_connect"]
pub(crate) fn connect(options: *const Options) -> ::std::os::raw::c_int;
#[link_name = "stop"]
#[link_name = "vpn_disconnect"]
pub(crate) fn disconnect();
}

View File

@ -46,7 +46,7 @@ static void setup_tun_handler(void *_vpninfo)
}
/* Initialize VPN connection */
int start(const Options *options)
int vpn_connect(const Options *options)
{
struct openconnect_info *vpninfo;
struct utsname utsbuf;
@ -111,7 +111,7 @@ int start(const Options *options)
}
/* Stop the VPN connection */
void stop()
void vpn_disconnect()
{
char cmd = OC_CMD_CANCEL;
if (write(g_cmd_pipe_fd, &cmd, 1) < 0)

View File

@ -5,8 +5,8 @@ typedef struct Options {
void *user_data;
} Options;
int start(const Options *options);
void stop();
int vpn_connect(const Options *options);
void vpn_disconnect();
extern void on_vpn_connected(int cmd_pipe_fd, void *user_data);
extern void vpn_log(int level, const char *msg);