VLC  3.0.15
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 
31 struct vlc_http_msg;
32 struct vlc_http_mgr;
33 struct vlc_http_resource;
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 
43 struct vlc_http_resource
44 {
45  const struct vlc_http_resource_cbs *cbs;
48  bool secure;
49  bool negotiate;
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 
74 struct 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
vlc_http_resource::referrer
char * referrer
Definition: resource.h:57
vlc_http_res_open
struct vlc_http_msg * vlc_http_res_open(struct vlc_http_resource *res, void *)
Definition: resource.c:83
vlc_http_res_get_type
char * vlc_http_res_get_type(struct vlc_http_resource *)
Gets MIME type.
Definition: resource.c:311
vlc_http_res_init
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)
vlc_http_resource::port
unsigned port
Definition: resource.h:51
vlc_http_resource_cbs::response_validate
int(* response_validate)(const struct vlc_http_resource *, const struct vlc_http_msg *, void *)
Definition: resource.h:38
vlc_http_resource_cbs::request_format
int(* request_format)(const struct vlc_http_resource *, struct vlc_http_msg *, void *)
Definition: resource.h:36
vlc_http_resource::host
char * host
Definition: resource.h:50
vlc_http_resource::response
struct vlc_http_msg * response
Definition: resource.h:45
vlc_http_mgr
Definition: connmgr.c:95
vlc_http_res_destroy
void vlc_http_res_destroy(struct vlc_http_resource *)
Destroys an HTTP resource.
Definition: resource.c:161
vlc_http_resource::path
char * path
Definition: resource.h:53
vlc_http_resource::agent
char * agent
Definition: resource.h:56
vlc_http_res_set_login
int vlc_http_res_set_login(struct vlc_http_resource *res, const char *username, const char *password)
Definition: resource.c:330
vlc_http_resource::authority
char * authority
Definition: resource.h:52
vlc_http_resource::manager
struct vlc_http_mgr * manager
Definition: resource.h:46
vlc_http_resource::cbs
const struct vlc_http_resource_cbs * cbs
Definition: resource.h:44
vlc_http_resource::username
char * username
Definition: resource.h:54
vlc_http_resource
Definition: resource.h:42
vlc_http_res_get_redirect
char * vlc_http_res_get_redirect(struct vlc_http_resource *)
Gets redirection URL.
vlc_http_resource::secure
bool secure
Definition: resource.h:47
vlc_http_res_get_status
int vlc_http_res_get_status(struct vlc_http_resource *res)
Definition: resource.c:130
vlc_http_resource::negotiate
bool negotiate
Definition: resource.h:48
vlc_http_res_get_basic_realm
char * vlc_http_res_get_basic_realm(struct vlc_http_resource *res)
Definition: resource.c:364
vlc_http_res_read
struct block_t * vlc_http_res_read(struct vlc_http_resource *)
Reads data.
Definition: resource.c:321
vlc_http_resource::failure
bool failure
Definition: resource.h:49
vlc_http_resource_cbs
Definition: resource.h:34
vlc_http_resource::password
char * password
Definition: resource.h:55
vlc_http_msg
Definition: message.c:40
block_t
Definition: vlc_block.h:111