libxr
—
developer's documentation
Main Page
Related Pages
Data Structures
Files
File List
Globals
xr-http.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006-2008 Ondrej Jirman <ondrej.jirman@zonio.net>
3
*
4
* This file is part of libxr.
5
*
6
* Libxr is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU Lesser General Public License as published by the Free
8
* Software Foundation, either version 2 of the License, or (at your option) any
9
* later version.
10
*
11
* Libxr is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14
* details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with libxr. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef __XR_HTTP_H__
21
#define __XR_HTTP_H__
22
23
#include <glib.h>
24
#include <openssl/bio.h>
25
46
typedef
struct
_xr_http
xr_http
;
47
50
typedef
enum
{
51
XR_HTTP_NONE,
52
XR_HTTP_REQUEST,
53
XR_HTTP_RESPONSE
54
}
xr_http_message_type
;
55
56
#define XR_HTTP_ERROR xr_http_error_quark()
57
58
typedef
enum
59
{
60
XR_HTTP_ERROR_FAILED = 1
61
} XRHttpError;
62
63
G_BEGIN_DECLS
64
67
void
xr_http_init
();
68
75
xr_http
*
xr_http_new
(BIO* bio);
76
81
void
xr_http_free
(
xr_http
* http);
82
83
/* receive API */
84
92
gboolean
xr_http_read_header
(
xr_http
* http, GError** err);
93
101
const
char
*
xr_http_get_header
(
xr_http
* http,
const
char
* name);
102
109
void
xr_http_set_basic_auth
(
xr_http
* http,
const
char
* username,
const
char
* password);
110
121
gboolean
xr_http_get_basic_auth
(
xr_http
* http,
char
** username,
char
** password);
122
129
const
char
*
xr_http_get_method
(
xr_http
* http);
130
137
int
xr_http_get_code
(
xr_http
* http);
138
145
const
char
*
xr_http_get_resource
(
xr_http
* http);
146
153
int
xr_http_get_version
(
xr_http
* http);
154
162
xr_http_message_type
xr_http_get_message_type
(
xr_http
* http);
163
172
gssize
xr_http_get_message_length
(
xr_http
* http);
173
183
gssize
xr_http_read
(
xr_http
* http,
char
* buffer, gsize length, GError** err);
184
192
GString*
xr_http_read_all
(
xr_http
* http, GError** err);
193
194
/* transmit API */
195
202
void
xr_http_set_header
(
xr_http
* http,
const
char
* name,
const
char
* value);
203
209
void
xr_http_set_message_type
(
xr_http
* http,
xr_http_message_type
type);
210
216
void
xr_http_set_message_length
(
xr_http
* http, gsize length);
217
225
void
xr_http_setup_request
(
xr_http
* http,
const
char
* method,
const
char
* resource,
const
char
* host);
226
232
void
xr_http_setup_response
(
xr_http
* http,
int
code);
233
244
gboolean
xr_http_write_header
(
xr_http
* http, GError** err);
245
260
gboolean
xr_http_write
(
xr_http
* http,
const
char
* buffer, gsize length, GError** err);
261
272
gboolean
xr_http_write_complete
(
xr_http
* http, GError** err);
273
283
gboolean
xr_http_write_all
(
xr_http
* http,
const
char
* buffer, gssize length, GError** err);
284
291
gboolean
xr_http_is_ready
(
xr_http
* http);
292
300
gboolean
xr_http_has_pending_request
(
xr_http
* http, time_t timeout);
301
302
GQuark xr_http_error_quark();
303
304
G_END_DECLS
305
306
#endif
Documentation for
libxr
, Sat Nov 1 2014 21:06:15.