* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce0432f78d5624f1fdc328b2068ae363c1c35814.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce0432f78d5624f1fdc328b2068ae363c1c35814.svn-base
new file mode 100644
index 0000000..94279f5
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce0432f78d5624f1fdc328b2068ae363c1c35814.svn-base
@@ -0,0 +1,127 @@
+/*
+ * rtp.h
+ * 
+ * rtp interface for srtp reference implementation
+ *
+ * David A. McGrew
+ * Cisco Systems, Inc.
+ *
+ * data types:
+ *
+ * rtp_msg_t       an rtp message (the data that goes on the wire)
+ * rtp_sender_t    sender side socket and rtp info
+ * rtp_receiver_t  receiver side socket and rtp info
+ *
+ */
+
+/*
+ *	
+ * Copyright (c) 2001-2006, Cisco Systems, Inc.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ *   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.
+ * 
+ *   Neither the name of the Cisco Systems, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ *
+ */
+
+
+#ifndef RTP_H
+#define RTP_H
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#elif defined HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+
+#include "srtp.h"
+
+typedef struct rtp_sender_ctx_t *rtp_sender_t;
+
+typedef struct rtp_receiver_ctx_t *rtp_receiver_t;
+
+unsigned int
+rtp_sendto(rtp_sender_t sender, const void* msg, int len);
+
+unsigned int
+rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len);
+
+int
+rtp_receiver_init(rtp_receiver_t rcvr, int socket, 
+		  struct sockaddr_in addr, unsigned int ssrc);
+
+int
+rtp_sender_init(rtp_sender_t sender, int socket, 
+		struct sockaddr_in addr, unsigned int ssrc);
+
+/*
+ * srtp_sender_init(...) initializes an rtp_sender_t
+ */
+
+int
+srtp_sender_init(rtp_sender_t rtp_ctx,          /* structure to be init'ed */
+		 struct sockaddr_in name,       /* socket name             */
+		 sec_serv_t security_services,  /* sec. servs. to be used  */
+		 unsigned char *input_key       /* master key/salt in hex  */
+		 );
+
+int
+srtp_receiver_init(rtp_receiver_t rtp_ctx,       /* structure to be init'ed */
+		   struct sockaddr_in name, 	 /* socket name             */
+		   sec_serv_t security_services, /* sec. servs. to be used  */
+		   unsigned char *input_key	 /* master key/salt in hex  */
+		   );
+
+
+int
+rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy);
+
+int
+rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy);
+
+
+rtp_sender_t 
+rtp_sender_alloc();
+
+rtp_receiver_t 
+rtp_receiver_alloc();
+
+
+/*
+ * RTP_HEADER_LEN indicates the size of an RTP header
+ */
+#define RTP_HEADER_LEN   12
+
+/* 
+ * RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementation
+ */
+#define RTP_MAX_BUF_LEN  16384
+
+
+#endif /* RTP_H */
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce0c951d6cdeff0bc7c205e513d20080ed45fc6b.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce0c951d6cdeff0bc7c205e513d20080ed45fc6b.svn-base
new file mode 100644
index 0000000..e4f7755
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce0c951d6cdeff0bc7c205e513d20080ed45fc6b.svn-base
@@ -0,0 +1,307 @@
+/* $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 
+ */
+
+/**
+ * @file doxygen.h
+ * @brief PJSIP Doxygen's mainpage.
+ */
+
+/*////////////////////////////////////////////////////////////////////////// */
+/*
+	INTRODUCTION PAGE
+ */
+
+/**
+  \n
+
+  @mainpage PJSIP - Open Source SIP Stack
+
+  \n
+  \n
+  @section intro_sec Introduction
+
+  PJSIP is an Open Source SIP prototol stack, designed to be very small in 
+  footprint, have high performance, and very flexible.
+
+  @subsection hist_sec History
+
+  PJSIP has been actively developed since 2003, but its history goes well
+  beyond that. The author has been developing SIP stack since 1999 during
+  RFC 2543 era, and after several experimentation with different approaches 
+  in the programming (the first stack actually was in C++!), and also with
+  the evolution of the SIP protocol itself, the current/third generation
+  of PJSIP (the 0.2.9 version is the second generation) can be considered 
+  as pretty stable in term of design, and should
+  incorporate all design considerations (and implementation tricks!) that 
+  have been learned over the years. Of course only time will tell if this 
+  statement can still be held true in the future.
+
+
+
+
+  \n
+  \n
+  @section pjsipgetting_started Getting Started
+
+  PJSIP consists of multiple levels of APIs, which each of them layered on
+  top of another. Because of this, new readers may find it a bit difficult
+  to find the place to start.
+
+  In general, I think perhaps I can recommend two approaches on using PJSIP.
+
+
+  \n
+  @subsection getting_started_high Using PJSUA API
+
+  @ref PJSUA_LIB wraps together all SIP components and media into a high level
+  API, suitable for creating typical SIP user agent applications. It 
+  features easy to use API for:
+  - multiple client registration (accounts),
+  - high level SIP and media session (calls),
+  - buddy list, presence and instant messaging,
+  - powerful and very easy to use media manipulation,
+
+  while maintaining some space for customization (custom SIP
+  transport, custom SIP media, etc.) needed by some types of applications.
+  @ref PJSUA_LIB is also aimed to be able to run on devices such as PDA
+  or mobile phones, by carefully allowing application to set the appropriate
+  threading strategy and memory limits (number of calls, media ports, etc.).
+
+  However, @ref PJSUA_LIB may not be the most suitable API for some types
+  of applications, since it is directed towards an easy to use API. For
+  more more advanced use, you may better implement the application by using
+  PJSIP + PJMEDIA directly, as described below.
+
+
+  \n
+  @subsection getting_started_pjsip_pjmedia Using PJSIP and PJMEDIA Directly
+
+  For the ultimate flexibility and power, using PJSIP and PJMEDIA directly
+  is the way to go. The drawback will be, of course, steeper learning curve. 
+
+  However, the following links may provide some useful information:
+  - <A HREF="/docs.htm">PJSIP Developer's Guide</A> PDF
+    document is the ultimate guide to understand PJSIP design concept.
+  - there are some samples in <A HREF="/cgi-bin/viewcvs.cgi/pjproject/trunk/pjsip-apps/src/samples/">
+   <b>pjsip-apps/src/samples</b></A> directory.
+  - @ref PJSUA_LIB source code may also be useful to see how high level
+    API are implemented with PJSIP/PJMEDIA.
+  - and finally, you can always <b>Use the Source</b>!
+
+
+
+  \n
+  \n
+  @section this_doc About This Document
+
+  This document contains the reference information about PJSIP. For
+  more in-depth guide (and information in general), readers are 
+  encouraged to read the <A HREF="/docs.htm">
+  <b>PJSIP Developer's Guide</b></A> PDF document
+  which can be downloaded from http://www.pjsip.org/docs.htm.
+
+  \n
+  @subsection doc_how_to_read How to Read This Document
+
+  For main navigation, please go to <A HREF="modules.htm"><b>Modules</b></A>
+  link on top of this page.
+
+  This document was generated with <A HREF="http://www.doxygen.org">Doxygen</A>
+  from PJSIP header files.
+
+
+  \n
+  \n
+  @section pjsip_toc Documentation Contents
+
+  Click on <A HREF="modules.htm"><b>Modules</b></A> link on top of this page 
+  to get the detailed table of contents.
+
+  The following are top level sections in the <A HREF="modules.htm">
+  <b>Modules</b></A>, as laid out in the following diagram:
+
+  \image html pjsip-arch.jpg "Static Library Layout"
+
+  Enumerating the static libraries from the bottom:
+
+  - <A HREF="/pjlib/docs/main.htm">PJLIB</A>, is the platform abstraction
+    and framework library, on which all other libraries depend,
+
+  - PJLIB-UTIL, provides auxiliary functions such as text scanning,
+    XML, and STUN,
+
+  - PJMEDIA is the multimedia framework,
+
+  - PJMEDIA-CODEC is the placeholder for media codecs,
+
+  - @ref PJSIP_CORE (<b>PJSIP-CORE</b>) is the very core of the PJSIP library, 
+    and contains the SIP @ref PJSIP_ENDPT, which is the owner/manager for all
+    SIP objects in the application, messaging elements, parsing, transport 
+    management, module management, and stateless operations, and also
+    contains:
+
+  - The @ref PJSIP_TRANSACT module inside <b>PJSIP-CORE</b> provides 
+    stateful operation, and is the base for higher layer features such as 
+    dialogs,
+
+  - The @ref PJSIP_UA module inside <b>PJSIP-CORE</b> manages dialogs, and supports dialog
+    usages,
+
+  - @ref PJSIP_SIMPLE (<b>PJSIP-SIMPLE</b>) provides the base SIP event framework 
+    (which uses the common/base dialog framework) and implements presence 
+    on top of it, and is also used by call transfer functions,
+
+  - @ref PJSIP_HIGH_UA (<b>PJSIP-UA</b>) is the high level abstraction of INVITE sessions
+    (using the common/base dialog framework). This library also provides
+    SIP client registration and call transfer functionality,
+
+  - and finally, @ref PJSUA_LIB (<b>PJSUA-LIB</b>) is the highest level of abstraction, 
+    which wraps together all above functionalities into high level, easy to
+    use API.
+*/
+
+
+/**
+ @page page_pjsip_samples PJSIP Samples
+
+ I wish I could write more samples, but for now here are some samples or
+ working applications that are available from the source tree:
+
+  - @ref page_pjsip_sample_sipstateless_c\n
+    This is about the simplest SIP application with PJSIP, all it does is
+    respond all incoming requests with 501 (Not Implemented) response
+    statelessly.
+
+  - @ref page_pjsip_sample_simple_ua_c\n
+    This is a very simple SIP User Agent application that only use PJSIP
+    (without PJSIP-UA). It's able to make and receive call, and play
+    media to the sound device.
+    
+  - @ref page_pjsip_sample_simple_pjsuaua_c\n
+    Very simple SIP User Agent with registration, call, and media, using
+    PJSUA-API, all in under 200 lines of code.
+
+  - @ref page_pjsip_samples_pjsua\n
+    This is the reference implementation for PJSIP and PJMEDIA.
+    PJSUA is a console based application, designed to be simple enough
+    to be readble, but powerful enough to demonstrate all features
+    available in PJSIP and PJMEDIA.\n
+    Screenshot on WinXP: \image html pjsua.jpg "pjsua on WinXP"
+
+  - @ref page_pjmedia_samples_siprtp_c\n
+    This is a useful program (integrated with PJSIP) to actively measure 
+    the network quality/impairment parameters by making one or more SIP 
+    calls (or receiving one or more SIP calls) and display the network
+    impairment of each stream direction at the end of the call.
+    The program is able to measure network quality parameters such as
+    jitter, packet lost/reorder/duplicate, round trip time, etc.\n
+    Note that the remote peer MUST support RTCP so that network quality
+    of each direction can be calculated. Using siprtp for both endpoints
+    is recommended.\n
+    Screenshots on WinXP: \image html siprtp.jpg "siprtp screenshot on WinXP"
+
+  - @ref page_pjsip_perf_c\n
+    This sample contains a complete implementation of a SIP performance
+    measurement tool. Unlike other tool such SIPp, pjsip-perf is geared
+    more towards finding the performance of an endpoint by flooding the
+    endpoint with some requests and time the completion of the requests.\n
+    Screenshots on Linux console: \image html pjsip-perf.jpg "pjsip-perf screenshot on Linux"
+ */
+
+/**
+ * \page page_pjsip_samples_pjsua PJSUA
+ *
+ * This is the reference implementation for PJSIP and PJMEDIA.
+ * PJSUA is a console based application, designed to be simple enough
+ * to be readble, but powerful enough to demonstrate all features
+ * available in PJSIP and PJMEDIA.
+ *
+ * This file is pjsip-apps/src/pjsua/pjsua_app.c
+ *
+ * Screenshot on WinXP: \image html pjsua.jpg "pjsua on WinXP"
+ *
+ * \includelineno pjsua_app.c
+ */
+
+/**
+ * \page page_pjsip_sample_simple_ua_c Samples: Simple UA
+ *
+ * This is a very simple SIP User Agent application that only use PJSIP
+ * (without PJSIP-UA). It's able to make and receive call, and play
+ * media to the sound device.
+ *
+ * \includelineno simpleua.c
+ */
+
+/**
+ * \page page_pjsip_sample_simple_pjsuaua_c Samples: Simple PJSUA
+ *
+ * Very simple SIP User Agent with registration, call, and media, all
+ * in under 200 lines of code.
+ *
+ * \includelineno simple_pjsua.c
+ */
+
+/**
+ * \page page_pjsip_sample_sipstateless_c Samples: Stateless SIP Endpoint
+ *
+ * This is about the simplest SIP application with PJSIP, all it does is
+ * respond all incoming requests with 501 (Not Implemented) response
+ * statelessly.
+ *
+ * \includelineno sipstateless.c
+ */
+
+/**
+ * \page page_pjmedia_samples_siprtp_c Samples: siprtp - SIP with RTCP Quality Monitoring
+ *
+ * This source is an example to demonstrate using SIP and RTP/RTCP framework
+ * to measure the network quality/impairment from the SIP call. This
+ * program can be used to make calls or to receive calls from other
+ * SIP endpoint (or other siprtp program), and to display the media
+ * quality statistics at the end of the call.
+ *
+ * Note that the remote peer must support RTCP.
+ *
+ * The layout of the program has been designed so that custom reporting
+ * can be generated instead of plain human readable text.
+ *
+ * The source code of the file is pjsip-apps/src/samples/siprtp.c
+ *
+ * Screenshots on WinXP: \image html siprtp.jpg
+ *
+ * \includelineno siprtp.c
+ */
+
+/**
+ * \page page_pjsip_perf_c Samples: pjsip-perf - SIP Performance Benchmarking Tool
+ *
+ * This sample contains a complete implementation of a SIP performance
+ * measurement tool. Unlike other tool such SIPp, pjsip-perf is geared
+ * more towards finding the performance of an endpoint by flooding the
+ * endpoint with some requests and time the completion of the requests.
+ *
+ * The source code of the file is pjsip-apps/src/samples/pjsip-perf.c
+ *
+ * Screenshots on Linux console: \image html pjsip-perf.jpg
+ *
+ * \includelineno pjsip-perf.c
+ */
+
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce2a4f8fdefe7e17a028f0d8175086fa61940524.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce2a4f8fdefe7e17a028f0d8175086fa61940524.svn-base
new file mode 100644
index 0000000..8a99371
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce2a4f8fdefe7e17a028f0d8175086fa61940524.svn-base
@@ -0,0 +1,42 @@
+#!/bin/env python
+
+#
+# main.py - main entry for PJSIP's CDash tests
+#
+# Copyright (C) 2008-2009 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
+#
+
+import sys
+
+if len(sys.argv)==1:
+    print "Usage: main.py cfg_file [cfg_site]"
+    print "Example:"
+    print "  main.py cfg_gnu"
+    print "  main.py cfg_gnu custom_cfg_site"
+    sys.exit(1)
+
+
+args = []
+args.extend(sys.argv)
+args.remove(args[1])
+args.remove(args[0])
+
+cfg_file = __import__(sys.argv[1])
+builders = cfg_file.create_builder(args)
+
+for builder in builders:
+    builder.execute()
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce4744413a183aa7bff1f26f58a60c440cf3c6c7.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce4744413a183aa7bff1f26f58a60c440cf3c6c7.svn-base
new file mode 100644
index 0000000..4b78a04
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce4744413a183aa7bff1f26f58a60c440cf3c6c7.svn-base
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>$title ($projectnumber)</title>
+<link href="/style/style.css" rel="stylesheet" type="text/css">
+</head><body>
+	<!--#include virtual="/header.html" -->
+
+	<p><A HREF="/">Home</A> --&gt; <A HREF="/docs.htm">Documentations</A> --&gt; PJMEDIA Reference</p>
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce65607f0f0985b2cb5d017f1868c2c43f648f75.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce65607f0f0985b2cb5d017f1868c2c43f648f75.svn-base
new file mode 100644
index 0000000..d6a1df2
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce65607f0f0985b2cb5d017f1868c2c43f648f75.svn-base
@@ -0,0 +1,1063 @@
+/* $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/os.h>
+#include <pj/assert.h>
+#include <pj/pool.h>
+#include <pj/log.h>
+#include <pj/rand.h>
+#include <pj/string.h>
+#include <pj/guid.h>
+#include <pj/except.h>
+#include <pj/errno.h>
+
+#include "os_symbian.h"
+
+
+#define PJ_MAX_TLS	    32
+#define DUMMY_MUTEX	    ((pj_mutex_t*)101)
+#define DUMMY_SEMAPHORE	    ((pj_sem_t*)102)
+#define THIS_FILE	    "os_core_symbian.c"
+
+/* Default message slot number for RSocketServ::Connect().
+ * Increase it to 32 from the default 8 (KESockDefaultMessageSlots)
+ */
+#ifndef PJ_SYMBIAN_SOCK_MSG_SLOTS
+#  define PJ_SYMBIAN_SOCK_MSG_SLOTS  32
+#endif
+
+/*
+ * Note:
+ *
+ * The Symbian implementation does not support threading!
+ */ 
+
+struct pj_thread_t
+{
+    char	    obj_name[PJ_MAX_OBJ_NAME];
+    void	   *tls_values[PJ_MAX_TLS];
+
+#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
+    pj_uint32_t	    stk_size;
+    pj_uint32_t	    stk_max_usage;
+    char	   *stk_start;
+    const char	   *caller_file;
+    int		    caller_line;
+#endif
+
+} main_thread;
+
+struct pj_atomic_t
+{
+    pj_atomic_value_t	value;
+};
+
+struct pj_sem_t
+{
+    int value;
+    int max;
+};
+
+/* Flag and reference counter for PJLIB instance */
+static int initialized;
+
+/* Flags to indicate which TLS variables have been used */
+static int tls_vars[PJ_MAX_TLS];
+
+/* atexit handlers */
+static unsigned atexit_count;
+static void (*atexit_func[32])(void);
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// CPjTimeoutTimer implementation
+//
+
+CPjTimeoutTimer::CPjTimeoutTimer()
+: CActive(PJ_SYMBIAN_TIMER_PRIORITY), hasTimedOut_(PJ_FALSE)
+{
+}
+
+CPjTimeoutTimer::~CPjTimeoutTimer()
+{
+    Cancel();
+    timer_.Close();
+}
+
+void CPjTimeoutTimer::ConstructL()
+{
+    hasTimedOut_ = PJ_FALSE;
+    timer_.CreateLocal();
+    CActiveScheduler::Add(this);
+}
+
+CPjTimeoutTimer *CPjTimeoutTimer::NewL()
+{
+    CPjTimeoutTimer *self = new CPjTimeoutTimer;
+    CleanupStack::PushL(self);
+
+    self->ConstructL();
+
+    CleanupStack::Pop(self);
+    return self;
+
+}
+
+void CPjTimeoutTimer::StartTimer(TUint miliSeconds)
+{
+    Cancel();
+
+    hasTimedOut_ = PJ_FALSE;
+    timer_.After(iStatus, miliSeconds * 1000);
+    SetActive();
+}
+
+bool CPjTimeoutTimer::HasTimedOut() const
+{
+    return hasTimedOut_ != 0;
+}
+
+void CPjTimeoutTimer::RunL()
+{
+    hasTimedOut_ = PJ_TRUE;
+}
+
+void CPjTimeoutTimer::DoCancel()
+{
+    timer_.Cancel();
+}
+
+TInt CPjTimeoutTimer::RunError(TInt aError)
+{
+    PJ_UNUSED_ARG(aError);
+    return KErrNone;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// PjSymbianOS implementation
+//
+
+PjSymbianOS::PjSymbianOS()
+: isConnectionUp_(false),
+  isSocketServInitialized_(false), isResolverInitialized_(false),
+  console_(NULL), selectTimeoutTimer_(NULL),
+  appSocketServ_(NULL), appConnection_(NULL), appHostResolver_(NULL),
+  appHostResolver6_(NULL)
+{
+}
+
+// Set parameters
+void PjSymbianOS::SetParameters(pj_symbianos_params *params) 
+{
+    appSocketServ_ = (RSocketServ*) params->rsocketserv;
+    appConnection_ = (RConnection*) params->rconnection;
+    appHostResolver_ = (RHostResolver*) params->rhostresolver;
+    appHostResolver6_ = (RHostResolver*) params->rhostresolver6;
+}
+
+// Get PjSymbianOS instance
+PjSymbianOS *PjSymbianOS::Instance()
+{
+    static PjSymbianOS instance_;
+    return &instance_;
+}
+
+
+// Initialize
+TInt PjSymbianOS::Initialize()
+{
+    TInt err;
+
+    selectTimeoutTimer_ = CPjTimeoutTimer::NewL();
+
+#if 0
+    pj_assert(console_ == NULL);
+    TRAPD(err, console_ = Console::NewL(_L("PJLIB"), 
+				        TSize(KConsFullScreen,KConsFullScreen)));
+    return err;
+#endif
+
+    /* Only create RSocketServ if application doesn't specify it
+     * in the parameters
+     */
+    if (!isSocketServInitialized_ && appSocketServ_ == NULL) {
+	err = socketServ_.Connect(PJ_SYMBIAN_SOCK_MSG_SLOTS);
+	if (err != KErrNone)
+	    goto on_error;
+
+	isSocketServInitialized_ = true;
+    }
+
+    if (!isResolverInitialized_) {
+    	if (appHostResolver_ == NULL) {
+    	    if (Connection())
+    	    	err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream,
+    	    			     	 *Connection());
+    	    else
+	    	err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream);
+    	
+	    if (err != KErrNone)
+	    	goto on_error;
+    	}
+    	
+#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6!=0
+    	if (appHostResolver6_ == NULL) {
+    	    if (Connection())
+    	    	err = hostResolver6_.Open(SocketServ(), KAfInet6, KSockStream,
+    	    			     	  *Connection());
+    	    else
+	    	err = hostResolver6_.Open(SocketServ(), KAfInet6, KSockStream);
+    	
+	    if (err != KErrNone)
+	    	goto on_error;
+    	}
+#endif
+    	
+    	
+	isResolverInitialized_ = true;
+    }
+
+    isConnectionUp_ = true;
+    
+    return KErrNone;
+
+on_error:
+    Shutdown();
+    return err;
+}
+
+// Shutdown
+void PjSymbianOS::Shutdown()
+{
+    isConnectionUp_ = false;
+    
+    if (isResolverInitialized_) {
+		hostResolver_.Close();
+#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6!=0
+    	hostResolver6_.Close();
+#endif
+    	isResolverInitialized_ = false;
+    }
+
+    if (isSocketServInitialized_) {
+	socketServ_.Close();
+	isSocketServInitialized_ = false;
+    }
+
+    delete console_;
+    console_ = NULL;
+
+    delete selectTimeoutTimer_;
+    selectTimeoutTimer_ = NULL;
+    
+    appSocketServ_ = NULL;
+    appConnection_ = NULL;
+    appHostResolver_ = NULL;
+    appHostResolver6_ = NULL;
+}
+
+// Convert to Unicode
+TInt PjSymbianOS::ConvertToUnicode(TDes16 &aUnicode, const TDesC8 &aForeign)
+{
+#if 0
+    pj_assert(conv_ != NULL);
+    return conv_->ConvertToUnicode(aUnicode, aForeign, convToUnicodeState_);
+#else
+    return CnvUtfConverter::ConvertToUnicodeFromUtf8(aUnicode, aForeign);
+#endif
+}
+
+// Convert from Unicode
+TInt PjSymbianOS::ConvertFromUnicode(TDes8 &aForeign, const TDesC16 &aUnicode)
+{
+#if 0
+    pj_assert(conv_ != NULL);
+    return conv_->ConvertFromUnicode(aForeign, aUnicode, convToAnsiState_);
+#else
+    return CnvUtfConverter::ConvertFromUnicodeToUtf8(aForeign, aUnicode);
+#endif
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// PJLIB os.h implementation
+//
+
+PJ_DEF(pj_uint32_t) pj_getpid(void)
+{
+    return 0;
+}
+
+
+/* Set Symbian specific parameters */
+PJ_DEF(pj_status_t) pj_symbianos_set_params(pj_symbianos_params *prm) 
+{
+    PJ_ASSERT_RETURN(prm != NULL, PJ_EINVAL);
+    PjSymbianOS::Instance()->SetParameters(prm);
+    return PJ_SUCCESS;
+}
+
+
+/* Set connection status */
+PJ_DEF(void) pj_symbianos_set_connection_status(pj_bool_t up)
+{
+    PjSymbianOS::Instance()->SetConnectionStatus(up != 0);
+}
+
+
+/*
+ * pj_init(void).
+ * Init PJLIB!
+ */
+PJ_DEF(pj_status_t) pj_init(void)
+{
+	char stack_ptr;
+    pj_status_t status;
+    
+    /* Check if PJLIB have been initialized */
+    if (initialized) {
+	++initialized;
+	return PJ_SUCCESS;
+    }
+
+    pj_ansi_strcpy(main_thread.obj_name, "pjthread");
+
+    // Init main thread
+    pj_memset(&main_thread, 0, sizeof(main_thread));
+
+    // Initialize PjSymbianOS instance
+    PjSymbianOS *os = PjSymbianOS::Instance();
+
+    PJ_LOG(4,(THIS_FILE, "Initializing PJLIB for Symbian OS.."));
+
+    TInt err; 
+    err = os->Initialize();
+    if (err != KErrNone)
+    	return PJ_RETURN_OS_ERROR(err);
+
+    /* Init logging */
+    pj_log_init();
+
+    /* Initialize exception ID for the pool. 
+     * Must do so after critical section is configured.
+     */ 
+    status = pj_exception_id_alloc("PJLIB/No memory", &PJ_NO_MEMORY_EXCEPTION);
+    if (status != PJ_SUCCESS)
+        goto on_error;
+
+#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
+    main_thread.stk_start = &stack_ptr;
+    main_thread.stk_size = 0xFFFFFFFFUL;
+    main_thread.stk_max_usage = 0;
+#else
+    stack_ptr = '\0';
+#endif
+
+    /* Flag PJLIB as initialized */
+    ++initialized;
+    pj_assert(initialized == 1);
+
+    PJ_LOG(5,(THIS_FILE, "PJLIB initialized."));
+    return PJ_SUCCESS;
+
+on_error:
+    pj_shutdown();
+    return PJ_RETURN_OS_ERROR(err);
+}
+
+
+PJ_DEF(pj_status_t) pj_atexit(pj_exit_callback func)
+{
+    if (atexit_count >= PJ_ARRAY_SIZE(atexit_func))
+	return PJ_ETOOMANY;
+
+    atexit_func[atexit_count++] = func;
+    return PJ_SUCCESS;
+}
+
+
+
+PJ_DEF(void) pj_shutdown(void)
+{
+    /* Only perform shutdown operation when 'initialized' reaches zero */
+    pj_assert(initialized > 0);
+    if (--initialized != 0)
+	return;
+
+    /* Call atexit() functions */
+    while (atexit_count > 0) {
+	(*atexit_func[atexit_count-1])();
+	--atexit_count;
+    }
+
+    /* Free exception ID */
+    if (PJ_NO_MEMORY_EXCEPTION != -1) {
+	pj_exception_id_free(PJ_NO_MEMORY_EXCEPTION);
+	PJ_NO_MEMORY_EXCEPTION = -1;
+    }
+
+    /* Clear static variables */
+    pj_errno_clear_handlers();
+
+    PjSymbianOS *os = PjSymbianOS::Instance();
+    os->Shutdown();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+class CPollTimeoutTimer : public CActive 
+{
+public:
+    static CPollTimeoutTimer* NewL(int msec, TInt prio);
+    ~CPollTimeoutTimer();
+    
+    virtual void RunL();
+    virtual void DoCancel();
+
+private:	
+    RTimer	     rtimer_;
+    
+    explicit CPollTimeoutTimer(TInt prio);
+    void ConstructL(int msec);
+};
+
+CPollTimeoutTimer::CPollTimeoutTimer(TInt prio)
+: CActive(prio)
+{
+}
+
+
+CPollTimeoutTimer::~CPollTimeoutTimer() 
+{
+    rtimer_.Close();
+}
+
+void CPollTimeoutTimer::ConstructL(int msec) 
+{
+    rtimer_.CreateLocal();
+    CActiveScheduler::Add(this);
+    rtimer_.After(iStatus, msec*1000);
+    SetActive();
+}
+
+CPollTimeoutTimer* CPollTimeoutTimer::NewL(int msec, TInt prio) 
+{
+    CPollTimeoutTimer *self = new CPollTimeoutTimer(prio);
+    CleanupStack::PushL(self);
+    self->ConstructL(msec);    
+    CleanupStack::Pop(self);
+
+    return self;
+}
+
+void CPollTimeoutTimer::RunL() 
+{
+}
+
+void CPollTimeoutTimer::DoCancel() 
+{
+     rtimer_.Cancel();
+}
+
+
+/*
+ * Wait the completion of any Symbian active objects. 
+ */
+PJ_DEF(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout)
+{
+    CPollTimeoutTimer *timer = NULL;
+    
+    if (priority==-1)
+    	priority = EPriorityNull;
+    
+    if (ms_timeout >= 0) {
+    	timer = CPollTimeoutTimer::NewL(ms_timeout, priority);
+    }
+    
+    PjSymbianOS::Instance()->WaitForActiveObjects(priority);
+    
+    if (timer) {
+        bool timer_is_active = timer->IsActive();
+    
+	timer->Cancel();
+        
+        delete timer;
+        
+    	return timer_is_active ? PJ_TRUE : PJ_FALSE;
+    	
+    } else {
+    	return PJ_TRUE;
+    }
+}
+
+
+/*
+ * pj_thread_is_registered()
+ */
+PJ_DEF(pj_bool_t) pj_thread_is_registered(void)
+{
+    return PJ_FALSE;
+}
+
+
+/*
+ * Get thread priority value for the thread.
+ */
+PJ_DEF(int) pj_thread_get_prio(pj_thread_t *thread)
+{
+    PJ_UNUSED_ARG(thread);
+    return 1;
+}
+
+
+/*
+ * Set the thread priority.
+ */
+PJ_DEF(pj_status_t) pj_thread_set_prio(pj_thread_t *thread,  int prio)
+{
+    PJ_UNUSED_ARG(thread);
+    PJ_UNUSED_ARG(prio);
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Get the lowest priority value available on this system.
+ */
+PJ_DEF(int) pj_thread_get_prio_min(pj_thread_t *thread)
+{
+    PJ_UNUSED_ARG(thread);
+    return 1;
+}
+
+
+/*
+ * Get the highest priority value available on this system.
+ */
+PJ_DEF(int) pj_thread_get_prio_max(pj_thread_t *thread)
+{
+    PJ_UNUSED_ARG(thread);
+    return 1;
+}
+
+
+/*
+ * pj_thread_get_os_handle()
+ */
+PJ_DEF(void*) pj_thread_get_os_handle(pj_thread_t *thread) 
+{
+    PJ_UNUSED_ARG(thread);
+    return NULL;
+}
+
+/*
+ * pj_thread_register(..)
+ */
+PJ_DEF(pj_status_t) pj_thread_register ( const char *cstr_thread_name,
+					 pj_thread_desc desc,
+                                         pj_thread_t **thread_ptr)
+{
+    PJ_UNUSED_ARG(cstr_thread_name);
+    PJ_UNUSED_ARG(desc);
+    PJ_UNUSED_ARG(thread_ptr);
+    return PJ_EINVALIDOP;
+}
+
+
+/*
+ * pj_thread_create(...)
+ */
+PJ_DEF(pj_status_t) pj_thread_create( pj_pool_t *pool, 
+				      const char *thread_name,
+				      pj_thread_proc *proc, 
+				      void *arg,
+				      pj_size_t stack_size, 
+				      unsigned flags,
+				      pj_thread_t **ptr_thread)
+{
+    PJ_UNUSED_ARG(pool);
+    PJ_UNUSED_ARG(thread_name);
+    PJ_UNUSED_ARG(proc);
+    PJ_UNUSED_ARG(arg);
+    PJ_UNUSED_ARG(stack_size);
+    PJ_UNUSED_ARG(flags);
+    PJ_UNUSED_ARG(ptr_thread);
+
+    /* Sorry mate, we don't support threading */
+    return PJ_ENOTSUP;
+}
+
+/*
+ * pj_thread-get_name()
+ */
+PJ_DEF(const char*) pj_thread_get_name(pj_thread_t *p)
+{
+    pj_assert(p == &main_thread);
+    return p->obj_name;
+}
+
+/*
+ * pj_thread_resume()
+ */
+PJ_DEF(pj_status_t) pj_thread_resume(pj_thread_t *p)
+{
+    PJ_UNUSED_ARG(p);
+    return PJ_EINVALIDOP;
+}
+
+/*
+ * pj_thread_this()
+ */
+PJ_DEF(pj_thread_t*) pj_thread_this(void)
+{
+    return &main_thread;
+}
+
+/*
+ * pj_thread_join()
+ */
+PJ_DEF(pj_status_t) pj_thread_join(pj_thread_t *rec)
+{
+    PJ_UNUSED_ARG(rec);
+    return PJ_EINVALIDOP;
+}
+
+/*
+ * pj_thread_destroy()
+ */
+PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *rec)
+{
+    PJ_UNUSED_ARG(rec);
+    return PJ_EINVALIDOP;
+}
+
+/*
+ * pj_thread_sleep()
+ */
+PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec)
+{
+    User::After(msec*1000);
+
+    return PJ_SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/*
+ * pj_thread_local_alloc()
+ */
+
+PJ_DEF(pj_status_t) pj_thread_local_alloc(long *index)
+{
+    unsigned i;
+
+    /* Find unused TLS variable */
+    for (i=0; i<PJ_ARRAY_SIZE(tls_vars); ++i) {
+	if (tls_vars[i] == 0)
+	    break;
+    }
+
+    if (i == PJ_ARRAY_SIZE(tls_vars))
+	return PJ_ETOOMANY;
+
+    tls_vars[i] = 1;
+    *index = i;
+
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_thread_local_free()
+ */
+PJ_DEF(void) pj_thread_local_free(long index)
+{
+    PJ_ASSERT_ON_FAIL(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
+		     tls_vars[index] != 0, return);
+
+    tls_vars[index] = 0;
+}
+
+
+/*
+ * pj_thread_local_set()
+ */
+PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value)
+{
+    pj_thread_t *rec = pj_thread_this();
+
+    PJ_ASSERT_RETURN(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
+		     tls_vars[index] != 0, PJ_EINVAL);
+
+    rec->tls_values[index] = value;
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_thread_local_get()
+ */
+PJ_DEF(void*) pj_thread_local_get(long index)
+{
+    pj_thread_t *rec = pj_thread_this();
+
+    PJ_ASSERT_RETURN(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
+		     tls_vars[index] != 0, NULL);
+
+    return rec->tls_values[index];
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/*
+ * Create atomic variable.
+ */
+PJ_DEF(pj_status_t) pj_atomic_create( pj_pool_t *pool, 
+				      pj_atomic_value_t initial,
+				      pj_atomic_t **atomic )
+{
+    *atomic = (pj_atomic_t*)pj_pool_alloc(pool, sizeof(struct pj_atomic_t));
+    (*atomic)->value = initial;
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Destroy atomic variable.
+ */
+PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var )
+{
+    PJ_UNUSED_ARG(atomic_var);
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Set the value of an atomic type, and return the previous value.
+ */
+PJ_DEF(void) pj_atomic_set( pj_atomic_t *atomic_var, 
+			    pj_atomic_value_t value)
+{
+    atomic_var->value = value;
+}
+
+
+/*
+ * Get the value of an atomic type.
+ */
+PJ_DEF(pj_atomic_value_t) pj_atomic_get(pj_atomic_t *atomic_var)
+{
+    return atomic_var->value;
+}
+
+
+/*
+ * Increment the value of an atomic type.
+ */
+PJ_DEF(void) pj_atomic_inc(pj_atomic_t *atomic_var)
+{
+    ++atomic_var->value;
+}
+
+
+/*
+ * Increment the value of an atomic type and get the result.
+ */
+PJ_DEF(pj_atomic_value_t) pj_atomic_inc_and_get(pj_atomic_t *atomic_var)
+{
+    return ++atomic_var->value;
+}
+
+
+/*
+ * Decrement the value of an atomic type.
+ */
+PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var)
+{
+    --atomic_var->value;
+}	
+
+
+/*
+ * Decrement the value of an atomic type and get the result.
+ */
+PJ_DEF(pj_atomic_value_t) pj_atomic_dec_and_get(pj_atomic_t *atomic_var)
+{
+    return --atomic_var->value;
+}
+
+
+/*
+ * Add a value to an atomic type.
+ */
+PJ_DEF(void) pj_atomic_add( pj_atomic_t *atomic_var,
+			    pj_atomic_value_t value)
+{
+    atomic_var->value += value;
+}
+
+
+/*
+ * Add a value to an atomic type and get the result.
+ */
+PJ_DEF(pj_atomic_value_t) pj_atomic_add_and_get( pj_atomic_t *atomic_var,
+			                         pj_atomic_value_t value)
+{
+    atomic_var->value += value;
+    return atomic_var->value;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+PJ_DEF(pj_status_t) pj_mutex_create( pj_pool_t *pool, 
+                                     const char *name,
+				     int type, 
+                                     pj_mutex_t **mutex)
+{
+    PJ_UNUSED_ARG(pool);
+    PJ_UNUSED_ARG(name);
+    PJ_UNUSED_ARG(type);
+
+    *mutex = DUMMY_MUTEX;
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_mutex_create_simple()
+ */
+PJ_DEF(pj_status_t) pj_mutex_create_simple( pj_pool_t *pool, 
+                                            const char *name,
+					    pj_mutex_t **mutex )
+{
+    return pj_mutex_create(pool, name, PJ_MUTEX_SIMPLE, mutex);
+}
+
+
+PJ_DEF(pj_status_t) pj_mutex_create_recursive( pj_pool_t *pool,
+					       const char *name,
+					       pj_mutex_t **mutex )
+{
+    return pj_mutex_create(pool, name, PJ_MUTEX_RECURSE, mutex);
+}
+
+
+/*
+ * pj_mutex_lock()
+ */
+PJ_DEF(pj_status_t) pj_mutex_lock(pj_mutex_t *mutex)
+{
+    pj_assert(mutex == DUMMY_MUTEX);
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_mutex_trylock()
+ */
+PJ_DEF(pj_status_t) pj_mutex_trylock(pj_mutex_t *mutex)
+{
+    pj_assert(mutex == DUMMY_MUTEX);
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_mutex_unlock()
+ */
+PJ_DEF(pj_status_t) pj_mutex_unlock(pj_mutex_t *mutex)
+{
+    pj_assert(mutex == DUMMY_MUTEX);
+    return PJ_SUCCESS;
+}
+
+/*
+ * pj_mutex_destroy()
+ */
+PJ_DEF(pj_status_t) pj_mutex_destroy(pj_mutex_t *mutex)
+{
+    pj_assert(mutex == DUMMY_MUTEX);
+    return PJ_SUCCESS;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+/*
+ * RW Mutex
+ */
+#include "os_rwmutex.c"
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ * Enter critical section.
+ */
+PJ_DEF(void) pj_enter_critical_section(void)
+{
+    /* Nothing to do */
+}
+
+
+/*
+ * Leave critical section.
+ */
+PJ_DEF(void) pj_leave_critical_section(void)
+{
+    /* Nothing to do */
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ * Create semaphore.
+ */
+PJ_DEF(pj_status_t) pj_sem_create( pj_pool_t *pool, 
+                                   const char *name,
+				   unsigned initial, 
+                                   unsigned max,
+				   pj_sem_t **p_sem)
+{
+    pj_sem_t *sem;
+ 
+    PJ_UNUSED_ARG(name);
+
+    sem = (pj_sem_t*) pj_pool_zalloc(pool, sizeof(pj_sem_t));
+    sem->value = initial;
+    sem->max = max;
+
+    *p_sem = sem;
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Wait for semaphore.
+ */
+PJ_DEF(pj_status_t) pj_sem_wait(pj_sem_t *sem)
+{
+    if (sem->value > 0) {
+	sem->value--;
+	return PJ_SUCCESS;
+    } else {
+	pj_assert(!"Unexpected!");
+	return PJ_EINVALIDOP;
+    }
+}
+
+
+/*
+ * Try wait for semaphore.
+ */
+PJ_DEF(pj_status_t) pj_sem_trywait(pj_sem_t *sem)
+{
+    if (sem->value > 0) {
+	sem->value--;
+	return PJ_SUCCESS;
+    } else {
+	pj_assert(!"Unexpected!");
+	return PJ_EINVALIDOP;
+    }
+}
+
+
+/*
+ * Release semaphore.
+ */
+PJ_DEF(pj_status_t) pj_sem_post(pj_sem_t *sem)
+{
+    sem->value++;
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Destroy semaphore.
+ */
+PJ_DEF(pj_status_t) pj_sem_destroy(pj_sem_t *sem)
+{
+    PJ_UNUSED_ARG(sem);
+    return PJ_SUCCESS;
+}
+
+
+#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK != 0
+/*
+ * The implementation of stack checking. 
+ */
+PJ_DEF(void) pj_thread_check_stack(const char *file, int line)
+{
+    char stk_ptr;
+    pj_uint32_t usage;
+    pj_thread_t *thread = pj_thread_this();
+
+    pj_assert(thread);
+
+    /* Calculate current usage. */
+    usage = (&stk_ptr > thread->stk_start) ? &stk_ptr - thread->stk_start :
+		thread->stk_start - &stk_ptr;
+
+    /* Assert if stack usage is dangerously high. */
+    pj_assert("STACK OVERFLOW!! " && (usage <= thread->stk_size - 128));
+
+    /* Keep statistic. */
+    if (usage > thread->stk_max_usage) {
+	thread->stk_max_usage = usage;
+	thread->caller_file = file;
+	thread->caller_line = line;
+    }
+}
+
+/*
+ * Get maximum stack usage statistic. 
+ */
+PJ_DEF(pj_uint32_t) pj_thread_get_stack_max_usage(pj_thread_t *thread)
+{
+    return thread->stk_max_usage;
+}
+
+/*
+ * Dump thread stack status. 
+ */
+PJ_DEF(pj_status_t) pj_thread_get_stack_info(pj_thread_t *thread,
+					     const char **file,
+					     int *line)
+{
+    pj_assert(thread);
+
+    *file = thread->caller_file;
+    *line = thread->caller_line;
+    return 0;
+}
+
+#endif	/* PJ_OS_HAS_CHECK_STACK */
+
+/*
+ * pj_run_app()
+ */
+PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
+                       unsigned flags)
+{
+    return (*main_func)(argc, argv);
+}
diff --git a/jni/pjproject-android/.svn/pristine/ce/ce71a3d2577459ba70e2d4976c7d76e912fe1be5.svn-base b/jni/pjproject-android/.svn/pristine/ce/ce71a3d2577459ba70e2d4976c7d76e912fe1be5.svn-base
new file mode 100644
index 0000000..9a24ddf
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/ce71a3d2577459ba70e2d4976c7d76e912fe1be5.svn-base
@@ -0,0 +1,25 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# Torture message from RFC 4475
+# 3.1.1.  Valid Messages
+# 3.1.1.4. Escaped Nulls in URIs
+complete_msg = \
+"""REGISTER sip:example.com SIP/2.0
+To: sip:null-%00-null@example.com
+From: sip:null-%00-null@example.com;tag=839923423
+Max-Forwards: 70
+Call-ID: escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd
+CSeq: 14398234 REGISTER
+Via: SIP/2.0/UDP host5.example.com;rport;branch=z9hG4bKkdjuw
+Contact: <sip:%00@host5.example.com>
+Contact: <sip:%00%00@host5.example.com>
+L:0
+"""
+
+
+sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.4", 
+			    "--null-audio --auto-answer 200", 
+			    "", 200, complete_msg=complete_msg)
+
diff --git a/jni/pjproject-android/.svn/pristine/ce/cea14edbce4de2fdebcf70e758b53a3c074683b8.svn-base b/jni/pjproject-android/.svn/pristine/ce/cea14edbce4de2fdebcf70e758b53a3c074683b8.svn-base
new file mode 100644
index 0000000..4f32e97
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/cea14edbce4de2fdebcf70e758b53a3c074683b8.svn-base
@@ -0,0 +1,35 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# Torture message from RFC 4475
+# 3.1.1.  Valid Messages
+# 3.1.1.3. Valid Use of the % Escaping Mechanism
+complete_msg = \
+"""INVITE sip:sips%3Auser%40example.com@example.net SIP/2.0
+To: sip:%75se%72@example.com
+From: <sip:I%20have%20spaces@example.net>;tag=$FROM_TAG
+Max-Forwards: 87
+i: esc01.239409asdfakjkn23onasd0-3234
+CSeq: 234234 INVITE
+Via: SIP/2.0/UDP host5.example.net;rport;branch=z9hG4bKkdjuw
+C: application/sdp
+Contact:
+  <sip:cal%6Cer@$LOCAL_IP:$LOCAL_PORT;%6C%72;n%61me=v%61lue%25%34%31>
+Content-Length: 150
+
+v=0
+o=mhandley 29739 7272939 IN IP4 192.0.2.1
+s=-
+c=IN IP4 192.0.2.1
+t=0 0
+m=audio 49217 RTP/AVP 0 12
+m=video 3227 RTP/AVP 31
+a=rtpmap:31 LPC
+"""
+
+
+sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.3", 
+			    "--null-audio --auto-answer 200", 
+			    "", 200, complete_msg=complete_msg)
+
diff --git a/jni/pjproject-android/.svn/pristine/ce/cef96c916aab6e75dd05d11fd2765416c7625854.svn-base b/jni/pjproject-android/.svn/pristine/ce/cef96c916aab6e75dd05d11fd2765416c7625854.svn-base
new file mode 100644
index 0000000..94f5f3f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/ce/cef96c916aab6e75dd05d11fd2765416c7625854.svn-base
@@ -0,0 +1,86 @@
+#
+# cfg_symbian.py - Symbian target configurator
+#
+# Copyright (C) 2008-2009 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
+#
+import builder
+import os
+import sys
+
+# Each configurator must export this function
+def create_builder(args):
+    usage = """\
+Usage:
+  main.py cfg_symbian [-h|--help] [-t|--target TARGET] [cfg_site]
+ 
+Arguments:
+  cfg_site:            site configuration module. If not specified, "cfg_site" 
+                       is implied
+  -t,--target TARGET:  Symbian target to build. Default is "gcce urel". 
+                       Other values:
+                        "winscw udeb", "gcce udeb", etc.
+  -h, --help           Show this help screen
+"""           
+
+    cfg_site = "cfg_site"
+    target = "gcce urel"
+    in_option = ""
+    
+    for arg in args:
+        if in_option=="-t":
+            target = arg
+            in_option = ""
+        elif arg=="--target" or arg=="-t":
+            in_option = "-t"
+        elif arg=="--help" or arg=="-h":
+            print usage
+            sys.exit(0)
+        elif arg[0]=="-":
+            print usage
+            sys.exit(1)
+        else:
+            cfg_site = arg
+        
+    if os.access(cfg_site+".py", os.F_OK) == False:
+        print "Error: file '%s.py' doesn't exist." % (cfg_site)
+        sys.exit(1)
+
+    cfg_site = __import__(cfg_site)
+    test_cfg = builder.BaseConfig(cfg_site.BASE_DIR, \
+                                  cfg_site.URL, \
+                                  cfg_site.SITE_NAME, \
+                                  cfg_site.GROUP, \
+                                  cfg_site.OPTIONS)
+    config_site1 = """\
+#define PJ_TODO(x)
+#include <pj/config_site_sample.h>
+
+"""
+
+    config_Site = config_site1 + cfg_site.CONFIG_SITE
+
+    builders = [
+        builder.SymbianTestBuilder(test_cfg, 
+                                   target=target,
+                                   build_config_name="default",
+                                   config_site=config_site1,
+                                   exclude=cfg_site.EXCLUDE,
+                                   not_exclude=cfg_site.NOT_EXCLUDE)
+        ]
+
+    return builders
+