annotate httpauth.h @ 6115:4c91cdcb8a52 libavformat

Initialize the http connection in http_seek, too This makes url_fsize return correct values for delay opened connections that have not yet been initialized. This fixes using the image2 demuxer with http sources.
author mstorsjo
date Wed, 09 Jun 2010 08:29:51 +0000
parents a1a309c4a751
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5879
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
1 /*
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
2 * HTTP authentication
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
3 * Copyright (c) 2010 Martin Storsjo
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
4 *
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
5 * This file is part of FFmpeg.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
6 *
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
11 *
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
15 * Lesser General Public License for more details.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
16 *
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
20 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
21
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
22 #ifndef AVFORMAT_HTTPAUTH_H
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
23 #define AVFORMAT_HTTPAUTH_H
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
24
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
25 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
26 * Authentication types, ordered from weakest to strongest.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
27 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
28 typedef enum HTTPAuthType {
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
29 HTTP_AUTH_NONE = 0, /**< No authentication specified */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
30 HTTP_AUTH_BASIC, /**< HTTP 1.0 Basic auth from RFC 1945
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
31 * (also in RFC 2617) */
5885
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
32 HTTP_AUTH_DIGEST, /**< HTTP 1.1 Digest auth from RFC 2617 */
5879
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
33 } HTTPAuthType;
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
34
5885
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
35 typedef struct {
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
36 char nonce[300]; /**< Server specified nonce */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
37 char algorithm[10]; /**< Server specified digest algorithm */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
38 char qop[30]; /**< Quality of protection, containing the one
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
39 * that we've chosen to use, from the
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
40 * alternatives that the server offered. */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
41 char opaque[300]; /**< A server-specified string that should be
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
42 * included in authentication responses, not
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
43 * included in the actual digest calculation. */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
44 int nc; /**< Nonce count, the number of earlier replies
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
45 * where this particular nonce has been used. */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
46 } DigestParams;
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
47
5879
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
48 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
49 * HTTP Authentication state structure. Must be zero-initialized
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
50 * before used with the functions below.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
51 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
52 typedef struct {
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
53 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
54 * The currently chosen auth type.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
55 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
56 HTTPAuthType auth_type;
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
57 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
58 * Authentication realm
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
59 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
60 char realm[200];
5885
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
61 /**
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
62 * The parameters specifiec to digest authentication.
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
63 */
a1a309c4a751 Add support for http digest authentication
mstorsjo
parents: 5879
diff changeset
64 DigestParams digest_params;
5879
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
65 } HTTPAuthState;
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
66
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
67 void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
68 const char *value);
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
69 char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
70 const char *path, const char *method);
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
71
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
72 #endif /* AVFORMAT_HTTPAUTH_H */