mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
refactor: update the function name
This commit is contained in:
parent
5a84c99cd9
commit
cbd8b0f144
@ -4,7 +4,7 @@ fn main() {
|
|||||||
println!("cargo:rerun-if-changed=src/vpn/vpn.c");
|
println!("cargo:rerun-if-changed=src/vpn/vpn.c");
|
||||||
println!("cargo:rerun-if-changed=src/vpn/vpn.h");
|
println!("cargo:rerun-if-changed=src/vpn/vpn.h");
|
||||||
|
|
||||||
// Compile the wrapper.c file
|
// Compile the vpn.c file
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
.file("src/vpn/vpn.c")
|
.file("src/vpn/vpn.c")
|
||||||
.include("src/vpn")
|
.include("src/vpn")
|
||||||
|
@ -12,10 +12,10 @@ pub(crate) struct Options {
|
|||||||
|
|
||||||
#[link(name = "vpn")]
|
#[link(name = "vpn")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[link_name = "start"]
|
#[link_name = "vpn_connect"]
|
||||||
pub(crate) fn connect(options: *const Options) -> ::std::os::raw::c_int;
|
pub(crate) fn connect(options: *const Options) -> ::std::os::raw::c_int;
|
||||||
|
|
||||||
#[link_name = "stop"]
|
#[link_name = "vpn_disconnect"]
|
||||||
pub(crate) fn disconnect();
|
pub(crate) fn disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ static void setup_tun_handler(void *_vpninfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize VPN connection */
|
/* Initialize VPN connection */
|
||||||
int start(const Options *options)
|
int vpn_connect(const Options *options)
|
||||||
{
|
{
|
||||||
struct openconnect_info *vpninfo;
|
struct openconnect_info *vpninfo;
|
||||||
struct utsname utsbuf;
|
struct utsname utsbuf;
|
||||||
@ -111,7 +111,7 @@ int start(const Options *options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop the VPN connection */
|
/* Stop the VPN connection */
|
||||||
void stop()
|
void vpn_disconnect()
|
||||||
{
|
{
|
||||||
char cmd = OC_CMD_CANCEL;
|
char cmd = OC_CMD_CANCEL;
|
||||||
if (write(g_cmd_pipe_fd, &cmd, 1) < 0)
|
if (write(g_cmd_pipe_fd, &cmd, 1) < 0)
|
||||||
|
@ -5,8 +5,8 @@ typedef struct Options {
|
|||||||
void *user_data;
|
void *user_data;
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
int start(const Options *options);
|
int vpn_connect(const Options *options);
|
||||||
void stop();
|
void vpn_disconnect();
|
||||||
|
|
||||||
extern void on_vpn_connected(int cmd_pipe_fd, void *user_data);
|
extern void on_vpn_connected(int cmd_pipe_fd, void *user_data);
|
||||||
extern void vpn_log(int level, const char *msg);
|
extern void vpn_log(int level, const char *msg);
|
Loading…
Reference in New Issue
Block a user