1
/* $Id: sip_auth_msg.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJSIP_AUTH_SIP_AUTH_MSG_H__
21
#define __PJSIP_AUTH_SIP_AUTH_MSG_H__
23
#include <pjsip/sip_msg.h>
28
* @addtogroup PJSIP_MSG_HDR
33
* Common credential structure represents common credential fields
34
* present in Authorization/Proxy-Authorization header.
36
struct pjsip_common_credential
38
pj_str_t realm; /**< Credential's realm. */
39
pjsip_param other_param; /**< Other parameters. */
43
* @see pjsip_common_credential
45
typedef struct pjsip_common_credential pjsip_common_credential;
49
* This structure describe credential used in Authorization and
50
* Proxy-Authorization header for digest authentication scheme.
52
struct pjsip_digest_credential
54
pj_str_t realm; /**< Realm of the credential */
55
pjsip_param other_param; /**< Other parameters. */
56
pj_str_t username; /**< Username parameter. */
57
pj_str_t nonce; /**< Nonce parameter. */
58
pj_str_t uri; /**< URI parameter. */
59
pj_str_t response; /**< Response digest. */
60
pj_str_t algorithm; /**< Algorithm. */
61
pj_str_t cnonce; /**< Cnonce. */
62
pj_str_t opaque; /**< Opaque value. */
63
pj_str_t qop; /**< Quality of protection. */
64
pj_str_t nc; /**< Nonce count. */
68
* @see pjsip_digest_credential
70
typedef struct pjsip_digest_credential pjsip_digest_credential;
73
* This structure describe credential used in Authorization and
74
* Proxy-Authorization header for PGP authentication scheme.
76
struct pjsip_pgp_credential
78
pj_str_t realm; /**< Realm. */
79
pjsip_param other_param; /**< Other parameters. */
80
pj_str_t version; /**< Version parameter. */
81
pj_str_t signature; /**< Signature parameter. */
82
pj_str_t signed_by; /**< Signed by parameter. */
83
pj_str_t nonce; /**< Nonce parameter. */
87
* @see pjsip_pgp_credential
89
typedef struct pjsip_pgp_credential pjsip_pgp_credential;
92
* This structure describes SIP Authorization header (and also SIP
93
* Proxy-Authorization header).
95
struct pjsip_authorization_hdr
97
/** Standard header fiends. */
98
PJSIP_DECL_HDR_MEMBER(struct pjsip_authorization_hdr);
100
/** Authorization scheme. */
103
/** Type of credentials, depending on the scheme. */
106
pjsip_common_credential common; /**< Common fields. */
107
pjsip_digest_credential digest; /**< Digest credentials. */
108
pjsip_pgp_credential pgp; /**< PGP credentials. */
113
* @see pjsip_authorization_hdr.
115
typedef struct pjsip_authorization_hdr pjsip_authorization_hdr;
117
/** SIP Proxy-Authorization header shares the same structure as SIP
118
Authorization header.
120
typedef struct pjsip_authorization_hdr pjsip_proxy_authorization_hdr;
123
* Create SIP Authorization header.
124
* @param pool Pool where memory will be allocated from.
125
* @return SIP Authorization header.
127
PJ_DECL(pjsip_authorization_hdr*)
128
pjsip_authorization_hdr_create(pj_pool_t *pool);
131
* Create SIP Proxy-Authorization header.
132
* @param pool Pool where memory will be allocated from.
133
* @return SIP Proxy-Authorization header.
135
PJ_DECL(pjsip_proxy_authorization_hdr*)
136
pjsip_proxy_authorization_hdr_create(pj_pool_t *pool);
140
* This structure describes common fields in authentication challenge
141
* headers (WWW-Authenticate and Proxy-Authenticate).
143
struct pjsip_common_challenge
145
pj_str_t realm; /**< Realm for the challenge. */
146
pjsip_param other_param; /**< Other parameters. */
150
* @see pjsip_common_challenge
152
typedef struct pjsip_common_challenge pjsip_common_challenge;
155
* This structure describes authentication challenge used in Proxy-Authenticate
156
* or WWW-Authenticate for digest authentication scheme.
158
struct pjsip_digest_challenge
160
pj_str_t realm; /**< Realm for the challenge. */
161
pjsip_param other_param; /**< Other parameters. */
162
pj_str_t domain; /**< Domain. */
163
pj_str_t nonce; /**< Nonce challenge. */
164
pj_str_t opaque; /**< Opaque value. */
165
int stale; /**< Stale parameter. */
166
pj_str_t algorithm; /**< Algorithm parameter. */
167
pj_str_t qop; /**< Quality of protection. */
171
* @see pjsip_digest_challenge
173
typedef struct pjsip_digest_challenge pjsip_digest_challenge;
176
* This structure describes authentication challenge used in Proxy-Authenticate
177
* or WWW-Authenticate for PGP authentication scheme.
179
struct pjsip_pgp_challenge
181
pj_str_t realm; /**< Realm for the challenge. */
182
pjsip_param other_param; /**< Other parameters. */
183
pj_str_t version; /**< PGP version. */
184
pj_str_t micalgorithm; /**< micalgorithm parameter. */
185
pj_str_t pubalgorithm; /**< pubalgorithm parameter. */
186
pj_str_t nonce; /**< Nonce challenge. */
190
* @see pjsip_pgp_challenge
192
typedef struct pjsip_pgp_challenge pjsip_pgp_challenge;
195
* This structure describe SIP WWW-Authenticate header (Proxy-Authenticate
196
* header also uses the same structure).
198
struct pjsip_www_authenticate_hdr
200
/** Standard header fields. */
201
PJSIP_DECL_HDR_MEMBER(struct pjsip_www_authenticate_hdr);
203
/** Authentication scheme */
206
/** This union contains structures that are only relevant
207
depending on the value of the scheme being used.
211
pjsip_common_challenge common; /**< Common fields. */
212
pjsip_digest_challenge digest; /**< Digest challenge. */
213
pjsip_pgp_challenge pgp; /**< PGP challenge. */
218
* WWW-Authenticate header.
220
typedef struct pjsip_www_authenticate_hdr pjsip_www_authenticate_hdr;
223
* Proxy-Authenticate header.
225
typedef struct pjsip_www_authenticate_hdr pjsip_proxy_authenticate_hdr;
229
* Create SIP WWW-Authenticate header.
231
* @param pool Pool where memory will be allocated from.
232
* @return SIP WWW-Authenticate header.
234
PJ_DECL(pjsip_www_authenticate_hdr*)
235
pjsip_www_authenticate_hdr_create(pj_pool_t *pool);
238
* Create SIP Proxy-Authenticate header.
240
* @param pool Pool where memory will be allocated from.
241
* @return SIP Proxy-Authenticate header.
243
PJ_DECL(pjsip_proxy_authenticate_hdr*)
244
pjsip_proxy_authenticate_hdr_create(pj_pool_t *pool);
252
#endif /* __PJSIP_AUTH_SIP_AUTH_MSG_H__ */