httpclient.c File Reference

#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "rtv.h"
#include "rtvlib.h"
#include "httpclient.h"

Go to the source code of this file.

Data Structures

struct  hc_headers
struct  hc
struct  chunk
struct  read_all_data

Functions

static void hc_dump_struct (const struct hc *hc_struct)
static void hc_h_free (struct hc_headers *hh)
static struct hc_headershc_h_make (const char *tag, const char *value)
void hc_free (struct hc *hc)
int hc_add_req_header (struct hc *hc, const char *tag, const char *value)
hchc_start_request (char *url)
int hc_send_request (struct hc *hc, const char *append)
int hc_post_request (struct hc *hc, int(*callback)(unsigned char *, size_t, void *), void *v)
int hc_get_status (const struct hc *hc)
char * hc_lookup_rsp_header (const struct hc *hc, const char *tag)
int hc_read_pieces (const struct hc *hc, http_read_chunked_cb_t callback, void *v, int mergechunks)
static int read_all_callback (unsigned char *buf, size_t len, void *vd)
int hc_read_all (struct hc *hc, char **data_p, unsigned int *len)


Function Documentation

int hc_add_req_header struct hc hc,
const char *  tag,
const char *  value
 

Definition at line 110 of file httpclient.c.

References error(), hc_h_make(), hc_headers::next, hc::req_headers, RTV_DBGLOG, and RTVLOG_HTTP_VERB.

Referenced by add_httpfs_headers(), hc_start_request(), and hfs_do_post_simple().

static void hc_dump_struct const struct hc hc_struct  )  [static]
 

Definition at line 44 of file httpclient.c.

References hc::hostname, hc::localpart, hc::port, hc::req_headers, hc::rsp_headers, RTV_PRT, hc::status, hc_headers::tag, and hc_headers::value.

Referenced by hc_read_pieces().

void hc_free struct hc hc  ) 
 

Definition at line 86 of file httpclient.c.

References hc_h_free(), hc::hostname, hc::localpart, hc::nc, nc_close(), hc_headers::next, hc::req_headers, hc::rsp_headers, and hc::status.

Referenced by get_guide_ss(), guide_do_request(), hc_start_request(), hfs_do_chunked(), hfs_do_post_simple(), hfs_do_simple(), hfs_do_simple_binary(), make_request(), and rtv_get_device_info().

int hc_get_status const struct hc hc  ) 
 

Definition at line 292 of file httpclient.c.

References hc::status.

Referenced by guide_do_request(), hc_read_pieces(), hfs_do_post_simple(), hfs_do_simple(), hfs_do_simple_binary(), and make_request().

static void hc_h_free struct hc_headers hh  )  [static]
 

Definition at line 55 of file httpclient.c.

References hc_headers::tag, and hc_headers::value.

Referenced by hc_free(), and hc_h_make().

static struct hc_headers* hc_h_make const char *  tag,
const char *  value
[static]
 

Definition at line 62 of file httpclient.c.

References error(), and hc_h_free().

Referenced by hc_add_req_header(), hc_post_request(), and hc_send_request().

char* hc_lookup_rsp_header const struct hc hc,
const char *  tag
 

Definition at line 297 of file httpclient.c.

References hc_headers::next, hc::rsp_headers, hc_headers::tag, and hc_headers::value.

Referenced by hc_read_pieces().

int hc_post_request struct hc hc,
int(*)(unsigned char *, size_t, void *)  callback,
void *  v
 

Definition at line 239 of file httpclient.c.

References buffer, errno, hc_h_make(), hc::localpart, hc::nc, nc_read_line(), nc_write(), hc_headers::next, hc::req_headers, hc::rsp_headers, RTV_ERRLOG, hc::status, hc_headers::tag, and hc_headers::value.

Referenced by hfs_do_post_simple().

int hc_read_all struct hc hc,
char **  data_p,
unsigned int *  len
 

Definition at line 463 of file httpclient.c.

References chunk::buf, data, hc_read_pieces(), chunk::len, chunk::next, rc, read_all_callback(), and RTV_ERRLOG.

Referenced by guide_do_request(), hfs_do_post_simple(), hfs_do_simple(), and hfs_do_simple_binary().

int hc_read_pieces const struct hc hc,
http_read_chunked_cb_t  callback,
void *  v,
int  mergechunks
 

Definition at line 307 of file httpclient.c.

References hc_dump_struct(), hc_get_status(), hc_lookup_rsp_header(), hc::nc, nc_read(), nc_read_line(), rc, RTV_CHUNK_SZ, RTV_DBGLOG, RTV_ERRLOG, RTVLOG_HTTP, RTVLOG_HTTP_VERB, hc::status, and x.

Referenced by get_guide_ss(), hc_read_all(), hfs_do_chunked(), and rtv_get_device_info().

int hc_send_request struct hc hc,
const char *  append
 

Definition at line 179 of file httpclient.c.

References buffer, errno, hc_h_make(), hc::localpart, hc::nc, nc_read_line(), nc_write(), hc_headers::next, hc::req_headers, hc::rsp_headers, RTV_DBGLOG, RTV_ERRLOG, RTVLOG_HTTP, RTVLOG_HTTP_VERB, hc::status, hc_headers::tag, hc_headers::value, and x.

Referenced by get_guide_ss(), guide_do_request(), make_request(), and rtv_get_device_info().

struct hc* hc_start_request char *  url  ) 
 

Definition at line 125 of file httpclient.c.

References error(), hc_add_req_header(), hc_free(), nc_open(), RTV_DBGLOG, RTV_ERRLOG, and RTVLOG_HTTP_VERB.

Referenced by get_guide_ss(), guide_do_request(), hfs_do_post_simple(), make_request(), and rtv_get_device_info().

static int read_all_callback unsigned char *  buf,
size_t  len,
void *  vd
[static]
 

Definition at line 442 of file httpclient.c.

References data.

Referenced by hc_read_all().


Generated on Fri Sep 10 03:13:24 2010 for mvpmc by  doxygen 1.4.6