Commit c5c04993 authored by David Woodhouse's avatar David Woodhouse

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: default avatarDavid Woodhouse <>
parent ef662e9c
......@@ -91,6 +91,8 @@ struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
bindtextdomain("openconnect", LOCALEDIR);
vpninfo->proto.vpn_close_session = cstp_bye;
return vpninfo;
......@@ -224,8 +224,8 @@ int openconnect_mainloop(struct openconnect_info *vpninfo,
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);
return ret < 0 ? ret : -EIO;
......@@ -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;
iconv_t ic_legacy_to_utf8;
iconv_t ic_utf8_to_legacy;
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