annotate httpauth.h @ 5879:61062082488b libavformat

Split out http authentication handling into a separate file This prepares for adding support for more authentication methods
author mstorsjo
date Wed, 24 Mar 2010 22:32:05 +0000
parents
children a1a309c4a751
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) */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
32 } HTTPAuthType;
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
33
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
34 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
35 * HTTP Authentication state structure. Must be zero-initialized
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
36 * before used with the functions below.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
37 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
38 typedef struct {
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
39 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
40 * The currently chosen auth type.
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
41 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
42 HTTPAuthType auth_type;
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
43 /**
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
44 * Authentication realm
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
45 */
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
46 char realm[200];
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
47 } HTTPAuthState;
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 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
50 const char *value);
61062082488b Split out http authentication handling into a separate file
mstorsjo
parents:
diff changeset
51 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
52 const char *path, const char *method);
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 #endif /* AVFORMAT_HTTPAUTH_H */