Commit 2568f53e authored by David Woodhouse's avatar David Woodhouse

Move CSTP methods into struct vpn_proto

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 9831d261
......@@ -576,7 +576,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
}
int openconnect_make_cstp_connection(struct openconnect_info *vpninfo)
int cstp_connect(struct openconnect_info *vpninfo)
{
int ret;
int deflate_bufsize = 0;
......
......@@ -92,6 +92,8 @@ struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
#endif
vpninfo->proto.vpn_close_session = cstp_bye;
vpninfo->proto.tcp_connect = cstp_connect;
vpninfo->proto.tcp_mainloop = cstp_mainloop;
#ifdef HAVE_DTLS
vpninfo->proto.udp_setup = dtls_setup;
vpninfo->proto.udp_mainloop = dtls_mainloop;
......@@ -122,6 +124,11 @@ int openconnect_setup_dtls(struct openconnect_info *vpninfo,
return -EINVAL;
}
int openconnect_make_cstp_connection(struct openconnect_info *vpninfo)
{
return vpninfo->proto.tcp_connect(vpninfo);
}
int openconnect_set_reported_os(struct openconnect_info *vpninfo,
const char *os)
{
......
......@@ -145,7 +145,7 @@ int openconnect_mainloop(struct openconnect_info *vpninfo,
did_work += ret;
}
ret = cstp_mainloop(vpninfo, &timeout);
ret = vpninfo->proto.tcp_mainloop(vpninfo, &timeout);
if (vpninfo->quit_reason)
break;
did_work += ret;
......
......@@ -205,6 +205,11 @@ struct proxy_auth_state {
struct vpn_proto {
int (*vpn_close_session)(struct openconnect_info *vpninfo, const char *reason);
/* Establish the TCP connection (and obtain configuration) */
int (*tcp_connect)(struct openconnect_info *vpninfo);
int (*tcp_mainloop)(struct openconnect_info *vpninfo, int *timeout);
/* Set up the UDP (DTLS) connection. Doesn't actually *start* it. */
int (*udp_setup)(struct openconnect_info *vpninfo, int attempt_period);
......@@ -656,6 +661,7 @@ void dtls_close(struct openconnect_info *vpninfo);
void dtls_shutdown(struct openconnect_info *vpninfo);
/* cstp.c */
int cstp_connect(struct openconnect_info *vpninfo);
int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout);
int cstp_bye(struct openconnect_info *vpninfo, const char *reason);
void cstp_free_splits(struct openconnect_info *vpninfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment