• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2000-2003, Ximian, Inc.
4  */
5 
6 #ifndef __SOUP_AUTH_DIGEST_H__
7 #define __SOUP_AUTH_DIGEST_H__ 1
8 
9 #include "soup-auth.h"
10 
11 #define SOUP_AUTH_DIGEST(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), SOUP_TYPE_AUTH_DIGEST, SoupAuthDigest))
12 #define SOUP_AUTH_DIGEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH_DIGEST, SoupAuthDigestClass))
13 #define SOUP_IS_AUTH_DIGEST(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOUP_TYPE_AUTH_DIGEST))
14 #define SOUP_IS_AUTH_DIGEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_AUTH_DIGEST))
15 #define SOUP_AUTH_DIGEST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH_DIGEST, SoupAuthDigestClass))
16 
17 typedef struct {
18 	SoupAuth parent;
19 
20 } SoupAuthDigest;
21 
22 typedef struct {
23 	SoupAuthClass parent_class;
24 
25 } SoupAuthDigestClass;
26 
27 /* Utility routines (also used by SoupAuthDomainDigest) */
28 
29 typedef enum {
30 	SOUP_AUTH_DIGEST_ALGORITHM_NONE,
31 	SOUP_AUTH_DIGEST_ALGORITHM_MD5,
32 	SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS
33 } SoupAuthDigestAlgorithm;
34 
35 typedef enum {
36 	SOUP_AUTH_DIGEST_QOP_AUTH     = 1 << 0,
37 	SOUP_AUTH_DIGEST_QOP_AUTH_INT = 1 << 1
38 } SoupAuthDigestQop;
39 
40 SoupAuthDigestAlgorithm  soup_auth_digest_parse_algorithm (const char *algorithm);
41 char                    *soup_auth_digest_get_algorithm   (SoupAuthDigestAlgorithm algorithm);
42 
43 SoupAuthDigestQop        soup_auth_digest_parse_qop       (const char *qop);
44 char                    *soup_auth_digest_get_qop         (SoupAuthDigestQop qop);
45 
46 void soup_auth_digest_compute_hex_urp  (const char              *username,
47 					const char              *realm,
48 					const char              *password,
49 					char                     hex_urp[33]);
50 void soup_auth_digest_compute_hex_a1   (const char              *hex_urp,
51 					SoupAuthDigestAlgorithm  algorithm,
52 					const char              *nonce,
53 					const char              *cnonce,
54 					char                     hex_a1[33]);
55 void soup_auth_digest_compute_response (const char              *method,
56 					const char              *uri,
57 					const char              *hex_a1,
58 					SoupAuthDigestQop        qop,
59 					const char              *nonce,
60 					const char              *cnonce,
61 					int                      nc,
62 					char                     response[33]);
63 
64 #endif /* __SOUP_AUTH_DIGEST_H__ */
65