VLC 4.0.0-dev
Loading...
Searching...
No Matches
resource.h
Go to the documentation of this file.
1/*****************************************************************************
2 * resource.h: HTTP resource common code
3 *****************************************************************************
4 * Copyright (C) 2015 RĂ©mi Denis-Courmont
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20
21#ifndef VLC_HTTP_RESOURCE_H
22#define VLC_HTTP_RESOURCE_H 1
23
24/**
25 * \defgroup http_res Resources
26 * Remote HTTP resources identified by a URL
27 * \ingroup http
28 * @{
29 */
30
31struct vlc_http_msg;
32struct vlc_http_mgr;
34
36{
37 int (*request_format)(const struct vlc_http_resource *,
38 struct vlc_http_msg *, void *);
39 int (*response_validate)(const struct vlc_http_resource *,
40 const struct vlc_http_msg *, void *);
41};
42
44{
48 bool secure;
50 bool failure;
51 char *host;
52 unsigned port;
53 char *authority;
54 char *path;
55 char *username;
56 char *password;
57 char *agent;
58 char *referrer;
59};
60
62 const struct vlc_http_resource_cbs *cbs,
63 struct vlc_http_mgr *mgr,
64 const char *uri, const char *ua, const char *ref);
65
66/**
67 * Destroys an HTTP resource.
68 *
69 * Releases all underlying resources allocated or held by the HTTP resource
70 * object.
71 */
73
74struct vlc_http_msg *vlc_http_res_open(struct vlc_http_resource *res, void *);
76
77/**
78 * Gets redirection URL.
79 *
80 * Checks if the resource URL lead to a redirection. If so, return the redirect
81 * location.
82 *
83 * @return Heap-allocated URL or NULL if no redirection.
84 */
86
87/**
88 * Gets MIME type.
89 *
90 * @return Heap-allocated MIME type string, or NULL if unknown.
91 */
93
94/**
95 * Reads data.
96 */
98
100 const char *username, const char *password);
102
103/** @} */
104#endif
int vlc_http_res_init(struct vlc_http_resource *, const struct vlc_http_resource_cbs *cbs, struct vlc_http_mgr *mgr, const char *uri, const char *ua, const char *ref)
char * vlc_http_res_get_type(struct vlc_http_resource *)
Gets MIME type.
Definition resource.c:300
char * vlc_http_res_get_redirect(struct vlc_http_resource *)
Gets redirection URL.
int vlc_http_res_get_status(struct vlc_http_resource *res)
Definition resource.c:131
int vlc_http_res_set_login(struct vlc_http_resource *res, const char *username, const char *password)
Definition resource.c:319
struct vlc_http_msg * vlc_http_res_open(struct vlc_http_resource *res, void *)
Definition resource.c:84
char * vlc_http_res_get_basic_realm(struct vlc_http_resource *res)
Definition resource.c:353
void vlc_http_res_destroy(struct vlc_http_resource *)
Destroys an HTTP resource.
Definition resource.c:162
block_t * vlc_http_res_read(struct vlc_http_resource *)
Reads data.
Definition resource.c:310
Definition vlc_frame.h:123
Definition connmgr.c:100
Definition message.c:43
Definition resource.h:36
int(* request_format)(const struct vlc_http_resource *, struct vlc_http_msg *, void *)
Definition resource.h:37
int(* response_validate)(const struct vlc_http_resource *, const struct vlc_http_msg *, void *)
Definition resource.h:39
Definition resource.h:44
char * password
Definition resource.h:56
unsigned port
Definition resource.h:52
bool negotiate
Definition resource.h:49
char * path
Definition resource.h:54
char * host
Definition resource.h:51
char * referrer
Definition resource.h:58
char * agent
Definition resource.h:57
const struct vlc_http_resource_cbs * cbs
Definition resource.h:45
struct vlc_http_mgr * manager
Definition resource.h:47
bool failure
Definition resource.h:50
char * username
Definition resource.h:55
char * authority
Definition resource.h:53
struct vlc_http_msg * response
Definition resource.h:46
bool secure
Definition resource.h:48