Skip to content

Commit

Permalink
Make buf_append() from http.c visible elsewhere
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 19, 2014
1 parent c3c511e commit aa6ac0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
15 changes: 4 additions & 11 deletions http.c
Expand Up @@ -40,19 +40,12 @@ static int proxy_read(struct openconnect_info *vpninfo, char *buf, size_t len);
#define MAX_BUF_LEN 131072
#define BUF_CHUNK_SIZE 4096

struct oc_text_buf {
char *data;
int pos;
int buf_len;
int error;
};

static struct oc_text_buf *buf_alloc(void)
struct oc_text_buf *buf_alloc(void)
{
return calloc(1, sizeof(struct oc_text_buf));
}

static void buf_append(struct oc_text_buf *buf, const char *fmt, ...)
void buf_append(struct oc_text_buf *buf, const char *fmt, ...)
{
va_list ap;

Expand Down Expand Up @@ -99,12 +92,12 @@ static void buf_append(struct oc_text_buf *buf, const char *fmt, ...)
}
}

static int buf_error(struct oc_text_buf *buf)
int buf_error(struct oc_text_buf *buf)
{
return buf ? buf->error : -ENOMEM;
}

static int buf_free(struct oc_text_buf *buf)
int buf_free(struct oc_text_buf *buf)
{
int error = buf_error(buf);

Expand Down
11 changes: 11 additions & 0 deletions openconnect-internal.h
Expand Up @@ -126,6 +126,13 @@ struct pin_cache {
char *pin;
};

struct oc_text_buf {
char *data;
int pos;
int buf_len;
int error;
};

#define RECONNECT_INTERVAL_MIN 10
#define RECONNECT_INTERVAL_MAX 100

Expand Down Expand Up @@ -552,6 +559,10 @@ int xmlpost_initial_req(struct openconnect_info *vpninfo, char *request_body, in
int prepare_stoken(struct openconnect_info *vpninfo);

/* http.c */
struct oc_text_buf *buf_alloc(void);
void buf_append(struct oc_text_buf *buf, const char *fmt, ...);
int buf_error(struct oc_text_buf *buf);
int buf_free(struct oc_text_buf *buf);
char *openconnect_create_useragent(const char *base);
int process_proxy(struct openconnect_info *vpninfo, int ssl_sock);
int internal_parse_url(char *url, char **res_proto, char **res_host,
Expand Down

0 comments on commit aa6ac0d

Please sign in to comment.