Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move unhex to script.c
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 26, 2015
1 parent 317061d commit 7c60127
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
13 changes: 0 additions & 13 deletions dtls.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion openconnect-internal.h
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions script.c
Expand Up @@ -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;
Expand Down

0 comments on commit 7c60127

Please sign in to comment.