Changeset 1877 for pjproject/trunk/pjnath/include/pjnath/stun_auth.h
- Timestamp:
- Mar 19, 2008 11:00:30 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/stun_auth.h
r1869 r1877 40 40 41 41 /** 42 * Type of authentication. 43 */ 44 typedef enum pj_stun_auth_type 45 { 46 /** 47 * No authentication. 48 */ 49 PJ_STUN_AUTH_NONE = 0, 50 51 /** 52 * Authentication using short term credential. 53 */ 54 PJ_STUN_AUTH_SHORT_TERM = 1, 55 56 /** 57 * Authentication using long term credential. 58 */ 59 PJ_STUN_AUTH_LONG_TERM = 2 60 61 } pj_stun_auth_type; 62 63 64 /** 42 65 * Type of authentication data in the credential. 43 66 */ … … 60 83 61 84 } pj_stun_auth_cred_type; 85 86 87 /** 88 * Type of encoding applied to the password stored in the credential. 89 */ 90 typedef enum pj_stun_passwd_type 91 { 92 /** 93 * Plain text password. 94 */ 95 PJ_STUN_PASSWD_PLAIN = 0, 96 97 /** 98 * Hashed password, valid for long term credential only. The hash value 99 * of the password is calculated as MD5(USERNAME ":" REALM ":" PASSWD) 100 * with all quotes removed from the username and realm values. 101 */ 102 PJ_STUN_PASSWD_HASHED = 1 103 104 } pj_stun_passwd_type; 62 105 63 106 … … 90 133 * If not-empty, it indicates that this is a long term credential. 91 134 */ 92 pj_str_t 135 pj_str_t realm; 93 136 94 137 /** 95 138 * The username of the credential. 96 139 */ 97 pj_str_t 140 pj_str_t username; 98 141 99 142 /** 100 143 * Data type to indicate the type of password in the \a data field. 101 * Value zero indicates that the data contains a plaintext 102 * password. 103 */ 104 int data_type; 144 */ 145 pj_stun_passwd_type data_type; 105 146 106 147 /** … … 109 150 * plaintext password. 110 151 */ 111 pj_str_t 152 pj_str_t data; 112 153 113 154 /** 114 155 * Optional NONCE. 115 156 */ 116 pj_str_t 157 pj_str_t nonce; 117 158 118 159 } static_cred; … … 157 198 158 199 /** 159 * Get the credential to be put in outgoing message.200 * Get the credential to be put in outgoing request. 160 201 * 161 202 * @param msg The outgoing message where the credential is … … 187 228 pj_str_t *username, 188 229 pj_str_t *nonce, 189 int*data_type,230 pj_stun_passwd_type *data_type, 190 231 pj_str_t *data); 191 232 … … 218 259 const pj_str_t *username, 219 260 pj_pool_t *pool, 220 int*data_type,261 pj_stun_passwd_type *data_type, 221 262 pj_str_t *data); 222 263 … … 251 292 252 293 /** 294 * This structure contains the credential information that is found and 295 * used to authenticate incoming requests. Application may use this 296 * information when generating authentication for the outgoing response. 297 */ 298 typedef struct pj_stun_req_cred_info 299 { 300 /** 301 * The REALM value found in the incoming request. If short term 302 * credential is used, the value will be empty. 303 */ 304 pj_str_t realm; 305 306 /** 307 * The USERNAME value found in the incoming request. 308 */ 309 pj_str_t username; 310 311 /** 312 * Optional NONCE. 313 */ 314 pj_str_t nonce; 315 316 /** 317 * Authentication key that was used to authenticate the incoming 318 * request. This key is created with #pj_stun_create_key(), and 319 * it can be used to encode the credential of the outgoing 320 * response. 321 */ 322 pj_str_t auth_key; 323 324 } pj_stun_req_cred_info; 325 326 327 /** 253 328 * Duplicate authentication credential. 254 329 * … … 261 336 const pj_stun_auth_cred *src); 262 337 338 /** 339 * Duplicate request credential. 340 * 341 * @param pool Pool to be used to allocate memory. 342 * @param dst Destination credential. 343 * @param src Source credential. 344 */ 345 PJ_DECL(void) pj_stun_req_cred_info_dup(pj_pool_t *pool, 346 pj_stun_req_cred_info *dst, 347 const pj_stun_req_cred_info *src); 348 349 350 /** 351 * Create authentication key to be used for encoding the message with 352 * MESSAGE-INTEGRITY. If short term credential is used (i.e. the realm 353 * argument is NULL or empty), the key will be copied from the password. 354 * If long term credential is used, the key will be calculated from the 355 * MD5 hash of the realm, username, and password. 356 * 357 * @param pool Pool to allocate memory for the key. 358 * @param key String to receive the key. 359 * @param realm The realm of the credential, if long term credential 360 * is to be used. If short term credential is wanted, 361 * application can put NULL or empty string here. 362 * @param username The username. 363 * @param data_type Password encoding. 364 * @param data The password. 365 */ 366 PJ_DECL(void) pj_stun_create_key(pj_pool_t *pool, 367 pj_str_t *key, 368 const pj_str_t *realm, 369 const pj_str_t *username, 370 pj_stun_passwd_type data_type, 371 const pj_str_t *data); 263 372 264 373 /** … … 278 387 * @param pool If response is to be created, then memory will 279 388 * be allocated from this pool. 280 * @param auth_key Optional pointer to receive authentication key to281 * calculate MESSAGE-INTEGRITY of the response, if282 * t he response needs to be authenticated.389 * @param info Optional pointer to receive authentication information 390 * found in the request and the credential that is used 391 * to authenticate the request. 283 392 * @param p_response Optional pointer to receive the response message 284 393 * then the credential in the request fails to … … 295 404 pj_stun_auth_cred *cred, 296 405 pj_pool_t *pool, 297 pj_st r_t *auth_key,406 pj_stun_req_cred_info *info, 298 407 pj_stun_msg **p_response); 299 408
Note: See TracChangeset
for help on using the changeset viewer.