Skip to content

Commit

Permalink
library: Make vpn_option a public struct
Browse files Browse the repository at this point in the history
Rename vpn_option to oc_vpn_option and move it into the public header
file.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
  • Loading branch information
cernekee committed Jan 15, 2014
1 parent a492af0 commit d86782e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion auth.c
Expand Up @@ -717,7 +717,7 @@ int handle_auth_form(struct openconnect_info *vpninfo, struct oc_auth_form *form
const char **request_body_type)
{
int ret;
struct vpn_option *opt, *next;
struct oc_vpn_option *opt, *next;

if (!strcmp(form->auth_id, "success"))
return OC_FORM_RESULT_LOGGEDIN;
Expand Down
14 changes: 7 additions & 7 deletions cstp.c
Expand Up @@ -177,10 +177,10 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
char buf[65536];
int i;
int retried = 0, sessid_found = 0;
struct vpn_option **next_dtls_option = &vpninfo->dtls_options;
struct vpn_option **next_cstp_option = &vpninfo->cstp_options;
struct vpn_option *old_cstp_opts = vpninfo->cstp_options;
struct vpn_option *old_dtls_opts = vpninfo->dtls_options;
struct oc_vpn_option **next_dtls_option = &vpninfo->dtls_options;
struct oc_vpn_option **next_cstp_option = &vpninfo->cstp_options;
struct oc_vpn_option *old_cstp_opts = vpninfo->cstp_options;
struct oc_vpn_option *old_dtls_opts = vpninfo->dtls_options;
const char *old_addr = vpninfo->ip_info.addr;
const char *old_netmask = vpninfo->ip_info.netmask;
const char *old_addr6 = vpninfo->ip_info.addr6;
Expand Down Expand Up @@ -282,7 +282,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
mtu = 0;

while ((i = openconnect_SSL_gets(vpninfo, buf, sizeof(buf)))) {
struct vpn_option *new_option;
struct oc_vpn_option *new_option;
char *colon;

if (i < 0)
Expand Down Expand Up @@ -477,14 +477,14 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
}

while (old_dtls_opts) {
struct vpn_option *tmp = old_dtls_opts;
struct oc_vpn_option *tmp = old_dtls_opts;
old_dtls_opts = old_dtls_opts->next;
free(tmp->value);
free(tmp->option);
free(tmp);
}
while (old_cstp_opts) {
struct vpn_option *tmp = old_cstp_opts;
struct oc_vpn_option *tmp = old_cstp_opts;
old_cstp_opts = old_cstp_opts->next;
free(tmp->value);
free(tmp->option);
Expand Down
2 changes: 1 addition & 1 deletion dtls.c
Expand Up @@ -583,7 +583,7 @@ static int dtls_restart(struct openconnect_info *vpninfo)

int openconnect_setup_dtls(struct openconnect_info *vpninfo, int dtls_attempt_period)
{
struct vpn_option *dtls_opt = vpninfo->dtls_options;
struct oc_vpn_option *dtls_opt = vpninfo->dtls_options;
int dtls_port = 0;

vpninfo->dtls_attempt_period = dtls_attempt_period;
Expand Down
8 changes: 4 additions & 4 deletions http.c
Expand Up @@ -135,7 +135,7 @@ static int buf_free(struct oc_text_buf *buf)
static int http_add_cookie(struct openconnect_info *vpninfo,
const char *option, const char *value)
{
struct vpn_option *new, **this;
struct oc_vpn_option *new, **this;

if (*value) {
new = malloc(sizeof(*new));
Expand Down Expand Up @@ -433,7 +433,7 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,

static void add_common_headers(struct openconnect_info *vpninfo, struct oc_text_buf *buf)
{
struct vpn_option *opt;
struct oc_vpn_option *opt;

buf_append(buf, "Host: %s\r\n", vpninfo->hostname);
buf_append(buf, "User-Agent: %s\r\n", vpninfo->useragent);
Expand Down Expand Up @@ -717,7 +717,7 @@ int internal_parse_url(char *url, char **res_proto, char **res_host,

static void clear_cookies(struct openconnect_info *vpninfo)
{
struct vpn_option *opt, *next;
struct oc_vpn_option *opt, *next;

for (opt = vpninfo->cookies; opt; opt = next) {
next = opt->next;
Expand Down Expand Up @@ -989,7 +989,7 @@ static int check_response_type(struct openconnect_info *vpninfo, char *form_buf)
*/
int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
{
struct vpn_option *opt;
struct oc_vpn_option *opt;
char *form_buf = NULL;
struct oc_auth_form *form = NULL;
int result, buflen, tries;
Expand Down
4 changes: 2 additions & 2 deletions library.c
Expand Up @@ -107,9 +107,9 @@ int openconnect_set_reported_os(struct openconnect_info *vpninfo, const char *os
return 0;
}

static void free_optlist(struct vpn_option *opt)
static void free_optlist(struct oc_vpn_option *opt)
{
struct vpn_option *next;
struct oc_vpn_option *next;

for (; opt; opt = next) {
next = opt->next;
Expand Down
12 changes: 3 additions & 9 deletions openconnect-internal.h
Expand Up @@ -91,12 +91,6 @@ struct pkt {
unsigned char data[];
};

struct vpn_option {
char *option;
char *value;
struct vpn_option *next;
};

#define KA_NONE 0
#define KA_DPD 1
#define KA_DPD_DEAD 2
Expand Down Expand Up @@ -194,9 +188,9 @@ struct openconnect_info {
OPENCONNECT_X509 *peer_cert;

char *cookie; /* Pointer to within cookies list */
struct vpn_option *cookies;
struct vpn_option *cstp_options;
struct vpn_option *dtls_options;
struct oc_vpn_option *cookies;
struct oc_vpn_option *cstp_options;
struct oc_vpn_option *dtls_options;

#if defined(OPENCONNECT_OPENSSL)
X509 *cert_x509;
Expand Down
6 changes: 6 additions & 0 deletions openconnect.h
Expand Up @@ -181,6 +181,12 @@ struct oc_ip_info {
struct oc_split_include *split_excludes;
};

struct oc_vpn_option {
char *option;
char *value;
struct oc_vpn_option *next;
};

/****************************************************************************/

#define PRG_ERR 0
Expand Down
2 changes: 1 addition & 1 deletion tun.c
Expand Up @@ -202,7 +202,7 @@ static void setenv_cstp_opts(struct openconnect_info *vpninfo)
char *env_buf;
int buflen = 0;
int bufofs = 0;
struct vpn_option *opt;
struct oc_vpn_option *opt;

for (opt = vpninfo->cstp_options; opt; opt = opt->next)
buflen += 2 + strlen(opt->option) + strlen(opt->value);
Expand Down

0 comments on commit d86782e

Please sign in to comment.