vo_glamo: sub.h was moved to sub directory in c9026cb3210205b07e2e068467a18ee40f9259a3
[mplayer/glamo.git] / stream / http.h
blob2dd5125881dc3dc22a147aea797b740fd9e22639
1 /*
2 * HTTP Helper
4 * Copyright (C) 2001 Bertrand Baudet <bertrand_baudet@yahoo.com>
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_HTTP_H
24 #define MPLAYER_HTTP_H
26 #include <sys/types.h>
28 typedef struct HTTP_field_type {
29 char *field_name;
30 struct HTTP_field_type *next;
31 } HTTP_field_t;
33 typedef struct {
34 char *protocol;
35 char *method;
36 char *uri;
37 unsigned int status_code;
38 char *reason_phrase;
39 unsigned int http_minor_version;
40 // Field variables
41 HTTP_field_t *first_field;
42 HTTP_field_t *last_field;
43 unsigned int field_nb;
44 char *field_search;
45 HTTP_field_t *field_search_pos;
46 // Body variables
47 char *body;
48 size_t body_size;
49 char *buffer;
50 size_t buffer_size;
51 unsigned int is_parsed;
52 } HTTP_header_t;
54 HTTP_header_t* http_new_header(void);
55 void http_free( HTTP_header_t *http_hdr );
56 int http_response_append( HTTP_header_t *http_hdr, char *data, int length );
57 int http_response_parse( HTTP_header_t *http_hdr );
58 int http_is_header_entire( HTTP_header_t *http_hdr );
59 char* http_build_request( HTTP_header_t *http_hdr );
60 char* http_get_field( HTTP_header_t *http_hdr, const char *field_name );
61 char* http_get_next_field( HTTP_header_t *http_hdr );
62 void http_set_field( HTTP_header_t *http_hdr, const char *field_name );
63 void http_set_method( HTTP_header_t *http_hdr, const char *method );
64 void http_set_uri( HTTP_header_t *http_hdr, const char *uri );
65 int http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, const char *password );
66 int http_add_basic_proxy_authentication( HTTP_header_t *http_hdr, const char *username, const char *password );
68 void http_debug_hdr( HTTP_header_t *http_hdr );
70 #endif /* MPLAYER_HTTP_H */