annotate ffmpeg/libavformat/httpauth.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * HTTP authentication
yading@11 3 * Copyright (c) 2010 Martin Storsjo
yading@11 4 *
yading@11 5 * This file is part of FFmpeg.
yading@11 6 *
yading@11 7 * FFmpeg is free software; you can redistribute it and/or
yading@11 8 * modify it under the terms of the GNU Lesser General Public
yading@11 9 * License as published by the Free Software Foundation; either
yading@11 10 * version 2.1 of the License, or (at your option) any later version.
yading@11 11 *
yading@11 12 * FFmpeg is distributed in the hope that it will be useful,
yading@11 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 15 * Lesser General Public License for more details.
yading@11 16 *
yading@11 17 * You should have received a copy of the GNU Lesser General Public
yading@11 18 * License along with FFmpeg; if not, write to the Free Software
yading@11 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 20 */
yading@11 21
yading@11 22 #ifndef AVFORMAT_HTTPAUTH_H
yading@11 23 #define AVFORMAT_HTTPAUTH_H
yading@11 24
yading@11 25 /**
yading@11 26 * Authentication types, ordered from weakest to strongest.
yading@11 27 */
yading@11 28 typedef enum HTTPAuthType {
yading@11 29 HTTP_AUTH_NONE = 0, /**< No authentication specified */
yading@11 30 HTTP_AUTH_BASIC, /**< HTTP 1.0 Basic auth from RFC 1945
yading@11 31 * (also in RFC 2617) */
yading@11 32 HTTP_AUTH_DIGEST, /**< HTTP 1.1 Digest auth from RFC 2617 */
yading@11 33 } HTTPAuthType;
yading@11 34
yading@11 35 typedef struct DigestParams {
yading@11 36 char nonce[300]; /**< Server specified nonce */
yading@11 37 char algorithm[10]; /**< Server specified digest algorithm */
yading@11 38 char qop[30]; /**< Quality of protection, containing the one
yading@11 39 * that we've chosen to use, from the
yading@11 40 * alternatives that the server offered. */
yading@11 41 char opaque[300]; /**< A server-specified string that should be
yading@11 42 * included in authentication responses, not
yading@11 43 * included in the actual digest calculation. */
yading@11 44 char stale[10]; /**< The server indicated that the auth was ok,
yading@11 45 * but needs to be redone with a new, non-stale
yading@11 46 * nonce. */
yading@11 47 int nc; /**< Nonce count, the number of earlier replies
yading@11 48 * where this particular nonce has been used. */
yading@11 49 } DigestParams;
yading@11 50
yading@11 51 /**
yading@11 52 * HTTP Authentication state structure. Must be zero-initialized
yading@11 53 * before used with the functions below.
yading@11 54 */
yading@11 55 typedef struct HTTPAuthState {
yading@11 56 /**
yading@11 57 * The currently chosen auth type.
yading@11 58 */
yading@11 59 HTTPAuthType auth_type;
yading@11 60 /**
yading@11 61 * Authentication realm
yading@11 62 */
yading@11 63 char realm[200];
yading@11 64 /**
yading@11 65 * The parameters specifiec to digest authentication.
yading@11 66 */
yading@11 67 DigestParams digest_params;
yading@11 68 /**
yading@11 69 * Auth ok, but needs to be resent with a new nonce.
yading@11 70 */
yading@11 71 int stale;
yading@11 72 } HTTPAuthState;
yading@11 73
yading@11 74 void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
yading@11 75 const char *value);
yading@11 76 char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
yading@11 77 const char *path, const char *method);
yading@11 78
yading@11 79 #endif /* AVFORMAT_HTTPAUTH_H */