Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start separating protocol-specific methods from generic VPN support
It looks like we can understand the Juniper oNCP protocol and it fits fairly
well with the OpenConnect model — you first authenticate and are rewarded
with a cookie, and then you make the actual connection to the HTTPS server
and *can* transport data over that, or ideally you have a UDP transport
(in this case ESP) instead.

So start factoring out the methods which are specific to the VPN protocol,
with a view to making Juniper support possible too.

Starting with cstp_bye().

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 26, 2015
1 parent ef662e9 commit c5c0499
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions library.c
Expand Up @@ -91,6 +91,8 @@ struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
bindtextdomain("openconnect", LOCALEDIR);
#endif

vpninfo->proto.vpn_close_session = cstp_bye;

return vpninfo;

err:
Expand Down
4 changes: 2 additions & 2 deletions mainloop.c
Expand Up @@ -224,8 +224,8 @@ int openconnect_mainloop(struct openconnect_info *vpninfo,
#endif
}

if (vpninfo->quit_reason)
cstp_bye(vpninfo, vpninfo->quit_reason);
if (vpninfo->quit_reason && vpninfo->proto.vpn_close_session)
vpninfo->proto.vpn_close_session(vpninfo, vpninfo->quit_reason);

os_shutdown_tun(vpninfo);
return ret < 0 ? ret : -EIO;
Expand Down
6 changes: 6 additions & 0 deletions openconnect-internal.h
Expand Up @@ -201,7 +201,13 @@ struct proxy_auth_state {
char *challenge;
};

struct vpn_proto {
int (*vpn_close_session)(struct openconnect_info *vpninfo, const char *reason);
};

struct openconnect_info {
struct vpn_proto proto;

#ifdef HAVE_ICONV
iconv_t ic_legacy_to_utf8;
iconv_t ic_utf8_to_legacy;
Expand Down

0 comments on commit c5c0499

Please sign in to comment.