BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB-UTIL Reference

http_client.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef __PJLIB_UTIL_HTTP_CLIENT_H__
19#define __PJLIB_UTIL_HTTP_CLIENT_H__
20
25#include <pj/activesock.h>
26#include <pjlib-util/types.h>
27
29
42typedef struct pj_http_req pj_http_req;
43
48#define PJ_HTTP_HEADER_SIZE 32
49
53typedef struct pj_http_header_elmt
54{
58
64typedef struct pj_http_headers
65{
67 unsigned count;
68
72
76typedef struct pj_http_auth_cred
77{
86
95
102
109 unsigned data_type;
110
118
120
121
126typedef struct pj_http_req_param
127{
133
139
145
151
157
163
178 {
179 void *data;
189
202
210
219
221
225typedef struct pj_http_auth_chal
226{
232 int stale;
236
240typedef struct pj_http_resp
241{
250 void *data;
253
257typedef struct pj_http_url
258{
266
271{
279 void (*on_response)(pj_http_req *http_req, const pj_http_resp *resp);
280
297 void (*on_send_data)(pj_http_req *http_req,
298 void **data, pj_size_t *size);
299
313 void (*on_data_read)(pj_http_req *http_req,
314 void *data, pj_size_t size);
315
339 void (*on_complete)(pj_http_req *http_req,
340 pj_status_t status,
341 const pj_http_resp *resp);
342
344
345
352
365 pj_str_t *name,
366 pj_str_t *val);
367
381 char *name, char *val);
382
393 pj_http_url *hurl);
394
413 const pj_str_t *url,
414 pj_timer_heap_t *timer,
415 pj_ioqueue_t *ioqueue,
416 const pj_http_req_param *param,
417 const pj_http_req_callback *hcb,
418 pj_http_req **http_req);
419
428PJ_DECL(void) pj_http_req_set_timeout(pj_http_req *http_req,
429 const pj_time_val* timeout);
430
441
455 pj_bool_t notify);
456
465
475
484PJ_DECL(void *) pj_http_req_get_user_data(pj_http_req *http_req);
485
491
492
493#endif /* __PJLIB_UTIL_HTTP_CLIENT_H__ */
int pj_bool_t
struct pj_ioqueue_t pj_ioqueue_t
unsigned short pj_uint16_t
size_t pj_size_t
int pj_status_t
int pj_int32_t
struct pj_timer_heap_t pj_timer_heap_t
pj_status_t pj_http_headers_add_elmt(pj_http_headers *headers, pj_str_t *name, pj_str_t *val)
pj_status_t pj_http_req_parse_url(const pj_str_t *url, pj_http_url *hurl)
void pj_http_req_param_default(pj_http_req_param *param)
pj_status_t pj_http_req_start(pj_http_req *http_req)
pj_bool_t pj_http_req_is_running(const pj_http_req *http_req)
pj_status_t pj_http_req_destroy(pj_http_req *http_req)
#define PJ_HTTP_HEADER_SIZE
Definition: http_client.h:48
pj_status_t pj_http_headers_add_elmt2(pj_http_headers *headers, char *name, char *val)
struct pj_http_req pj_http_req
Definition: http_client.h:42
void * pj_http_req_get_user_data(pj_http_req *http_req)
pj_status_t pj_http_req_cancel(pj_http_req *http_req, pj_bool_t notify)
pj_status_t pj_http_req_create(pj_pool_t *pool, const pj_str_t *url, pj_timer_heap_t *timer, pj_ioqueue_t *ioqueue, const pj_http_req_param *param, const pj_http_req_callback *hcb, pj_http_req **http_req)
void pj_http_req_set_timeout(pj_http_req *http_req, const pj_time_val *timeout)
#define PJ_BEGIN_DECL
#define PJ_END_DECL
Definition: http_client.h:226
pj_str_t opaque
Definition: http_client.h:231
pj_str_t qop
Definition: http_client.h:234
pj_str_t algorithm
Definition: http_client.h:233
pj_str_t domain
Definition: http_client.h:229
int stale
Definition: http_client.h:232
pj_str_t nonce
Definition: http_client.h:230
pj_str_t scheme
Definition: http_client.h:227
pj_str_t realm
Definition: http_client.h:228
Definition: http_client.h:77
pj_str_t data
Definition: http_client.h:117
unsigned data_type
Definition: http_client.h:109
pj_str_t realm
Definition: http_client.h:94
pj_str_t scheme
Definition: http_client.h:85
pj_str_t username
Definition: http_client.h:101
Definition: http_client.h:54
pj_str_t value
Definition: http_client.h:56
pj_str_t name
Definition: http_client.h:55
Definition: http_client.h:65
pj_http_header_elmt header[32]
Definition: http_client.h:70
unsigned count
Definition: http_client.h:67
Definition: http_client.h:271
void(* on_response)(pj_http_req *http_req, const pj_http_resp *resp)
Definition: http_client.h:279
void(* on_complete)(pj_http_req *http_req, pj_status_t status, const pj_http_resp *resp)
Definition: http_client.h:339
void(* on_data_read)(pj_http_req *http_req, void *data, pj_size_t size)
Definition: http_client.h:313
void(* on_send_data)(pj_http_req *http_req, void **data, pj_size_t *size)
Definition: http_client.h:297
Definition: http_client.h:178
pj_size_t total_size
Definition: http_client.h:181
void * data
Definition: http_client.h:179
pj_size_t size
Definition: http_client.h:180
Definition: http_client.h:127
pj_uint16_t source_port_range_start
Definition: http_client.h:201
struct pj_http_req_param::pj_http_reqdata reqdata
int addr_family
Definition: http_client.h:132
pj_time_val timeout
Definition: http_client.h:150
pj_http_auth_cred auth_cred
Definition: http_client.h:188
pj_http_headers headers
Definition: http_client.h:162
pj_str_t method
Definition: http_client.h:138
pj_uint16_t source_port_range_size
Definition: http_client.h:209
pj_uint16_t max_retries
Definition: http_client.h:218
void * user_data
Definition: http_client.h:156
pj_str_t version
Definition: http_client.h:144
Definition: http_client.h:241
pj_http_headers headers
Definition: http_client.h:245
pj_uint16_t status_code
Definition: http_client.h:243
pj_str_t reason
Definition: http_client.h:244
pj_size_t size
Definition: http_client.h:251
pj_http_auth_chal auth_chal
Definition: http_client.h:246
pj_str_t version
Definition: http_client.h:242
void * data
Definition: http_client.h:250
pj_int32_t content_length
Definition: http_client.h:248
Definition: http_client.h:258
pj_str_t path
Definition: http_client.h:264
pj_str_t username
Definition: http_client.h:259
pj_str_t passwd
Definition: http_client.h:260
pj_uint16_t port
Definition: http_client.h:263
pj_str_t host
Definition: http_client.h:262
pj_str_t protocol
Definition: http_client.h:261
PJLIB-UTIL types.

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.