Mercurial > libavformat.hg
annotate httpauth.h @ 6083:5ec1f78c30fe libavformat
reindent after previous commit.
Patch by Anton Khirnov, wyskas at gmail
author | mstorsjo |
---|---|
date | Fri, 04 Jun 2010 07:33:34 +0000 |
parents | a1a309c4a751 |
children |
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 | 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 | 35 typedef struct { |
36 char nonce[300]; /**< Server specified nonce */ | |
37 char algorithm[10]; /**< Server specified digest algorithm */ | |
38 char qop[30]; /**< Quality of protection, containing the one | |
39 * that we've chosen to use, from the | |
40 * alternatives that the server offered. */ | |
41 char opaque[300]; /**< A server-specified string that should be | |
42 * included in authentication responses, not | |
43 * included in the actual digest calculation. */ | |
44 int nc; /**< Nonce count, the number of earlier replies | |
45 * where this particular nonce has been used. */ | |
46 } DigestParams; | |
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 | 61 /** |
62 * The parameters specifiec to digest authentication. | |
63 */ | |
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 */ |