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 char *bearer;
60};
61
63 const struct vlc_http_resource_cbs *cbs,
64 struct vlc_http_mgr *mgr,
65 const char *uri, const char *ua, const char *ref);
66
67/**
68 * Destroys an HTTP resource.
69 *
70 * Releases all underlying resources allocated or held by the HTTP resource
71 * object.
72 */
74
75struct vlc_http_msg *vlc_http_res_open(struct vlc_http_resource *res, void *);
77
78/**
79 * Gets redirection URL.
80 *
81 * Checks if the resource URL lead to a redirection. If so, return the redirect
82 * location.
83 *
84 * @return Heap-allocated URL or NULL if no redirection.
85 */
87
88/**
89 * Gets MIME type.
90 *
91 * @return Heap-allocated MIME type string, or NULL if unknown.
92 */
94
95/**
96 * Reads data.
97 */
99
101 const char *username, const char *password);
104 unsigned index);
106 unsigned index, const char *param);
108 const char *token);
109
110/** @} */
111#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:305
char * vlc_http_res_get_redirect(struct vlc_http_resource *)
Gets redirection URL.
bool vlc_http_res_has_bearer_challenge(struct vlc_http_resource *res, unsigned index)
Definition resource.c:368
int vlc_http_res_get_status(struct vlc_http_resource *res)
Definition resource.c:134
char * vlc_http_res_get_bearer_param(struct vlc_http_resource *res, unsigned index, const char *param)
Definition resource.c:377
int vlc_http_res_set_login(struct vlc_http_resource *res, const char *username, const char *password)
Definition resource.c:324
struct vlc_http_msg * vlc_http_res_open(struct vlc_http_resource *res, void *)
Definition resource.c:87
char * vlc_http_res_get_basic_realm(struct vlc_http_resource *res)
Definition resource.c:360
int vlc_http_res_set_bearer(struct vlc_http_resource *res, const char *token)
Definition resource.c:386
void vlc_http_res_destroy(struct vlc_http_resource *)
Destroys an HTTP resource.
Definition resource.c:166
block_t * vlc_http_res_read(struct vlc_http_resource *)
Reads data.
Definition resource.c:315
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 * bearer
Definition resource.h:59
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
struct vlc_frame_t block_t
Definition vlc_common.h:447