Index: /pjproject/main/pjsip/include/pjsip/sip_auth.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip/sip_auth.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip/sip_auth.h	(revision 42)
@@ -0,0 +1,232 @@
+/* $Id$
+ *
+ */
+#ifndef __PJSIP_AUTH_SIP_AUTH_H__
+#define __PJSIP_AUTH_SIP_AUTH_H__
+
+/**
+ * @file pjsip_auth.h
+ * @brief SIP Authorization Module.
+ */
+
+#include <pjsip/sip_config.h>
+#include <pjsip/sip_auth_msg.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_AUTH_API Authorization API's
+ * @ingroup PJSIP_AUTH
+ * @{
+ */
+
+ /** Type of data in the credential information. */
+typedef enum pjsip_cred_data_type
+{
+    PJSIP_CRED_DATA_PLAIN_PASSWD,   /**< Plain text password.	*/
+    PJSIP_CRED_DATA_DIGEST,	    /**< Hashed digest.		*/
+} pjsip_cred_data_type;
+
+/** Authentication's quality of protection (qop) type. */
+typedef enum pjsip_auth_qop_type
+{
+    PJSIP_AUTH_QOP_NONE,	    /**< No quality of protection. */
+    PJSIP_AUTH_QOP_AUTH,	    /**< Authentication. */
+    PJSIP_AUTH_QOP_AUTH_INT,	    /**< Authentication with integrity protection. */
+    PJSIP_AUTH_QOP_UNKNOWN,	    /**< Unknown protection. */
+} pjsip_auth_qop_type;
+
+
+/** 
+ * This structure describes credential information. 
+ * A credential information is a static, persistent information that identifies
+ * username and password required to authorize to a specific realm.
+ */
+struct pjsip_cred_info
+{
+    pj_str_t    realm;		/**< Realm.	    */
+    pj_str_t	scheme;		/**< Scheme.	    */
+    pj_str_t	username;	/**< User name.	    */
+    int		data_type;	/**< Type of data.  */
+    pj_str_t	data;		/**< The data, which can be a plaintext 
+				     password or a hashed digest. */
+};
+
+/**
+ * This structure describes cached value of previously sent Authorization
+ * or Proxy-Authorization header. The authentication framework keeps a list
+ * of this structure and will resend the same header to the same server
+ * as long as the method, uri, and nonce stays the same.
+ */
+typedef struct pjsip_cached_auth_hdr
+{
+    PJ_DECL_LIST_MEMBER(struct pjsip_cached_auth_hdr)
+
+    pjsip_method	     method;
+    pjsip_authorization_hdr *hdr;
+
+} pjsip_cached_auth_hdr;
+
+
+/**
+ * This structure describes authentication information for the specified
+ * realm. Each instance of this structure describes authentication "session"
+ * between this endpoint and remote server. This "session" information is
+ * usefull to keep information that persists for more than one challenge,
+ * such as nonce-count and cnonce value.
+ *
+ * Other than that, this structure also keeps the last authorization headers
+ * that have been sent in the cache list.
+ */
+typedef struct pjsip_auth_session
+{
+    PJ_DECL_LIST_MEMBER(struct pjsip_auth_session)
+
+    pj_str_t			 realm;
+    pj_bool_t			 is_proxy;
+    pjsip_auth_qop_type		 qop_value;
+#if PJSIP_AUTH_QOP_SUPPORT
+    pj_uint32_t			 nc;
+    pj_str_t			 cnonce;
+#endif
+#if PJSIP_AUTH_AUTO_SEND_NEXT
+    pjsip_www_authenticate_hdr	*last_chal;
+#endif
+#if PJSIP_AUTH_HEADER_CACHING
+    pjsip_cached_auth_hdr	 cached_hdr;
+#endif
+
+} pjsip_auth_session;
+
+
+/**
+ * Create authorization header for the specified credential.
+ * Application calls this function to create Authorization or Proxy-Authorization
+ * header after receiving WWW-Authenticate or Proxy-Authenticate challenge
+ * (normally in 401/407 response).
+ * If authorization session argument is specified, this function will update
+ * the session with the updated information if required (e.g. to update
+ * nonce-count when qop is "auth" or "auth-int"). This function will also
+ * save the authorization header in the session's cached header list.
+ *
+ * @param req_pool	Pool to allocate new header for the request.
+ * @param hdr		The WWW-Authenticate or Proxy-Authenticate found in 
+ *			the response.
+ * @param uri		The URI for which authorization is targeted to.
+ * @param cred_info	The credential to be used for authentication.
+ * @param method	The method.
+ * @param sess_pool	Session pool to update session or to allocate message
+ *			in the cache. May be NULL if auth_sess is NULL.
+ * @param auth_sess	If not NULL, this specifies the specific authentication
+ *			session to be used or updated.
+ *
+ * @return		The Authorization header, which can be typecasted to 
+ *			Proxy-Authorization.
+ */
+PJ_DECL(pjsip_authorization_hdr*) pjsip_auth_respond( 
+					 pj_pool_t *req_pool,
+					 const pjsip_www_authenticate_hdr *hdr,
+					 const pjsip_uri *uri,
+					 const pjsip_cred_info *cred_info,
+					 const pjsip_method *method,
+					 pj_pool_t *sess_pool,
+					 pjsip_auth_session *auth_sess);
+
+/**
+ * Verify digest in the authorization request.
+ *
+ * @param hdr		The incoming Authorization/Proxy-Authorization header.
+ * @param method	The method.
+ * @param password	The plaintext password to verify.
+ *
+ * @return		Non-zero if authorization succeed.
+ */
+PJ_DECL(pj_bool_t) pjsip_auth_verify(	const pjsip_authorization_hdr *hdr,
+					const pj_str_t *method,
+					const pjsip_cred_info *cred_info );
+
+
+/**
+ * This function can be used to find credential information which matches
+ * the specified realm.
+ *
+ * @param count		Number of credentials in the parameter.
+ * @param cred		The array of credentials.
+ * @param realm		Realm to search.
+ * @param scheme	Authentication scheme.
+ *
+ * @return		The credential which matches the specified realm.
+ */
+PJ_DECL(const pjsip_cred_info*) pjsip_auth_find_cred( unsigned count,
+						      const pjsip_cred_info cred[],
+						      const pj_str_t *realm,
+						      const pj_str_t *scheme );
+
+
+/**
+ * Initialize new request message with authorization headers.
+ * This function will put Authorization/Proxy-Authorization headers to the
+ * outgoing request message. If caching is enabled (PJSIP_AUTH_HEADER_CACHING)
+ * and the session has previously sent Authorization/Proxy-Authorization header
+ * with the same method, then the same Authorization/Proxy-Authorization header
+ * will be resent from the cache only if qop is not present. If the stack is 
+ * configured to automatically generate next Authorization/Proxy-Authorization
+ * headers (PJSIP_AUTH_AUTO_SEND_NEXT flag), then new Authorization/Proxy-
+ * Authorization headers are calculated and generated when they are not present
+ * in the case or if authorization session has qop.
+ *
+ * If both PJSIP_AUTH_HEADER_CACHING flag and PJSIP_AUTH_AUTO_SEND_NEXT flag
+ * are not set, this function will do nothing. The stack then will only send
+ * Authorization/Proxy-Authorization to respond 401/407 response.
+ *
+ * @param sess_pool	Session level pool, where memory will be allocated from
+ *			for data that persists across requests (e.g. caching).
+ * @param tdata		The request message to be initialized.
+ * @param sess_list	List of authorization sessions that have been recorded.
+ * @param cred_count	Number of credentials.
+ * @param cred_info	Array of credentials.
+ *
+ * @return		Zero if successfull.
+ */
+PJ_DECL(pj_status_t) pjsip_auth_init_req( pj_pool_t *sess_pool,
+					  pjsip_tx_data *tdata,
+					  pjsip_auth_session *sess_list,
+					  int cred_count, 
+					  const pjsip_cred_info cred_info[]);
+
+/**
+ * Call this function when a transaction failed with 401 or 407 response.
+ * This function will reinitialize the original request message with the
+ * authentication challenge found in the response message, and add the
+ * new authorization header in the authorization cache.
+ *
+ * Note that upon return the reference counter of the transmit data
+ * will be incremented.
+ *
+ * @param endpt		Endpoint.
+ * @param pool		The pool to allocate memory for new cred_info.
+ * @param cached_list	Cached authorization headers.
+ * @param cred_count	Number of credentials.
+ * @param cred_info	Array of credentials to use.
+ * @param tdata		The original request message, which normally can be
+ *			retrieved from tsx->last_tx.
+ * @param rdata		The response message containing 401/407 status.
+ *
+ * @return		New transmit data buffer, or NULL if the dialog
+ *			can not respond to the authorization challenge.
+ */
+PJ_DECL(pjsip_tx_data*) 
+pjsip_auth_reinit_req( pjsip_endpoint *endpt,
+		       pj_pool_t *ses_pool,
+		       pjsip_auth_session *sess_list,
+		       int cred_count, const pjsip_cred_info cred_info[],
+		       pjsip_tx_data *tdata, const pjsip_rx_data *rdata);
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+#endif	/* __PJSIP_AUTH_SIP_AUTH_H__ */
+
Index: /pjproject/main/pjsip/include/pjsip/sip_auth_msg.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip/sip_auth_msg.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip/sip_auth_msg.h	(revision 42)
@@ -0,0 +1,194 @@
+/* $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__ */
Index: /pjproject/main/pjsip/include/pjsip/sip_auth_parser.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip/sip_auth_parser.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip/sip_auth_parser.h	(revision 42)
@@ -0,0 +1,70 @@
+/* $Id$
+ *
+ */
+#ifndef __PJSIP_AUTH_SIP_AUTH_PARSER_H__
+#define __PJSIP_AUTH_SIP_AUTH_PARSER_H__
+
+/**
+ * @file pjsip_auth_parser.h
+ * @brief SIP Authorization Parser Module.
+ */
+
+#include <pj/types.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_AUTH_PARSER_MODULE Authorization Parser Module
+ * @ingroup PJSIP_AUTH
+ * @{
+ */
+
+/**
+ * Initialize and register authorization parser module.
+ * This will register parser handler for various Authorization related headers
+ * such as Authorization, WWW-Authenticate, Proxy-Authorizization, and 
+ * Proxy-Authenticate headers.
+ */
+PJ_DECL(void) pjsip_auth_init_parser();
+
+/**
+ * DeInitialize authorization parser module.
+ */
+PJ_DECL(void) pjsip_auth_deinit_parser();
+
+
+extern const pj_str_t	pjsip_USERNAME_STR,
+			pjsip_REALM_STR,
+			pjsip_NONCE_STR,
+			pjsip_URI_STR,
+			pjsip_RESPONSE_STR,
+			pjsip_ALGORITHM_STR,
+			pjsip_DOMAIN_STR,
+			pjsip_STALE_STR,
+			pjsip_QOP_STR,
+			pjsip_CNONCE_STR,
+			pjsip_OPAQUE_STR,
+			pjsip_NC_STR,
+			pjsip_TRUE_STR,
+			pjsip_FALSE_STR,
+			pjsip_DIGEST_STR,
+			pjsip_PGP_STR,
+			pjsip_MD5_STR,
+			pjsip_AUTH_STR;
+/*
+extern const pj_str_t	pjsip_QUOTED_TRUE_STR,
+			pjsip_QUOTED_FALSE_STR,
+			pjsip_QUOTED_DIGEST_STR,
+			pjsip_QUOTED_PGP_STR,
+			pjsip_QUOTED_MD5_STR,
+			pjsip_QUOTED_AUTH_STR;
+*/
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+#endif	/* __PJSIP_AUTH_SIP_AUTH_PARSER_H__ */
+
Index: /pjproject/main/pjsip/include/pjsip_auth.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip_auth.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip_auth.h	(revision 42)
@@ -0,0 +1,22 @@
+/* $Id$
+ *
+ */
+#ifndef __PJSIP_AUTH_H__
+#define __PJSIP_AUTH_H__
+
+/**
+ * @defgroup PJSIP_AUTH SIP Authorization module
+ */
+
+/**
+ * @file pjsip_auth.h
+ * @brief SIP Authorization Module.
+ */
+
+
+#include <pjsip_auth/sip_auth.h>
+#include <pjsip_auth/sip_auth_msg.h>
+#include <pjsip_auth/sip_auth_parser.h>
+
+#endif	/* __PJSIP_AUTH_H__ */
+
Index: /pjproject/main/pjsip/include/pjsip_core.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip_core.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip_core.h	(revision 42)
@@ -0,0 +1,21 @@
+/* $Id$
+ *
+ */
+#ifndef __PJSIP_CORE_H__
+#define __PJSIP_CORE_H__
+
+#include <pjsip/sip_types.h>
+#include <pjsip/sip_endpoint.h>
+#include <pjsip/sip_event.h>
+#include <pjsip/sip_misc.h>
+#include <pjsip/sip_module.h>
+#include <pjsip/sip_msg.h>
+#include <pjsip/sip_parser.h>
+#include <pjsip/sip_resolve.h>
+#include <pjsip/sip_transaction.h>
+#include <pjsip/sip_transport.h>
+#include <pjsip/sip_uri.h>
+#include <pjsip/sip_auth.h>
+
+#endif	/* __PJSIP_CORE_H__ */
+
Index: /pjproject/main/pjsip/include/pjsip_simple.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip_simple.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip_simple.h	(revision 42)
@@ -0,0 +1,26 @@
+/* $Id$
+ *
+ */
+
+/**
+ * @defgroup PJSIP_SIMPLE SIP Event, Instant Messaging and Presence Extension (SIMPLE)
+ */
+
+/**
+ * @file pjsip_simple.h
+ * @brief SIP SIMPLE Extension
+ */
+
+/*
+ * Include this header file to get all functionalities for SIMPLE extension
+ * (SIP for Instant Messaging and Presence Leveraging Extension).
+ */
+#ifndef __PJSIP_SIMPLE_H__
+#define __PJSIP_SIMPLE_H__
+
+#include <pjsip_simple/messaging.h>
+#include <pjsip_simple/event_notify.h>
+#include <pjsip_simple/pidf.h>
+#include <pjsip_simple/presence.h>
+
+#endif	/* __PJSIP_SIMPLE_H__ */
Index: /pjproject/main/pjsip/include/pjsip_ua.h
===================================================================
--- /pjproject/main/pjsip/include/pjsip_ua.h	(revision 42)
+++ /pjproject/main/pjsip/include/pjsip_ua.h	(revision 42)
@@ -0,0 +1,13 @@
+/* $Id$
+ *
+ */
+
+#ifndef __PJSIP_UA_H__
+#define __PJSIP_UA_H__
+
+#include <pjsip_mod_ua/sip_dialog.h>
+#include <pjsip_mod_ua/sip_reg.h>
+#include <pjsip_mod_ua/sip_ua.h>
+
+#endif	/* __PJSIP_UA_H__ */
+
Index: project/main/pjsip/include/sip_auth.h
===================================================================
--- /pjproject/main/pjsip/include/sip_auth.h	(revision 41)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/* $Id$
- *
- */
-#ifndef __PJSIP_AUTH_SIP_AUTH_H__
-#define __PJSIP_AUTH_SIP_AUTH_H__
-
-/**
- * @file pjsip_auth.h
- * @brief SIP Authorization Module.
- */
-
-#include <pjsip/sip_config.h>
-#include <pjsip/sip_auth_msg.h>
-
-PJ_BEGIN_DECL
-
-/**
- * @defgroup PJSIP_AUTH_API Authorization API's
- * @ingroup PJSIP_AUTH
- * @{
- */
-
- /** Type of data in the credential information. */
-typedef enum pjsip_cred_data_type
-{
-    PJSIP_CRED_DATA_PLAIN_PASSWD,   /**< Plain text password.	*/
-    PJSIP_CRED_DATA_DIGEST,	    /**< Hashed digest.		*/
-} pjsip_cred_data_type;
-
-/** Authentication's quality of protection (qop) type. */
-typedef enum pjsip_auth_qop_type
-{
-    PJSIP_AUTH_QOP_NONE,	    /**< No quality of protection. */
-    PJSIP_AUTH_QOP_AUTH,	    /**< Authentication. */
-    PJSIP_AUTH_QOP_AUTH_INT,	    /**< Authentication with integrity protection. */
-    PJSIP_AUTH_QOP_UNKNOWN,	    /**< Unknown protection. */
-} pjsip_auth_qop_type;
-
-
-/** 
- * This structure describes credential information. 
- * A credential information is a static, persistent information that identifies
- * username and password required to authorize to a specific realm.
- */
-struct pjsip_cred_info
-{
-    pj_str_t    realm;		/**< Realm.	    */
-    pj_str_t	scheme;		/**< Scheme.	    */
-    pj_str_t	username;	/**< User name.	    */
-    int		data_type;	/**< Type of data.  */
-    pj_str_t	data;		/**< The data, which can be a plaintext 
-				     password or a hashed digest. */
-};
-
-/**
- * This structure describes cached value of previously sent Authorization
- * or Proxy-Authorization header. The authentication framework keeps a list
- * of this structure and will resend the same header to the same server
- * as long as the method, uri, and nonce stays the same.
- */
-typedef struct pjsip_cached_auth_hdr
-{
-    PJ_DECL_LIST_MEMBER(struct pjsip_cached_auth_hdr)
-
-    pjsip_method	     method;
-    pjsip_authorization_hdr *hdr;
-
-} pjsip_cached_auth_hdr;
-
-
-/**
- * This structure describes authentication information for the specified
- * realm. Each instance of this structure describes authentication "session"
- * between this endpoint and remote server. This "session" information is
- * usefull to keep information that persists for more than one challenge,
- * such as nonce-count and cnonce value.
- *
- * Other than that, this structure also keeps the last authorization headers
- * that have been sent in the cache list.
- */
-typedef struct pjsip_auth_session
-{
-    PJ_DECL_LIST_MEMBER(struct pjsip_auth_session)
-
-    pj_str_t			 realm;
-    pj_bool_t			 is_proxy;
-    pjsip_auth_qop_type		 qop_value;
-#if PJSIP_AUTH_QOP_SUPPORT
-    pj_uint32_t			 nc;
-    pj_str_t			 cnonce;
-#endif
-#if PJSIP_AUTH_AUTO_SEND_NEXT
-    pjsip_www_authenticate_hdr	*last_chal;
-#endif
-#if PJSIP_AUTH_HEADER_CACHING
-    pjsip_cached_auth_hdr	 cached_hdr;
-#endif
-
-} pjsip_auth_session;
-
-
-/**
- * Create authorization header for the specified credential.
- * Application calls this function to create Authorization or Proxy-Authorization
- * header after receiving WWW-Authenticate or Proxy-Authenticate challenge
- * (normally in 401/407 response).
- * If authorization session argument is specified, this function will update
- * the session with the updated information if required (e.g. to update
- * nonce-count when qop is "auth" or "auth-int"). This function will also
- * save the authorization header in the session's cached header list.
- *
- * @param req_pool	Pool to allocate new header for the request.
- * @param hdr		The WWW-Authenticate or Proxy-Authenticate found in 
- *			the response.
- * @param uri		The URI for which authorization is targeted to.
- * @param cred_info	The credential to be used for authentication.
- * @param method	The method.
- * @param sess_pool	Session pool to update session or to allocate message
- *			in the cache. May be NULL if auth_sess is NULL.
- * @param auth_sess	If not NULL, this specifies the specific authentication
- *			session to be used or updated.
- *
- * @return		The Authorization header, which can be typecasted to 
- *			Proxy-Authorization.
- */
-PJ_DECL(pjsip_authorization_hdr*) pjsip_auth_respond( 
-					 pj_pool_t *req_pool,
-					 const pjsip_www_authenticate_hdr *hdr,
-					 const pjsip_uri *uri,
-					 const pjsip_cred_info *cred_info,
-					 const pjsip_method *method,
-					 pj_pool_t *sess_pool,
-					 pjsip_auth_session *auth_sess);
-
-/**
- * Verify digest in the authorization request.
- *
- * @param hdr		The incoming Authorization/Proxy-Authorization header.
- * @param method	The method.
- * @param password	The plaintext password to verify.
- *
- * @return		Non-zero if authorization succeed.
- */
-PJ_DECL(pj_bool_t) pjsip_auth_verify(	const pjsip_authorization_hdr *hdr,
-					const pj_str_t *method,
-					const pjsip_cred_info *cred_info );
-
-
-/**
- * This function can be used to find credential information which matches
- * the specified realm.
- *
- * @param count		Number of credentials in the parameter.
- * @param cred		The array of credentials.
- * @param realm		Realm to search.
- * @param scheme	Authentication scheme.
- *
- * @return		The credential which matches the specified realm.
- */
-PJ_DECL(const pjsip_cred_info*) pjsip_auth_find_cred( unsigned count,
-						      const pjsip_cred_info cred[],
-						      const pj_str_t *realm,
-						      const pj_str_t *scheme );
-
-
-/**
- * Initialize new request message with authorization headers.
- * This function will put Authorization/Proxy-Authorization headers to the
- * outgoing request message. If caching is enabled (PJSIP_AUTH_HEADER_CACHING)
- * and the session has previously sent Authorization/Proxy-Authorization header
- * with the same method, then the same Authorization/Proxy-Authorization header
- * will be resent from the cache only if qop is not present. If the stack is 
- * configured to automatically generate next Authorization/Proxy-Authorization
- * headers (PJSIP_AUTH_AUTO_SEND_NEXT flag), then new Authorization/Proxy-
- * Authorization headers are calculated and generated when they are not present
- * in the case or if authorization session has qop.
- *
- * If both PJSIP_AUTH_HEADER_CACHING flag and PJSIP_AUTH_AUTO_SEND_NEXT flag
- * are not set, this function will do nothing. The stack then will only send
- * Authorization/Proxy-Authorization to respond 401/407 response.
- *
- * @param sess_pool	Session level pool, where memory will be allocated from
- *			for data that persists across requests (e.g. caching).
- * @param tdata		The request message to be initialized.
- * @param sess_list	List of authorization sessions that have been recorded.
- * @param cred_count	Number of credentials.
- * @param cred_info	Array of credentials.
- *
- * @return		Zero if successfull.
- */
-PJ_DECL(pj_status_t) pjsip_auth_init_req( pj_pool_t *sess_pool,
-					  pjsip_tx_data *tdata,
-					  pjsip_auth_session *sess_list,
-					  int cred_count, 
-					  const pjsip_cred_info cred_info[]);
-
-/**
- * Call this function when a transaction failed with 401 or 407 response.
- * This function will reinitialize the original request message with the
- * authentication challenge found in the response message, and add the
- * new authorization header in the authorization cache.
- *
- * Note that upon return the reference counter of the transmit data
- * will be incremented.
- *
- * @param endpt		Endpoint.
- * @param pool		The pool to allocate memory for new cred_info.
- * @param cached_list	Cached authorization headers.
- * @param cred_count	Number of credentials.
- * @param cred_info	Array of credentials to use.
- * @param tdata		The original request message, which normally can be
- *			retrieved from tsx->last_tx.
- * @param rdata		The response message containing 401/407 status.
- *
- * @return		New transmit data buffer, or NULL if the dialog
- *			can not respond to the authorization challenge.
- */
-PJ_DECL(pjsip_tx_data*) 
-pjsip_auth_reinit_req( pjsip_endpoint *endpt,
-		       pj_pool_t *ses_pool,
-		       pjsip_auth_session *sess_list,
-		       int cred_count, const pjsip_cred_info cred_info[],
-		       pjsip_tx_data *tdata, const pjsip_rx_data *rdata);
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-#endif	/* __PJSIP_AUTH_SIP_AUTH_H__ */
-
Index: project/main/pjsip/include/sip_auth_msg.h
===================================================================
--- /pjproject/main/pjsip/include/sip_auth_msg.h	(revision 41)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/* $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__ */
Index: project/main/pjsip/include/sip_auth_parser.h
===================================================================
--- /pjproject/main/pjsip/include/sip_auth_parser.h	(revision 41)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/* $Id$
- *
- */
-#ifndef __PJSIP_AUTH_SIP_AUTH_PARSER_H__
-#define __PJSIP_AUTH_SIP_AUTH_PARSER_H__
-
-/**
- * @file pjsip_auth_parser.h
- * @brief SIP Authorization Parser Module.
- */
-
-#include <pj/types.h>
-
-PJ_BEGIN_DECL
-
-/**
- * @defgroup PJSIP_AUTH_PARSER_MODULE Authorization Parser Module
- * @ingroup PJSIP_AUTH
- * @{
- */
-
-/**
- * Initialize and register authorization parser module.
- * This will register parser handler for various Authorization related headers
- * such as Authorization, WWW-Authenticate, Proxy-Authorizization, and 
- * Proxy-Authenticate headers.
- */
-PJ_DECL(void) pjsip_auth_init_parser();
-
-/**
- * DeInitialize authorization parser module.
- */
-PJ_DECL(void) pjsip_auth_deinit_parser();
-
-
-extern const pj_str_t	pjsip_USERNAME_STR,
-			pjsip_REALM_STR,
-			pjsip_NONCE_STR,
-			pjsip_URI_STR,
-			pjsip_RESPONSE_STR,
-			pjsip_ALGORITHM_STR,
-			pjsip_DOMAIN_STR,
-			pjsip_STALE_STR,
-			pjsip_QOP_STR,
-			pjsip_CNONCE_STR,
-			pjsip_OPAQUE_STR,
-			pjsip_NC_STR,
-			pjsip_TRUE_STR,
-			pjsip_FALSE_STR,
-			pjsip_DIGEST_STR,
-			pjsip_PGP_STR,
-			pjsip_MD5_STR,
-			pjsip_AUTH_STR;
-/*
-extern const pj_str_t	pjsip_QUOTED_TRUE_STR,
-			pjsip_QUOTED_FALSE_STR,
-			pjsip_QUOTED_DIGEST_STR,
-			pjsip_QUOTED_PGP_STR,
-			pjsip_QUOTED_MD5_STR,
-			pjsip_QUOTED_AUTH_STR;
-*/
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-#endif	/* __PJSIP_AUTH_SIP_AUTH_PARSER_H__ */
-
