* #27232: jni: added pjproject checkout as regular git content

We will remove it once the next release of pjsip (with Android support)
comes out and is merged into SFLphone.
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e0144e6862c3ab83cafaf95b5fcc299850d85bf.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e0144e6862c3ab83cafaf95b5fcc299850d85bf.svn-base
new file mode 100644
index 0000000..a521fd4
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e0144e6862c3ab83cafaf95b5fcc299850d85bf.svn-base
@@ -0,0 +1,715 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#include <pj/lock.h>
+#include <pj/os.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/pool.h>
+#include <pj/string.h>
+#include <pj/errno.h>
+
+#define THIS_FILE	"lock.c"
+
+typedef void LOCK_OBJ;
+
+/*
+ * Lock structure.
+ */
+struct pj_lock_t
+{
+    LOCK_OBJ *lock_object;
+
+    pj_status_t	(*acquire)	(LOCK_OBJ*);
+    pj_status_t	(*tryacquire)	(LOCK_OBJ*);
+    pj_status_t	(*release)	(LOCK_OBJ*);
+    pj_status_t	(*destroy)	(LOCK_OBJ*);
+};
+
+typedef pj_status_t (*FPTR)(LOCK_OBJ*);
+
+/******************************************************************************
+ * Implementation of lock object with mutex.
+ */
+static pj_lock_t mutex_lock_template = 
+{
+    NULL,
+    (FPTR) &pj_mutex_lock,
+    (FPTR) &pj_mutex_trylock,
+    (FPTR) &pj_mutex_unlock,
+    (FPTR) &pj_mutex_destroy
+};
+
+static pj_status_t create_mutex_lock( pj_pool_t *pool,
+				      const char *name,
+				      int type,
+				      pj_lock_t **lock )
+{
+    pj_lock_t *p_lock;
+    pj_mutex_t *mutex;
+    pj_status_t rc;
+
+    PJ_ASSERT_RETURN(pool && lock, PJ_EINVAL);
+
+    p_lock = PJ_POOL_ALLOC_T(pool, pj_lock_t);
+    if (!p_lock)
+	return PJ_ENOMEM;
+
+    pj_memcpy(p_lock, &mutex_lock_template, sizeof(pj_lock_t));
+    rc = pj_mutex_create(pool, name, type, &mutex);
+    if (rc != PJ_SUCCESS)
+	return rc;
+
+    p_lock->lock_object = mutex;
+    *lock = p_lock;
+    return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pj_lock_create_simple_mutex( pj_pool_t *pool,
+						 const char *name,
+						 pj_lock_t **lock )
+{
+    return create_mutex_lock(pool, name, PJ_MUTEX_SIMPLE, lock);
+}
+
+PJ_DEF(pj_status_t) pj_lock_create_recursive_mutex( pj_pool_t *pool,
+						    const char *name,
+						    pj_lock_t **lock )
+{
+    return create_mutex_lock(pool, name, PJ_MUTEX_RECURSE, lock);
+}
+
+
+/******************************************************************************
+ * Implementation of NULL lock object.
+ */
+static pj_status_t null_op(void *arg)
+{
+    PJ_UNUSED_ARG(arg);
+    return PJ_SUCCESS;
+}
+
+static pj_lock_t null_lock_template = 
+{
+    NULL,
+    &null_op,
+    &null_op,
+    &null_op,
+    &null_op
+};
+
+PJ_DEF(pj_status_t) pj_lock_create_null_mutex( pj_pool_t *pool,
+					       const char *name,
+					       pj_lock_t **lock )
+{
+    PJ_UNUSED_ARG(name);
+    PJ_UNUSED_ARG(pool);
+
+    PJ_ASSERT_RETURN(lock, PJ_EINVAL);
+
+    *lock = &null_lock_template;
+    return PJ_SUCCESS;
+}
+
+
+/******************************************************************************
+ * Implementation of semaphore lock object.
+ */
+#if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0
+
+static pj_lock_t sem_lock_template = 
+{
+    NULL,
+    (FPTR) &pj_sem_wait,
+    (FPTR) &pj_sem_trywait,
+    (FPTR) &pj_sem_post,
+    (FPTR) &pj_sem_destroy
+};
+
+PJ_DEF(pj_status_t) pj_lock_create_semaphore(  pj_pool_t *pool,
+					       const char *name,
+					       unsigned initial,
+					       unsigned max,
+					       pj_lock_t **lock )
+{
+    pj_lock_t *p_lock;
+    pj_sem_t *sem;
+    pj_status_t rc;
+
+    PJ_ASSERT_RETURN(pool && lock, PJ_EINVAL);
+
+    p_lock = PJ_POOL_ALLOC_T(pool, pj_lock_t);
+    if (!p_lock)
+	return PJ_ENOMEM;
+
+    pj_memcpy(p_lock, &sem_lock_template, sizeof(pj_lock_t));
+    rc = pj_sem_create( pool, name, initial, max, &sem);
+    if (rc != PJ_SUCCESS)
+        return rc;
+
+    p_lock->lock_object = sem;
+    *lock = p_lock;
+
+    return PJ_SUCCESS;
+}
+
+
+#endif	/* PJ_HAS_SEMAPHORE */
+
+
+PJ_DEF(pj_status_t) pj_lock_acquire( pj_lock_t *lock )
+{
+    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
+    return (*lock->acquire)(lock->lock_object);
+}
+
+PJ_DEF(pj_status_t) pj_lock_tryacquire( pj_lock_t *lock )
+{
+    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
+    return (*lock->tryacquire)(lock->lock_object);
+}
+
+PJ_DEF(pj_status_t) pj_lock_release( pj_lock_t *lock )
+{
+    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
+    return (*lock->release)(lock->lock_object);
+}
+
+PJ_DEF(pj_status_t) pj_lock_destroy( pj_lock_t *lock )
+{
+    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
+    return (*lock->destroy)(lock->lock_object);
+}
+
+
+/******************************************************************************
+ * Group lock
+ */
+
+/* Individual lock in the group lock */
+typedef struct grp_lock_item
+{
+    PJ_DECL_LIST_MEMBER(struct grp_lock_item);
+    int		 prio;
+    pj_lock_t	*lock;
+
+} grp_lock_item;
+
+/* Destroy callbacks */
+typedef struct grp_destroy_callback
+{
+    PJ_DECL_LIST_MEMBER(struct grp_destroy_callback);
+    void	*comp;
+    void	(*handler)(void*);
+} grp_destroy_callback;
+
+#if PJ_GRP_LOCK_DEBUG
+/* Store each add_ref caller */
+typedef struct grp_lock_ref
+{
+    PJ_DECL_LIST_MEMBER(struct grp_lock_ref);
+    const char	*file;
+    int		 line;
+} grp_lock_ref;
+#endif
+
+/* The group lock */
+struct pj_grp_lock_t
+{
+    pj_lock_t	 	 base;
+
+    pj_pool_t		*pool;
+    pj_atomic_t		*ref_cnt;
+    pj_lock_t		*own_lock;
+
+    pj_thread_t		*owner;
+    int			 owner_cnt;
+
+    grp_lock_item	 lock_list;
+    grp_destroy_callback destroy_list;
+
+#if PJ_GRP_LOCK_DEBUG
+    grp_lock_ref	 ref_list;
+    grp_lock_ref	 ref_free_list;
+#endif
+};
+
+
+PJ_DEF(void) pj_grp_lock_config_default(pj_grp_lock_config *cfg)
+{
+    pj_bzero(cfg, sizeof(*cfg));
+}
+
+static void grp_lock_set_owner_thread(pj_grp_lock_t *glock)
+{
+    if (!glock->owner) {
+	glock->owner = pj_thread_this();
+	glock->owner_cnt = 1;
+    } else {
+	pj_assert(glock->owner == pj_thread_this());
+	glock->owner_cnt++;
+    }
+}
+
+static void grp_lock_unset_owner_thread(pj_grp_lock_t *glock)
+{
+    pj_assert(glock->owner == pj_thread_this());
+    pj_assert(glock->owner_cnt > 0);
+    if (--glock->owner_cnt <= 0) {
+	glock->owner = NULL;
+	glock->owner_cnt = 0;
+    }
+}
+
+static pj_status_t grp_lock_acquire(LOCK_OBJ *p)
+{
+    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
+    grp_lock_item *lck;
+
+    pj_assert(pj_atomic_get(glock->ref_cnt) > 0);
+
+    lck = glock->lock_list.next;
+    while (lck != &glock->lock_list) {
+	pj_lock_acquire(lck->lock);
+	lck = lck->next;
+    }
+    grp_lock_set_owner_thread(glock);
+    pj_grp_lock_add_ref(glock);
+    return PJ_SUCCESS;
+}
+
+static pj_status_t grp_lock_tryacquire(LOCK_OBJ *p)
+{
+    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
+    grp_lock_item *lck;
+
+    pj_assert(pj_atomic_get(glock->ref_cnt) > 0);
+
+    lck = glock->lock_list.next;
+    while (lck != &glock->lock_list) {
+	pj_status_t status = pj_lock_tryacquire(lck->lock);
+	if (status != PJ_SUCCESS) {
+	    lck = lck->prev;
+	    while (lck != &glock->lock_list) {
+		pj_lock_release(lck->lock);
+		lck = lck->prev;
+	    }
+	    return status;
+	}
+	lck = lck->next;
+    }
+    grp_lock_set_owner_thread(glock);
+    pj_grp_lock_add_ref(glock);
+    return PJ_SUCCESS;
+}
+
+static pj_status_t grp_lock_release(LOCK_OBJ *p)
+{
+    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
+    grp_lock_item *lck;
+
+    grp_lock_unset_owner_thread(glock);
+
+    lck = glock->lock_list.prev;
+    while (lck != &glock->lock_list) {
+	pj_lock_release(lck->lock);
+	lck = lck->prev;
+    }
+    return pj_grp_lock_dec_ref(glock);
+}
+
+static pj_status_t grp_lock_destroy(LOCK_OBJ *p)
+{
+    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
+    pj_pool_t *pool = glock->pool;
+    grp_lock_item *lck;
+    grp_destroy_callback *cb;
+
+    if (!glock->pool) {
+	/* already destroyed?! */
+	return PJ_EINVAL;
+    }
+
+    /* Release all chained locks */
+    lck = glock->lock_list.next;
+    while (lck != &glock->lock_list) {
+	if (lck->lock != glock->own_lock) {
+	    int i;
+	    for (i=0; i<glock->owner_cnt; ++i)
+		pj_lock_release(lck->lock);
+	}
+	lck = lck->next;
+    }
+
+    /* Call callbacks */
+    cb = glock->destroy_list.next;
+    while (cb != &glock->destroy_list) {
+	grp_destroy_callback *next = cb->next;
+	cb->handler(cb->comp);
+	cb = next;
+    }
+
+    pj_lock_destroy(glock->own_lock);
+    pj_atomic_destroy(glock->ref_cnt);
+    glock->pool = NULL;
+    pj_pool_release(pool);
+
+    return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pj_grp_lock_create( pj_pool_t *pool,
+                                        const pj_grp_lock_config *cfg,
+                                        pj_grp_lock_t **p_grp_lock)
+{
+    pj_grp_lock_t *glock;
+    grp_lock_item *own_lock;
+    pj_status_t status;
+
+    PJ_ASSERT_RETURN(pool && p_grp_lock, PJ_EINVAL);
+
+    PJ_UNUSED_ARG(cfg);
+
+    pool = pj_pool_create(pool->factory, "glck%p", 512, 512, NULL);
+    if (!pool)
+	return PJ_ENOMEM;
+
+    glock = PJ_POOL_ZALLOC_T(pool, pj_grp_lock_t);
+    glock->base.lock_object = glock;
+    glock->base.acquire = &grp_lock_acquire;
+    glock->base.tryacquire = &grp_lock_tryacquire;
+    glock->base.release = &grp_lock_release;
+    glock->base.destroy = &grp_lock_destroy;
+
+    glock->pool = pool;
+    pj_list_init(&glock->lock_list);
+    pj_list_init(&glock->destroy_list);
+#if PJ_GRP_LOCK_DEBUG
+    pj_list_init(&glock->ref_list);
+    pj_list_init(&glock->ref_free_list);
+#endif
+
+    status = pj_atomic_create(pool, 0, &glock->ref_cnt);
+    if (status != PJ_SUCCESS)
+	goto on_error;
+
+    status = pj_lock_create_recursive_mutex(pool, pool->obj_name,
+                                            &glock->own_lock);
+    if (status != PJ_SUCCESS)
+	goto on_error;
+
+    own_lock = PJ_POOL_ZALLOC_T(pool, grp_lock_item);
+    own_lock->lock = glock->own_lock;
+    pj_list_push_back(&glock->lock_list, own_lock);
+
+    *p_grp_lock = glock;
+    return PJ_SUCCESS;
+
+on_error:
+    grp_lock_destroy(glock);
+    return status;
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_destroy( pj_grp_lock_t *grp_lock)
+{
+    return grp_lock_destroy(grp_lock);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_acquire( pj_grp_lock_t *grp_lock)
+{
+    return grp_lock_acquire(grp_lock);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_tryacquire( pj_grp_lock_t *grp_lock)
+{
+    return grp_lock_tryacquire(grp_lock);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_release( pj_grp_lock_t *grp_lock)
+{
+    return grp_lock_release(grp_lock);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_replace( pj_grp_lock_t *old_lock,
+                                         pj_grp_lock_t *new_lock)
+{
+    grp_destroy_callback *ocb;
+
+    /* Move handlers from old to new */
+    ocb = old_lock->destroy_list.next;
+    while (ocb != &old_lock->destroy_list) {
+	grp_destroy_callback *ncb;
+
+	ncb = PJ_POOL_ALLOC_T(new_lock->pool, grp_destroy_callback);
+	ncb->comp = ocb->comp;
+	ncb->handler = ocb->handler;
+	pj_list_push_back(&new_lock->destroy_list, ncb);
+
+	ocb = ocb->next;
+    }
+
+    pj_list_init(&old_lock->destroy_list);
+
+    grp_lock_destroy(old_lock);
+    return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_add_handler( pj_grp_lock_t *glock,
+                                             pj_pool_t *pool,
+                                             void *comp,
+                                             void (*destroy)(void *comp))
+{
+    grp_destroy_callback *cb;
+
+    grp_lock_acquire(glock);
+
+    if (pool == NULL)
+	pool = glock->pool;
+
+    cb = PJ_POOL_ZALLOC_T(pool, grp_destroy_callback);
+    cb->comp = comp;
+    cb->handler = destroy;
+    pj_list_push_back(&glock->destroy_list, cb);
+
+    grp_lock_release(glock);
+    return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_del_handler( pj_grp_lock_t *glock,
+                                             void *comp,
+                                             void (*destroy)(void *comp))
+{
+    grp_destroy_callback *cb;
+
+    grp_lock_acquire(glock);
+
+    cb = glock->destroy_list.next;
+    while (cb != &glock->destroy_list) {
+	if (cb->comp == comp && cb->handler == destroy)
+	    break;
+	cb = cb->next;
+    }
+
+    if (cb != &glock->destroy_list)
+	pj_list_erase(cb);
+
+    grp_lock_release(glock);
+    return PJ_SUCCESS;
+}
+
+static pj_status_t grp_lock_add_ref(pj_grp_lock_t *glock)
+{
+    pj_atomic_inc(glock->ref_cnt);
+    return PJ_SUCCESS;
+}
+
+static pj_status_t grp_lock_dec_ref(pj_grp_lock_t *glock)
+{
+    int cnt; /* for debugging */
+    if ((cnt=pj_atomic_dec_and_get(glock->ref_cnt)) == 0) {
+	grp_lock_destroy(glock);
+	return PJ_EGONE;
+    }
+    pj_assert(cnt > 0);
+    pj_grp_lock_dump(glock);
+    return PJ_SUCCESS;
+}
+
+#if PJ_GRP_LOCK_DEBUG
+PJ_DEF(pj_status_t) pj_grp_lock_add_ref_dbg(pj_grp_lock_t *glock,
+                                            const char *file,
+                                            int line)
+{
+    grp_lock_ref *ref;
+    pj_status_t status;
+
+    pj_enter_critical_section();
+    if (!pj_list_empty(&glock->ref_free_list)) {
+	ref = glock->ref_free_list.next;
+	pj_list_erase(ref);
+    } else {
+	ref = PJ_POOL_ALLOC_T(glock->pool, grp_lock_ref);
+    }
+
+    ref->file = file;
+    ref->line = line;
+    pj_list_push_back(&glock->ref_list, ref);
+
+    pj_leave_critical_section();
+
+    status = grp_lock_add_ref(glock);
+
+    if (status != PJ_SUCCESS) {
+	pj_enter_critical_section();
+	pj_list_erase(ref);
+	pj_list_push_back(&glock->ref_free_list, ref);
+	pj_leave_critical_section();
+    }
+
+    return status;
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_dec_ref_dbg(pj_grp_lock_t *glock,
+                                            const char *file,
+                                            int line)
+{
+    grp_lock_ref *ref;
+
+    pj_enter_critical_section();
+    /* Find the same source file */
+    ref = glock->ref_list.next;
+    while (ref != &glock->ref_list) {
+	if (strcmp(ref->file, file) == 0) {
+	    pj_list_erase(ref);
+	    pj_list_push_back(&glock->ref_free_list, ref);
+	    break;
+	}
+	ref = ref->next;
+    }
+    pj_leave_critical_section();
+
+    if (ref == &glock->ref_list) {
+	PJ_LOG(2,(THIS_FILE, "pj_grp_lock_dec_ref_dbg() could not find "
+			      "matching ref for %s", file));
+    }
+
+    return grp_lock_dec_ref(glock);
+}
+#else
+PJ_DEF(pj_status_t) pj_grp_lock_add_ref(pj_grp_lock_t *glock)
+{
+    return grp_lock_add_ref(glock);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_dec_ref(pj_grp_lock_t *glock)
+{
+    return grp_lock_dec_ref(glock);
+}
+#endif
+
+PJ_DEF(int) pj_grp_lock_get_ref(pj_grp_lock_t *glock)
+{
+    return pj_atomic_get(glock->ref_cnt);
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_chain_lock( pj_grp_lock_t *glock,
+                                            pj_lock_t *lock,
+                                            int pos)
+{
+    grp_lock_item *lck, *new_lck;
+    int i;
+
+    grp_lock_acquire(glock);
+
+    for (i=0; i<glock->owner_cnt; ++i)
+	pj_lock_acquire(lock);
+
+    lck = glock->lock_list.next;
+    while (lck != &glock->lock_list) {
+	if (lck->prio >= pos)
+	    break;
+	lck = lck->next;
+    }
+
+    new_lck = PJ_POOL_ZALLOC_T(glock->pool, grp_lock_item);
+    new_lck->prio = pos;
+    new_lck->lock = lock;
+    pj_list_insert_before(lck, new_lck);
+
+    /* this will also release the new lock */
+    grp_lock_release(glock);
+    return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pj_grp_lock_unchain_lock( pj_grp_lock_t *glock,
+                                              pj_lock_t *lock)
+{
+    grp_lock_item *lck;
+
+    grp_lock_acquire(glock);
+
+    lck = glock->lock_list.next;
+    while (lck != &glock->lock_list) {
+	if (lck->lock == lock)
+	    break;
+	lck = lck->next;
+    }
+
+    if (lck != &glock->lock_list) {
+	int i;
+
+	pj_list_erase(lck);
+	for (i=0; i<glock->owner_cnt; ++i)
+	    pj_lock_release(lck->lock);
+    }
+
+    grp_lock_release(glock);
+    return PJ_SUCCESS;
+}
+
+PJ_DEF(void) pj_grp_lock_dump(pj_grp_lock_t *grp_lock)
+{
+#if PJ_GRP_LOCK_DEBUG
+    grp_lock_ref *ref = grp_lock->ref_list.next;
+    char info_buf[1000];
+    pj_str_t info;
+
+    info.ptr = info_buf;
+    info.slen = 0;
+
+    pj_grp_lock_acquire(grp_lock);
+    pj_enter_critical_section();
+
+    while (ref != &grp_lock->ref_list && info.slen < sizeof(info_buf)) {
+	char *start = info.ptr + info.slen;
+	int max_len = sizeof(info_buf) - info.slen;
+	int len;
+
+	len = pj_ansi_snprintf(start, max_len, "%s:%d ", ref->file, ref->line);
+	if (len < 1 || len > max_len) {
+	    len = strlen(ref->file);
+	    if (len > max_len - 1)
+		len = max_len - 1;
+
+	    memcpy(start, ref->file, len);
+	    start[len++] = ' ';
+	}
+
+	info.slen += len;
+
+	ref = ref->next;
+    }
+
+    if (ref != &grp_lock->ref_list) {
+	int i;
+	for (i=0; i<4; ++i)
+	    info_buf[sizeof(info_buf)-i-1] = '.';
+    }
+    info.ptr[info.slen-1] = '\0';
+
+    pj_leave_critical_section();
+    pj_grp_lock_release(grp_lock);
+
+    PJ_LOG(4,(THIS_FILE, "Group lock %p, ref_cnt=%d. Reference holders: %s",
+	       grp_lock, pj_grp_lock_get_ref(grp_lock), info.ptr));
+#else
+    PJ_UNUSED_ARG(grp_lock);
+#endif
+}
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e16bb33e1e20b81392f4fa12d21da5c907310e3.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e16bb33e1e20b81392f4fa12d21da5c907310e3.svn-base
new file mode 100644
index 0000000..35b84cf
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e16bb33e1e20b81392f4fa12d21da5c907310e3.svn-base
Binary files differ
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e32ed98585f63b248990f549778e08691341cc6.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e32ed98585f63b248990f549778e08691341cc6.svn-base
new file mode 100644
index 0000000..b117dd3
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e32ed98585f63b248990f549778e08691341cc6.svn-base
@@ -0,0 +1,393 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#include <pjsip-ua/sip_replaces.h>
+#include <pjsip-ua/sip_inv.h>
+#include <pjsip/print_util.h>
+#include <pjsip/sip_endpoint.h>
+#include <pjsip/sip_errno.h>
+#include <pjsip/sip_parser.h>
+#include <pjsip/sip_transport.h>
+#include <pjsip/sip_ua_layer.h>
+#include <pjsip/sip_util.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/pool.h>
+#include <pj/string.h>
+
+#define THIS_FILE		"sip_replaces.c"
+
+
+/*
+ * Replaces header vptr.
+ */
+static int replaces_hdr_print( pjsip_replaces_hdr *hdr, 
+			       char *buf, pj_size_t size);
+static pjsip_replaces_hdr* replaces_hdr_clone( pj_pool_t *pool, 
+					       const pjsip_replaces_hdr *hdr);
+static pjsip_replaces_hdr* replaces_hdr_shallow_clone( pj_pool_t *pool,
+						       const pjsip_replaces_hdr*);
+
+static pjsip_hdr_vptr replaces_hdr_vptr = 
+{
+    (pjsip_hdr_clone_fptr) &replaces_hdr_clone,
+    (pjsip_hdr_clone_fptr) &replaces_hdr_shallow_clone,
+    (pjsip_hdr_print_fptr) &replaces_hdr_print,
+};
+
+/* Globals */
+static pjsip_endpoint *the_endpt;
+static pj_bool_t is_initialized;
+
+PJ_DEF(pjsip_replaces_hdr*) pjsip_replaces_hdr_create(pj_pool_t *pool)
+{
+    pjsip_replaces_hdr *hdr = PJ_POOL_ZALLOC_T(pool, pjsip_replaces_hdr);
+    hdr->type = PJSIP_H_OTHER;
+    hdr->name.ptr = "Replaces";
+    hdr->name.slen = 8;
+    hdr->vptr = &replaces_hdr_vptr;
+    pj_list_init(hdr);
+    pj_list_init(&hdr->other_param);
+    return hdr;
+}
+
+static int replaces_hdr_print( pjsip_replaces_hdr *hdr, 
+			       char *buf, pj_size_t size)
+{
+    char *p = buf;
+    char *endbuf = buf+size;
+    pj_ssize_t printed;
+    const pjsip_parser_const_t *pc = pjsip_parser_const();
+
+    copy_advance(p, hdr->name);
+    *p++ = ':';
+    *p++ = ' ';
+
+    copy_advance(p, hdr->call_id);
+    copy_advance_pair(p, ";to-tag=", 8, hdr->to_tag);
+    copy_advance_pair(p, ";from-tag=", 10, hdr->from_tag);
+
+    if (hdr->early_only) {
+	const pj_str_t str_early_only = { ";early-only", 11 };
+	copy_advance(p, str_early_only);
+    }
+    
+    printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p,
+				   &pc->pjsip_TOKEN_SPEC, 
+				   &pc->pjsip_TOKEN_SPEC, ';');
+    if (printed < 0)
+	return (int)printed;
+
+    p += printed;
+    return (int)(p - buf);
+}
+
+static pjsip_replaces_hdr* replaces_hdr_clone( pj_pool_t *pool, 
+					       const pjsip_replaces_hdr *rhs)
+{
+    pjsip_replaces_hdr *hdr = pjsip_replaces_hdr_create(pool);
+    pj_strdup(pool, &hdr->call_id, &rhs->call_id);
+    pj_strdup(pool, &hdr->to_tag, &rhs->to_tag);
+    pj_strdup(pool, &hdr->from_tag, &rhs->from_tag);
+    hdr->early_only = rhs->early_only;
+    pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param);
+    return hdr;
+}
+
+static pjsip_replaces_hdr* 
+replaces_hdr_shallow_clone( pj_pool_t *pool,
+			    const pjsip_replaces_hdr *rhs )
+{
+    pjsip_replaces_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_replaces_hdr);
+    pj_memcpy(hdr, rhs, sizeof(*hdr));
+    pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param);
+    return hdr;
+}
+
+
+/*
+ * Parse Replaces header.
+ */
+static pjsip_hdr *parse_hdr_replaces(pjsip_parse_ctx *ctx)
+{
+    pjsip_replaces_hdr *hdr = pjsip_replaces_hdr_create(ctx->pool);
+    const pj_str_t to_tag = { "to-tag", 6 };
+    const pj_str_t from_tag = { "from-tag", 8 };
+    const pj_str_t early_only_tag = { "early-only", 10 };
+
+    /*pj_scan_get(ctx->scanner, &pjsip_TOKEN_SPEC, &hdr->call_id);*/
+    /* Get Call-ID (until ';' is found). using pjsip_TOKEN_SPEC doesn't work
+     * because it stops parsing when '@' character is found.
+     */
+    pj_scan_get_until_ch(ctx->scanner, ';', &hdr->call_id);
+
+    while (*ctx->scanner->curptr == ';') {
+	pj_str_t pname, pvalue;
+
+	pj_scan_get_char(ctx->scanner);
+	pjsip_parse_param_imp(ctx->scanner, ctx->pool, &pname, &pvalue, 0);
+
+	if (pj_stricmp(&pname, &to_tag)==0) {
+	    hdr->to_tag = pvalue;
+	} else if (pj_stricmp(&pname, &from_tag)==0) {
+	    hdr->from_tag = pvalue;
+	} else if (pj_stricmp(&pname, &early_only_tag)==0) {
+	    hdr->early_only = PJ_TRUE;
+	} else {
+	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
+	    param->name = pname;
+	    param->value = pvalue;
+	    pj_list_push_back(&hdr->other_param, param);
+	}
+    }
+    pjsip_parse_end_hdr_imp( ctx->scanner );
+    return (pjsip_hdr*)hdr;
+}
+
+
+/* Deinitialize Replaces */
+static void pjsip_replaces_deinit_module(pjsip_endpoint *endpt)
+{
+    PJ_TODO(provide_initialized_flag_for_each_endpoint);
+    PJ_UNUSED_ARG(endpt);
+    is_initialized = PJ_FALSE;
+}
+
+/*
+ * Initialize Replaces support in PJSIP. 
+ */
+PJ_DEF(pj_status_t) pjsip_replaces_init_module(pjsip_endpoint *endpt)
+{
+    pj_status_t status;
+    const pj_str_t STR_REPLACES = { "replaces", 8 };
+
+    the_endpt = endpt;
+
+    if (is_initialized)
+	return PJ_SUCCESS;
+
+    /* Register Replaces header parser */
+    status = pjsip_register_hdr_parser( "Replaces", NULL, 
+				        &parse_hdr_replaces);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    /* Register "replaces" capability */
+    status = pjsip_endpt_add_capability(endpt, NULL, PJSIP_H_SUPPORTED, NULL,
+					1, &STR_REPLACES);
+
+    /* Register deinit module to be executed when PJLIB shutdown */
+    if (pjsip_endpt_atexit(endpt, &pjsip_replaces_deinit_module) != PJ_SUCCESS)
+    {
+	/* Failure to register this function may cause this module won't 
+	 * work properly when the stack is restarted (without quitting 
+	 * application).
+	 */
+	pj_assert(!"Failed to register Replaces deinit.");
+	PJ_LOG(1, (THIS_FILE, "Failed to register Replaces deinit."));
+    }
+
+    is_initialized = PJ_TRUE;
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Verify that incoming request with Replaces header can be processed.
+ */
+PJ_DEF(pj_status_t) pjsip_replaces_verify_request( pjsip_rx_data *rdata,
+						   pjsip_dialog **p_dlg,
+						   pj_bool_t lock_dlg,
+						   pjsip_tx_data **p_tdata)
+{
+    const pj_str_t STR_REPLACES = { "Replaces", 8 };
+    pjsip_replaces_hdr *rep_hdr;
+    int code = 200;
+    const char *warn_text = NULL;
+    pjsip_hdr res_hdr_list;
+    pjsip_dialog *dlg = NULL;
+    pjsip_inv_session *inv;
+    pj_status_t status = PJ_SUCCESS;
+
+    PJ_ASSERT_RETURN(rdata && p_dlg, PJ_EINVAL);
+
+    /* Check that pjsip_replaces_init_module() has been called. */
+    PJ_ASSERT_RETURN(the_endpt != NULL, PJ_EINVALIDOP);
+
+
+    /* Init output arguments */
+    *p_dlg = NULL;
+    if (p_tdata) *p_tdata = NULL;
+
+    pj_list_init(&res_hdr_list);
+
+    /* Find Replaces header */
+    rep_hdr = (pjsip_replaces_hdr*) 
+	      pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &STR_REPLACES, 
+					 NULL);
+    if (!rep_hdr) {
+	/* No Replaces header. No further processing is necessary. */
+	return PJ_SUCCESS;
+    }
+
+
+    /* Check that there's no other Replaces header and return 400 Bad Request
+     * if not. 
+     */
+    if (pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &STR_REPLACES, 
+				   rep_hdr->next)) {
+	code = PJSIP_SC_BAD_REQUEST;
+	warn_text = "Found multiple Replaces headers";
+	goto on_return;
+    }
+
+    /* Find the dialog identified by Replaces header (and always lock the
+     * dialog no matter what application wants).
+     */
+    dlg = pjsip_ua_find_dialog(&rep_hdr->call_id, &rep_hdr->to_tag,
+			       &rep_hdr->from_tag, PJ_TRUE);
+
+    /* Respond with 481 "Call/Transaction Does Not Exist" response if
+     * no dialog is found.
+     */
+    if (dlg == NULL) {
+	code = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST;
+	warn_text = "No dialog found for Replaces request";
+	goto on_return;
+    }
+
+    /* Get the invite session within the dialog */
+    inv = pjsip_dlg_get_inv_session(dlg);
+
+    /* Return 481 if no invite session is present. */
+    if (inv == NULL) {
+	code = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST;
+	warn_text = "No INVITE session found for Replaces request";
+	goto on_return;
+    }
+
+    /* Return 603 Declined response if invite session has already 
+     * terminated 
+     */
+    if (inv->state >= PJSIP_INV_STATE_DISCONNECTED) {
+	code = PJSIP_SC_DECLINE;
+	warn_text = "INVITE session already terminated";
+	goto on_return;
+    }
+
+    /* If "early-only" flag is present, check that the invite session
+     * has not been confirmed yet. If the session has been confirmed, 
+     * return 486 "Busy Here" response.
+     */
+    if (rep_hdr->early_only && inv->state >= PJSIP_INV_STATE_CONNECTING) {
+	code = PJSIP_SC_BUSY_HERE;
+	warn_text = "INVITE session already established";
+	goto on_return;
+    }
+
+    /* If the Replaces header field matches an early dialog that was not
+     * initiated by this UA, it returns a 481 (Call/Transaction Does Not
+     * Exist) response to the new INVITE.
+     */
+    if (inv->state <= PJSIP_INV_STATE_EARLY && inv->role != PJSIP_ROLE_UAC)
+    {
+	/* Really return 481 only if call haven't reached early state or
+	 * accept-replace-in-early-state (ticket #1587) is not allowed.
+	 */
+	if (inv->state != PJSIP_INV_STATE_EARLY ||
+	    pjsip_cfg()->endpt.accept_replace_in_early_state == PJ_FALSE)
+	{
+	    code = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST;
+	    warn_text = "Found early INVITE session but not initiated by "
+			"this UA";
+	    goto on_return;
+	}
+    }
+
+
+    /*
+     * Looks like everything is okay!!
+     */
+    *p_dlg = dlg;
+    status = PJ_SUCCESS;
+    code = 200;
+
+on_return:
+
+    /* Create response if necessary */
+    if (code != 200) {
+	/* If we have dialog we must unlock it */
+	if (dlg)
+	    pjsip_dlg_dec_lock(dlg);
+
+	/* Create response */
+	if (p_tdata) {
+	    pjsip_tx_data *tdata;
+	    const pjsip_hdr *h;
+
+	    status = pjsip_endpt_create_response(the_endpt, rdata, code, 
+						 NULL, &tdata);
+
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    /* Add response headers. */
+	    h = res_hdr_list.next;
+	    while (h != &res_hdr_list) {
+		pjsip_hdr *cloned;
+
+		cloned = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, h);
+		PJ_ASSERT_RETURN(cloned, PJ_ENOMEM);
+
+		pjsip_msg_add_hdr(tdata->msg, cloned);
+
+		h = h->next;
+	    }
+
+	    /* Add warn text, if any */
+	    if (warn_text) {
+		pjsip_warning_hdr *warn_hdr;
+		pj_str_t warn_value = pj_str((char*)warn_text);
+
+		warn_hdr=pjsip_warning_hdr_create(tdata->pool, 399, 
+						  pjsip_endpt_name(the_endpt),
+						  &warn_value);
+		pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)warn_hdr);
+	    }
+
+	    *p_tdata = tdata;
+	}
+
+	/* Can not return PJ_SUCCESS when response message is produced.
+	 * Ref: PROTOS test ~#2490
+	 */
+	if (status == PJ_SUCCESS)
+	    status = PJSIP_ERRNO_FROM_SIP_STATUS(code);
+
+    } else {
+	/* If application doesn't want to lock the dialog, unlock it */
+	if (!lock_dlg)
+	    pjsip_dlg_dec_lock(dlg);
+    }
+
+    return status;
+}
+
+
+
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e45f17b1eefcb8b0ad4408c1a2e42f76ced59b0.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e45f17b1eefcb8b0ad4408c1a2e42f76ced59b0.svn-base
new file mode 100644
index 0000000..1fd7440
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e45f17b1eefcb8b0ad4408c1a2e42f76ced59b0.svn-base
@@ -0,0 +1,69 @@
+#if defined(PJ_BUILD_DLL)
+
+TARGET		pjsip.dll
+TARGETTYPE	dll
+
+UID		0x0 0xA0000007
+
+
+CAPABILITY	None
+LIBRARY		pjsdp.lib pjlib_util.lib pjlib.lib esock.lib insock.lib charconv.lib euser.lib estlib.lib
+MACRO		PJ_DLL
+MACRO		PJ_EXPORTING
+
+DEFFILE		.\pjsip.def
+
+#else
+
+TARGET 		pjsip.lib
+TARGETTYPE 	lib
+
+#endif
+
+SOURCEPATH	..\pjsip\src\pjsip
+
+MACRO		PJ_M_I386=1
+MACRO		PJ_SYMBIAN=1
+
+// Must compile as C++, otherwise exception would not work
+OPTION          CW -lang c++
+OPTION          ARMCC --cpp --gnu
+OPTION          GCC     -x c++
+OPTION          GCCE    -x c++
+
+// PJSIP-CORE files
+
+//SOURCE	sip_auth_aka.c
+SOURCE	sip_auth_client.c
+SOURCE	sip_auth_msg.c
+SOURCE	sip_auth_parser_wrap.cpp
+SOURCE	sip_auth_server.c
+SOURCE	sip_config.c
+SOURCE	sip_dialog_wrap.cpp
+SOURCE	sip_endpoint_wrap.cpp
+SOURCE	sip_errno.c
+SOURCE	sip_msg.c
+SOURCE	sip_multipart.c
+SOURCE	sip_parser_wrap.cpp
+SOURCE	sip_resolve.c
+SOURCE	sip_tel_uri_wrap.cpp
+SOURCE	sip_transaction.c
+SOURCE	sip_transport_wrap.cpp
+SOURCE	sip_transport_loop.c
+SOURCE	sip_transport_tcp.c
+SOURCE	sip_transport_udp.c
+SOURCE	sip_transport_tls.c
+SOURCE	sip_ua_layer.c
+SOURCE	sip_uri.c
+SOURCE	sip_util_wrap.cpp
+SOURCE	sip_util_proxy_wrap.cpp
+SOURCE	sip_util_statefull.c
+
+SYSTEMINCLUDE	..\pjlib\include 
+SYSTEMINCLUDE	..\pjlib-util\include 
+SYSTEMINCLUDE	..\pjsip\include
+
+SYSTEMINCLUDE	\epoc32\include
+SYSTEMINCLUDE	\epoc32\include\libc
+
+
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e4c45ee54553de16dbd9b0578bd6ba48f8526bd.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e4c45ee54553de16dbd9b0578bd6ba48f8526bd.svn-base
new file mode 100644
index 0000000..6b9b9df
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e4c45ee54553de16dbd9b0578bd6ba48f8526bd.svn-base
@@ -0,0 +1,198 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJ_POOL_ALT_H__
+#define __PJ_POOL_ALT_H__
+
+#define __PJ_POOL_H__
+
+
+/**
+ * The type for function to receive callback from the pool when it is unable
+ * to allocate memory. The elegant way to handle this condition is to throw
+ * exception, and this is what is expected by most of this library 
+ * components.
+ */
+typedef void pj_pool_callback(pj_pool_t *pool, pj_size_t size);
+
+struct pj_pool_mem
+{
+    struct pj_pool_mem *next;
+
+    /* data follows immediately */
+};
+
+
+struct pj_pool_t
+{
+    struct pj_pool_mem *first_mem;
+    pj_pool_factory    *factory;
+    char	        obj_name[32];
+    pj_size_t		used_size;
+    pj_pool_callback   *cb;
+};
+
+
+#define PJ_POOL_SIZE	        (sizeof(struct pj_pool_t))
+
+/**
+ * This constant denotes the exception number that will be thrown by default
+ * memory factory policy when memory allocation fails.
+ */
+extern int PJ_NO_MEMORY_EXCEPTION;
+
+
+
+/*
+ * Declare all pool API as macro that calls the implementation
+ * function.
+ */
+#define pj_pool_create(fc,nm,init,inc,cb)   \
+	pj_pool_create_imp(__FILE__, __LINE__, fc, nm, init, inc, cb)
+
+#define pj_pool_release(pool)		    pj_pool_release_imp(pool)
+#define pj_pool_getobjname(pool)	    pj_pool_getobjname_imp(pool)
+#define pj_pool_reset(pool)		    pj_pool_reset_imp(pool)
+#define pj_pool_get_capacity(pool)	    pj_pool_get_capacity_imp(pool)
+#define pj_pool_get_used_size(pool)	    pj_pool_get_used_size_imp(pool)
+#define pj_pool_alloc(pool,sz)		    \
+	pj_pool_alloc_imp(__FILE__, __LINE__, pool, sz)
+
+#define pj_pool_calloc(pool,cnt,elem)	    \
+	pj_pool_calloc_imp(__FILE__, __LINE__, pool, cnt, elem)
+
+#define pj_pool_zalloc(pool,sz)		    \
+	pj_pool_zalloc_imp(__FILE__, __LINE__, pool, sz)
+
+
+
+/*
+ * Declare prototypes for pool implementation API.
+ */
+
+/* Create pool */
+PJ_DECL(pj_pool_t*) pj_pool_create_imp(const char *file, int line,
+				       void *factory,
+				       const char *name,
+				       pj_size_t initial_size,
+				       pj_size_t increment_size,
+				       pj_pool_callback *callback);
+
+/* Release pool */
+PJ_DECL(void) pj_pool_release_imp(pj_pool_t *pool);
+
+/* Get pool name */
+PJ_DECL(const char*) pj_pool_getobjname_imp(pj_pool_t *pool);
+
+/* Reset pool */
+PJ_DECL(void) pj_pool_reset_imp(pj_pool_t *pool);
+
+/* Get capacity */
+PJ_DECL(pj_size_t) pj_pool_get_capacity_imp(pj_pool_t *pool);
+
+/* Get total used size */
+PJ_DECL(pj_size_t) pj_pool_get_used_size_imp(pj_pool_t *pool);
+
+/* Allocate memory from the pool */
+PJ_DECL(void*) pj_pool_alloc_imp(const char *file, int line, 
+				 pj_pool_t *pool, pj_size_t sz);
+
+/* Allocate memory from the pool and zero the memory */
+PJ_DECL(void*) pj_pool_calloc_imp(const char *file, int line, 
+				  pj_pool_t *pool, unsigned cnt, 
+				  unsigned elemsz);
+
+/* Allocate memory from the pool and zero the memory */
+PJ_DECL(void*) pj_pool_zalloc_imp(const char *file, int line, 
+				  pj_pool_t *pool, pj_size_t sz);
+
+
+#define PJ_POOL_ZALLOC_T(pool,type) \
+	    ((type*)pj_pool_zalloc(pool, sizeof(type)))
+#define PJ_POOL_ALLOC_T(pool,type) \
+	    ((type*)pj_pool_alloc(pool, sizeof(type)))
+#ifndef PJ_POOL_ALIGNMENT
+#   define PJ_POOL_ALIGNMENT    4
+#endif
+
+/**
+ * This structure declares pool factory interface.
+ */
+typedef struct pj_pool_factory_policy
+{
+    /**
+     * Allocate memory block (for use by pool). This function is called
+     * by memory pool to allocate memory block.
+     * 
+     * @param factory	Pool factory.
+     * @param size	The size of memory block to allocate.
+     *
+     * @return		Memory block.
+     */
+    void* (*block_alloc)(pj_pool_factory *factory, pj_size_t size);
+
+    /**
+     * Free memory block.
+     *
+     * @param factory	Pool factory.
+     * @param mem	Memory block previously allocated by block_alloc().
+     * @param size	The size of memory block.
+     */
+    void (*block_free)(pj_pool_factory *factory, void *mem, pj_size_t size);
+
+    /**
+     * Default callback to be called when memory allocation fails.
+     */
+    pj_pool_callback *callback;
+
+    /**
+     * Option flags.
+     */
+    unsigned flags;
+
+} pj_pool_factory_policy;
+
+struct pj_pool_factory
+{
+    pj_pool_factory_policy policy;
+    int dummy;
+};
+
+struct pj_caching_pool 
+{
+    pj_pool_factory factory;
+
+    /* just to make it compilable */
+    unsigned used_count;
+    unsigned used_size;
+    unsigned peak_used_size;
+};
+
+/* just to make it compilable */
+typedef struct pj_pool_block
+{
+    int dummy;
+} pj_pool_block;
+
+#define pj_caching_pool_init( cp, pol, mac)
+#define pj_caching_pool_destroy(cp)
+#define pj_pool_factory_dump(pf, detail)
+
+#endif	/* __PJ_POOL_ALT_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e5c8c0e3989941468d8c4f606899eaa14082ebd.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e5c8c0e3989941468d8c4f606899eaa14082ebd.svn-base
new file mode 100644
index 0000000..b2c0e1a
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e5c8c0e3989941468d8c4f606899eaa14082ebd.svn-base
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioPropertySheet

+	ProjectType="Visual C++"

+	Version="8.00"

+	Name="pjproject-vs8-wm6-release-defaults"

+	InheritedPropertySheets=".\pjproject-vs8-wm6-common-defaults.vsprops"

+	>

+</VisualStudioPropertySheet>

diff --git a/jni/pjproject-android/.svn/pristine/4e/4e6f1a43accab0c3308f63592db2a7ac45a0976d.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e6f1a43accab0c3308f63592db2a7ac45a0976d.svn-base
new file mode 100644
index 0000000..09239b0
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e6f1a43accab0c3308f63592db2a7ac45a0976d.svn-base
@@ -0,0 +1,1021 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#include <pj/sock.h>
+#include <pj/addr_resolv.h>
+#include <pj/assert.h>
+#include <pj/errno.h>
+#include <pj/os.h>
+#include <pj/string.h>
+#include <pj/unicode.h>
+
+#include "os_symbian.h"
+
+
+/*
+ * Address families.
+ */
+const pj_uint16_t PJ_AF_UNSPEC	= KAFUnspec;
+const pj_uint16_t PJ_AF_UNIX	= 0xFFFF;
+const pj_uint16_t PJ_AF_INET	= KAfInet;
+const pj_uint16_t PJ_AF_INET6	= KAfInet6;
+const pj_uint16_t PJ_AF_PACKET	= 0xFFFF;
+const pj_uint16_t PJ_AF_IRDA	= 0xFFFF;
+
+/*
+ * Socket types conversion.
+ * The values here are indexed based on pj_sock_type
+ */
+const pj_uint16_t PJ_SOCK_STREAM= KSockStream;
+const pj_uint16_t PJ_SOCK_DGRAM	= KSockDatagram;
+const pj_uint16_t PJ_SOCK_RAW	= 0xFFFF;
+const pj_uint16_t PJ_SOCK_RDM	= 0xFFFF;
+
+/* we don't support setsockopt(), these are just dummy values */
+const pj_uint16_t PJ_SOL_SOCKET	= 0xFFFF;
+const pj_uint16_t PJ_SOL_IP	= 0xFFFF;
+const pj_uint16_t PJ_SOL_TCP	= 0xFFFF;
+const pj_uint16_t PJ_SOL_UDP	= 0xFFFF;
+const pj_uint16_t PJ_SOL_IPV6	= 0xFFFF;
+const pj_uint16_t PJ_SO_NOSIGPIPE = 0xFFFF;
+
+/* TOS */
+const pj_uint16_t PJ_IP_TOS		= 0;
+const pj_uint16_t PJ_IPTOS_LOWDELAY	= 0;
+const pj_uint16_t PJ_IPTOS_THROUGHPUT	= 0;
+const pj_uint16_t PJ_IPTOS_RELIABILITY	= 0;
+const pj_uint16_t PJ_IPTOS_MINCOST	= 0;
+
+/* Misc */
+const pj_uint16_t PJ_TCP_NODELAY = 0xFFFF;
+const pj_uint16_t PJ_SO_REUSEADDR = 0xFFFF;
+const pj_uint16_t PJ_SO_PRIORITY = 0xFFFF;
+
+/* ioctl() is also not supported. */
+const pj_uint16_t PJ_SO_TYPE    = 0xFFFF;
+const pj_uint16_t PJ_SO_RCVBUF  = 0xFFFF;
+const pj_uint16_t PJ_SO_SNDBUF  = 0xFFFF;
+
+/* IP multicast is also not supported. */
+const pj_uint16_t PJ_IP_MULTICAST_IF    = 0xFFFF;
+const pj_uint16_t PJ_IP_MULTICAST_TTL   = 0xFFFF;
+const pj_uint16_t PJ_IP_MULTICAST_LOOP  = 0xFFFF;
+const pj_uint16_t PJ_IP_ADD_MEMBERSHIP  = 0xFFFF;
+const pj_uint16_t PJ_IP_DROP_MEMBERSHIP = 0xFFFF;
+
+/* Flags */
+const int PJ_MSG_OOB	     = 0;
+const int PJ_MSG_PEEK	     = KSockReadPeek;
+const int PJ_MSG_DONTROUTE   = 0;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// CPjSocket implementation.
+// (declaration is in os_symbian.h)
+//
+
+CPjSocket::~CPjSocket()
+{
+    DestroyReader();
+    sock_.Close();
+}
+
+
+// Create socket reader.
+CPjSocketReader *CPjSocket::CreateReader(unsigned max_len)
+{
+    pj_assert(sockReader_ == NULL);
+    return sockReader_ = CPjSocketReader::NewL(*this, max_len);
+}
+
+// Delete socket reader when it's not wanted.
+void CPjSocket::DestroyReader() 
+{
+    if (sockReader_) {
+	sockReader_->Cancel();
+	delete sockReader_;
+	sockReader_ = NULL;
+    }
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// CPjSocketReader implementation
+// (declaration in os_symbian.h)
+//
+
+
+CPjSocketReader::CPjSocketReader(CPjSocket &sock)
+: CActive(EPriorityStandard), 
+  sock_(sock), buffer_(NULL, 0), readCb_(NULL), key_(NULL)
+{
+}
+
+
+void CPjSocketReader::ConstructL(unsigned max_len)
+{
+    isDatagram_ = sock_.IsDatagram();
+
+    TUint8 *ptr = new TUint8[max_len];
+    buffer_.Set(ptr, 0, (TInt)max_len);
+    CActiveScheduler::Add(this);
+}
+
+CPjSocketReader *CPjSocketReader::NewL(CPjSocket &sock, unsigned max_len)
+{
+    CPjSocketReader *self = new (ELeave) CPjSocketReader(sock);
+    CleanupStack::PushL(self);
+    self->ConstructL(max_len);
+    CleanupStack::Pop(self);
+
+    return self;
+}
+
+
+CPjSocketReader::~CPjSocketReader()
+{
+    const TUint8 *data = buffer_.Ptr();
+    delete [] data;
+}
+
+void CPjSocketReader::StartRecv(void (*cb)(void *key), 
+			        void *key, 
+			        TDes8 *aDesc,
+			        TUint flags)
+{
+    StartRecvFrom(cb, key, aDesc, flags, NULL);
+}
+
+void CPjSocketReader::StartRecvFrom(void (*cb)(void *key), 
+				    void *key, 
+				    TDes8 *aDesc,
+				    TUint flags,
+				    TSockAddr *fromAddr)
+{
+    readCb_ = cb;
+    key_ = key;
+
+    if (aDesc == NULL) aDesc = &buffer_;
+    if (fromAddr == NULL) fromAddr = &recvAddr_;
+
+    sock_.Socket().RecvFrom(*aDesc, *fromAddr, flags, iStatus);
+    SetActive();
+}
+
+void CPjSocketReader::DoCancel()
+{
+    sock_.Socket().CancelRecv();
+}
+
+void CPjSocketReader::RunL()
+{
+    void (*old_cb)(void *key) = readCb_;
+    void *old_key = key_;
+
+    readCb_ = NULL;
+    key_ = NULL;
+
+    if (old_cb) {
+	(*old_cb)(old_key);
+    }
+}
+
+// Append data to aDesc, up to aDesc's maximum size.
+// If socket is datagram based, buffer_ will be clared.
+void CPjSocketReader::ReadData(TDes8 &aDesc, TInetAddr *addr)
+{
+    if (isDatagram_)
+	aDesc.Zero();
+
+    if (buffer_.Length() == 0)
+	return;
+
+    TInt size_to_copy = aDesc.MaxLength() - aDesc.Length();
+    if (size_to_copy > buffer_.Length())
+	size_to_copy = buffer_.Length();
+
+    aDesc.Append(buffer_.Ptr(), size_to_copy);
+
+    if (isDatagram_)
+	buffer_.Zero();
+    else
+	buffer_.Delete(0, size_to_copy);
+
+    if (addr)
+	*addr = recvAddr_;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// PJLIB's sock.h implementation
+//
+
+/*
+ * Convert 16-bit value from network byte order to host byte order.
+ */
+PJ_DEF(pj_uint16_t) pj_ntohs(pj_uint16_t netshort)
+{
+#if PJ_IS_LITTLE_ENDIAN
+    return pj_swap16(netshort);
+#else
+    return netshort;
+#endif
+}
+
+/*
+ * Convert 16-bit value from host byte order to network byte order.
+ */
+PJ_DEF(pj_uint16_t) pj_htons(pj_uint16_t hostshort)
+{
+#if PJ_IS_LITTLE_ENDIAN
+    return pj_swap16(hostshort);
+#else
+    return hostshort;
+#endif
+}
+
+/*
+ * Convert 32-bit value from network byte order to host byte order.
+ */
+PJ_DEF(pj_uint32_t) pj_ntohl(pj_uint32_t netlong)
+{
+#if PJ_IS_LITTLE_ENDIAN
+    return pj_swap32(netlong);
+#else
+    return netlong;
+#endif
+}
+
+/*
+ * Convert 32-bit value from host byte order to network byte order.
+ */
+PJ_DEF(pj_uint32_t) pj_htonl(pj_uint32_t hostlong)
+{
+#if PJ_IS_LITTLE_ENDIAN
+    return pj_swap32(hostlong);
+#else
+    return netlong;
+#endif
+}
+
+/*
+ * Convert an Internet host address given in network byte order
+ * to string in standard numbers and dots notation.
+ */
+PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr)
+{
+	static char str8[PJ_INET_ADDRSTRLEN];
+    TBuf<PJ_INET_ADDRSTRLEN> str16(0);
+
+    /* (Symbian IP address is in host byte order) */
+    TInetAddr temp_addr((TUint32)pj_ntohl(inaddr.s_addr), (TUint)0);
+    temp_addr.Output(str16);
+ 
+    return pj_unicode_to_ansi((const wchar_t*)str16.PtrZ(), str16.Length(),
+			      str8, sizeof(str8));
+}
+
+/*
+ * This function converts the Internet host address cp from the standard
+ * numbers-and-dots notation into binary data and stores it in the structure
+ * that inp points to. 
+ */
+PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)
+{
+    enum { MAXIPLEN = PJ_INET_ADDRSTRLEN };
+
+    /* Initialize output with PJ_INADDR_NONE.
+     * Some apps relies on this instead of the return value
+     * (and anyway the return value is quite confusing!)
+     */
+    inp->s_addr = PJ_INADDR_NONE;
+
+    /* Caution:
+     *	this function might be called with cp->slen >= 16
+     *  (i.e. when called with hostname to check if it's an IP addr).
+     */
+    PJ_ASSERT_RETURN(cp && cp->slen && inp, 0);
+    if (cp->slen >= 16) {
+	return 0;
+    }
+
+    char tempaddr8[MAXIPLEN];
+    pj_memcpy(tempaddr8, cp->ptr, cp->slen);
+    tempaddr8[cp->slen] = '\0';
+
+    wchar_t tempaddr16[MAXIPLEN];
+    pj_ansi_to_unicode(tempaddr8, pj_ansi_strlen(tempaddr8),
+		       tempaddr16, sizeof(tempaddr16));
+
+    TBuf<MAXIPLEN> ip_addr((const TText*)tempaddr16);
+
+    TInetAddr addr;
+    addr.Init(KAfInet);
+    if (addr.Input(ip_addr) == KErrNone) {
+	/* Success (Symbian IP address is in host byte order) */
+	inp->s_addr = pj_htonl(addr.Address());
+	return 1;
+    } else {
+	/* Error */
+	return 0;
+    }
+}
+
+/*
+ * Convert text to IPv4/IPv6 address.
+ */
+PJ_DEF(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst)
+{
+    char tempaddr[PJ_INET6_ADDRSTRLEN];
+
+    PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL);
+    PJ_ASSERT_RETURN(src && src->slen && dst, PJ_EINVAL);
+
+    /* Initialize output with PJ_IN_ADDR_NONE for IPv4 (to be 
+     * compatible with pj_inet_aton()
+     */
+    if (af==PJ_AF_INET) {
+	((pj_in_addr*)dst)->s_addr = PJ_INADDR_NONE;
+    }
+
+    /* Caution:
+     *	this function might be called with cp->slen >= 46
+     *  (i.e. when called with hostname to check if it's an IP addr).
+     */
+    if (src->slen >= PJ_INET6_ADDRSTRLEN) {
+	return PJ_ENAMETOOLONG;
+    }
+
+    pj_memcpy(tempaddr, src->ptr, src->slen);
+    tempaddr[src->slen] = '\0';
+
+
+    wchar_t tempaddr16[PJ_INET6_ADDRSTRLEN];
+    pj_ansi_to_unicode(tempaddr, pj_ansi_strlen(tempaddr),
+		       tempaddr16, sizeof(tempaddr16));
+
+    TBuf<PJ_INET6_ADDRSTRLEN> ip_addr((const TText*)tempaddr16);
+
+    TInetAddr addr;
+    addr.Init(KAfInet6);
+    if (addr.Input(ip_addr) == KErrNone) {
+	if (af==PJ_AF_INET) {
+	    /* Success (Symbian IP address is in host byte order) */
+	    pj_uint32_t ip = pj_htonl(addr.Address());
+	    pj_memcpy(dst, &ip, 4);
+	} else if (af==PJ_AF_INET6) {
+	    const TIp6Addr & ip6 = addr.Ip6Address();
+	    pj_memcpy(dst, ip6.u.iAddr8, 16);
+	} else {
+	    pj_assert(!"Unexpected!");
+	    return PJ_EBUG;
+	}
+	return PJ_SUCCESS;
+    } else {
+	/* Error */
+	return PJ_EINVAL;
+    }
+}
+
+/*
+ * Convert IPv4/IPv6 address to text.
+ */
+PJ_DEF(pj_status_t) pj_inet_ntop(int af, const void *src,
+				 char *dst, int size)
+
+{
+    PJ_ASSERT_RETURN(src && dst && size, PJ_EINVAL);
+
+    *dst = '\0';
+
+    if (af==PJ_AF_INET) {
+
+	TBuf<PJ_INET_ADDRSTRLEN> str16;
+	pj_in_addr inaddr;
+
+	if (size < PJ_INET_ADDRSTRLEN)
+	    return PJ_ETOOSMALL;
+
+	pj_memcpy(&inaddr, src, 4);
+
+	/* Symbian IP address is in host byte order */
+	TInetAddr temp_addr((TUint32)pj_ntohl(inaddr.s_addr), (TUint)0);
+	temp_addr.Output(str16);
+ 
+	pj_unicode_to_ansi((const wchar_t*)str16.PtrZ(), str16.Length(),
+			   dst, size);
+	return PJ_SUCCESS;
+
+    } else if (af==PJ_AF_INET6) {
+	TBuf<PJ_INET6_ADDRSTRLEN> str16;
+
+	if (size < PJ_INET6_ADDRSTRLEN)
+	    return PJ_ETOOSMALL;
+
+	TIp6Addr ip6;
+	pj_memcpy(ip6.u.iAddr8, src, 16);
+
+	TInetAddr temp_addr(ip6, (TUint)0);
+	temp_addr.Output(str16);
+ 
+	pj_unicode_to_ansi((const wchar_t*)str16.PtrZ(), str16.Length(),
+			   dst, size);
+	return PJ_SUCCESS;
+
+    } else {
+	pj_assert(!"Unsupport address family");
+	return PJ_EINVAL;
+    }
+
+}
+
+/*
+ * Get hostname.
+ */
+PJ_DEF(const pj_str_t*) pj_gethostname(void)
+{
+    static char buf[PJ_MAX_HOSTNAME];
+    static pj_str_t hostname;
+
+    PJ_CHECK_STACK();
+
+    if (hostname.ptr == NULL) {
+	RHostResolver &resv = PjSymbianOS::Instance()->GetResolver(PJ_AF_INET);
+	TRequestStatus reqStatus;
+	THostName tmpName;
+
+	// Return empty hostname if access point is marked as down by app.
+	PJ_SYMBIAN_CHECK_CONNECTION2(&hostname);
+
+	resv.GetHostName(tmpName, reqStatus);
+	User::WaitForRequest(reqStatus);
+
+	hostname.ptr = pj_unicode_to_ansi((const wchar_t*)tmpName.Ptr(), tmpName.Length(),
+					  buf, sizeof(buf));
+	hostname.slen = tmpName.Length();
+    }
+    return &hostname;
+}
+
+/*
+ * Create new socket/endpoint for communication and returns a descriptor.
+ */
+PJ_DEF(pj_status_t) pj_sock_socket(int af, 
+				   int type, 
+				   int proto,
+				   pj_sock_t *p_sock)
+{
+    TInt rc;
+
+    PJ_CHECK_STACK();
+
+    /* Sanity checks. */
+    PJ_ASSERT_RETURN(p_sock!=NULL, PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+    
+    /* Set proto if none is specified. */
+    if (proto == 0) {
+	if (type == pj_SOCK_STREAM())
+	    proto = KProtocolInetTcp;
+	else if (type == pj_SOCK_DGRAM())
+	    proto = KProtocolInetUdp;
+    }
+
+    /* Create Symbian RSocket */
+    RSocket rSock;
+    if (PjSymbianOS::Instance()->Connection())
+    	rc = rSock.Open(PjSymbianOS::Instance()->SocketServ(), 
+    			af, type, proto,
+    			*PjSymbianOS::Instance()->Connection());
+    else
+    	rc = rSock.Open(PjSymbianOS::Instance()->SocketServ(), 
+    			af, type, proto);
+        
+    if (rc != KErrNone)
+	return PJ_RETURN_OS_ERROR(rc);
+
+
+    /* Wrap Symbian RSocket into PJLIB's CPjSocket, and return to caller */
+    CPjSocket *pjSock = new CPjSocket(af, type, rSock);
+    *p_sock = (pj_sock_t)pjSock;
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Bind socket.
+ */
+PJ_DEF(pj_status_t) pj_sock_bind( pj_sock_t sock, 
+				  const pj_sockaddr_t *addr,
+				  int len)
+{
+    pj_status_t status;
+    TInt rc;
+
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock != 0, PJ_EINVAL);
+    PJ_ASSERT_RETURN(addr && len>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
+
+    // Convert PJLIB's pj_sockaddr into Symbian's TInetAddr
+    TInetAddr inetAddr;
+    status = PjSymbianOS::pj2Addr(*(pj_sockaddr*)addr, len, inetAddr);
+    if (status != PJ_SUCCESS)
+    	return status;
+
+    // Get the RSocket instance
+    RSocket &rSock = ((CPjSocket*)sock)->Socket();
+
+    // Bind
+    rc = rSock.Bind(inetAddr);
+
+    return (rc==KErrNone) ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(rc);
+}
+
+
+/*
+ * Bind socket.
+ */
+PJ_DEF(pj_status_t) pj_sock_bind_in( pj_sock_t sock, 
+				     pj_uint32_t addr32,
+				     pj_uint16_t port)
+{
+    pj_sockaddr_in addr;
+
+    PJ_CHECK_STACK();
+
+    pj_bzero(&addr, sizeof(addr));
+    addr.sin_family = PJ_AF_INET;
+    addr.sin_addr.s_addr = pj_htonl(addr32);
+    addr.sin_port = pj_htons(port);
+
+    return pj_sock_bind(sock, &addr, sizeof(pj_sockaddr_in));
+}
+
+
+/*
+ * Close socket.
+ */
+PJ_DEF(pj_status_t) pj_sock_close(pj_sock_t sock)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock != 0, PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+
+    // This will close the socket.
+    delete pjSock;
+
+    return PJ_SUCCESS;
+}
+
+/*
+ * Get remote's name.
+ */
+PJ_DEF(pj_status_t) pj_sock_getpeername( pj_sock_t sock,
+					 pj_sockaddr_t *addr,
+					 int *namelen)
+{
+    PJ_CHECK_STACK();
+    
+    PJ_ASSERT_RETURN(sock && addr && namelen && 
+		     *namelen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    // Socket must be connected.
+    PJ_ASSERT_RETURN(pjSock->IsConnected(), PJ_EINVALIDOP);
+
+    TInetAddr inetAddr;
+    rSock.RemoteName(inetAddr);
+
+    return PjSymbianOS::Addr2pj(inetAddr, *(pj_sockaddr*)addr, namelen);
+}
+
+/*
+ * Get socket name.
+ */
+PJ_DEF(pj_status_t) pj_sock_getsockname( pj_sock_t sock,
+					 pj_sockaddr_t *addr,
+					 int *namelen)
+{
+    PJ_CHECK_STACK();
+    
+    PJ_ASSERT_RETURN(sock && addr && namelen && 
+		     *namelen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    TInetAddr inetAddr;
+    rSock.LocalName(inetAddr);
+
+    return PjSymbianOS::Addr2pj(inetAddr, *(pj_sockaddr*)addr, namelen);
+}
+
+/*
+ * Send data
+ */
+PJ_DEF(pj_status_t) pj_sock_send(pj_sock_t sock,
+				 const void *buf,
+				 pj_ssize_t *len,
+				 unsigned flags)
+{
+    PJ_CHECK_STACK();
+    PJ_ASSERT_RETURN(sock && buf && len, PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+    
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    // send() should only be called to connected socket
+    PJ_ASSERT_RETURN(pjSock->IsConnected(), PJ_EINVALIDOP);
+
+    TPtrC8 data((const TUint8*)buf, (TInt)*len);
+    TRequestStatus reqStatus;
+    TSockXfrLength sentLen;
+
+    rSock.Send(data, flags, reqStatus, sentLen);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus.Int()==KErrNone) {
+	//*len = (TInt) sentLen.Length();
+	return PJ_SUCCESS;
+    } else
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+}
+
+
+/*
+ * Send data.
+ */
+PJ_DEF(pj_status_t) pj_sock_sendto(pj_sock_t sock,
+				   const void *buf,
+				   pj_ssize_t *len,
+				   unsigned flags,
+				   const pj_sockaddr_t *to,
+				   int tolen)
+{
+    pj_status_t status;
+    
+    PJ_CHECK_STACK();
+    PJ_ASSERT_RETURN(sock && buf && len, PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+    
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    // Only supports AF_INET for now
+    PJ_ASSERT_RETURN(tolen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
+
+    TInetAddr inetAddr;
+    status = PjSymbianOS::pj2Addr(*(pj_sockaddr*)to, tolen, inetAddr);
+    if (status != PJ_SUCCESS)
+    	return status;
+
+    TPtrC8 data((const TUint8*)buf, (TInt)*len);
+    TRequestStatus reqStatus;
+    TSockXfrLength sentLen;
+
+    rSock.SendTo(data, inetAddr, flags, reqStatus, sentLen);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus.Int()==KErrNone) {
+	//For some reason TSockXfrLength is not returning correctly!
+	//*len = (TInt) sentLen.Length();
+	return PJ_SUCCESS;
+    } else 
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+}
+
+/*
+ * Receive data.
+ */
+PJ_DEF(pj_status_t) pj_sock_recv(pj_sock_t sock,
+				 void *buf,
+				 pj_ssize_t *len,
+				 unsigned flags)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock && buf && len, PJ_EINVAL);
+    PJ_ASSERT_RETURN(*len > 0, PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+
+    if (pjSock->Reader()) {
+	CPjSocketReader *reader = pjSock->Reader();
+
+	while (reader->IsActive() && !reader->HasData()) {
+	    User::WaitForAnyRequest();
+	}
+
+	if (reader->HasData()) {
+	    TPtr8 data((TUint8*)buf, (TInt)*len);
+	    TInetAddr inetAddr;
+
+	    reader->ReadData(data, &inetAddr);
+
+	    *len = data.Length();
+	    return PJ_SUCCESS;
+	}
+    }
+
+    TRequestStatus reqStatus;
+    TSockXfrLength recvLen;
+    TPtr8 data((TUint8*)buf, (TInt)*len, (TInt)*len);
+
+    if (pjSock->IsDatagram()) {
+	pjSock->Socket().Recv(data, flags, reqStatus);
+    } else {
+	// Using static like this is not pretty, but we don't need to use
+	// the value anyway, hence doing it like this is probably most
+	// optimal.
+	static TSockXfrLength len;
+	pjSock->Socket().RecvOneOrMore(data, flags, reqStatus, len);
+    }
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus == KErrNone) {
+	//*len = (TInt)recvLen.Length();
+	*len = data.Length();
+	return PJ_SUCCESS;
+    } else {
+	*len = -1;
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+    }
+}
+
+/*
+ * Receive data.
+ */
+PJ_DEF(pj_status_t) pj_sock_recvfrom(pj_sock_t sock,
+				     void *buf,
+				     pj_ssize_t *len,
+				     unsigned flags,
+				     pj_sockaddr_t *from,
+				     int *fromlen)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock && buf && len && from && fromlen, PJ_EINVAL);
+    PJ_ASSERT_RETURN(*len > 0, PJ_EINVAL);
+    PJ_ASSERT_RETURN(*fromlen >= (int)sizeof(pj_sockaddr_in), PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    if (pjSock->Reader()) {
+	CPjSocketReader *reader = pjSock->Reader();
+
+	while (reader->IsActive() && !reader->HasData()) {
+	    User::WaitForAnyRequest();
+	}
+
+	if (reader->HasData()) {
+	    TPtr8 data((TUint8*)buf, (TInt)*len);
+	    TInetAddr inetAddr;
+
+	    reader->ReadData(data, &inetAddr);
+
+	    *len = data.Length();
+
+	    if (from && fromlen) {
+		return PjSymbianOS::Addr2pj(inetAddr, *(pj_sockaddr*)from, 
+					    fromlen);
+	    } else {
+	    	return PJ_SUCCESS;
+	    }
+	}
+    }
+
+    TInetAddr inetAddr;
+    TRequestStatus reqStatus;
+    TSockXfrLength recvLen;
+    TPtr8 data((TUint8*)buf, (TInt)*len, (TInt)*len);
+
+    rSock.RecvFrom(data, inetAddr, flags, reqStatus, recvLen);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus == KErrNone) {
+	//*len = (TInt)recvLen.Length();
+	*len = data.Length();
+	return PjSymbianOS::Addr2pj(inetAddr, *(pj_sockaddr*)from, fromlen);
+    } else {
+	*len = -1;
+	*fromlen = -1;
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+    }
+}
+
+/*
+ * Get socket option.
+ */
+PJ_DEF(pj_status_t) pj_sock_getsockopt( pj_sock_t sock,
+					pj_uint16_t level,
+					pj_uint16_t optname,
+					void *optval,
+					int *optlen)
+{
+    // Not supported for now.
+    PJ_UNUSED_ARG(sock);
+    PJ_UNUSED_ARG(level);
+    PJ_UNUSED_ARG(optname);
+    PJ_UNUSED_ARG(optval);
+    PJ_UNUSED_ARG(optlen);
+    return PJ_EINVALIDOP;
+}
+
+/*
+ * Set socket option.
+ */
+PJ_DEF(pj_status_t) pj_sock_setsockopt( pj_sock_t sock,
+					pj_uint16_t level,
+					pj_uint16_t optname,
+					const void *optval,
+					int optlen)
+{
+    // Not supported for now.
+    PJ_UNUSED_ARG(sock);
+    PJ_UNUSED_ARG(level);
+    PJ_UNUSED_ARG(optname);
+    PJ_UNUSED_ARG(optval);
+    PJ_UNUSED_ARG(optlen);
+    return PJ_EINVALIDOP;
+}
+
+/*
+ * Connect socket.
+ */
+PJ_DEF(pj_status_t) pj_sock_connect( pj_sock_t sock,
+				     const pj_sockaddr_t *addr,
+				     int namelen)
+{
+    pj_status_t status;
+    
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock && addr && namelen, PJ_EINVAL);
+    PJ_ASSERT_RETURN(((pj_sockaddr*)addr)->addr.sa_family == PJ_AF_INET, 
+		     PJ_EINVAL);
+
+    // Return failure if access point is marked as down by app.
+    PJ_SYMBIAN_CHECK_CONNECTION();
+    
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    TInetAddr inetAddr;
+    TRequestStatus reqStatus;
+
+    status = PjSymbianOS::pj2Addr(*(pj_sockaddr*)addr, namelen, inetAddr);
+    if (status != PJ_SUCCESS)
+    	return status;
+
+    rSock.Connect(inetAddr, reqStatus);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus == KErrNone) {
+	pjSock->SetConnected(true);
+	return PJ_SUCCESS;
+    } else {
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+    }
+}
+
+
+/*
+ * Shutdown socket.
+ */
+#if PJ_HAS_TCP
+PJ_DEF(pj_status_t) pj_sock_shutdown( pj_sock_t sock,
+				      int how)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock, PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    RSocket::TShutdown aHow;
+    if (how == PJ_SD_RECEIVE)
+	aHow = RSocket::EStopInput;
+    else if (how == PJ_SHUT_WR)
+	aHow = RSocket::EStopOutput;
+    else
+	aHow = RSocket::ENormal;
+
+    TRequestStatus reqStatus;
+
+    rSock.Shutdown(aHow, reqStatus);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus == KErrNone) {
+	return PJ_SUCCESS;
+    } else {
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+    }
+}
+
+/*
+ * Start listening to incoming connections.
+ */
+PJ_DEF(pj_status_t) pj_sock_listen( pj_sock_t sock,
+				    int backlog)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(sock && backlog, PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)sock;
+    RSocket &rSock = pjSock->Socket();
+
+    TInt rc = rSock.Listen((TUint)backlog);
+
+    if (rc == KErrNone) {
+	return PJ_SUCCESS;
+    } else {
+	return PJ_RETURN_OS_ERROR(rc);
+    }
+}
+
+/*
+ * Accept incoming connections
+ */
+PJ_DEF(pj_status_t) pj_sock_accept( pj_sock_t serverfd,
+				    pj_sock_t *newsock,
+				    pj_sockaddr_t *addr,
+				    int *addrlen)
+{
+    PJ_CHECK_STACK();
+
+    PJ_ASSERT_RETURN(serverfd && newsock, PJ_EINVAL);
+
+    CPjSocket *pjSock = (CPjSocket*)serverfd;
+    RSocket &rSock = pjSock->Socket();
+
+    // Create a 'blank' socket
+    RSocket newSock;
+    newSock.Open(PjSymbianOS::Instance()->SocketServ());
+
+    // Call Accept()
+    TRequestStatus reqStatus;
+
+    rSock.Accept(newSock, reqStatus);
+    User::WaitForRequest(reqStatus);
+
+    if (reqStatus != KErrNone) {
+	return PJ_RETURN_OS_ERROR(reqStatus.Int());
+    }
+
+    // Create PJ socket
+    CPjSocket *newPjSock = new CPjSocket(pjSock->GetAf(), pjSock->GetSockType(),
+					 newSock);
+    newPjSock->SetConnected(true);
+
+    *newsock = (pj_sock_t) newPjSock;
+
+    if (addr && addrlen) {
+	return pj_sock_getpeername(*newsock, addr, addrlen);
+    }
+
+    return PJ_SUCCESS;
+}
+#endif	/* PJ_HAS_TCP */
+
+
diff --git a/jni/pjproject-android/.svn/pristine/4e/4e7935837c402bb6e5e56e399ab40b9cd1edcb3c.svn-base b/jni/pjproject-android/.svn/pristine/4e/4e7935837c402bb6e5e56e399ab40b9cd1edcb3c.svn-base
new file mode 100644
index 0000000..e82e875
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4e7935837c402bb6e5e56e399ab40b9cd1edcb3c.svn-base
@@ -0,0 +1,163 @@
+/* Copyright (C) 2002 Jean-Marc Valin 
+   File: high_lsp_tables.c
+   Codebooks for high-band LSPs in SB-CELP mode
+  
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.  
+
+   2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+ 
+const signed char high_lsp_cdbk[512]={
+39,12,-14,-20,-29,-61,-67,-76,
+-32,-71,-67,68,77,46,34,5,
+-13,-48,-46,-72,-81,-84,-60,-58,
+-40,-28,82,93,68,45,29,3,
+-19,-47,-28,-43,-35,-30,-8,-13,
+-39,-91,-91,-123,-96,10,10,-6,
+-18,-55,-60,-91,-56,-36,-27,-16,
+-48,-75,40,28,-10,-28,35,9,
+37,19,1,-20,-31,-41,-18,-25,
+-35,-68,-80,45,27,-1,47,13,
+0,-29,-35,-57,-50,-79,-73,-38,
+-19,5,35,14,-10,-23,16,-8,
+5,-24,-40,-62,-23,-27,-22,-16,
+-18,-46,-72,-77,43,21,33,1,
+-80,-70,-70,-64,-56,-52,-39,-33,
+-31,-38,-19,-19,-15,32,33,-2,
+7,-15,-15,-24,-23,-33,-41,-56,
+-24,-57,5,89,64,41,27,5,
+-9,-47,-60,-97,-97,-124,-20,-9,
+-44,-73,31,29,-4,64,48,7,
+-35,-57,0,-3,-26,-47,-3,-6,
+-40,-76,-79,-48,12,81,55,10,
+9,-24,-43,-73,-57,-69,16,5,
+-28,-53,18,29,20,0,-4,-11,
+6,-13,23,7,-17,-35,-37,-37,
+-30,-68,-63,6,24,-9,-14,3,
+21,-13,-27,-57,-49,-80,-24,-41,
+-5,-16,-5,1,45,25,12,-7,
+3,-15,-6,-16,-15,-8,6,-13,
+-42,-81,-80,-87,14,1,-10,-3,
+-43,-69,-46,-24,-28,-29,36,6,
+-43,-56,-12,12,54,79,43,9,
+54,22,2,8,-12,-43,-46,-52,
+-38,-69,-89,-5,75,38,33,5,
+-13,-53,-62,-87,-89,-113,-99,-55,
+-34,-37,62,55,33,16,21,-2,
+-17,-46,-29,-38,-38,-48,-39,-42,
+-36,-75,-72,-88,-48,-30,21,2,
+-15,-57,-64,-98,-84,-76,25,1,
+-46,-80,-12,18,-7,3,34,6,
+38,31,23,4,-1,20,14,-15,
+-43,-78,-91,-24,14,-3,54,16,
+0,-27,-28,-44,-56,-83,-92,-89,
+-3,34,56,41,36,22,20,-8,
+-7,-35,-42,-62,-49,3,12,-10,
+-50,-87,-96,-66,92,70,38,9,
+-70,-71,-62,-42,-39,-43,-11,-7,
+-50,-79,-58,-50,-31,32,31,-6,
+-4,-25,7,-17,-38,-70,-58,-27,
+-43,-83,-28,59,36,20,31,2,
+-27,-71,-80,-109,-98,-75,-33,-32,
+-31,-2,33,15,-6,43,33,-5,
+0,-22,-10,-27,-34,-49,-11,-20,
+-41,-91,-100,-121,-39,57,41,10,
+-19,-50,-38,-59,-60,-70,-18,-20,
+-8,-31,-8,-15,1,-14,-26,-25,
+33,21,32,17,1,-19,-19,-26,
+-58,-81,-35,-22,45,30,11,-11,
+3,-26,-48,-87,-67,-83,-58,3,
+-1,-26,-20,44,10,25,39,5,
+-9,-35,-27,-38,7,10,4,-9,
+-42,-85,-102,-127,52,44,28,10,
+-47,-61,-40,-39,-17,-1,-10,-33,
+-42,-74,-48,21,-4,70,52,10};
+
+
+const signed char high_lsp_cdbk2[512]={
+-36,-62,6,-9,-10,-14,-56,23,
+1,-26,23,-48,-17,12,8,-7,
+23,29,-36,-28,-6,-29,-17,-5,
+40,23,10,10,-46,-13,36,6,
+4,-30,-29,62,32,-32,-1,22,
+-14,1,-4,-22,-45,2,54,4,
+-30,-57,-59,-12,27,-3,-31,8,
+-9,5,10,-14,32,66,19,9,
+2,-25,-37,23,-15,18,-38,-31,
+5,-9,-21,15,0,22,62,30,
+15,-12,-14,-46,77,21,33,3,
+34,29,-19,50,2,11,9,-38,
+-12,-37,62,1,-15,54,32,6,
+2,-24,20,35,-21,2,19,24,
+-13,55,4,9,39,-19,30,-1,
+-21,73,54,33,8,18,3,15,
+6,-19,-47,6,-3,-48,-50,1,
+26,20,8,-23,-50,65,-14,-55,
+-17,-31,-37,-28,53,-1,-17,-53,
+1,57,11,-8,-25,-30,-37,64,
+5,-52,-45,15,23,31,15,14,
+-25,24,33,-2,-44,-56,-18,6,
+-21,-43,4,-12,17,-37,20,-10,
+34,15,2,15,55,21,-11,-31,
+-6,46,25,16,-9,-25,-8,-62,
+28,17,20,-32,-29,26,30,25,
+-19,2,-16,-17,26,-51,2,50,
+42,19,-66,23,29,-2,3,19,
+-19,-37,32,15,6,30,-34,13,
+11,-5,40,31,10,-42,4,-9,
+26,-9,-70,17,-2,-23,20,-22,
+-55,51,-24,-31,22,-22,15,-13,
+3,-10,-28,-16,56,4,-63,11,
+-18,-15,-18,-38,-35,16,-7,34,
+-1,-21,-49,-47,9,-37,7,8,
+69,55,20,6,-33,-45,-10,-9,
+6,-9,12,71,15,-3,-42,-7,
+-24,32,-35,-2,-42,-17,-5,0,
+-2,-33,-54,13,-12,-34,47,23,
+19,55,7,-8,74,31,14,16,
+-23,-26,19,12,-18,-49,-28,-31,
+-20,2,-14,-20,-47,78,40,13,
+-23,-11,21,-6,18,1,47,5,
+38,35,32,46,22,8,13,16,
+-14,18,51,19,40,39,11,-26,
+-1,-17,47,2,-53,-15,31,-22,
+38,21,-15,-16,5,-33,53,15,
+-38,86,11,-3,-24,49,13,-4,
+-11,-18,28,20,-12,-27,-26,35,
+-25,-35,-3,-20,-61,30,10,-55,
+-12,-22,-52,-54,-14,19,-32,-12,
+45,15,-8,-48,-9,11,-32,8,
+-16,-34,-13,51,18,38,-2,-32,
+-17,22,-2,-18,-28,-70,59,27,
+-28,-19,-10,-20,-9,-9,-8,-21,
+21,-8,35,-2,45,-3,-9,12,
+0,30,7,-39,43,27,-38,-91,
+30,26,19,-55,-4,63,14,-17,
+13,9,13,2,7,4,6,61,
+72,-1,-17,29,-1,-22,-17,8,
+-28,-37,63,44,41,3,2,14,
+9,-6,75,-8,-7,-12,-15,-12,
+13,9,-4,30,-22,-65,15,0,
+-45,4,-4,1,5,22,11,23};
diff --git a/jni/pjproject-android/.svn/pristine/4e/4ed59ba7c6a6fca653cc2c3aefbc8aafa357aa42.svn-base b/jni/pjproject-android/.svn/pristine/4e/4ed59ba7c6a6fca653cc2c3aefbc8aafa357aa42.svn-base
new file mode 100644
index 0000000..7adf26b
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4ed59ba7c6a6fca653cc2c3aefbc8aafa357aa42.svn-base
@@ -0,0 +1,38 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#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__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/4e/4ee64d291373423d1c61d9294c3bed8ffc3a9cf7.svn-base b/jni/pjproject-android/.svn/pristine/4e/4ee64d291373423d1c61d9294c3bed8ffc3a9cf7.svn-base
new file mode 100644
index 0000000..973c08b
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4ee64d291373423d1c61d9294c3bed8ffc3a9cf7.svn-base
@@ -0,0 +1,361 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
+ * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_decode.c,v 1.2 1996/07/02 09:59:05 jutta Exp $ */
+
+#include "private.h"
+
+#include "gsm.h"
+#include "proto.h"
+
+int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
+{
+	word  	LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
+
+#ifdef WAV49
+	if (s->wav_fmt) {
+
+		uword sr = 0;
+
+		s->frame_index = !s->frame_index;
+		if (s->frame_index) {
+
+			sr = *c++;
+			LARc[0] = sr & 0x3f;  sr >>= 6;
+			sr |= (uword)*c++ << 2;
+			LARc[1] = sr & 0x3f;  sr >>= 6;
+			sr |= (uword)*c++ << 4;
+			LARc[2] = sr & 0x1f;  sr >>= 5;
+			LARc[3] = sr & 0x1f;  sr >>= 5;
+			sr |= (uword)*c++ << 2;
+			LARc[4] = sr & 0xf;  sr >>= 4;
+			LARc[5] = sr & 0xf;  sr >>= 4;
+			sr |= (uword)*c++ << 2;			/* 5 */
+			LARc[6] = sr & 0x7;  sr >>= 3;
+			LARc[7] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 4;
+			Nc[0] = sr & 0x7f;  sr >>= 7;
+			bc[0] = sr & 0x3;  sr >>= 2;
+			Mc[0] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 1;
+			xmaxc[0] = sr & 0x3f;  sr >>= 6;
+			xmc[0] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[1] = sr & 0x7;  sr >>= 3;
+			xmc[2] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[3] = sr & 0x7;  sr >>= 3;
+			xmc[4] = sr & 0x7;  sr >>= 3;
+			xmc[5] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;			/* 10 */
+			xmc[6] = sr & 0x7;  sr >>= 3;
+			xmc[7] = sr & 0x7;  sr >>= 3;
+			xmc[8] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[9] = sr & 0x7;  sr >>= 3;
+			xmc[10] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[11] = sr & 0x7;  sr >>= 3;
+			xmc[12] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 4;
+			Nc[1] = sr & 0x7f;  sr >>= 7;
+			bc[1] = sr & 0x3;  sr >>= 2;
+			Mc[1] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 1;
+			xmaxc[1] = sr & 0x3f;  sr >>= 6;
+			xmc[13] = sr & 0x7;  sr >>= 3;
+			sr = *c++;				/* 15 */
+			xmc[14] = sr & 0x7;  sr >>= 3;
+			xmc[15] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[16] = sr & 0x7;  sr >>= 3;
+			xmc[17] = sr & 0x7;  sr >>= 3;
+			xmc[18] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[19] = sr & 0x7;  sr >>= 3;
+			xmc[20] = sr & 0x7;  sr >>= 3;
+			xmc[21] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[22] = sr & 0x7;  sr >>= 3;
+			xmc[23] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[24] = sr & 0x7;  sr >>= 3;
+			xmc[25] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 4;			/* 20 */
+			Nc[2] = sr & 0x7f;  sr >>= 7;
+			bc[2] = sr & 0x3;  sr >>= 2;
+			Mc[2] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 1;
+			xmaxc[2] = sr & 0x3f;  sr >>= 6;
+			xmc[26] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[27] = sr & 0x7;  sr >>= 3;
+			xmc[28] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[29] = sr & 0x7;  sr >>= 3;
+			xmc[30] = sr & 0x7;  sr >>= 3;
+			xmc[31] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[32] = sr & 0x7;  sr >>= 3;
+			xmc[33] = sr & 0x7;  sr >>= 3;
+			xmc[34] = sr & 0x7;  sr >>= 3;
+			sr = *c++;				/* 25 */
+			xmc[35] = sr & 0x7;  sr >>= 3;
+			xmc[36] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[37] = sr & 0x7;  sr >>= 3;
+			xmc[38] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 4;
+			Nc[3] = sr & 0x7f;  sr >>= 7;
+			bc[3] = sr & 0x3;  sr >>= 2;
+			Mc[3] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 1;
+			xmaxc[3] = sr & 0x3f;  sr >>= 6;
+			xmc[39] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[40] = sr & 0x7;  sr >>= 3;
+			xmc[41] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;			/* 30 */
+			xmc[42] = sr & 0x7;  sr >>= 3;
+			xmc[43] = sr & 0x7;  sr >>= 3;
+			xmc[44] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[45] = sr & 0x7;  sr >>= 3;
+			xmc[46] = sr & 0x7;  sr >>= 3;
+			xmc[47] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[48] = sr & 0x7;  sr >>= 3;
+			xmc[49] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[50] = sr & 0x7;  sr >>= 3;
+			xmc[51] = sr & 0x7;  sr >>= 3;
+
+			s->frame_chain = sr & 0xf;
+		}
+		else {
+			sr = s->frame_chain;
+			sr |= (uword)*c++ << 4;			/* 1 */
+			LARc[0] = sr & 0x3f;  sr >>= 6;
+			LARc[1] = sr & 0x3f;  sr >>= 6;
+			sr = *c++;
+			LARc[2] = sr & 0x1f;  sr >>= 5;
+			sr |= (uword)*c++ << 3;
+			LARc[3] = sr & 0x1f;  sr >>= 5;
+			LARc[4] = sr & 0xf;  sr >>= 4;
+			sr |= (uword)*c++ << 2;
+			LARc[5] = sr & 0xf;  sr >>= 4;
+			LARc[6] = sr & 0x7;  sr >>= 3;
+			LARc[7] = sr & 0x7;  sr >>= 3;
+			sr = *c++;				/* 5 */
+			Nc[0] = sr & 0x7f;  sr >>= 7;
+			sr |= (uword)*c++ << 1;
+			bc[0] = sr & 0x3;  sr >>= 2;
+			Mc[0] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 5;
+			xmaxc[0] = sr & 0x3f;  sr >>= 6;
+			xmc[0] = sr & 0x7;  sr >>= 3;
+			xmc[1] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[2] = sr & 0x7;  sr >>= 3;
+			xmc[3] = sr & 0x7;  sr >>= 3;
+			xmc[4] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[5] = sr & 0x7;  sr >>= 3;
+			xmc[6] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;			/* 10 */
+			xmc[7] = sr & 0x7;  sr >>= 3;
+			xmc[8] = sr & 0x7;  sr >>= 3;
+			xmc[9] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[10] = sr & 0x7;  sr >>= 3;
+			xmc[11] = sr & 0x7;  sr >>= 3;
+			xmc[12] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			Nc[1] = sr & 0x7f;  sr >>= 7;
+			sr |= (uword)*c++ << 1;
+			bc[1] = sr & 0x3;  sr >>= 2;
+			Mc[1] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 5;
+			xmaxc[1] = sr & 0x3f;  sr >>= 6;
+			xmc[13] = sr & 0x7;  sr >>= 3;
+			xmc[14] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;			/* 15 */
+			xmc[15] = sr & 0x7;  sr >>= 3;
+			xmc[16] = sr & 0x7;  sr >>= 3;
+			xmc[17] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[18] = sr & 0x7;  sr >>= 3;
+			xmc[19] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[20] = sr & 0x7;  sr >>= 3;
+			xmc[21] = sr & 0x7;  sr >>= 3;
+			xmc[22] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[23] = sr & 0x7;  sr >>= 3;
+			xmc[24] = sr & 0x7;  sr >>= 3;
+			xmc[25] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			Nc[2] = sr & 0x7f;  sr >>= 7;
+			sr |= (uword)*c++ << 1;			/* 20 */
+			bc[2] = sr & 0x3;  sr >>= 2;
+			Mc[2] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 5;
+			xmaxc[2] = sr & 0x3f;  sr >>= 6;
+			xmc[26] = sr & 0x7;  sr >>= 3;
+			xmc[27] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;	
+			xmc[28] = sr & 0x7;  sr >>= 3;
+			xmc[29] = sr & 0x7;  sr >>= 3;
+			xmc[30] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			xmc[31] = sr & 0x7;  sr >>= 3;
+			xmc[32] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[33] = sr & 0x7;  sr >>= 3;
+			xmc[34] = sr & 0x7;  sr >>= 3;
+			xmc[35] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;			/* 25 */
+			xmc[36] = sr & 0x7;  sr >>= 3;
+			xmc[37] = sr & 0x7;  sr >>= 3;
+			xmc[38] = sr & 0x7;  sr >>= 3;
+			sr = *c++;
+			Nc[3] = sr & 0x7f;  sr >>= 7;
+			sr |= (uword)*c++ << 1;		
+			bc[3] = sr & 0x3;  sr >>= 2;
+			Mc[3] = sr & 0x3;  sr >>= 2;
+			sr |= (uword)*c++ << 5;
+			xmaxc[3] = sr & 0x3f;  sr >>= 6;
+			xmc[39] = sr & 0x7;  sr >>= 3;
+			xmc[40] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[41] = sr & 0x7;  sr >>= 3;
+			xmc[42] = sr & 0x7;  sr >>= 3;
+			xmc[43] = sr & 0x7;  sr >>= 3;
+			sr = *c++;				/* 30 */
+			xmc[44] = sr & 0x7;  sr >>= 3;
+			xmc[45] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 2;
+			xmc[46] = sr & 0x7;  sr >>= 3;
+			xmc[47] = sr & 0x7;  sr >>= 3;
+			xmc[48] = sr & 0x7;  sr >>= 3;
+			sr |= (uword)*c++ << 1;
+			xmc[49] = sr & 0x7;  sr >>= 3;
+			xmc[50] = sr & 0x7;  sr >>= 3;
+			xmc[51] = sr & 0x7;  sr >>= 3;
+		}
+	}
+	else
+#endif
+	{
+		/* GSM_MAGIC  = (*c >> 4) & 0xF; */
+
+		if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
+
+		LARc[0]  = (*c++ & 0xF) << 2;		/* 1 */
+		LARc[0] |= (*c >> 6) & 0x3;
+		LARc[1]  = *c++ & 0x3F;
+		LARc[2]  = (*c >> 3) & 0x1F;
+		LARc[3]  = (*c++ & 0x7) << 2;
+		LARc[3] |= (*c >> 6) & 0x3;
+		LARc[4]  = (*c >> 2) & 0xF;
+		LARc[5]  = (*c++ & 0x3) << 2;
+		LARc[5] |= (*c >> 6) & 0x3;
+		LARc[6]  = (*c >> 3) & 0x7;
+		LARc[7]  = *c++ & 0x7;
+		Nc[0]  = (*c >> 1) & 0x7F;
+		bc[0]  = (*c++ & 0x1) << 1;
+		bc[0] |= (*c >> 7) & 0x1;
+		Mc[0]  = (*c >> 5) & 0x3;
+		xmaxc[0]  = (*c++ & 0x1F) << 1;
+		xmaxc[0] |= (*c >> 7) & 0x1;
+		xmc[0]  = (*c >> 4) & 0x7;
+		xmc[1]  = (*c >> 1) & 0x7;
+		xmc[2]  = (*c++ & 0x1) << 2;
+		xmc[2] |= (*c >> 6) & 0x3;
+		xmc[3]  = (*c >> 3) & 0x7;
+		xmc[4]  = *c++ & 0x7;
+		xmc[5]  = (*c >> 5) & 0x7;
+		xmc[6]  = (*c >> 2) & 0x7;
+		xmc[7]  = (*c++ & 0x3) << 1;		/* 10 */
+		xmc[7] |= (*c >> 7) & 0x1;
+		xmc[8]  = (*c >> 4) & 0x7;
+		xmc[9]  = (*c >> 1) & 0x7;
+		xmc[10]  = (*c++ & 0x1) << 2;
+		xmc[10] |= (*c >> 6) & 0x3;
+		xmc[11]  = (*c >> 3) & 0x7;
+		xmc[12]  = *c++ & 0x7;
+		Nc[1]  = (*c >> 1) & 0x7F;
+		bc[1]  = (*c++ & 0x1) << 1;
+		bc[1] |= (*c >> 7) & 0x1;
+		Mc[1]  = (*c >> 5) & 0x3;
+		xmaxc[1]  = (*c++ & 0x1F) << 1;
+		xmaxc[1] |= (*c >> 7) & 0x1;
+		xmc[13]  = (*c >> 4) & 0x7;
+		xmc[14]  = (*c >> 1) & 0x7;
+		xmc[15]  = (*c++ & 0x1) << 2;
+		xmc[15] |= (*c >> 6) & 0x3;
+		xmc[16]  = (*c >> 3) & 0x7;
+		xmc[17]  = *c++ & 0x7;
+		xmc[18]  = (*c >> 5) & 0x7;
+		xmc[19]  = (*c >> 2) & 0x7;
+		xmc[20]  = (*c++ & 0x3) << 1;
+		xmc[20] |= (*c >> 7) & 0x1;
+		xmc[21]  = (*c >> 4) & 0x7;
+		xmc[22]  = (*c >> 1) & 0x7;
+		xmc[23]  = (*c++ & 0x1) << 2;
+		xmc[23] |= (*c >> 6) & 0x3;
+		xmc[24]  = (*c >> 3) & 0x7;
+		xmc[25]  = *c++ & 0x7;
+		Nc[2]  = (*c >> 1) & 0x7F;
+		bc[2]  = (*c++ & 0x1) << 1;		/* 20 */
+		bc[2] |= (*c >> 7) & 0x1;
+		Mc[2]  = (*c >> 5) & 0x3;
+		xmaxc[2]  = (*c++ & 0x1F) << 1;
+		xmaxc[2] |= (*c >> 7) & 0x1;
+		xmc[26]  = (*c >> 4) & 0x7;
+		xmc[27]  = (*c >> 1) & 0x7;
+		xmc[28]  = (*c++ & 0x1) << 2;
+		xmc[28] |= (*c >> 6) & 0x3;
+		xmc[29]  = (*c >> 3) & 0x7;
+		xmc[30]  = *c++ & 0x7;
+		xmc[31]  = (*c >> 5) & 0x7;
+		xmc[32]  = (*c >> 2) & 0x7;
+		xmc[33]  = (*c++ & 0x3) << 1;
+		xmc[33] |= (*c >> 7) & 0x1;
+		xmc[34]  = (*c >> 4) & 0x7;
+		xmc[35]  = (*c >> 1) & 0x7;
+		xmc[36]  = (*c++ & 0x1) << 2;
+		xmc[36] |= (*c >> 6) & 0x3;
+		xmc[37]  = (*c >> 3) & 0x7;
+		xmc[38]  = *c++ & 0x7;
+		Nc[3]  = (*c >> 1) & 0x7F;
+		bc[3]  = (*c++ & 0x1) << 1;
+		bc[3] |= (*c >> 7) & 0x1;
+		Mc[3]  = (*c >> 5) & 0x3;
+		xmaxc[3]  = (*c++ & 0x1F) << 1;
+		xmaxc[3] |= (*c >> 7) & 0x1;
+		xmc[39]  = (*c >> 4) & 0x7;
+		xmc[40]  = (*c >> 1) & 0x7;
+		xmc[41]  = (*c++ & 0x1) << 2;
+		xmc[41] |= (*c >> 6) & 0x3;
+		xmc[42]  = (*c >> 3) & 0x7;
+		xmc[43]  = *c++ & 0x7;			/* 30  */
+		xmc[44]  = (*c >> 5) & 0x7;
+		xmc[45]  = (*c >> 2) & 0x7;
+		xmc[46]  = (*c++ & 0x3) << 1;
+		xmc[46] |= (*c >> 7) & 0x1;
+		xmc[47]  = (*c >> 4) & 0x7;
+		xmc[48]  = (*c >> 1) & 0x7;
+		xmc[49]  = (*c++ & 0x1) << 2;
+		xmc[49] |= (*c >> 6) & 0x3;
+		xmc[50]  = (*c >> 3) & 0x7;
+		xmc[51]  = *c & 0x7;			/* 33 */
+	}
+
+	Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
+
+	return 0;
+}
diff --git a/jni/pjproject-android/.svn/pristine/4e/4ef116bae2892fa96e3b3836ced5891f5a0ce41e.svn-base b/jni/pjproject-android/.svn/pristine/4e/4ef116bae2892fa96e3b3836ced5891f5a0ce41e.svn-base
new file mode 100644
index 0000000..d04a1c7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/4e/4ef116bae2892fa96e3b3836ced5891f5a0ce41e.svn-base
@@ -0,0 +1,179 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJSIP_SIP_MULTIPART_H__
+#define __PJSIP_SIP_MULTIPART_H__
+
+/**
+ * @file pjsip/sip_multipart.h
+ * @brief Multipart support.
+ */
+
+#include <pjsip/sip_msg.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_MULTIPART Multipart message bodies.
+ * @ingroup PJSIP_MSG
+ * @brief Support for multipart message bodies.
+ * @{
+ */
+
+/**
+ * This structure describes the individual body part inside a multipart
+ * message body. It mainly contains the message body itself and optional
+ * headers.
+ */
+typedef struct pjsip_multipart_part
+{
+    /**
+     * Standard list element.
+     */
+    PJ_DECL_LIST_MEMBER(struct pjsip_multipart_part);
+
+    /**
+     * Optional message headers.
+     */
+    pjsip_hdr		    hdr;
+
+    /**
+     * Pointer to the message body.
+     */
+    pjsip_msg_body	   *body;
+
+} pjsip_multipart_part;
+
+/**
+ * Create an empty multipart body.
+ *
+ * @param pool		Memory pool to allocate memory from.
+ * @param ctype		Optional MIME media type of the multipart
+ * 			bodies. If not specified, "multipart/mixed"
+ * 			will be used.
+ * @param boundary	Optional string to be set as part boundary.
+ * 			The boundary string excludes the leading
+ * 			hyphens. If this parameter is NULL or empty,
+ * 			a random boundary will be generated.
+ *
+ * @return		Multipart body instance with no part.
+ */
+PJ_DECL(pjsip_msg_body*) pjsip_multipart_create(pj_pool_t *pool,
+						const pjsip_media_type *ctype,
+						const pj_str_t *boundary);
+
+/**
+ * Create an empty multipart part.
+ *
+ * @param pool		The memory pool.
+ *
+ * @return		The multipart part.
+ */
+PJ_DECL(pjsip_multipart_part*) pjsip_multipart_create_part(pj_pool_t *pool);
+
+
+/**
+ * Perform a deep clone to a multipart part.
+ *
+ * @param pool		The memory pool.
+ * @param part		The part to be duplicated.
+ *
+ * @return		Copy of the multipart part.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_clone_part(pj_pool_t *pool,
+			   const pjsip_multipart_part *part);
+
+/**
+ * Add a part into multipart bodies.
+ *
+ * @param pool		The memory pool.
+ * @param mp		The multipart bodies.
+ * @param part		The part to be added into the bodies.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_multipart_add_part(pj_pool_t *pool,
+					      pjsip_msg_body *mp,
+					      pjsip_multipart_part *part);
+
+/**
+ * Get the first part of multipart bodies.
+ *
+ * @param mp		The multipart bodies.
+ *
+ * @return		The first part, or NULL if the multipart
+ * 			bodies currently doesn't hold any elements.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_get_first_part(const pjsip_msg_body *mp);
+
+/**
+ * Get the next part after the specified part.
+ *
+ * @param mp		The multipart bodies.
+ * @param part		The part.
+ *
+ * @return		The next part, or NULL if there is no other part after
+ * 			the part.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_get_next_part(const pjsip_msg_body *mp,
+			      pjsip_multipart_part *part);
+
+/**
+ * Find a body inside multipart bodies which has the specified content type.
+ *
+ * @param mp		The multipart body.
+ * @param content_type	Content type to find.
+ * @param start		If specified, the search will begin at
+ * 			start->next. Otherwise it will begin at
+ * 			the first part in the multipart bodies.
+ *
+ * @return		The first part with the specified content type
+ * 			if found, or NULL.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_find_part( const pjsip_msg_body *mp,
+			   const pjsip_media_type *content_type,
+			   const pjsip_multipart_part *start);
+
+/**
+ * Parse multipart message.
+ *
+ * @param pool		Memory pool.
+ * @param buf		Input buffer.
+ * @param len		The buffer length.
+ * @param ctype		Content type of the multipart body.
+ * @param options	Parsing options, must be zero for now.
+ *
+ * @return		Multipart message body.
+ */
+PJ_DECL(pjsip_msg_body*) pjsip_multipart_parse(pj_pool_t *pool,
+					       char *buf, pj_size_t len,
+					       const pjsip_media_type *ctype,
+					       unsigned options);
+
+/**
+ * @}  PJSIP_MULTIPART
+ */
+
+
+PJ_END_DECL
+
+#endif	/* __PJSIP_SIP_MULTIPART_H__ */