blob: 8e68331d47d3eb2988577efcc70d5a975fb96acb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
/* $Id$
*/
#ifndef __PJSIP_AUTH_SIP_AUTH_MSG_H__
#define __PJSIP_AUTH_SIP_AUTH_MSG_H__
#include <pjsip/sip_msg.h>
PJ_BEGIN_DECL
/**
* @defgroup PJSIP_MSG_AUTHORIZATION Header Field: Authorization and Proxy-Authorization
* @brief Authorization and Proxy-Authorization header field.
* @ingroup PJSIP_MSG
* @{
*/
/**
* Common credential.
*/
struct pjsip_common_credential
{
pj_str_t realm;
};
typedef struct pjsip_common_credential pjsip_common_credential;
/**
* This structure describe credential used in Authorization and
* Proxy-Authorization header for digest authentication scheme.
*/
struct pjsip_digest_credential
{
pj_str_t realm;
pj_str_t username;
pj_str_t nonce;
pj_str_t uri;
pj_str_t response;
pj_str_t algorithm;
pj_str_t cnonce;
pj_str_t opaque;
pj_str_t qop;
pj_str_t nc;
pj_str_t other_param;
};
typedef struct pjsip_digest_credential pjsip_digest_credential;
/**
* This structure describe credential used in Authorization and
* Proxy-Authorization header for PGP authentication scheme.
*/
struct pjsip_pgp_credential
{
pj_str_t realm;
pj_str_t version;
pj_str_t signature;
pj_str_t signed_by;
pj_str_t nonce;
};
typedef struct pjsip_pgp_credential pjsip_pgp_credential;
/**
* This structure describes SIP Authorization header (and also SIP
* Proxy-Authorization header).
*/
struct pjsip_authorization_hdr
{
PJSIP_DECL_HDR_MEMBER(struct pjsip_authorization_hdr);
pj_str_t scheme;
union
{
pjsip_common_credential common;
pjsip_digest_credential digest;
pjsip_pgp_credential pgp;
} credential;
};
typedef struct pjsip_authorization_hdr pjsip_authorization_hdr;
/** SIP Proxy-Authorization header shares the same structure as SIP
Authorization header.
*/
typedef struct pjsip_authorization_hdr pjsip_proxy_authorization_hdr;
/**
* Create SIP Authorization header.
* @param pool Pool where memory will be allocated from.
* @return SIP Authorization header.
*/
PJ_DECL(pjsip_authorization_hdr*) pjsip_authorization_hdr_create(pj_pool_t *pool);
/**
* Create SIP Proxy-Authorization header.
* @param pool Pool where memory will be allocated from.
* @return SIP Proxy-Authorization header.
*/
PJ_DECL(pjsip_proxy_authorization_hdr*) pjsip_proxy_authorization_hdr_create(pj_pool_t *pool);
/**
* @}
*/
/**
* @defgroup PJSIP_WWW_AUTH Header Field: Proxy-Authenticate and WWW-Authenticate
* @brief Proxy-Authenticate and WWW-Authenticate.
* @ingroup PJSIP_MSG
* @{
*/
struct pjsip_common_challenge
{
pj_str_t realm;
};
typedef struct pjsip_common_challenge pjsip_common_challenge;
/**
* This structure describes authentication challenge used in Proxy-Authenticate
* or WWW-Authenticate for digest authentication scheme.
*/
struct pjsip_digest_challenge
{
pj_str_t realm;
pj_str_t domain;
pj_str_t nonce;
pj_str_t opaque;
int stale;
pj_str_t algorithm;
pj_str_t qop;
pj_str_t other_param;
};
typedef struct pjsip_digest_challenge pjsip_digest_challenge;
/**
* This structure describes authentication challenge used in Proxy-Authenticate
* or WWW-Authenticate for PGP authentication scheme.
*/
struct pjsip_pgp_challenge
{
pj_str_t realm;
pj_str_t version;
pj_str_t micalgorithm;
pj_str_t pubalgorithm;
pj_str_t nonce;
};
typedef struct pjsip_pgp_challenge pjsip_pgp_challenge;
/**
* This structure describe SIP WWW-Authenticate header (Proxy-Authenticate
* header also uses the same structure).
*/
struct pjsip_www_authenticate_hdr
{
PJSIP_DECL_HDR_MEMBER(struct pjsip_www_authenticate_hdr);
pj_str_t scheme;
union
{
pjsip_common_challenge common;
pjsip_digest_challenge digest;
pjsip_pgp_challenge pgp;
} challenge;
};
typedef struct pjsip_www_authenticate_hdr pjsip_www_authenticate_hdr;
typedef struct pjsip_www_authenticate_hdr pjsip_proxy_authenticate_hdr;
/**
* Create SIP WWW-Authenticate header.
* @param pool Pool where memory will be allocated from.
* @return SIP WWW-Authenticate header.
*/
PJ_DECL(pjsip_www_authenticate_hdr*) pjsip_www_authenticate_hdr_create(pj_pool_t *pool);
/**
* Create SIP Proxy-Authenticate header.
* @param pool Pool where memory will be allocated from.
* @return SIP Proxy-Authenticate header.
*/
PJ_DECL(pjsip_proxy_authenticate_hdr*) pjsip_proxy_authenticate_hdr_create(pj_pool_t *pool);
/**
* @}
*/
PJ_END_DECL
#endif /* __PJSIP_AUTH_SIP_AUTH_MSG_H__ */
|