Commit aa6ac0de authored by David Woodhouse's avatar David Woodhouse

Make buf_append() from http.c visible elsewhere

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent c3c511ed
......@@ -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;
......@@ -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);
......
......@@ -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
......@@ -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,
......
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