Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move CSTP methods into struct vpn_proto
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 26, 2015
1 parent 9831d26 commit 2568f53
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cstp.c
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions library.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion mainloop.c
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions openconnect-internal.h
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2568f53

Please sign in to comment.