Commit 7c601276 authored by David Woodhouse's avatar David Woodhouse

Move unhex to script.c

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 317061d0
......@@ -28,19 +28,6 @@
#include "openconnect-internal.h"
static unsigned char nybble(unsigned char n)
{
if (n >= '0' && n <= '9') return n - '0';
else if (n >= 'A' && n <= 'F') return n - ('A' - 10);
else if (n >= 'a' && n <= 'f') return n - ('a' - 10);
return 0;
}
unsigned char unhex(const char *data)
{
return (nybble(data[0]) << 4) | nybble(data[1]);
}
#ifdef HAVE_DTLS
#if 0
......
......@@ -645,6 +645,7 @@ char *openconnect_legacy_to_utf8(struct openconnect_info *vpninfo, const char *l
#endif
/* script.c */
unsigned char unhex(const char *data);
int script_setenv(struct openconnect_info *vpninfo, const char *opt, const char *val, int append);
int script_setenv_int(struct openconnect_info *vpninfo, const char *opt, int value);
void prepare_script_env(struct openconnect_info *vpninfo);
......@@ -659,7 +660,6 @@ int os_write_tun(struct openconnect_info *vpninfo, struct pkt *pkt);
intptr_t os_setup_tun(struct openconnect_info *vpninfo);
/* dtls.c */
unsigned char unhex(const char *data);
int dtls_setup(struct openconnect_info *vpninfo, int dtls_attempt_period);
int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout);
int dtls_try_handshake(struct openconnect_info *vpninfo);
......
......@@ -166,6 +166,19 @@ static void setenv_cstp_opts(struct openconnect_info *vpninfo)
free(env_buf);
}
static unsigned char nybble(unsigned char n)
{
if (n >= '0' && n <= '9') return n - '0';
else if (n >= 'A' && n <= 'F') return n - ('A' - 10);
else if (n >= 'a' && n <= 'f') return n - ('a' - 10);
return 0;
}
unsigned char unhex(const char *data)
{
return (nybble(data[0]) << 4) | nybble(data[1]);
}
static void set_banner(struct openconnect_info *vpninfo)
{
char *banner, *legacy_banner, *q;
......
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