* #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/f6/f6319dd0c20273b6343570a25f345dfb496d4190.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6319dd0c20273b6343570a25f345dfb496d4190.svn-base
new file mode 100644
index 0000000..af99dbf
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6319dd0c20273b6343570a25f345dfb496d4190.svn-base
@@ -0,0 +1,17 @@
+#
+# Global OS specific configurations for RTEMS OS.
+#
+# Thanks Zetron, Inc and Phil Torre <ptorre@zetron.com> for donating PJLIB
+# port to RTEMS.
+#
+export RTEMS_DEBUG := -ggdb3 -DRTEMS_DEBUG -DDEBUG -qrtems_debug 
+
+export OS_CFLAGS   := $(CC_DEF)PJ_RTEMS=1 \
+	-B$(RTEMS_LIBRARY_PATH)/lib/ -specs bsp_specs -qrtems
+
+export OS_CXXFLAGS := 
+
+export OS_LDFLAGS  := -B$(RTEMS_LIBRARY_PATH)/lib/ -specs bsp_specs -qrtems  -lm
+
+export OS_SOURCES  := 
+
diff --git a/jni/pjproject-android/.svn/pristine/f6/f64bf44d397de932d74a995c98266533ce266f65.svn-base b/jni/pjproject-android/.svn/pristine/f6/f64bf44d397de932d74a995c98266533ce266f65.svn-base
new file mode 100644
index 0000000..9904bf8
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f64bf44d397de932d74a995c98266533ce266f65.svn-base
@@ -0,0 +1,92 @@
+/* $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 "test.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+extern const char *system_name;
+
+static void usage()
+{
+    puts("Usage: test-pjsip");
+    puts("Options:");
+    puts(" -i,--interractive   Key input at the end.");
+    puts(" -h,--help           Show this screen");
+    puts(" -l,--log-level N    Set log level (0-6)");
+}
+
+int main(int argc, char *argv[])
+{
+    int interractive = 0;
+    int retval;
+    char **opt_arg;
+
+    PJ_UNUSED_ARG(argc);
+
+    /* Parse arguments. */
+    opt_arg = argv+1;
+    while (*opt_arg) {
+	if (strcmp(*opt_arg, "-i") == 0 ||
+	    strcmp(*opt_arg, "--interractive") == 0)
+	{
+	    interractive = 1;
+	} else if (strcmp(*opt_arg, "-h") == 0 ||
+		   strcmp(*opt_arg, "--help") == 0) 
+	{
+	    usage();
+	    return 1;
+	} else if (strcmp(*opt_arg, "-l") == 0 ||
+		   strcmp(*opt_arg, "--log-level") == 0) 
+	{
+	    ++opt_arg;
+	    if (!opt_arg) {
+		usage();
+		return 1;
+	    }
+	    log_level = atoi(*opt_arg);
+	} else 	if (strcmp(*opt_arg, "-s") == 0 ||
+	    strcmp(*opt_arg, "--system") == 0)
+	{
+	    ++opt_arg;
+	    if (!opt_arg) {
+		usage();
+		return 1;
+	    }
+	    system_name = *opt_arg;
+	} else {
+	    usage();
+	    return 1;
+	}
+
+	++opt_arg;
+    }
+
+    retval = test_main();
+
+    if (interractive) {
+	char s[10];
+	printf("<Press ENTER to quit>\n"); fflush(stdout);
+	if (fgets(s, sizeof(s), stdin) == NULL)
+	    return retval;
+    }
+
+    return retval;
+}
diff --git a/jni/pjproject-android/.svn/pristine/f6/f64ff134b8800371e0052ead89e15e4b164266a7.svn-base b/jni/pjproject-android/.svn/pristine/f6/f64ff134b8800371e0052ead89e15e4b164266a7.svn-base
new file mode 100644
index 0000000..7ec94cb
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f64ff134b8800371e0052ead89e15e4b164266a7.svn-base
@@ -0,0 +1,244 @@
+/* $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 __PJMEDIA_DOXYGEN_H__
+#define __PJMEDIA_DOXYGEN_H__
+
+/**
+ * @file doxygen.h
+ * @brief Doxygen's mainpage.
+ */
+
+
+/*////////////////////////////////////////////////////////////////////////// */
+/*
+	INTRODUCTION PAGE
+ */
+
+/**
+ * @mainpage PJMEDIA
+ *
+ * \n
+ * @section intro2 Introduction to PJMEDIA
+ *
+ * PJMEDIA is a fully featured media stack, distributed under Open Source/GPL
+ * terms, and featuring small footprint and good extensibility and excellent
+ * portability. Here are some brief overview of PJMEDIA benefits.
+ *
+ * @subsection benefit Benefits
+ * @subsubsection full_feature Many Features
+ * PJMEDIA has many features, and rather than to list them all here, please
+ * see the <A HREF="modules.htm"><b>Modules</b></A> page for more info.
+ *
+ * Video is planned to arrive at version 2.
+ *
+ * @subsubsection portable Excellent Portability
+ * It's been ported to all desktop systems and many mobile platforms including
+ * Symbian, Windows Mobile, iPhone, and Android. Thanks to its zero thread
+ * design, users have been able to run PJMEDIA on deeply embedded platforms,
+ * even without operating systems (those typically found in DSP platforms).
+ * Except the echo suppressor, all other PJMEDIA components have fixed point
+ * implementation, which makes it ideal for embedded systems which lack FPU.
+ * PJMEDIA also has tiny footprint, as explained below
+ *
+ * @subsubsection footprint Tiny Footprint
+ * Lets not talk about less meaningful and potentially misleading term such as
+ * core footprint, and instead here is the footprint of all components
+ * typically used to build a full streaming media:
+ *
+ * \verbatim
+Category        Component       text    data    bss     dec     filename
+-------------------------------------------------------------------------------
+Core            Error subsystem 135     0       0       135     errno.o
+Core            Endpoint        4210    4       4       4218    endpoint.o
+Core            Port framework  652     0       0       652     port.o
+Core            Codec framework 6257    0       0       6257    codec.o
+Codec           Alaw/ulaw conv. 1060    16      0       1076    alaw_ulaw.o
+Codec           G.711           3298    128     96      3522    g711.o
+Codec           PLC             883     24      0       907     plc_common.o
+Codec           PLC             7130    0       0       7130    wsola.o
+Session         Stream          12222   0       1920    14142   stream.o
+Transport       RTCP            3732    0       0       3732    rtcp.o
+Transport       RTP             2568    0       0       2568    rtp.o
+Transport       UDP             6612    96      0       6708    transport_udp.o
+Transport       Jitter buffer   6473    0       0       6473    jbuf.o
+-------------------------------------------------------------------------------
+TOTAL                          55,232   268    2,020    57,520
+
+ \endverbatim
+ * The 56KB are for media streaming components, complete with codec, RTP, and
+ * RTCP. The footprint above was done for PJSIP version 1.8.2 on a Linux x86
+ * machine, using footprintopimization as explained in PJSIP FAQ. Numbers are
+ * in bytes.
+ *
+ * @subsubsection quality Good Quality
+ * PJMEDIA supports wideband, ultra-wideband, and beyond, as well as multiple
+ * audio channels. The jitter buffer has been proven to work on lower
+ * bandwidth links such as 3G, and to some extent, Edge and GPRS. We've grown
+ * our own algorithm to compensate for packet losses and clock drifts in audio
+ * transmission, as well as feature to use codec's built in PLC if available.
+ *
+ * @subsubsection hw Hardware Support
+ * PJMEDIA supports hardware, firmware, or other built-in feature that comes
+ * with the device. These are crucial for mobile devices to allow the best
+ * use of the very limited CPU and battery power of the device. Among other
+ * things, device's on-board codec and echo cancellation may be used if
+ * available.
+ *
+ * @subsubsection extensible Extensible
+ * Despite its tiny footprint, PJMEDIA uses a flexible port concept, which is
+ * adapted from filter based concept found in other media framework. It is not
+ * as flexible as those found in Direct Show or gstreamer (and that would be
+ * unnecessary since it serves different purpose), but it's flexible enough
+ * to allow components to be assembled one after another to achieve certain
+ * task, and easy creation of such components by application and interconnect
+ * them to the rest of the framework.
+ *
+ * @subsubsection doc (Fairly Okay) Documentation
+ * We understand that any documentation can always be improved, but we put
+ * a lot of efforts in creating and maintaining our documentation, because
+ * we know it matters.
+ *
+ * \n
+ * @subsection org1 Organization
+ *
+ * At the top-most level, PJMEDIA library suite contains the following
+ * libraries.
+ *
+ * @subsubsection libpjmedia PJMEDIA
+ * This contains all main media components. Please see the
+ * <A HREF="modules.htm"><b>Modules</b></A> page for complete list of
+ * components that PJMEDIA provides.
+ *
+ * @subsubsection libpjmediacodec PJMEDIA Codec
+ * PJMEDIA-CODEC is a static library containing various codec implementations,
+ * wrapped into PJMEDIA codec framework. The static library is designed as
+ * such so that only codecs that are explicitly initialized are linked with 
+ * the application, therefore keeping the application size in control.
+ *
+ * Please see @ref PJMEDIA_CODEC for more info.
+ *
+ * @subsubsection libpjmediaaudiodev PJMEDIA Audio Device
+ * PJMEDIA-Audiodev is audio device framework and abstraction library. Please
+ * see @ref audio_device_api for more info.
+ *
+ * \n
+ * @section pjmedia_concepts PJMEDIA Key Concepts
+ * Below are some key concepts in PJMEDIA:
+ *  - @ref PJMEDIA_PORT
+ *  - @ref PJMEDIA_PORT_CLOCK
+ *  - @ref PJMEDIA_TRANSPORT
+ *  - @ref PJMEDIA_SESSION
+ */
+
+
+/**
+  @page page_pjmedia_samples PJMEDIA and PJMEDIA-CODEC Examples
+
+  @section pjmedia_samples_sec PJMEDIA and PJMEDIA-CODEC Examples
+
+  Please find below some PJMEDIA related examples that may help in giving
+  some more info:
+
+  - @ref page_pjmedia_samples_level_c\n
+    This is a good place to start learning about @ref PJMEDIA_PORT,
+    as it shows that @ref PJMEDIA_PORT are only "passive" objects
+    with <tt>get_frame()</tt> and <tt>put_frame()</tt> interface, and
+    someone has to call these to retrieve/store media frames.
+
+  - @ref page_pjmedia_samples_playfile_c\n
+    This example shows that when application connects a media port (in this
+    case a @ref PJMEDIA_FILE_PLAY) to @ref PJMED_SND_PORT, media will flow
+    automatically since the @ref PJMED_SND_PORT provides @ref PJMEDIA_PORT_CLOCK.
+
+  - @ref page_pjmedia_samples_recfile_c\n
+    Demonstrates how to capture audio from microphone to WAV file.
+
+  - @ref page_pjmedia_samples_playsine_c\n
+    Demonstrates how to create a custom @ref PJMEDIA_PORT (in this
+    case a sine wave generator) and integrate it to PJMEDIA.
+
+  - @ref page_pjmedia_samples_confsample_c\n
+    This demonstrates how to use the @ref PJMEDIA_CONF. The sample program can 
+    open multiple WAV files, and instruct the conference bridge to mix the
+    signal before playing it to the sound device.
+
+  - @ref page_pjmedia_samples_confbench_c\n
+    I use this to benchmark/optimize the conference bridge algorithm, but
+    readers may find the source useful.
+
+  - @ref page_pjmedia_samples_resampleplay_c\n
+    Demonstrates how to use @ref PJMEDIA_RESAMPLE_PORT to change the
+    sampling rate of a media port (in this case, a @ref PJMEDIA_FILE_PLAY).
+
+  - @ref page_pjmedia_samples_sndtest_c\n
+    This program performs some tests to the sound device to get some
+    quality parameters (such as sound jitter and clock drifts).\n
+    Screenshots on WinXP: \image html sndtest.jpg "sndtest screenshot on WinXP"
+
+  - @ref page_pjmedia_samples_streamutil_c\n
+    This example mainly demonstrates how to stream media (in this case a
+    @ref PJMEDIA_FILE_PLAY) to remote peer using RTP.
+
+  - @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_pjmedia_samples_tonegen_c\n
+    This is a simple program to generate a tone and write the samples to
+    a raw PCM file. The main purpose of this file is to analyze the
+    quality of the tones/sine wave generated by PJMEDIA tone/sine wave
+    generator.
+
+  - @ref page_pjmedia_samples_aectest_c\n
+    Play a file to speaker, run AEC, and record the microphone input
+    to see if echo is coming.
+ */
+
+/**
+ * \page page_pjmedia_samples_siprtp_c Samples: Using SIP and Custom RTP/RTCP to Monitor Quality
+ *
+ * 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
+ */
+
+#endif /* __PJMEDIA_DOXYGEN_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/f6/f653facc878d59ddae8e5c7bb4e4bbbcf3a73c73.svn-base b/jni/pjproject-android/.svn/pristine/f6/f653facc878d59ddae8e5c7bb4e4bbbcf3a73c73.svn-base
new file mode 100644
index 0000000..0dd8c8a
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f653facc878d59ddae8e5c7bb4e4bbbcf3a73c73.svn-base
@@ -0,0 +1,47 @@
+/* $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 <pjmedia/types.h>
+#include <pj/assert.h>
+
+/**
+ * Utility function to return the string name for a pjmedia_type.
+ *
+ * @param t		The media type.
+ *
+ * @return		String.
+ */
+PJ_DEF(const char*) pjmedia_type_name(pjmedia_type t)
+{
+    const char *type_names[] = {
+	"none",
+	"audio",
+	"video",
+	"application",
+	"unknown"
+    };
+
+    pj_assert(t < (int)PJ_ARRAY_SIZE(type_names));
+    pj_assert(PJMEDIA_TYPE_UNKNOWN == 4);
+
+    if (t < (int)PJ_ARRAY_SIZE(type_names))
+	return type_names[t];
+    else
+	return "??";
+}
diff --git a/jni/pjproject-android/.svn/pristine/f6/f679561cc604ca60a427ff5b02c4fb5cd84ebaf6.svn-base b/jni/pjproject-android/.svn/pristine/f6/f679561cc604ca60a427ff5b02c4fb5cd84ebaf6.svn-base
new file mode 100644
index 0000000..f613b84
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f679561cc604ca60a427ff5b02c4fb5cd84ebaf6.svn-base
@@ -0,0 +1,486 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 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 
+ */
+#include "test.h"
+#include <pjmedia-codec/ffmpeg_vid_codecs.h>
+#include <pjmedia-videodev/videodev.h>
+#include <pjmedia/vid_codec.h>
+#include <pjmedia/port.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
+#define THIS_FILE "vid_codec.c"
+
+/* 
+ * Capture device setting: 
+ *   -1 = colorbar, 
+ *   -2 = any non-colorbar capture device (first found)
+ *    x = specified capture device id
+ */
+#define CAPTURE_DEV	    -1
+
+
+typedef struct codec_port_data_t
+{
+    pjmedia_vid_codec   *codec;
+    pjmedia_vid_port    *rdr_port;
+    pj_uint8_t          *enc_buf;
+    pj_size_t            enc_buf_size;
+    pj_uint8_t          *pack_buf;
+    pj_size_t            pack_buf_size;
+} codec_port_data_t;
+
+static pj_status_t codec_on_event(pjmedia_event *event,
+                                  void *user_data)
+{
+    codec_port_data_t *port_data = (codec_port_data_t*)user_data;
+
+    if (event->type == PJMEDIA_EVENT_FMT_CHANGED) {
+	pjmedia_vid_codec *codec = port_data->codec;
+	pjmedia_vid_codec_param codec_param;
+	pj_status_t status;
+
+	status = pjmedia_vid_codec_get_param(codec, &codec_param);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	status = pjmedia_vid_dev_stream_set_cap(
+			pjmedia_vid_port_get_stream(port_data->rdr_port),
+			PJMEDIA_VID_DEV_CAP_FORMAT,
+			&codec_param.dec_fmt);
+	if (status != PJ_SUCCESS)
+	    return status;
+    }
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t codec_put_frame(pjmedia_port *port,
+			           pjmedia_frame *frame)
+{
+    enum { MAX_PACKETS = 50 };
+    codec_port_data_t *port_data = (codec_port_data_t*)port->port_data.pdata;
+    pj_status_t status;
+    pjmedia_vid_codec *codec = port_data->codec;
+    unsigned enc_cnt = 0;
+    pj_uint8_t *enc_buf;
+    unsigned enc_size_left;
+    pjmedia_frame enc_frames[MAX_PACKETS];
+    pj_bool_t has_more = PJ_FALSE;
+
+    enc_buf = port_data->enc_buf;
+    enc_size_left = (unsigned)port_data->enc_buf_size;
+
+    /*
+     * Encode
+     */
+    enc_frames[enc_cnt].buf = enc_buf;
+    enc_frames[enc_cnt].size = enc_size_left;
+
+    status = pjmedia_vid_codec_encode_begin(codec, NULL, frame, enc_size_left,
+                                            &enc_frames[enc_cnt], &has_more);
+    if (status != PJ_SUCCESS) goto on_error;
+
+    enc_buf += enc_frames[enc_cnt].size;
+    enc_size_left -= (unsigned)enc_frames[enc_cnt].size;
+
+    ++enc_cnt;
+    while (has_more) {
+	enc_frames[enc_cnt].buf = enc_buf;
+	enc_frames[enc_cnt].size = enc_size_left;
+
+	status = pjmedia_vid_codec_encode_more(codec, enc_size_left,
+						&enc_frames[enc_cnt],
+						&has_more);
+	if (status != PJ_SUCCESS)
+	    break;
+
+	enc_buf += enc_frames[enc_cnt].size;
+	enc_size_left -= (unsigned)enc_frames[enc_cnt].size;
+
+	++enc_cnt;
+
+	if (enc_cnt >= MAX_PACKETS) {
+	    assert(!"Too many packets!");
+	    break;
+	}
+    }
+
+    /*
+     * Decode
+     */
+    status = pjmedia_vid_codec_decode(codec, enc_cnt, enc_frames,
+				      (unsigned)frame->size, frame);
+    if (status != PJ_SUCCESS) goto on_error;
+
+    /* Display */
+    status = pjmedia_port_put_frame(
+			pjmedia_vid_port_get_passive_port(port_data->rdr_port),
+			frame);
+    if (status != PJ_SUCCESS) goto on_error;
+
+    return PJ_SUCCESS;
+
+on_error:
+    pj_perror(3, THIS_FILE, status, "codec_put_frame() error");
+    return status;
+}
+
+static const char* dump_codec_info(const pjmedia_vid_codec_info *info)
+{
+    static char str[80];
+    unsigned i;
+    char *p = str;
+
+    /* Raw format ids */
+    for (i=0; (i<info->dec_fmt_id_cnt) && (p-str+5<sizeof(str)); ++i) {
+        pj_memcpy(p, &info->dec_fmt_id[i], 4);
+        p += 4;
+        *p++ = ' ';
+    }
+    *p = '\0';
+
+    return str;
+}
+
+static int enum_codecs()
+{
+    unsigned i, cnt;
+    pjmedia_vid_codec_info info[PJMEDIA_CODEC_MGR_MAX_CODECS];
+    pj_status_t status;
+
+    PJ_LOG(3, (THIS_FILE, "  codec enums"));
+    cnt = PJ_ARRAY_SIZE(info);
+    status = pjmedia_vid_codec_mgr_enum_codecs(NULL, &cnt, info, NULL);
+    if (status != PJ_SUCCESS)
+        return 100;
+
+    for (i = 0; i < cnt; ++i) {
+        PJ_LOG(3, (THIS_FILE, "  %-16.*s %c%c %s",
+                   info[i].encoding_name.slen, info[i].encoding_name.ptr,
+                   (info[i].dir & PJMEDIA_DIR_ENCODING? 'E' : ' '),
+                   (info[i].dir & PJMEDIA_DIR_DECODING? 'D' : ' '),
+                   dump_codec_info(&info[i])));
+    }
+
+    return PJ_SUCCESS;
+}
+
+static int encode_decode_test(pj_pool_t *pool, const char *codec_id,
+                              pjmedia_vid_packing packing)
+{
+    const pj_str_t port_name = {"codec", 5};
+
+    pjmedia_vid_codec *codec=NULL;
+    pjmedia_port codec_port;
+    codec_port_data_t codec_port_data;
+    pjmedia_vid_codec_param codec_param;
+    const pjmedia_vid_codec_info *codec_info;
+    const char *packing_name;
+    pjmedia_vid_dev_index cap_idx, rdr_idx;
+    pjmedia_vid_port *capture=NULL, *renderer=NULL;
+    pjmedia_vid_port_param vport_param;
+    pjmedia_video_format_detail *vfd;
+    char codec_name[5];
+    pj_status_t status;
+    int rc = 0;
+
+    switch (packing) {
+    case PJMEDIA_VID_PACKING_PACKETS:
+	packing_name = "framed";
+	break;
+    case PJMEDIA_VID_PACKING_WHOLE:
+	packing_name = "whole";
+	break;
+    default:
+	packing_name = "unknown";
+	break;
+    }
+
+    PJ_LOG(3, (THIS_FILE, "  encode decode test: codec=%s, packing=%s",
+	       codec_id, packing_name));
+
+    /* Lookup codec */
+    {
+        pj_str_t codec_id_st;
+        unsigned info_cnt = 1;
+
+        /* Lookup codec */
+        pj_cstr(&codec_id_st, codec_id);
+        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL, &codec_id_st, 
+                                                         &info_cnt, 
+                                                         &codec_info, NULL);
+        if (status != PJ_SUCCESS) {
+            rc = 205; goto on_return;
+        }
+    }
+
+
+#if CAPTURE_DEV == -1
+    /* Lookup colorbar source */
+    status = pjmedia_vid_dev_lookup("Colorbar", "Colorbar generator", &cap_idx);
+    if (status != PJ_SUCCESS) {
+	rc = 206; goto on_return;
+    }
+#elif CAPTURE_DEV == -2
+    /* Lookup any first non-colorbar source */
+    {
+	unsigned i, cnt;
+	pjmedia_vid_dev_info info;
+
+	cap_idx = -1;
+	cnt = pjmedia_vid_dev_count();
+	for (i = 0; i < cnt; ++i) {
+	    status = pjmedia_vid_dev_get_info(i, &info);
+	    if (status != PJ_SUCCESS) {
+		rc = 206; goto on_return;
+	    }
+	    if (info.dir & PJMEDIA_DIR_CAPTURE && 
+		pj_ansi_stricmp(info.driver, "Colorbar"))
+	    {
+		cap_idx = i;
+		break;
+	    }
+	}
+
+	if (cap_idx == -1) {
+	    status = PJ_ENOTFOUND;
+	    rc = 206; goto on_return;
+	}
+    }
+#else
+    cap_idx = CAPTURE_DEV;
+#endif
+
+    /* Lookup SDL renderer */
+    status = pjmedia_vid_dev_lookup("SDL", "SDL renderer", &rdr_idx);
+    if (status != PJ_SUCCESS) {
+	rc = 207; goto on_return;
+    }
+
+    /* Prepare codec */
+    {
+        pj_str_t codec_id_st;
+        unsigned info_cnt = 1;
+        const pjmedia_vid_codec_info *codec_info;
+
+        /* Lookup codec */
+        pj_cstr(&codec_id_st, codec_id);
+        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL, &codec_id_st, 
+                                                         &info_cnt, 
+                                                         &codec_info, NULL);
+        if (status != PJ_SUCCESS) {
+            rc = 245; goto on_return;
+        }
+        status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info,
+                                                         &codec_param);
+        if (status != PJ_SUCCESS) {
+            rc = 246; goto on_return;
+        }
+
+        codec_param.packing = packing;
+
+        /* Open codec */
+        status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info,
+                                                   &codec);
+        if (status != PJ_SUCCESS) {
+	    rc = 250; goto on_return;
+        }
+
+        status = pjmedia_vid_codec_init(codec, pool);
+        if (status != PJ_SUCCESS) {
+	    rc = 251; goto on_return;
+        }
+
+        status = pjmedia_vid_codec_open(codec, &codec_param);
+        if (status != PJ_SUCCESS) {
+	    rc = 252; goto on_return;
+        }
+
+	/* After opened, codec will update the param, let's sync encoder & 
+	 * decoder format detail.
+	 */
+	codec_param.dec_fmt.det = codec_param.enc_fmt.det;
+
+	/* Subscribe to codec events */
+	pjmedia_event_subscribe(NULL, &codec_on_event, &codec_port_data,
+                                codec);
+    }
+
+    pjmedia_vid_port_param_default(&vport_param);
+
+    /* Create capture, set it to active (master) */
+    status = pjmedia_vid_dev_default_param(pool, cap_idx,
+					   &vport_param.vidparam);
+    if (status != PJ_SUCCESS) {
+	rc = 220; goto on_return;
+    }
+    pjmedia_format_copy(&vport_param.vidparam.fmt, &codec_param.dec_fmt);
+    vport_param.vidparam.dir = PJMEDIA_DIR_CAPTURE;
+    vport_param.active = PJ_TRUE;
+
+    if (vport_param.vidparam.fmt.detail_type != PJMEDIA_FORMAT_DETAIL_VIDEO) {
+	rc = 221; goto on_return;
+    }
+
+    vfd = pjmedia_format_get_video_format_detail(&vport_param.vidparam.fmt,
+						 PJ_TRUE);
+    if (vfd == NULL) {
+	rc = 225; goto on_return;
+    }
+
+    status = pjmedia_vid_port_create(pool, &vport_param, &capture);
+    if (status != PJ_SUCCESS) {
+	rc = 226; goto on_return;
+    }
+
+    /* Create renderer, set it to passive (slave)  */
+    vport_param.active = PJ_FALSE;
+    vport_param.vidparam.dir = PJMEDIA_DIR_RENDER;
+    vport_param.vidparam.rend_id = rdr_idx;
+    vport_param.vidparam.disp_size = vfd->size;
+
+    status = pjmedia_vid_port_create(pool, &vport_param, &renderer);
+    if (status != PJ_SUCCESS) {
+	rc = 230; goto on_return;
+    }
+
+    /* Init codec port */
+    pj_bzero(&codec_port, sizeof(codec_port));
+    status = pjmedia_port_info_init2(&codec_port.info, &port_name, 0x1234,
+                                     PJMEDIA_DIR_ENCODING, 
+                                     &codec_param.dec_fmt);
+    if (status != PJ_SUCCESS) {
+	rc = 260; goto on_return;
+    }
+
+    codec_port_data.codec = codec;
+    codec_port_data.rdr_port = renderer;
+    codec_port_data.enc_buf_size = codec_param.dec_fmt.det.vid.size.w *
+				   codec_param.dec_fmt.det.vid.size.h * 4;
+    codec_port_data.enc_buf = pj_pool_alloc(pool, 
+					    codec_port_data.enc_buf_size);
+    codec_port_data.pack_buf_size = codec_port_data.enc_buf_size;
+    codec_port_data.pack_buf = pj_pool_alloc(pool, 
+					     codec_port_data.pack_buf_size);
+
+    codec_port.put_frame = &codec_put_frame;
+    codec_port.port_data.pdata = &codec_port_data;
+
+    /* Connect capture to codec port */
+    status = pjmedia_vid_port_connect(capture,
+				      &codec_port,
+				      PJ_FALSE);
+    if (status != PJ_SUCCESS) {
+	rc = 270; goto on_return;
+    }
+
+    PJ_LOG(3, (THIS_FILE, "    starting codec test: %s<->%.*s %dx%d",
+	pjmedia_fourcc_name(codec_param.dec_fmt.id, codec_name),
+	codec_info->encoding_name.slen,
+	codec_info->encoding_name.ptr,
+        codec_param.dec_fmt.det.vid.size.w,
+        codec_param.dec_fmt.det.vid.size.h
+        ));
+
+    /* Start streaming.. */
+    status = pjmedia_vid_port_start(renderer);
+    if (status != PJ_SUCCESS) {
+	rc = 275; goto on_return;
+    }
+    status = pjmedia_vid_port_start(capture);
+    if (status != PJ_SUCCESS) {
+	rc = 280; goto on_return;
+    }
+
+    /* Sleep while the video is being displayed... */
+    pj_thread_sleep(10000);
+
+on_return:
+    if (status != PJ_SUCCESS) {
+        PJ_PERROR(3, (THIS_FILE, status, "  error"));
+    }
+    if (capture)
+        pjmedia_vid_port_stop(capture);
+    if (renderer)
+        pjmedia_vid_port_stop(renderer);
+    if (capture)
+	pjmedia_vid_port_destroy(capture);
+    if (renderer)
+	pjmedia_vid_port_destroy(renderer);
+    if (codec) {
+	pjmedia_event_unsubscribe(NULL, &codec_on_event, &codec_port_data,
+                                  codec);
+        pjmedia_vid_codec_close(codec);
+        pjmedia_vid_codec_mgr_dealloc_codec(NULL, codec);
+    }
+
+    return rc;
+}
+
+int vid_codec_test(void)
+{
+    pj_pool_t *pool;
+    int rc = 0;
+    pj_status_t status;
+    int orig_log_level;
+    
+    orig_log_level = pj_log_get_level();
+    pj_log_set_level(3);
+
+    PJ_LOG(3, (THIS_FILE, "Performing video codec tests.."));
+
+    pool = pj_pool_create(mem, "Vid codec test", 256, 256, 0);
+
+    status = pjmedia_vid_dev_subsys_init(mem);
+    if (status != PJ_SUCCESS)
+        return -10;
+
+#if PJMEDIA_HAS_FFMPEG_VID_CODEC
+    status = pjmedia_codec_ffmpeg_vid_init(NULL, mem);
+    if (status != PJ_SUCCESS)
+        return -20;
+#endif
+
+    rc = enum_codecs();
+    if (rc != 0)
+	goto on_return;
+
+    rc = encode_decode_test(pool, "h263-1998", PJMEDIA_VID_PACKING_WHOLE);
+    if (rc != 0)
+	goto on_return;
+
+    rc = encode_decode_test(pool, "h263-1998", PJMEDIA_VID_PACKING_PACKETS);
+    if (rc != 0)
+	goto on_return;
+
+on_return:
+#if PJMEDIA_HAS_FFMPEG_VID_CODEC
+    pjmedia_codec_ffmpeg_vid_deinit();
+#endif
+    pjmedia_vid_dev_subsys_shutdown();
+    pj_pool_release(pool);
+    pj_log_set_level(orig_log_level);
+
+    return rc;
+}
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6a58a7f7ed91293aabac8bcf9bee2ec0330df5f.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6a58a7f7ed91293aabac8bcf9bee2ec0330df5f.svn-base
new file mode 100644
index 0000000..3d78159
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6a58a7f7ed91293aabac8bcf9bee2ec0330df5f.svn-base
@@ -0,0 +1,744 @@
+/* $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 <pjlib-util/dns.h>
+#include <pjlib-util/errno.h>
+#include <pj/assert.h>
+#include <pj/errno.h>
+#include <pj/pool.h>
+#include <pj/sock.h>
+#include <pj/string.h>
+
+
+PJ_DEF(const char *) pj_dns_get_type_name(int type)
+{
+    switch (type) {
+    case PJ_DNS_TYPE_A:	    return "A";
+    case PJ_DNS_TYPE_AAAA:  return "AAAA";
+    case PJ_DNS_TYPE_SRV:   return "SRV";
+    case PJ_DNS_TYPE_NS:    return "NS";
+    case PJ_DNS_TYPE_CNAME: return "CNAME";
+    case PJ_DNS_TYPE_PTR:   return "PTR";
+    case PJ_DNS_TYPE_MX:    return "MX";
+    case PJ_DNS_TYPE_TXT:   return "TXT";
+    case PJ_DNS_TYPE_NAPTR: return "NAPTR";
+    }
+    return "(Unknown)";
+}
+
+
+static void write16(pj_uint8_t *p, pj_uint16_t val)
+{
+    p[0] = (pj_uint8_t)(val >> 8);
+    p[1] = (pj_uint8_t)(val & 0xFF);
+}
+
+
+/**
+ * Initialize a DNS query transaction.
+ */
+PJ_DEF(pj_status_t) pj_dns_make_query( void *packet,
+				       unsigned *size,
+				       pj_uint16_t id,
+				       int qtype,
+				       const pj_str_t *name)
+{
+    pj_uint8_t *query, *p = (pj_uint8_t*)packet;
+    const char *startlabel, *endlabel, *endname;
+    pj_size_t d;
+
+    /* Sanity check */
+    PJ_ASSERT_RETURN(packet && size && qtype && name, PJ_EINVAL);
+
+    /* Calculate total number of bytes required. */
+    d = sizeof(pj_dns_hdr) + name->slen + 4;
+
+    /* Check that size is sufficient. */
+    PJ_ASSERT_RETURN(*size >= d, PJLIB_UTIL_EDNSQRYTOOSMALL);
+
+    /* Initialize header */
+    pj_assert(sizeof(pj_dns_hdr)==12);
+    pj_bzero(p, sizeof(struct pj_dns_hdr));
+    write16(p+0, id);
+    write16(p+2, (pj_uint16_t)PJ_DNS_SET_RD(1));
+    write16(p+4, (pj_uint16_t)1);
+
+    /* Initialize query */
+    query = p = ((pj_uint8_t*)packet)+sizeof(pj_dns_hdr);
+
+    /* Tokenize name */
+    startlabel = endlabel = name->ptr;
+    endname = name->ptr + name->slen;
+    while (endlabel != endname) {
+	while (endlabel != endname && *endlabel != '.')
+	    ++endlabel;
+	*p++ = (pj_uint8_t)(endlabel - startlabel);
+	pj_memcpy(p, startlabel, endlabel-startlabel);
+	p += (endlabel-startlabel);
+	if (endlabel != endname && *endlabel == '.')
+	    ++endlabel;
+	startlabel = endlabel;
+    }
+    *p++ = '\0';
+
+    /* Set type */
+    write16(p, (pj_uint16_t)qtype);
+    p += 2;
+
+    /* Set class (IN=1) */
+    write16(p, 1);
+    p += 2;
+
+    /* Done, calculate length */
+    *size = (unsigned)(p - (pj_uint8_t*)packet);
+
+    return 0;
+}
+
+
+/* Get a name length (note: name consists of multiple labels and
+ * it may contain pointers when name compression is applied) 
+ */
+static pj_status_t get_name_len(int rec_counter, const pj_uint8_t *pkt, 
+				const pj_uint8_t *start, const pj_uint8_t *max, 
+				int *parsed_len, int *name_len)
+{
+    const pj_uint8_t *p;
+    pj_status_t status;
+
+    /* Limit the number of recursion */
+    if (rec_counter > 10) {
+	/* Too many name recursion */
+	return PJLIB_UTIL_EDNSINNAMEPTR;
+    }
+
+    *name_len = *parsed_len = 0;
+    p = start;
+    while (*p) {
+	if ((*p & 0xc0) == 0xc0) {
+	    /* Compression is found! */
+	    int ptr_len = 0;
+	    int dummy;
+	    pj_uint16_t offset;
+
+	    /* Get the 14bit offset */
+	    pj_memcpy(&offset, p, 2);
+	    offset ^= pj_htons((pj_uint16_t)(0xc0 << 8));
+	    offset = pj_ntohs(offset);
+
+	    /* Check that offset is valid */
+	    if (offset >= max - pkt)
+		return PJLIB_UTIL_EDNSINNAMEPTR;
+
+	    /* Get the name length from that offset. */
+	    status = get_name_len(rec_counter+1, pkt, pkt + offset, max, 
+				  &dummy, &ptr_len);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    *parsed_len += 2;
+	    *name_len += ptr_len;
+
+	    return PJ_SUCCESS;
+	} else {
+	    unsigned label_len = *p;
+
+	    /* Check that label length is valid */
+	    if (pkt+label_len > max)
+		return PJLIB_UTIL_EDNSINNAMEPTR;
+
+	    p += (label_len + 1);
+	    *parsed_len += (label_len + 1);
+
+	    if (*p != 0)
+		++label_len;
+	    
+	    *name_len += label_len;
+
+	    if (p >= max)
+		return PJLIB_UTIL_EDNSINSIZE;
+	}
+    }
+    ++p;
+    (*parsed_len)++;
+
+    return PJ_SUCCESS;
+}
+
+
+/* Parse and copy name (note: name consists of multiple labels and
+ * it may contain pointers when compression is applied).
+ */
+static pj_status_t get_name(int rec_counter, const pj_uint8_t *pkt, 
+			    const pj_uint8_t *start, const pj_uint8_t *max,
+			    pj_str_t *name)
+{
+    const pj_uint8_t *p;
+    pj_status_t status;
+
+    /* Limit the number of recursion */
+    if (rec_counter > 10) {
+	/* Too many name recursion */
+	return PJLIB_UTIL_EDNSINNAMEPTR;
+    }
+
+    p = start;
+    while (*p) {
+	if ((*p & 0xc0) == 0xc0) {
+	    /* Compression is found! */
+	    pj_uint16_t offset;
+
+	    /* Get the 14bit offset */
+	    pj_memcpy(&offset, p, 2);
+	    offset ^= pj_htons((pj_uint16_t)(0xc0 << 8));
+	    offset = pj_ntohs(offset);
+
+	    /* Check that offset is valid */
+	    if (offset >= max - pkt)
+		return PJLIB_UTIL_EDNSINNAMEPTR;
+
+	    /* Retrieve the name from that offset. */
+	    status = get_name(rec_counter+1, pkt, pkt + offset, max, name);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    return PJ_SUCCESS;
+	} else {
+	    unsigned label_len = *p;
+
+	    /* Check that label length is valid */
+	    if (pkt+label_len > max)
+		return PJLIB_UTIL_EDNSINNAMEPTR;
+
+	    pj_memcpy(name->ptr + name->slen, p+1, label_len);
+	    name->slen += label_len;
+
+	    p += label_len + 1;
+	    if (*p != 0) {
+		*(name->ptr + name->slen) = '.';
+		++name->slen;
+	    }
+
+	    if (p >= max)
+		return PJLIB_UTIL_EDNSINSIZE;
+	}
+    }
+
+    return PJ_SUCCESS;
+}
+
+
+/* Parse query records. */
+static pj_status_t parse_query(pj_dns_parsed_query *q, pj_pool_t *pool,
+			       const pj_uint8_t *pkt, const pj_uint8_t *start,
+			       const pj_uint8_t *max, int *parsed_len)
+{
+    const pj_uint8_t *p = start;
+    int name_len, name_part_len;
+    pj_status_t status;
+
+    /* Get the length of the name */
+    status = get_name_len(0, pkt, start, max, &name_part_len, &name_len);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    /* Allocate memory for the name */
+    q->name.ptr = (char*) pj_pool_alloc(pool, name_len+4);
+    q->name.slen = 0;
+
+    /* Get the name */
+    status = get_name(0, pkt, start, max, &q->name);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    p = (start + name_part_len);
+
+    /* Get the type */
+    pj_memcpy(&q->type, p, 2);
+    q->type = pj_ntohs(q->type);
+    p += 2;
+
+    /* Get the class */
+    pj_memcpy(&q->dnsclass, p, 2);
+    q->dnsclass = pj_ntohs(q->dnsclass);
+    p += 2;
+
+    *parsed_len = (int)(p - start);
+
+    return PJ_SUCCESS;
+}
+
+
+/* Parse RR records */
+static pj_status_t parse_rr(pj_dns_parsed_rr *rr, pj_pool_t *pool,
+			    const pj_uint8_t *pkt,
+			    const pj_uint8_t *start, const pj_uint8_t *max,
+			    int *parsed_len)
+{
+    const pj_uint8_t *p = start;
+    int name_len, name_part_len;
+    pj_status_t status;
+
+    /* Get the length of the name */
+    status = get_name_len(0, pkt, start, max, &name_part_len, &name_len);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    /* Allocate memory for the name */
+    rr->name.ptr = (char*) pj_pool_alloc(pool, name_len+4);
+    rr->name.slen = 0;
+
+    /* Get the name */
+    status = get_name(0, pkt, start, max, &rr->name);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    p = (start + name_part_len);
+
+    /* Check the size can accomodate next few fields. */
+    if (p+10 > max)
+	return PJLIB_UTIL_EDNSINSIZE;
+
+    /* Get the type */
+    pj_memcpy(&rr->type, p, 2);
+    rr->type = pj_ntohs(rr->type);
+    p += 2;
+    
+    /* Get the class */
+    pj_memcpy(&rr->dnsclass, p, 2);
+    rr->dnsclass = pj_ntohs(rr->dnsclass);
+    p += 2;
+
+    /* Class MUST be IN */
+    if (rr->dnsclass != 1)
+	return PJLIB_UTIL_EDNSINCLASS;
+
+    /* Get TTL */
+    pj_memcpy(&rr->ttl, p, 4);
+    rr->ttl = pj_ntohl(rr->ttl);
+    p += 4;
+
+    /* Get rdlength */
+    pj_memcpy(&rr->rdlength, p, 2);
+    rr->rdlength = pj_ntohs(rr->rdlength);
+    p += 2;
+
+    /* Check that length is valid */
+    if (p + rr->rdlength > max)
+	return PJLIB_UTIL_EDNSINSIZE;
+
+    /* Parse some well known records */
+    if (rr->type == PJ_DNS_TYPE_A) {
+	pj_memcpy(&rr->rdata.a.ip_addr, p, 4);
+	p += 4;
+
+    } else if (rr->type == PJ_DNS_TYPE_AAAA) {
+	pj_memcpy(&rr->rdata.aaaa.ip_addr, p, 16);
+	p += 16;
+
+    } else if (rr->type == PJ_DNS_TYPE_CNAME ||
+	       rr->type == PJ_DNS_TYPE_NS ||
+	       rr->type == PJ_DNS_TYPE_PTR) 
+    {
+
+	/* Get the length of the target name */
+	status = get_name_len(0, pkt, p, max, &name_part_len, &name_len);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	/* Allocate memory for the name */
+	rr->rdata.cname.name.ptr = (char*) pj_pool_alloc(pool, name_len);
+	rr->rdata.cname.name.slen = 0;
+
+	/* Get the name */
+	status = get_name(0, pkt, p, max, &rr->rdata.cname.name);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	p += name_part_len;
+
+    } else if (rr->type == PJ_DNS_TYPE_SRV) {
+
+	/* Priority */
+	pj_memcpy(&rr->rdata.srv.prio, p, 2);
+	rr->rdata.srv.prio = pj_ntohs(rr->rdata.srv.prio);
+	p += 2;
+
+	/* Weight */
+	pj_memcpy(&rr->rdata.srv.weight, p, 2);
+	rr->rdata.srv.weight = pj_ntohs(rr->rdata.srv.weight);
+	p += 2;
+
+	/* Port */
+	pj_memcpy(&rr->rdata.srv.port, p, 2);
+	rr->rdata.srv.port = pj_ntohs(rr->rdata.srv.port);
+	p += 2;
+	
+	/* Get the length of the target name */
+	status = get_name_len(0, pkt, p, max, &name_part_len, &name_len);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	/* Allocate memory for the name */
+	rr->rdata.srv.target.ptr = (char*) pj_pool_alloc(pool, name_len);
+	rr->rdata.srv.target.slen = 0;
+
+	/* Get the name */
+	status = get_name(0, pkt, p, max, &rr->rdata.srv.target);
+	if (status != PJ_SUCCESS)
+	    return status;
+	p += name_part_len;
+
+    } else {
+	/* Copy the raw data */
+	rr->data = pj_pool_alloc(pool, rr->rdlength);
+	pj_memcpy(rr->data, p, rr->rdlength);
+
+	p += rr->rdlength;
+    }
+
+    *parsed_len = (int)(p - start);
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Parse raw DNS packet into DNS packet structure.
+ */
+PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
+				  	 const void *packet,
+					 unsigned size,
+					 pj_dns_parsed_packet **p_res)
+{
+    pj_dns_parsed_packet *res;
+    const pj_uint8_t *start, *end;
+    pj_status_t status;
+    unsigned i;
+
+    /* Sanity checks */
+    PJ_ASSERT_RETURN(pool && packet && size && p_res, PJ_EINVAL);
+
+    /* Packet size must be at least as big as the header */
+    if (size < sizeof(pj_dns_hdr))
+	return PJLIB_UTIL_EDNSINSIZE;
+
+    /* Create the structure */
+    res = PJ_POOL_ZALLOC_T(pool, pj_dns_parsed_packet);
+
+    /* Copy the DNS header, and convert endianness to host byte order */
+    pj_memcpy(&res->hdr, packet, sizeof(pj_dns_hdr));
+    res->hdr.id	      = pj_ntohs(res->hdr.id);
+    res->hdr.flags    = pj_ntohs(res->hdr.flags);
+    res->hdr.qdcount  = pj_ntohs(res->hdr.qdcount);
+    res->hdr.anscount = pj_ntohs(res->hdr.anscount);
+    res->hdr.nscount  = pj_ntohs(res->hdr.nscount);
+    res->hdr.arcount  = pj_ntohs(res->hdr.arcount);
+
+    /* Mark start and end of payload */
+    start = ((const pj_uint8_t*)packet) + sizeof(pj_dns_hdr);
+    end = ((const pj_uint8_t*)packet) + size;
+
+    /* Parse query records (if any).
+     */
+    if (res->hdr.qdcount) {
+	res->q = (pj_dns_parsed_query*)
+		 pj_pool_zalloc(pool, res->hdr.qdcount *
+				      sizeof(pj_dns_parsed_query));
+	for (i=0; i<res->hdr.qdcount; ++i) {
+	    int parsed_len = 0;
+	    
+	    status = parse_query(&res->q[i], pool, (const pj_uint8_t*)packet, 
+	    			 start, end, &parsed_len);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    start += parsed_len;
+	}
+    }
+
+    /* Parse answer, if any */
+    if (res->hdr.anscount) {
+	res->ans = (pj_dns_parsed_rr*)
+		   pj_pool_zalloc(pool, res->hdr.anscount * 
+					sizeof(pj_dns_parsed_rr));
+
+	for (i=0; i<res->hdr.anscount; ++i) {
+	    int parsed_len;
+
+	    status = parse_rr(&res->ans[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    start += parsed_len;
+	}
+    }
+
+    /* Parse authoritative NS records, if any */
+    if (res->hdr.nscount) {
+	res->ns = (pj_dns_parsed_rr*)
+		  pj_pool_zalloc(pool, res->hdr.nscount *
+				       sizeof(pj_dns_parsed_rr));
+
+	for (i=0; i<res->hdr.nscount; ++i) {
+	    int parsed_len;
+
+	    status = parse_rr(&res->ns[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    start += parsed_len;
+	}
+    }
+
+    /* Parse additional RR answer, if any */
+    if (res->hdr.arcount) {
+	res->arr = (pj_dns_parsed_rr*)
+		   pj_pool_zalloc(pool, res->hdr.arcount *
+					sizeof(pj_dns_parsed_rr));
+
+	for (i=0; i<res->hdr.arcount; ++i) {
+	    int parsed_len;
+
+	    status = parse_rr(&res->arr[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
+	    if (status != PJ_SUCCESS)
+		return status;
+
+	    start += parsed_len;
+	}
+    }
+
+    /* Looks like everything is okay */
+    *p_res = res;
+
+    return PJ_SUCCESS;
+}
+
+
+/* Perform name compression scheme.
+ * If a name is already in the nametable, when no need to duplicate
+ * the string with the pool, but rather just use the pointer there.
+ */
+static void apply_name_table( unsigned *count,
+			      pj_str_t nametable[],
+		    	      const pj_str_t *src,
+			      pj_pool_t *pool,
+			      pj_str_t *dst)
+{
+    unsigned i;
+
+    /* Scan strings in nametable */
+    for (i=0; i<*count; ++i) {
+	if (pj_stricmp(&nametable[i], src) == 0)
+	    break;
+    }
+
+    /* If name is found in nametable, use the pointer in the nametable */
+    if (i != *count) {
+	dst->ptr = nametable[i].ptr;
+	dst->slen = nametable[i].slen;
+	return;
+    }
+
+    /* Otherwise duplicate the string, and insert new name in nametable */
+    pj_strdup(pool, dst, src);
+
+    if (*count < PJ_DNS_MAX_NAMES_IN_NAMETABLE) {
+	nametable[*count].ptr = dst->ptr;
+	nametable[*count].slen = dst->slen;
+
+	++(*count);
+    }
+}
+
+static void copy_query(pj_pool_t *pool, pj_dns_parsed_query *dst,
+		       const pj_dns_parsed_query *src,
+		       unsigned *nametable_count,
+		       pj_str_t nametable[])
+{
+    pj_memcpy(dst, src, sizeof(*src));
+    apply_name_table(nametable_count, nametable, &src->name, pool, &dst->name);
+}
+
+
+static void copy_rr(pj_pool_t *pool, pj_dns_parsed_rr *dst,
+		    const pj_dns_parsed_rr *src,
+		    unsigned *nametable_count,
+		    pj_str_t nametable[])
+{
+    pj_memcpy(dst, src, sizeof(*src));
+    apply_name_table(nametable_count, nametable, &src->name, pool, &dst->name);
+
+    if (src->data) {
+	dst->data = pj_pool_alloc(pool, src->rdlength);
+	pj_memcpy(dst->data, src->data, src->rdlength);
+    }
+
+    if (src->type == PJ_DNS_TYPE_SRV) {
+	apply_name_table(nametable_count, nametable, &src->rdata.srv.target, 
+			 pool, &dst->rdata.srv.target);
+    } else if (src->type == PJ_DNS_TYPE_A) {
+	dst->rdata.a.ip_addr.s_addr =  src->rdata.a.ip_addr.s_addr;
+    } else if (src->type == PJ_DNS_TYPE_AAAA) {
+	pj_memcpy(&dst->rdata.aaaa.ip_addr, &src->rdata.aaaa.ip_addr,
+		  sizeof(pj_in6_addr));
+    } else if (src->type == PJ_DNS_TYPE_CNAME) {
+	pj_strdup(pool, &dst->rdata.cname.name, &src->rdata.cname.name);
+    } else if (src->type == PJ_DNS_TYPE_NS) {
+	pj_strdup(pool, &dst->rdata.ns.name, &src->rdata.ns.name);
+    } else if (src->type == PJ_DNS_TYPE_PTR) {
+	pj_strdup(pool, &dst->rdata.ptr.name, &src->rdata.ptr.name);
+    }
+}
+
+/*
+ * Duplicate DNS packet.
+ */
+PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
+			       const pj_dns_parsed_packet*p,
+			       unsigned options,
+			       pj_dns_parsed_packet **p_dst)
+{
+    pj_dns_parsed_packet *dst;
+    unsigned nametable_count = 0;
+#if PJ_DNS_MAX_NAMES_IN_NAMETABLE
+    pj_str_t nametable[PJ_DNS_MAX_NAMES_IN_NAMETABLE];
+#else
+    pj_str_t *nametable = NULL;
+#endif
+    unsigned i;
+
+    PJ_ASSERT_ON_FAIL(pool && p && p_dst, return);
+
+    /* Create packet and copy header */
+    *p_dst = dst = PJ_POOL_ZALLOC_T(pool, pj_dns_parsed_packet);
+    pj_memcpy(&dst->hdr, &p->hdr, sizeof(p->hdr));
+
+    /* Initialize section counts in the target packet to zero.
+     * If memory allocation fails during copying process, the target packet
+     * should have a correct section counts.
+     */
+    dst->hdr.qdcount = 0;
+    dst->hdr.anscount = 0;
+    dst->hdr.nscount = 0;
+    dst->hdr.arcount = 0;
+	
+
+    /* Copy query section */
+    if (p->hdr.qdcount && (options & PJ_DNS_NO_QD)==0) {
+	dst->q = (pj_dns_parsed_query*)
+		 pj_pool_alloc(pool, p->hdr.qdcount * 
+				     sizeof(pj_dns_parsed_query));
+	for (i=0; i<p->hdr.qdcount; ++i) {
+	    copy_query(pool, &dst->q[i], &p->q[i], 
+		       &nametable_count, nametable);
+	    ++dst->hdr.qdcount;
+	}
+    }
+
+    /* Copy answer section */
+    if (p->hdr.anscount && (options & PJ_DNS_NO_ANS)==0) {
+	dst->ans = (pj_dns_parsed_rr*)
+		   pj_pool_alloc(pool, p->hdr.anscount * 
+				       sizeof(pj_dns_parsed_rr));
+	for (i=0; i<p->hdr.anscount; ++i) {
+	    copy_rr(pool, &dst->ans[i], &p->ans[i],
+		    &nametable_count, nametable);
+	    ++dst->hdr.anscount;
+	}
+    }
+
+    /* Copy NS section */
+    if (p->hdr.nscount && (options & PJ_DNS_NO_NS)==0) {
+	dst->ns = (pj_dns_parsed_rr*)
+		  pj_pool_alloc(pool, p->hdr.nscount * 
+				      sizeof(pj_dns_parsed_rr));
+	for (i=0; i<p->hdr.nscount; ++i) {
+	    copy_rr(pool, &dst->ns[i], &p->ns[i],
+		    &nametable_count, nametable);
+	    ++dst->hdr.nscount;
+	}
+    }
+
+    /* Copy additional info section */
+    if (p->hdr.arcount && (options & PJ_DNS_NO_AR)==0) {
+	dst->arr = (pj_dns_parsed_rr*)
+		   pj_pool_alloc(pool, p->hdr.arcount * 
+				       sizeof(pj_dns_parsed_rr));
+	for (i=0; i<p->hdr.arcount; ++i) {
+	    copy_rr(pool, &dst->arr[i], &p->arr[i],
+		    &nametable_count, nametable);
+	    ++dst->hdr.arcount;
+	}
+    }
+}
+
+
+PJ_DEF(void) pj_dns_init_srv_rr( pj_dns_parsed_rr *rec,
+				 const pj_str_t *res_name,
+				 unsigned dnsclass,
+				 unsigned ttl,
+				 unsigned prio,
+				 unsigned weight,
+				 unsigned port,
+				 const pj_str_t *target)
+{
+    pj_bzero(rec, sizeof(*rec));
+    rec->name = *res_name;
+    rec->type = PJ_DNS_TYPE_SRV;
+    rec->dnsclass = (pj_uint16_t) dnsclass;
+    rec->ttl = ttl;
+    rec->rdata.srv.prio = (pj_uint16_t) prio;
+    rec->rdata.srv.weight = (pj_uint16_t) weight;
+    rec->rdata.srv.port = (pj_uint16_t) port;
+    rec->rdata.srv.target = *target;
+}
+
+
+PJ_DEF(void) pj_dns_init_cname_rr( pj_dns_parsed_rr *rec,
+				   const pj_str_t *res_name,
+				   unsigned dnsclass,
+				   unsigned ttl,
+				   const pj_str_t *name)
+{
+    pj_bzero(rec, sizeof(*rec));
+    rec->name = *res_name;
+    rec->type = PJ_DNS_TYPE_CNAME;
+    rec->dnsclass = (pj_uint16_t) dnsclass;
+    rec->ttl = ttl;
+    rec->rdata.cname.name = *name;
+}
+
+
+PJ_DEF(void) pj_dns_init_a_rr( pj_dns_parsed_rr *rec,
+			       const pj_str_t *res_name,
+			       unsigned dnsclass,
+			       unsigned ttl,
+			       const pj_in_addr *ip_addr)
+{
+    pj_bzero(rec, sizeof(*rec));
+    rec->name = *res_name;
+    rec->type = PJ_DNS_TYPE_A;
+    rec->dnsclass = (pj_uint16_t) dnsclass;
+    rec->ttl = ttl;
+    rec->rdata.a.ip_addr = *ip_addr;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6c35caa1f7f41a4dba58dae35760c52fe61c7ab.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6c35caa1f7f41a4dba58dae35760c52fe61c7ab.svn-base
new file mode 100644
index 0000000..07e45ab
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6c35caa1f7f41a4dba58dae35760c52fe61c7ab.svn-base
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+import os
+import sys
+import time
+import datetime
+import ccdash
+
+INTERVAL = 300
+DELAY = 0
+ONCE = False
+SUFFIX = ""
+FORCE = False
+
+def run_scenarios(scenarios, group):
+	# Run each scenario
+	rc = 0
+	for scenario in scenarios:
+		argv = []
+		argv.append("ccdash.py")
+		argv.append("scenario")
+		argv.append(scenario)
+		argv.append("--group")
+		argv.append(group)
+		thisrc = ccdash.main(argv)
+		if rc==0 and thisrc:
+			rc = thisrc
+	return rc
+
+
+def usage():
+	print """Periodically monitor working directory for Continuous and Nightly builds
+
+Usage:
+  run_continuous.py [options] scenario1.xml [scenario2.xml ...]
+
+options:
+  These are options which will be processed by run_continuous.py:
+
+  --delay MIN   Delay both Continuous and Nightly builds by MIN minutes. 
+  		This is useful to coordinate the build with other build 
+		machines. By default, Continuous build will be done right
+		after changes are detected, and Nightly build will be done
+		at 00:00 GMT. MIN is a float number.
+
+  --once        Just run one loop to see if anything needs to be done and
+                if so just do it once. Quit after that.
+
+  --suffix SFX  Set group suffix to SFX. For example, if SFX is "-2.x", then
+                tests will be submitted to "Nightly-2.x", "Continuous-2.x",
+		and "Experimental-2.x"
+
+  --force	Force running the test even when nothing has changed.
+"""
+	sys.exit(1)
+
+if __name__ == "__main__":
+	if len(sys.argv)<=1 or sys.argv[1]=="-h" or sys.argv[1]=="--h" or sys.argv[1]=="--help" or sys.argv[1]=="/h":
+		usage()
+
+	# Splice list
+	scenarios = []
+	i = 1
+	while i < len(sys.argv):
+		if sys.argv[i]=="--delay":
+			i = i + 1
+			if i >= len(sys.argv):
+				print "Error: missing argument"
+				sys.exit(1)
+			DELAY = float(sys.argv[i]) * 60
+			print "Delay is set to %f minute(s)" % (DELAY / 60)
+		elif sys.argv[i]=="--suffix":
+			i = i + 1
+			if i >= len(sys.argv):
+				print "Error: missing argument"
+				sys.exit(1)
+			SUFFIX = sys.argv[i]
+			print "Suffix is set to %s" % (SUFFIX)
+		elif sys.argv[i]=="--once":
+			ONCE = True
+		elif sys.argv[i]=="--force":
+			FORCE = True
+		else:
+			# Check if scenario exists
+			scenario = sys.argv[i]
+			if not os.path.exists(scenario):
+				print "Error: file " + scenario + " does not exist"
+				sys.exit(1)
+			scenarios.append(scenario)
+			print "Scenario %s added" % (scenario)
+		i = i + 1
+
+	if len(scenarios) < 1:
+		print "Error: scenario is required"
+		sys.exit(1)
+
+	# Current date
+	utc = time.gmtime(None)
+	day = utc.tm_mday
+
+	# Loop foreva
+	while True:
+		argv = []
+
+		# Anything changed recently?
+		argv.append("ccdash.py")
+		argv.append("status")
+		argv.append("-w")
+		argv.append("../..")
+		rc = ccdash.main(argv)
+
+		utc = time.gmtime(None)
+
+		if utc.tm_mday != day or rc != 0 or FORCE:
+			group = ""
+			if utc.tm_mday != day:
+				day = utc.tm_mday
+				group = "Nightly" + SUFFIX
+			elif rc != 0:
+				group = "Continuous" + SUFFIX
+			else:
+				group = "Experimental" + SUFFIX
+			if DELAY > 0:
+				print "Will run %s after %f s.." % (group, DELAY)
+				time.sleep(DELAY)
+			rc = run_scenarios(scenarios, group)
+			msg = str(datetime.datetime.now()) + \
+				  ": done running " + group + \
+				  "tests, will check again in " + str(INTERVAL) + "s.."
+			if ONCE:
+				sys.exit(0)
+		else:
+			# Nothing changed
+			msg = str(datetime.datetime.now()) + \
+				  ": No update, will check again in " + str(INTERVAL) + "s.."
+			if ONCE:
+				sys.exit(1)
+
+		print msg
+		time.sleep(INTERVAL)
+
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6c70880bdf9c72c2de4f49223646caa74b110e8.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6c70880bdf9c72c2de4f49223646caa74b110e8.svn-base
new file mode 100644
index 0000000..89cb36e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6c70880bdf9c72c2de4f49223646caa74b110e8.svn-base
@@ -0,0 +1,46 @@
+/* $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/types.h>
+#include <pj/os.h>
+
+PJ_DEF(void) pj_time_val_normalize(pj_time_val *t)
+{
+    PJ_CHECK_STACK();
+
+    if (t->msec >= 1000) {
+	t->sec += (t->msec / 1000);
+	t->msec = (t->msec % 1000);
+    }
+    else if (t->msec <= -1000) {
+	do {
+	    t->sec--;
+	    t->msec += 1000;
+        } while (t->msec <= -1000);
+    }
+
+    if (t->sec >= 1 && t->msec < 0) {
+	t->sec--;
+	t->msec += 1000;
+
+    } else if (t->sec < 0 && t->msec > 0) {
+	t->sec++;
+	t->msec -= 1000;
+    }
+}
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6cb2f1e2b7e5597a71b9af4828478ef4616d356.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6cb2f1e2b7e5597a71b9af4828478ef4616d356.svn-base
new file mode 100644
index 0000000..150dad2
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6cb2f1e2b7e5597a71b9af4828478ef4616d356.svn-base
@@ -0,0 +1,246 @@
+/* $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_XML_H__
+#define __PJ_XML_H__
+
+/**
+ * @file xml.h
+ * @brief PJLIB XML Parser/Helper.
+ */
+
+#include <pj/types.h>
+#include <pj/list.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJ_TINY_XML Mini/Tiny XML Parser/Helper
+ * @ingroup PJ_FILE_FMT
+ * @{
+ */
+
+/** Typedef for XML attribute. */
+typedef struct pj_xml_attr pj_xml_attr;
+
+/** Typedef for XML nodes. */
+typedef struct pj_xml_node pj_xml_node;
+
+/** This structure declares XML attribute. */
+struct pj_xml_attr
+{
+    PJ_DECL_LIST_MEMBER(pj_xml_attr);   /**< Standard list elements.    */
+    pj_str_t	name;	                /**< Attribute name.            */
+    pj_str_t	value;	                /**< Attribute value.           */
+};
+
+/** This structure describes XML node head inside XML node structure.
+ */
+typedef struct pj_xml_node_head
+{
+    PJ_DECL_LIST_MEMBER(pj_xml_node);   /**< Standard list elements.    */
+} pj_xml_node_head;
+
+/** This structure describes XML node. */
+struct pj_xml_node
+{
+    PJ_DECL_LIST_MEMBER(pj_xml_node);   /**< List @a prev and @a next member */
+    pj_str_t		name;		/**< Node name.                      */
+    pj_xml_attr		attr_head;      /**< Attribute list.                 */
+    pj_xml_node_head	node_head;      /**< Node list.                      */
+    pj_str_t		content;	/**< Node content.                   */
+};
+
+/**
+ * Parse XML message into XML document with a single root node. The parser
+ * is capable of parsing XML processing instruction construct ("<?") and 
+ * XML comments ("<!--"), however such constructs will be ignored and will not 
+ * be included in the resulted XML node tree.
+ *
+ * @param pool	    Pool to allocate memory from.
+ * @param msg	    The XML message to parse.
+ * @param len	    The length of the message.
+ *
+ * @return	    XML root node, or NULL if the XML document can not be parsed.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_parse( pj_pool_t *pool, char *msg, pj_size_t len);
+
+
+/**
+ * Print XML into XML message. Note that the function WILL NOT NULL terminate
+ * the output.
+ *
+ * @param node	    The XML node to print.
+ * @param buf	    Buffer to hold the output message.
+ * @param len	    The length of the buffer.
+ * @param prolog    If set to nonzero, will print XML prolog ("<?xml..")
+ *
+ * @return	    The size of the printed message, or -1 if there is not 
+ *		    sufficient space in the buffer to print the message.
+ */
+PJ_DECL(int) pj_xml_print( const pj_xml_node *node, char *buf, pj_size_t len,
+			   pj_bool_t prolog);
+
+/**
+ * Clone XML node and all subnodes.
+ *
+ * @param pool	    Pool to allocate memory for new nodes.
+ * @param rhs	    The node to clone.
+ *
+ * @return	    Cloned XML node, or NULL on fail.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_clone( pj_pool_t *pool, const pj_xml_node *rhs);
+
+
+/**
+ * Create an empty node.
+ *
+ * @param pool	    Pool.
+ * @param name	    Node name.
+ *
+ * @return	    The new node.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_node_new(pj_pool_t *pool, const pj_str_t *name);
+
+
+/**
+ * Create new XML attribute.
+ *
+ * @param pool	    Pool.
+ * @param name	    Attribute name.
+ * @param value	    Attribute value.
+ *
+ * @return	    The new XML attribute.
+ */
+PJ_DECL(pj_xml_attr*) pj_xml_attr_new(pj_pool_t *pool, const pj_str_t *name,
+				      const pj_str_t *value);
+
+/**
+ * Add node to another node.
+ *
+ * @param parent    Parent node.
+ * @param node	    Node to be added to parent.
+ */
+PJ_DECL(void) pj_xml_add_node( pj_xml_node *parent, pj_xml_node *node );
+
+
+/**
+ * Add attribute to a node.
+ *
+ * @param node	    Node.
+ * @param attr	    Attribute to add to node.
+ */
+PJ_DECL(void) pj_xml_add_attr( pj_xml_node *node, pj_xml_attr *attr );
+
+/**
+ * Find first direct child node with the specified name.
+ *
+ * @param parent    Parent node.
+ * @param name	    Node name to find.
+ *
+ * @return	    XML node found or NULL.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_find_node(const pj_xml_node *parent, 
+				       const pj_str_t *name);
+
+/**
+ * Find next direct child node with the specified name.
+ *
+ * @param parent    Parent node.
+ * @param node	    node->next is the starting point.
+ * @param name	    Node name to find.
+ *
+ * @return	    XML node found or NULL.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_find_next_node(const pj_xml_node *parent, 
+					    const pj_xml_node *node,
+					    const pj_str_t *name);
+
+/**
+ * Recursively find the first node with the specified name in the child nodes
+ * and their children.
+ *
+ * @param parent    Parent node.
+ * @param name	    Node name to find.
+ *
+ * @return	    XML node found or NULL.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_find_node_rec(const pj_xml_node *parent, 
+					   const pj_str_t *name);
+
+
+/**
+ * Find first attribute within a node with the specified name and optional 
+ * value.
+ *
+ * @param node	    XML Node.
+ * @param name	    Attribute name to find.
+ * @param value	    Optional value to match.
+ *
+ * @return	    XML attribute found, or NULL.
+ */
+PJ_DECL(pj_xml_attr*) pj_xml_find_attr(const pj_xml_node *node, 
+				       const pj_str_t *name,
+				       const pj_str_t *value);
+
+
+/**
+ * Find a direct child node with the specified name and match the function.
+ *
+ * @param parent    Parent node.
+ * @param name	    Optional name. If this is NULL, the name will not be
+ *		    matched.
+ * @param data	    Data to be passed to matching function.
+ * @param match	    Optional matching function.
+ *
+ * @return	    The first matched node, or NULL.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_find( const pj_xml_node *parent, 
+				   const pj_str_t *name,
+				   const void *data, 
+				   pj_bool_t (*match)(const pj_xml_node *, 
+						      const void*));
+
+
+/**
+ * Recursively find a child node with the specified name and match the 
+ * function.
+ *
+ * @param parent    Parent node.
+ * @param name	    Optional name. If this is NULL, the name will not be
+ *		    matched.
+ * @param data	    Data to be passed to matching function.
+ * @param match	    Optional matching function.
+ *
+ * @return	    The first matched node, or NULL.
+ */
+PJ_DECL(pj_xml_node*) pj_xml_find_rec(const pj_xml_node *parent, 
+				      const pj_str_t *name,
+				      const void *data, 
+				      pj_bool_t (*match)(const pj_xml_node*, 
+							 const void*));
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+#endif	/* __PJ_XML_H__ */
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6e561ea9aafba4d7a6d9944bfa5d10c7a3df447.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6e561ea9aafba4d7a6d9944bfa5d10c7a3df447.svn-base
new file mode 100644
index 0000000..5e847e9
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6e561ea9aafba4d7a6d9944bfa5d10c7a3df447.svn-base
@@ -0,0 +1,4 @@
+export M_CFLAGS := $(CC_DEF)PJ_M_X86_64=1
+export M_CXXFLAGS :=
+export M_LDFLAGS :=
+export M_SOURCES :=
diff --git a/jni/pjproject-android/.svn/pristine/f6/f6fadf57b9e45481995a87d3a7e2a317815ab340.svn-base b/jni/pjproject-android/.svn/pristine/f6/f6fadf57b9e45481995a87d3a7e2a317815ab340.svn-base
new file mode 100644
index 0000000..40fae8b
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f6/f6fadf57b9e45481995a87d3a7e2a317815ab340.svn-base
@@ -0,0 +1,2048 @@
+/* $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_SIP_MSG_H__
+#define __PJSIP_SIP_MSG_H__
+
+/**
+ * @file pjsip/sip_msg.h
+ * @brief SIP Message Structure.
+ */
+
+#include <pjsip/sip_types.h>
+#include <pjsip/sip_uri.h>
+#include <pj/list.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_MSG Messaging Elements
+ * @ingroup PJSIP_CORE
+ * @brief Various SIP message elements such as methods, headers, URIs, etc.
+ * @{
+ */
+
+/* **************************************************************************/
+/**
+ * @defgroup PJSIP_MSG_METHOD Methods
+ * @brief Method names and manipulation.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * This enumeration declares SIP methods as described by RFC3261. Additional
+ * methods do exist, and they are described by corresponding RFCs for the SIP
+ * extentensions. Since they won't alter the characteristic of the processing
+ * of the message, they don't need to be explicitly mentioned here.
+ */
+typedef enum pjsip_method_e
+{
+    PJSIP_INVITE_METHOD,    /**< INVITE method, for establishing dialogs.   */
+    PJSIP_CANCEL_METHOD,    /**< CANCEL method, for cancelling request.	    */
+    PJSIP_ACK_METHOD,	    /**< ACK method.				    */
+    PJSIP_BYE_METHOD,	    /**< BYE method, for terminating dialog.	    */
+    PJSIP_REGISTER_METHOD,  /**< REGISTER method.			    */
+    PJSIP_OPTIONS_METHOD,   /**< OPTIONS method.			    */
+
+    PJSIP_OTHER_METHOD	    /**< Other method.				    */
+
+} pjsip_method_e;
+
+
+
+/**
+ * This structure represents a SIP method.
+ * Application must always use either #pjsip_method_init or #pjsip_method_set
+ * to make sure that method name is initialized correctly. This way, the name
+ * member will always contain a valid method string regardless whether the ID
+ * is recognized or not.
+ */
+struct pjsip_method
+{
+    pjsip_method_e id;	    /**< Method ID, from \a pjsip_method_e. */
+    pj_str_t	   name;    /**< Method name, which will always contain the 
+			         method string. */
+};
+
+
+/*
+ * For convenience, standard method structures are defined in the library.
+ */
+/** INVITE method constant. @see pjsip_get_invite_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_invite_method;
+
+/** CANCEL method constant. @see pjsip_get_cancel_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_cancel_method;
+
+/** ACK method constant. @see pjsip_get_ack_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_ack_method;
+
+/** BYE method constant. @see pjsip_get_bye_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_bye_method;
+
+/** REGISTER method constant. @see pjsip_get_register_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_register_method;
+
+/** OPTIONS method constant. @see pjsip_get_options_method() */
+PJ_DECL_DATA(const pjsip_method) pjsip_options_method;
+
+/*
+ * Accessor functions for standard SIP methods.
+ */
+/** Get INVITE method constant. */
+PJ_DECL(const pjsip_method*) pjsip_get_invite_method(void);
+/** Get CANCEL method constant. */
+PJ_DECL(const pjsip_method*) pjsip_get_cancel_method(void);
+/** Get ACK method constant. */
+PJ_DECL(const pjsip_method*) pjsip_get_ack_method(void);
+/** Get BYE method constant. */
+PJ_DECL(const pjsip_method*) pjsip_get_bye_method(void);
+/** Get REGISTER method constant.*/
+PJ_DECL(const pjsip_method*) pjsip_get_register_method(void);
+/** Get OPTIONS method constant. */
+PJ_DECL(const pjsip_method*) pjsip_get_options_method(void);
+
+
+/*
+ * Accessor functions
+ */
+
+/** 
+ * Initialize the method structure from a string. 
+ * This function will check whether the method is a known method then set
+ * both the id and name accordingly.
+ *
+ * @param m	The method to initialize.
+ * @param pool	Pool where memory allocation will be allocated from, if required.
+ * @param str	The method string.
+ */
+PJ_DECL(void) pjsip_method_init( pjsip_method *m, 
+				 pj_pool_t *pool, 
+				 const pj_str_t *str);
+
+/** 
+ * Initialize the method structure from a string, without cloning the string.
+ * See #pjsip_method_init.
+ *
+ * @param m	The method structure to be initialized.
+ * @param str	The method string.
+ */
+PJ_DECL(void) pjsip_method_init_np( pjsip_method *m,
+				    pj_str_t *str);
+
+/** 
+ * Set the method with the predefined method ID. 
+ * This function will also set the name member of the structure to the correct
+ * string according to the method.
+ *
+ * @param m	The method structure.
+ * @param id	The method ID.
+ */
+PJ_DECL(void) pjsip_method_set( pjsip_method *m, pjsip_method_e id );
+
+
+/** 
+ * Copy one method structure to another. If the method is of the known methods,
+ * then memory allocation is not required.
+ *
+ * @param pool	    Pool to allocate memory from, if required.
+ * @param method    The destination method to copy to.
+ * @param rhs	    The source method to copy from.
+ */
+PJ_DECL(void) pjsip_method_copy( pj_pool_t *pool,
+				 pjsip_method *method,
+				 const pjsip_method *rhs );
+
+/** 
+ * Compare one method with another, and conveniently determine whether the 
+ * first method is equal, less than, or greater than the second method.
+ *
+ * @param m1	The first method.
+ * @param m2	The second method.
+ *
+ * @return	Zero if equal, otherwise will return -1 if less or +1 if greater.
+ */
+PJ_DECL(int) pjsip_method_cmp( const pjsip_method *m1, const pjsip_method *m2);
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/** 
+ * @defgroup PJSIP_MSG_HDR Header Fields
+ * @brief Declarations for various SIP header fields.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * Header types, as defined by RFC3261.
+ */
+typedef enum pjsip_hdr_e
+{
+    /*
+     * These are the headers documented in RFC3261. Headers not documented
+     * there must have type PJSIP_H_OTHER, and the header type itself is 
+     * recorded in the header name string.
+     *
+     * DO NOT CHANGE THE VALUE/ORDER OF THE HEADER IDs!!!.
+     */
+    PJSIP_H_ACCEPT,
+    PJSIP_H_ACCEPT_ENCODING_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_ACCEPT_LANGUAGE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_ALERT_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_ALLOW,
+    PJSIP_H_AUTHENTICATION_INFO_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_AUTHORIZATION,
+    PJSIP_H_CALL_ID,
+    PJSIP_H_CALL_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_CONTACT,
+    PJSIP_H_CONTENT_DISPOSITION_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_CONTENT_ENCODING_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_CONTENT_LANGUAGE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_CONTENT_LENGTH,
+    PJSIP_H_CONTENT_TYPE,
+    PJSIP_H_CSEQ,
+    PJSIP_H_DATE_UNIMP,			/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_ERROR_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_EXPIRES,
+    PJSIP_H_FROM,
+    PJSIP_H_IN_REPLY_TO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_MAX_FORWARDS,
+    PJSIP_H_MIME_VERSION_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_MIN_EXPIRES,
+    PJSIP_H_ORGANIZATION_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_PRIORITY_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_PROXY_AUTHENTICATE,
+    PJSIP_H_PROXY_AUTHORIZATION,
+    PJSIP_H_PROXY_REQUIRE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_RECORD_ROUTE,
+    PJSIP_H_REPLY_TO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_REQUIRE,
+    PJSIP_H_RETRY_AFTER,
+    PJSIP_H_ROUTE,
+    PJSIP_H_SERVER_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_SUBJECT_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_SUPPORTED,
+    PJSIP_H_TIMESTAMP_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_TO,
+    PJSIP_H_UNSUPPORTED,
+    PJSIP_H_USER_AGENT_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_VIA,
+    PJSIP_H_WARNING_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
+    PJSIP_H_WWW_AUTHENTICATE,
+
+    PJSIP_H_OTHER
+
+} pjsip_hdr_e;
+
+/**
+ * This structure provides the pointer to basic functions that are needed
+ * for generic header operations. All header fields will have pointer to
+ * this structure, so that they can be manipulated uniformly.
+ */
+typedef struct pjsip_hdr_vptr
+{
+    /** 
+     * Function to clone the header. 
+     *
+     * @param pool  Memory pool to allocate the new header.
+     * @param hdr   Header to clone.
+     *
+     * @return A new instance of the header.
+     */
+    void *(*clone)(pj_pool_t *pool, const void *hdr);
+
+    /** 
+     * Pointer to function to shallow clone the header. 
+     * Shallow cloning will just make a memory copy of the original header,
+     * thus all pointers in original header will be kept intact. Because the
+     * function does not need to perform deep copy, the operation should be
+     * faster, but the application must make sure that the original header
+     * is still valid throughout the lifetime of new header.
+     *
+     * @param pool  Memory pool to allocate the new header.
+     * @param hdr   The header to clone.
+     */
+    void *(*shallow_clone)(pj_pool_t *pool, const void *hdr);
+
+    /** Pointer to function to print the header to the specified buffer.
+     *	Returns the length of string written, or -1 if the remaining buffer
+     *	is not enough to hold the header.
+     *
+     *  @param hdr  The header to print.
+     *  @param buf  The buffer.
+     *  @param len  The size of the buffer.
+     *
+     *  @return	    The size copied to buffer, or -1 if there's not enough space.
+     */
+    int (*print_on)(void *hdr, char *buf, pj_size_t len);
+
+} pjsip_hdr_vptr;
+
+
+/**
+ * Generic fields for all SIP headers are declared using this macro, to make
+ * sure that all headers will have exactly the same layout in their start of
+ * the storage. This behaves like C++ inheritance actually.
+ */
+#define PJSIP_DECL_HDR_MEMBER(hdr)   \
+    /** List members. */	\
+    PJ_DECL_LIST_MEMBER(hdr);	\
+    /** Header type */		\
+    pjsip_hdr_e	    type;	\
+    /** Header name. */		\
+    pj_str_t	    name;	\
+    /** Header short name version. */	\
+    pj_str_t	    sname;		\
+    /** Virtual function table. */	\
+    pjsip_hdr_vptr *vptr
+
+
+/**
+ * Generic SIP header structure, for generic manipulation for headers in the
+ * message. All header fields can be typecasted to this type.
+ */
+struct pjsip_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_hdr);
+};
+
+
+/**
+ * This generic function will clone any header, by calling "clone" function
+ * in header's virtual function table.
+ *
+ * @param pool	    The pool to allocate memory from.
+ * @param hdr	    The header to clone.
+ *
+ * @return	    A new instance copied from the original header.
+ */
+PJ_DECL(void*) pjsip_hdr_clone( pj_pool_t *pool, const void *hdr );
+
+
+/**
+ * This generic function will clone any header, by calling "shallow_clone" 
+ * function in header's virtual function table.
+ *
+ * @param pool	    The pool to allocate memory from.
+ * @param hdr	    The header to clone.
+ *
+ * @return	    A new instance copied from the original header.
+ */
+PJ_DECL(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr );
+
+/**
+ * This generic function will print any header, by calling "print" 
+ * function in header's virtual function table.
+ *
+ * @param hdr  The header to print.
+ * @param buf  The buffer.
+ * @param len  The size of the buffer.
+ *
+ * @return	The size copied to buffer, or -1 if there's not enough space.
+ */
+PJ_DECL(int) pjsip_hdr_print_on( void *hdr, char *buf, pj_size_t len);
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
+ * @defgroup PJSIP_MSG_LINE Request and Status Line.
+ * @brief Request and status line structures and manipulation.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * This structure describes SIP request line.
+ */
+typedef struct pjsip_request_line 
+{
+    pjsip_method    method; /**< Method for this request line. */
+    pjsip_uri *uri;    /**< URI for this request line. */
+} pjsip_request_line;
+
+
+/**
+ * This structure describes SIP status line.
+ */
+typedef struct pjsip_status_line 
+{
+    int		code;	    /**< Status code. */
+    pj_str_t	reason;	    /**< Reason string. */
+} pjsip_status_line;
+
+
+/**
+ * This enumeration lists standard SIP status codes according to RFC 3261.
+ * In addition, it also declares new status class 7xx for errors generated
+ * by the stack. This status class however should not get transmitted on the 
+ * wire.
+ */
+typedef enum pjsip_status_code
+{
+    PJSIP_SC_TRYING = 100,
+    PJSIP_SC_RINGING = 180,
+    PJSIP_SC_CALL_BEING_FORWARDED = 181,
+    PJSIP_SC_QUEUED = 182,
+    PJSIP_SC_PROGRESS = 183,
+
+    PJSIP_SC_OK = 200,
+    PJSIP_SC_ACCEPTED = 202,
+
+    PJSIP_SC_MULTIPLE_CHOICES = 300,
+    PJSIP_SC_MOVED_PERMANENTLY = 301,
+    PJSIP_SC_MOVED_TEMPORARILY = 302,
+    PJSIP_SC_USE_PROXY = 305,
+    PJSIP_SC_ALTERNATIVE_SERVICE = 380,
+
+    PJSIP_SC_BAD_REQUEST = 400,
+    PJSIP_SC_UNAUTHORIZED = 401,
+    PJSIP_SC_PAYMENT_REQUIRED = 402,
+    PJSIP_SC_FORBIDDEN = 403,
+    PJSIP_SC_NOT_FOUND = 404,
+    PJSIP_SC_METHOD_NOT_ALLOWED = 405,
+    PJSIP_SC_NOT_ACCEPTABLE = 406,
+    PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED = 407,
+    PJSIP_SC_REQUEST_TIMEOUT = 408,
+    PJSIP_SC_GONE = 410,
+    PJSIP_SC_REQUEST_ENTITY_TOO_LARGE = 413,
+    PJSIP_SC_REQUEST_URI_TOO_LONG = 414,
+    PJSIP_SC_UNSUPPORTED_MEDIA_TYPE = 415,
+    PJSIP_SC_UNSUPPORTED_URI_SCHEME = 416,
+    PJSIP_SC_BAD_EXTENSION = 420,
+    PJSIP_SC_EXTENSION_REQUIRED = 421,
+    PJSIP_SC_SESSION_TIMER_TOO_SMALL = 422,
+    PJSIP_SC_INTERVAL_TOO_BRIEF = 423,
+    PJSIP_SC_TEMPORARILY_UNAVAILABLE = 480,
+    PJSIP_SC_CALL_TSX_DOES_NOT_EXIST = 481,
+    PJSIP_SC_LOOP_DETECTED = 482,
+    PJSIP_SC_TOO_MANY_HOPS = 483,
+    PJSIP_SC_ADDRESS_INCOMPLETE = 484,
+    PJSIP_AC_AMBIGUOUS = 485,
+    PJSIP_SC_BUSY_HERE = 486,
+    PJSIP_SC_REQUEST_TERMINATED = 487,
+    PJSIP_SC_NOT_ACCEPTABLE_HERE = 488,
+    PJSIP_SC_BAD_EVENT = 489,
+    PJSIP_SC_REQUEST_UPDATED = 490,
+    PJSIP_SC_REQUEST_PENDING = 491,
+    PJSIP_SC_UNDECIPHERABLE = 493,
+
+    PJSIP_SC_INTERNAL_SERVER_ERROR = 500,
+    PJSIP_SC_NOT_IMPLEMENTED = 501,
+    PJSIP_SC_BAD_GATEWAY = 502,
+    PJSIP_SC_SERVICE_UNAVAILABLE = 503,
+    PJSIP_SC_SERVER_TIMEOUT = 504,
+    PJSIP_SC_VERSION_NOT_SUPPORTED = 505,
+    PJSIP_SC_MESSAGE_TOO_LARGE = 513,
+    PJSIP_SC_PRECONDITION_FAILURE = 580,
+
+    PJSIP_SC_BUSY_EVERYWHERE = 600,
+    PJSIP_SC_DECLINE = 603,
+    PJSIP_SC_DOES_NOT_EXIST_ANYWHERE = 604,
+    PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE = 606,
+
+    PJSIP_SC_TSX_TIMEOUT = PJSIP_SC_REQUEST_TIMEOUT,
+    /*PJSIP_SC_TSX_RESOLVE_ERROR = 702,*/
+    PJSIP_SC_TSX_TRANSPORT_ERROR = PJSIP_SC_SERVICE_UNAVAILABLE,
+
+    /* This is not an actual status code, but rather a constant
+     * to force GCC to use 32bit to represent this enum, since
+     * we have a code in PJSUA-LIB that assigns an integer
+     * to this enum (see pjsua_acc_get_info() function).
+     */
+    PJSIP_SC__force_32bit = 0x7FFFFFFF
+
+} pjsip_status_code;
+
+/**
+ * Get the default status text for the status code.
+ *
+ * @param status_code	    SIP Status Code
+ *
+ * @return		    textual message for the status code.
+ */ 
+PJ_DECL(const pj_str_t*) pjsip_get_status_text(int status_code);
+
+/**
+ * This macro returns non-zero (TRUE) if the specified status_code is
+ * in the same class as the code_class.
+ *
+ * @param status_code	The status code.
+ * @param code_class	The status code in the class (for example 100, 200).
+ */
+#define PJSIP_IS_STATUS_IN_CLASS(status_code, code_class)    \
+	    (status_code/100 == code_class/100)
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
+ * @addtogroup PJSIP_MSG_MEDIA Media/MIME Type
+ * @brief Media/MIME type declaration and manipulations.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * This structure describes SIP media type, as used for example in 
+ * Accept and Content-Type header..
+ */
+typedef struct pjsip_media_type
+{
+    pj_str_t type;	    /**< Media type. */
+    pj_str_t subtype;	    /**< Media subtype. */
+    pjsip_param param;	    /**< Media type parameters */
+} pjsip_media_type;
+
+
+/**
+ * Initialize the media type with the specified type and subtype string.
+ *
+ * @param mt		The media type.
+ * @param type		Optionally specify the media type.
+ * @param subtype	Optionally specify the media subtype.
+ */
+PJ_DECL(void) pjsip_media_type_init(pjsip_media_type *mt,
+				    pj_str_t *type,
+				    pj_str_t *subtype);
+
+/**
+ * Initialize the media type with the specified type and subtype string.
+ *
+ * @param mt		The media type.
+ * @param type		Optionally specify the media type.
+ * @param subtype	Optionally specify the media subtype.
+ */
+PJ_DECL(void) pjsip_media_type_init2(pjsip_media_type *mt,
+				     char *type,
+				     char *subtype);
+
+/**
+ * Compare two media types.
+ *
+ * @param mt1		The first media type.
+ * @param mt2		The second media type.
+ * @param cmp_param	Specify how to compare the media type parameters:
+ * 			 - 0: do not compare parameters
+ * 			 - 1: compare parameters but ignore parameters that
+ * 			      only appear in one of the media type.
+ * 			 - 2: compare the parameters.
+ *
+ * @return		Zero if both media types are equal, -1 if mt1 < mt2,
+ * 			1 if mt1 > mt2.
+ */
+PJ_DECL(int) pjsip_media_type_cmp(const pjsip_media_type *mt1,
+				  const pjsip_media_type *mt2,
+				  int cmp_param);
+
+/**
+ * Copy SIP media type to another.
+ *
+ * @param pool	    Pool to duplicate strings.
+ * @param dst	    Destination structure.
+ * @param src	    Source structure.
+ */
+PJ_DECL(void) pjsip_media_type_cp(pj_pool_t *pool,
+				  pjsip_media_type *dst,
+				  const pjsip_media_type *src);
+
+/**
+ * Print media type to the specified buffer.
+ *
+ * @param buf		Destination buffer.
+ * @param len		Length of the buffer.
+ * @param mt		The media type to be printed.
+ *
+ * @return		The number of characters printed to the buffer, or -1
+ * 			if there's not enough space in the buffer.
+ */
+PJ_DECL(int) pjsip_media_type_print(char *buf, unsigned len,
+				    const pjsip_media_type *mt);
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
+ * @addtogroup PJSIP_MSG_BODY Message Body
+ * @brief SIP message body structures and manipulation.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * Generic abstraction to message body.
+ * When an incoming message is parsed (pjsip_parse_msg()), the parser fills in
+ * all members with the appropriate value. The 'data' and 'len' member will
+ * describe portion of incoming packet which denotes the message body.
+ * When application needs to attach message body to outgoing SIP message, it
+ * must fill in all members of this structure. 
+ */
+struct pjsip_msg_body
+{
+    /** MIME content type. 
+     *  For incoming messages, the parser will fill in this member with the
+     *  content type found in Content-Type header.
+     *
+     *  For outgoing messages, application may fill in this member with
+     *  appropriate value, because the stack will generate Content-Type header
+     *  based on the value specified here.
+     *
+     *  If the content_type is empty, no Content-Type AND Content-Length header
+     *  will be added to the message. The stack assumes that application adds
+     *  these headers themselves.
+     */
+    pjsip_media_type content_type;
+
+    /** Pointer to buffer which holds the message body data. 
+     *  For incoming messages, the parser will fill in this member with the
+     *  pointer to the body string.
+     *
+     *  When sending outgoing message, this member doesn't need to point to the
+     *  actual message body string. It can be assigned with arbitrary pointer,
+     *  because the value will only need to be understood by the print_body()
+     *  function. The stack itself will not try to interpret this value, but
+     *  instead will always call the print_body() whenever it needs to get the
+     *  actual body string.
+     */
+    void *data;
+
+    /** The length of the data. 
+     *  For incoming messages, the parser will fill in this member with the
+     *  actual length of message body.
+     *
+     *  When sending outgoing message, again just like the "data" member, the
+     *  "len" member doesn't need to point to the actual length of the body 
+     *  string.
+     */
+    unsigned len;
+
+    /** Pointer to function to print this message body. 
+     *  Application must set a proper function here when sending outgoing 
+     *  message.
+     *
+     *  @param msg_body	    This structure itself.
+     *  @param buf	    The buffer.
+     *  @param size	    The buffer size.
+     *
+     *  @return		    The length of the string printed, or -1 if there is
+     *			    not enough space in the buffer to print the whole
+     *			    message body.
+     */
+    int (*print_body)(struct pjsip_msg_body *msg_body, 
+		      char *buf, pj_size_t size);
+
+    /** Clone the data part only of this message body. Note that this only
+     *  duplicates the data part of the body instead of the whole message
+     *  body. If application wants to duplicate the entire message body
+     *  structure, it must call #pjsip_msg_body_clone().
+     *
+     *  @param pool	    Pool used to clone the data.
+     *  @param data	    The data inside message body, to be cloned.
+     *  @param len	    The length of the data.
+     *
+     *  @return		    New data duplicated from the original data.
+     */
+    void* (*clone_data)(pj_pool_t *pool, const void *data, unsigned len);
+
+};
+
+/**
+ * General purpose function to textual data in a SIP body. Attach this function
+ * in a SIP message body only if the data in pjsip_msg_body is a textual 
+ * message ready to be embedded in a SIP message. If the data in the message
+ * body is not a textual body, then application must supply a custom function
+ * to print that body.
+ *
+ * @param msg_body	The message body.
+ * @param buf		Buffer to copy the message body to.
+ * @param size		The size of the buffer.
+ *
+ * @return		The length copied to the buffer, or -1.
+ */
+PJ_DECL(int) pjsip_print_text_body( pjsip_msg_body *msg_body, 
+				    char *buf, pj_size_t size);
+
+/**
+ * General purpose function to clone textual data in a SIP body. Attach this
+ * function as "clone_data" member of the SIP body only if the data type
+ * is a text (i.e. C string, not pj_str_t), and the length indicates the
+ * length of the text.
+ *
+ *  @param pool		Pool used to clone the data.
+ *  @param data		Textual data.
+ *  @param len		The length of the string.
+ *
+ *  @return		New text duplicated from the original text.
+ */
+PJ_DECL(void*) pjsip_clone_text_data( pj_pool_t *pool, const void *data,
+				      unsigned len);
+
+
+/**
+ * Clone the message body in src_body to the dst_body. This will duplicate
+ * the contents of the message body using the \a clone_data member of the
+ * source message body.
+ *
+ * @param pool		Pool to use to duplicate the message body.
+ * @param dst_body	Destination message body.
+ * @param src_body	Source message body to duplicate.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_msg_body_copy( pj_pool_t *pool,
+					  pjsip_msg_body *dst_body,
+					  const pjsip_msg_body *src_body );
+					   
+
+/**
+ * Create cloned message body. This will duplicate the contents of the message
+ * body using the \a clone_data member of the source message body.
+ *
+ * @param pool		Pool to use to duplicate the message body.
+ * @param body		Source message body to duplicate.
+ *
+ * @return		The cloned message body on successfull.
+ */
+PJ_DECL(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool,
+					       const pjsip_msg_body *body );
+					   
+
+/**
+ * Create a text message body. Use this function to create message body when
+ * the content is a simple text. For non-text message body (e.g. 
+ * pjmedia_sdp_session or pj_xml_node), application must construct the message
+ * manually.
+ *
+ * @param pool		Pool to allocate message body and its contents.
+ * @param type		MIME type (e.g. "text").
+ * @param subtype	MIME subtype (e.g. "plain").
+ * @param text		The text content to be put in the message body.
+ *
+ * @return		A new message body with the specified Content-Type and
+ *			text.
+ */
+PJ_DECL(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool,
+					        const pj_str_t *type,
+						const pj_str_t *subtype,
+						const pj_str_t *text );
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
+ * @defgroup PJSIP_MSG_MSG Message Structure
+ * @brief SIP message (request and response) structure and operations.
+ * @ingroup PJSIP_MSG
+ * @{
+ */
+
+/**
+ * Message type (request or response).
+ */
+typedef enum pjsip_msg_type_e
+{
+    PJSIP_REQUEST_MSG,	    /**< Indicates request message. */
+    PJSIP_RESPONSE_MSG	    /**< Indicates response message. */
+} pjsip_msg_type_e;
+
+
+/**
+ * This structure describes a SIP message.
+ */
+struct pjsip_msg
+{
+    /** Message type (ie request or response). */
+    pjsip_msg_type_e  type;
+
+    /** The first line of the message can be either request line for request
+     *	messages, or status line for response messages. It is represented here
+     *  as a union.
+     */
+    union
+    {
+	/** Request Line. */
+	struct pjsip_request_line   req;
+
+	/** Status Line. */
+	struct pjsip_status_line    status;
+    } line;
+
+    /** List of message headers. */
+    pjsip_hdr hdr;
+
+    /** Pointer to message body, or NULL if no message body is attached to
+     *	this mesage. 
+     */
+    pjsip_msg_body *body;
+};
+
+
+/** 
+ * Create new request or response message.
+ *
+ * @param pool	    The pool.
+ * @param type	    Message type.
+ * @return	    New message, or THROW exception if failed.
+ */
+PJ_DECL(pjsip_msg*)  pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type);
+
+
+/**
+ * Perform a deep clone of a SIP message.
+ *
+ * @param pool	    The pool for creating the new message.
+ * @param msg	    The message to be duplicated.
+ *
+ * @return	    New message, which is duplicated from the original 
+ *		    message.
+ */
+PJ_DECL(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *msg);
+
+
+/** 
+ * Find a header in the message by the header type.
+ *
+ * @param msg	    The message.
+ * @param type	    The header type to find.
+ * @param start	    The first header field where the search should begin.
+ *		    If NULL is specified, then the search will begin from the
+ *		    first header, otherwise the search will begin at the
+ *		    specified header.
+ *
+ * @return	    The header field, or NULL if no header with the specified 
+ *		    type is found.
+ */
+PJ_DECL(void*)  pjsip_msg_find_hdr( const pjsip_msg *msg, 
+				    pjsip_hdr_e type, const void *start);
+
+/** 
+ * Find a header in the message by its name.
+ *
+ * @param msg	    The message.
+ * @param name	    The header name to find.
+ * @param start	    The first header field where the search should begin.
+ *		    If NULL is specified, then the search will begin from the
+ *		    first header, otherwise the search will begin at the
+ *		    specified header.
+ *
+ * @return	    The header field, or NULL if no header with the specified 
+ *		    type is found.
+ */
+PJ_DECL(void*)  pjsip_msg_find_hdr_by_name( const pjsip_msg *msg, 
+					    const pj_str_t *name, 
+					    const void *start);
+
+/** 
+ * Find a header in the message by its name and short name version.
+ *
+ * @param msg	    The message.
+ * @param name	    The header name to find.
+ * @param sname	    The short name version of the header name.
+ * @param start	    The first header field where the search should begin.
+ *		    If NULL is specified, then the search will begin from the
+ *		    first header, otherwise the search will begin at the
+ *		    specified header.
+ *
+ * @return	    The header field, or NULL if no header with the specified 
+ *		    type is found.
+ */
+PJ_DECL(void*)  pjsip_msg_find_hdr_by_names(const pjsip_msg *msg, 
+					    const pj_str_t *name, 
+					    const pj_str_t *sname,
+					    const void *start);
+
+/** 
+ * Find and remove a header in the message. 
+ *
+ * @param msg	    The message.
+ * @param hdr	    The header type to find.
+ * @param start	    The first header field where the search should begin,
+ *		    or NULL to search from the first header in the message.
+ *
+ * @return	    The header field, or NULL if not found.
+ */
+PJ_DECL(void*)  pjsip_msg_find_remove_hdr( pjsip_msg *msg, 
+					   pjsip_hdr_e hdr, void *start);
+
+/** 
+ * Add a header to the message, putting it last in the header list.
+ *
+ * @param msg	    The message.
+ * @param hdr	    The header to add.
+ *
+ * @bug Once the header is put in a list (or message), it can not be put in 
+ *      other list (or message). Otherwise Real Bad Thing will happen.
+ */
+PJ_INLINE(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
+{
+    pj_list_insert_before(&msg->hdr, hdr);
+}
+
+/** 
+ * Add header field to the message, putting it in the front of the header list.
+ *
+ * @param msg	The message.
+ * @param hdr	The header to add.
+ *
+ * @bug Once the header is put in a list (or message), it can not be put in 
+ *      other list (or message). Otherwise Real Bad Thing will happen.
+ */
+PJ_INLINE(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
+{
+    pj_list_insert_after(&msg->hdr, hdr);
+}
+
+/** 
+ * Print the message to the specified buffer. 
+ *
+ * @param msg	The message to print.
+ * @param buf	The buffer
+ * @param size	The size of the buffer.
+ *
+ * @return	The length of the printed characters (in bytes), or NEGATIVE
+ *		value if the message is too large for the specified buffer.
+ */
+PJ_DECL(pj_ssize_t) pjsip_msg_print(const pjsip_msg *msg, 
+				    char *buf, pj_size_t size);
+
+
+/*
+ * Some usefull macros to find common headers.
+ */
+
+
+/**
+ * Find Call-ID header.
+ *
+ * @param msg	The message.
+ * @return	Call-ID header instance.
+ */
+#define PJSIP_MSG_CID_HDR(msg) \
+	    ((pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL))
+
+/**
+ * Find CSeq header.
+ *
+ * @param msg	The message.
+ * @return	CSeq header instance.
+ */
+#define PJSIP_MSG_CSEQ_HDR(msg) \
+	    ((pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))
+
+/**
+ * Find From header.
+ *
+ * @param msg	The message.
+ * @return	From header instance.
+ */
+#define PJSIP_MSG_FROM_HDR(msg) \
+	    ((pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL))
+
+/**
+ * Find To header.
+ *
+ * @param msg	The message.
+ * @return	To header instance.
+ */
+#define PJSIP_MSG_TO_HDR(msg) \
+	    ((pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL))
+
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
+ * @addtogroup PJSIP_MSG_HDR
+ * @{
+ */
+
+/**
+ * Generic SIP header, which contains hname and a string hvalue.
+ * Note that this header is not supposed to be used as 'base' class for headers.
+ */
+typedef struct pjsip_generic_string_hdr
+{
+    /** Standard header field. */
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr);
+    /** hvalue */
+    pj_str_t hvalue;
+} pjsip_generic_string_hdr;
+
+
+/**
+ * Create a new instance of generic header. A generic header can have an
+ * arbitrary header name.
+ *
+ * @param pool	    The pool.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string.
+ * @param hvalue    Optional string to be assigned as the value.
+ *
+ * @return	    The header, or THROW exception.
+ */
+PJ_DECL(pjsip_generic_string_hdr*) 
+pjsip_generic_string_hdr_create( pj_pool_t *pool, 
+				 const pj_str_t *hname,
+				 const pj_str_t *hvalue);
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string later.
+ * @param hvalue    Optional string to be assigned as the value.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_generic_string_hdr*) 
+pjsip_generic_string_hdr_init( pj_pool_t *pool,
+			       void *mem,
+			       const pj_str_t *hname,
+			       const pj_str_t *hvalue);
+
+
+/**
+ * Construct a generic string header without allocating memory from the pool.
+ * This function is useful to create a temporary header which life-time is
+ * very short (for example, creating the header in the stack to be passed
+ * as argument to a function which will copy the header).
+ *
+ * @param h	    The header to be initialized.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string.
+ * @param hvalue    Optional string to be assigned as the value.
+ *
+ * @return	    The header, or THROW exception.
+ */
+PJ_DECL(void) pjsip_generic_string_hdr_init2(pjsip_generic_string_hdr *h,
+					     pj_str_t *hname,
+					     pj_str_t *hvalue);
+
+
+/* **************************************************************************/
+
+/**
+ * Generic SIP header, which contains hname and a string hvalue.
+ */
+typedef struct pjsip_generic_int_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_int_hdr); /**< Standard header field. */
+    pj_int32_t ivalue;				    /**< ivalue */
+} pjsip_generic_int_hdr;
+
+
+/**
+ * Create a new instance of generic header. A generic header can have an
+ * arbitrary header name.
+ *
+ * @param pool	    The pool.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string.
+ * @param hvalue    The value to be assigned to the header.
+ *
+ * @return	    The header, or THROW exception.
+ */
+PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
+						      const pj_str_t *hname,
+						      int hvalue );
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string later.
+ * @param value	    Value to be assigned to the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool,
+							    void *mem,
+							    const pj_str_t *hname,
+							    int value );
+
+/* **************************************************************************/
+
+/** Maximum elements in the header array. */
+#define PJSIP_GENERIC_ARRAY_MAX_COUNT	32
+
+/**
+ * Generic array of string header.
+ */
+typedef struct pjsip_generic_array_hdr
+{
+    /** Standard header fields. */
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_array_hdr);
+
+    /** Number of tags/elements. */
+    unsigned	count;
+
+    /** Tags/elements. */
+    pj_str_t	values[PJSIP_GENERIC_ARRAY_MAX_COUNT];
+
+} pjsip_generic_array_hdr;
+
+/**
+ * Create generic array header.
+ *
+ * @param pool	    Pool to allocate memory from.
+ * @param hname	    Header name.
+ *
+ * @return	    New generic array header.
+ */
+PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create(pj_pool_t *pool,
+							     const pj_str_t *hname);
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param hname	    The header name to be assigned to the header, or NULL to
+ *		    assign the header name with some string later.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init(pj_pool_t *pool,
+							       void *mem,
+							       const pj_str_t *hname);
+
+
+/* **************************************************************************/
+
+/** Accept header. */
+typedef pjsip_generic_array_hdr pjsip_accept_hdr;
+
+/** Maximum fields in Accept header. */
+#define PJSIP_MAX_ACCEPT_COUNT	PJSIP_GENERIC_ARRAY_MAX_COUNT
+
+/**
+ * Create new Accept header instance.
+ *
+ * @param pool	    The pool.
+ *
+ * @return	    New Accept header instance.
+ */
+PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool);
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool,
+						  void *mem );
+
+
+/* **************************************************************************/
+
+/**
+ * Allow header.
+ */
+typedef pjsip_generic_array_hdr pjsip_allow_hdr;
+
+/**
+ * Create new Allow header instance.
+ *
+ * @param pool	    The pool.
+ *
+ * @return	    New Allow header instance.
+ */
+PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool);
+
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool,
+						void *mem );
+
+/* **************************************************************************/
+
+/**
+ * Call-ID header.
+ */
+typedef struct pjsip_cid_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_cid_hdr);
+    pj_str_t id;	    /**< Call-ID string. */
+} pjsip_cid_hdr;
+
+
+/**
+ * Create new Call-ID header.
+ *
+ * @param pool	The pool.
+ *
+ * @return	new Call-ID header.
+ */
+PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_create( pj_pool_t *pool );
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool,
+					    void *mem );
+
+
+
+/* **************************************************************************/
+/**
+ * Content-Length header.
+ */
+typedef struct pjsip_clen_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_clen_hdr);
+    int len;	/**< Content length. */
+} pjsip_clen_hdr;
+
+/**
+ * Create new Content-Length header.
+ *
+ * @param pool	the pool.
+ * @return	A new Content-Length header instance.
+ */
+PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool,
+					      void *mem );
+
+
+/* **************************************************************************/
+/**
+ * CSeq header.
+ */
+typedef struct pjsip_cseq_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_cseq_hdr);
+    pj_int32_t	    cseq;	/**< CSeq number. */
+    pjsip_method    method;	/**< CSeq method. */
+} pjsip_cseq_hdr;
+
+
+/** Create new  CSeq header. 
+ *
+ *  @param pool	The pool.
+ *  @return A new CSeq header instance.
+ */
+PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool,
+					      void *mem );
+
+/* **************************************************************************/
+/**
+ * Contact header.
+ * In this library, contact header only contains single URI. If a message has
+ * multiple URI in the Contact header, the URI will be put in separate Contact
+ * headers.
+ */
+typedef struct pjsip_contact_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr);
+    int		    star;	    /**< The contact contains only a '*' character */
+    pjsip_uri	   *uri;	    /**< URI in the contact. */
+    int		    q1000;	    /**< The "q" value times 1000 (to avoid float) */
+    pj_int32_t	    expires;	    /**< Expires parameter, otherwise -1 if not present. */
+    pjsip_param	    other_param;    /**< Other parameters, concatenated in a single string. */
+} pjsip_contact_hdr;
+
+
+/**
+ * Create a new Contact header.
+ *
+ * @param pool	The pool.
+ * @return	A new instance of Contact header.
+ */
+PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool,
+						    void *mem );
+
+
+/* **************************************************************************/
+/**
+ * Content-Type.
+ */
+typedef struct pjsip_ctype_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_ctype_hdr);
+    pjsip_media_type media; /**< Media type. */
+} pjsip_ctype_hdr;
+
+
+/**
+ * Create a nwe Content Type header.
+ *
+ * @param pool	The pool.
+ * @return	A new Content-Type header.
+ */
+PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool,
+						void *mem );
+
+/* **************************************************************************/
+/** Expires header. */
+typedef pjsip_generic_int_hdr pjsip_expires_hdr;
+
+/**
+ * Create a new Expires header.
+ *
+ * @param pool	    The pool.
+ * @param value	    The expiration value.
+ *
+ * @return	    A new Expires header.
+ */
+PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
+						      int value);
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param value	    The expiration value.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
+						    void *mem,
+						    int value );
+
+
+
+/* **************************************************************************/
+/**
+ * To or From header.
+ */
+typedef struct pjsip_fromto_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_fromto_hdr);
+    pjsip_uri	    *uri;	    /**< URI in From/To header. */
+    pj_str_t	     tag;	    /**< Header "tag" parameter. */
+    pjsip_param	     other_param;   /**< Other params, concatenated as a single string. */
+} pjsip_fromto_hdr;
+
+/** Alias for From header. */
+typedef pjsip_fromto_hdr pjsip_from_hdr;
+
+/** Alias for To header. */
+typedef pjsip_fromto_hdr pjsip_to_hdr;
+
+/**
+ * Create a From header.
+ *
+ * @param pool	The pool.
+ * @return	New instance of From header.
+ */
+PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool,
+					      void *mem );
+
+/**
+ * Create a To header.
+ *
+ * @param pool	The pool.
+ * @return	New instance of To header.
+ */
+PJ_DECL(pjsip_to_hdr*)   pjsip_to_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool,
+					  void *mem );
+
+/**
+ * Convert the header to a From header.
+ *
+ * @param hdr	    The generic from/to header.
+ * @return	    "From" header.
+ */
+PJ_DECL(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr );
+
+/**
+ * Convert the header to a To header.
+ *
+ * @param hdr	    The generic from/to header.
+ * @return	    "To" header.
+ */
+PJ_DECL(pjsip_to_hdr*)   pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr );
+
+
+/* **************************************************************************/
+/**
+ * Max-Forwards header.
+ */
+typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr;
+
+/**
+ * Create new Max-Forwards header instance.
+ *
+ * @param pool	    The pool.
+ * @param value	    The Max-Forwards value.
+ *
+ * @return	    New Max-Forwards header instance.
+ */
+PJ_DECL(pjsip_max_fwd_hdr*) 
+pjsip_max_fwd_hdr_create(pj_pool_t *pool, int value);
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param value	    The Max-Forwards value.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_max_fwd_hdr*) 
+pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value );
+
+
+/* **************************************************************************/
+/**
+ * Min-Expires header.
+ */
+typedef pjsip_generic_int_hdr pjsip_min_expires_hdr;
+
+/**
+ * Create new Min-Expires header instance.
+ *
+ * @param pool	    The pool.
+ * @param value	    The Min-Expires value.
+ *
+ * @return	    New Min-Expires header instance.
+ */
+PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
+							     int value);
+
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param value	    The Min-Expires value.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
+							    void *mem,
+							    int value );
+
+
+/* **************************************************************************/
+/**
+ * Record-Route and Route headers.
+ */
+typedef struct pjsip_routing_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_routing_hdr);  /**< Generic header fields. */
+    pjsip_name_addr  name_addr;	  /**< The URL in the Route/Record-Route header. */
+    pjsip_param	     other_param; /**< Other parameter. */
+} pjsip_routing_hdr;
+
+/** Alias for Record-Route header. */
+typedef pjsip_routing_hdr pjsip_rr_hdr;
+
+/** Alias for Route header. */
+typedef pjsip_routing_hdr pjsip_route_hdr;
+
+
+/** 
+ * Create new Record-Route header from the pool. 
+ *
+ * @param pool	The pool.
+ * @return	A new instance of Record-Route header.
+ */
+PJ_DECL(pjsip_rr_hdr*)	    pjsip_rr_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool,
+					  void *mem );
+
+/** 
+ * Create new Route header from the pool. 
+ *
+ * @param pool	The pool.
+ * @return	A new instance of "Route" header.
+ */
+PJ_DECL(pjsip_route_hdr*)   pjsip_route_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool,
+					        void *mem );
+
+/** 
+ * Convert generic routing header to Record-Route header. 
+ *
+ * @param r	The generic routing header, or a "Routing" header.
+ * @return	Record-Route header.
+ */
+PJ_DECL(pjsip_rr_hdr*)	    pjsip_routing_hdr_set_rr( pjsip_routing_hdr *r );
+
+/** 
+ * Convert generic routing header to "Route" header. 
+ *
+ * @param r	The generic routing header, or a "Record-Route" header.
+ * @return	"Route" header.
+ */
+PJ_DECL(pjsip_route_hdr*)   pjsip_routing_hdr_set_route( pjsip_routing_hdr *r );
+
+/* **************************************************************************/
+/**
+ * Require header.
+ */
+typedef pjsip_generic_array_hdr pjsip_require_hdr;
+
+/**
+ * Create new Require header instance.
+ *
+ * @param pool	    The pool.
+ *
+ * @return	    New Require header instance.
+ */
+PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool);
+
+/**
+ * Initialize a preallocated memory with the header structure. This function
+ * should only be called when application uses its own memory allocation to
+ * allocate memory block for the specified header (e.g. in C++, when the 
+ * header is allocated with "new" operator).
+ * For normal applications, they should use pjsip_xxx_hdr_create() instead,
+ * which allocates memory and initialize it in one go.
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool,
+						    void *mem );
+
+
+/* **************************************************************************/
+/**
+ * Retry-After header.
+ */
+typedef struct pjsip_retry_after_hdr
+{
+    /** Standard header field. */
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_retry_after_hdr); 
+    pj_int32_t	ivalue;		/**< Retry-After value	    */
+    pjsip_param	param;		/**< Optional parameters    */
+    pj_str_t	comment;	/**< Optional comments.	    */
+} pjsip_retry_after_hdr;
+
+
+/**
+ * Create new Retry-After header instance.
+ *
+ * @param pool	    The pool.
+ * @param value	    The Retry-After value.
+ *
+ * @return	    New Retry-After header instance.
+ */
+PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool,
+							     int value);
+
+/**
+ * Initialize a preallocated memory with the header structure. 
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ * @param value	    The Retry-After value.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool,
+							    void *mem,
+							    int value );
+
+
+/* **************************************************************************/
+/**
+ * Supported header.
+ */
+typedef pjsip_generic_array_hdr pjsip_supported_hdr;
+
+/**
+ * Create new Supported header instance.
+ *
+ * @param pool	    The pool.
+ *
+ * @return	    New Supported header instance.
+ */
+PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool);
+
+/**
+ * Initialize a preallocated memory with the header structure. 
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool,
+							void *mem );
+
+/* **************************************************************************/
+/**
+ * Unsupported header.
+ */
+typedef pjsip_generic_array_hdr pjsip_unsupported_hdr;
+
+/**
+ * Create new Unsupported header instance.
+ *
+ * @param pool	    The pool.
+ *
+ * @return	    New Unsupported header instance.
+ */
+PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool);
+
+/**
+ * Initialize a preallocated memory with the header structure. 
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool,
+							    void *mem );
+
+/* **************************************************************************/
+/**
+ * SIP Via header.
+ * In this implementation, Via header can only have one element in each header.
+ * If a message arrives with multiple elements in a single Via, then they will
+ * be split up into multiple Via headers.
+ */
+typedef struct pjsip_via_hdr
+{
+    PJSIP_DECL_HDR_MEMBER(struct pjsip_via_hdr);
+    pj_str_t	     transport;	    /**< Transport type. */
+    pjsip_host_port  sent_by;	    /**< Host and optional port */
+    int		     ttl_param;	    /**< TTL parameter, or -1 if it's not specified. */
+    int		     rport_param;   /**< "rport" parameter, 0 to specify without
+					 port number, -1 means doesn't exist. */
+    pj_str_t	     maddr_param;   /**< "maddr" parameter. */
+    pj_str_t	     recvd_param;   /**< "received" parameter. */
+    pj_str_t	     branch_param;  /**< "branch" parameter. */
+    pjsip_param	     other_param;   /**< Other parameters, concatenated as single string. */
+    pj_str_t	     comment;	    /**< Comment. */
+} pjsip_via_hdr;
+
+/**
+ * Create a new Via header.
+ *
+ * @param pool	    The pool.
+ * @return	    A new "Via" header instance.
+ */
+PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool );
+
+/**
+ * Initialize a preallocated memory with the header structure. 
+ *
+ * @param pool	    Pool for additional memory allocation if required.
+ * @param mem	    Pre-allocated memory to be initialized as the header.
+ *
+ * @return	    The header instance, which points to the same memory 
+ *		    location as the mem argument.
+ */
+PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool,
+					    void *mem );
+
+/* **************************************************************************/
+/**
+ * SIP Warning header.
+ * In this version, Warning header is just a typedef for generic string 
+ * header.
+ */
+typedef pjsip_generic_string_hdr pjsip_warning_hdr;
+
+/**
+ * Create a warning header with the specified contents.
+ *
+ * @param pool	    Pool to allocate memory from.
+ * @param code	    Warning code, 300-399.
+ * @param host	    The host portion of the Warning header.
+ * @param text	    The warning text, which MUST not be quoted with
+ *		    double quote.
+ *
+ * @return	    The Warning header field.
+ */
+PJ_DECL(pjsip_warning_hdr*) pjsip_warning_hdr_create( pj_pool_t *pool,
+						      int code,
+						      const pj_str_t *host,
+						      const pj_str_t *text);
+
+/**
+ * Create a warning header and initialize the contents from the error
+ * message for the specified status code. The warning code will be
+ * set to 399.
+ *
+ * @param pool	    Pool to allocate memory from.
+ * @param host	    The host portion of the Warning header.
+ * @param status    The error status code, which error text will be
+ *		    put in as the Warning text.
+ *
+ * @return	    The Warning header field.
+ */
+PJ_DECL(pjsip_warning_hdr*) 
+pjsip_warning_hdr_create_from_status( pj_pool_t *pool,
+				      const pj_str_t *host,
+				      pj_status_t status);
+
+/* **************************************************************************/
+/** Accept-Encoding header. */
+typedef pjsip_generic_string_hdr pjsip_accept_encoding_hdr;
+
+/** Create Accept-Encoding header. */
+#define pjsip_accept_encoding_hdr_create pjsip_generic_string_hdr_create
+
+/** Accept-Language header. */
+typedef pjsip_generic_string_hdr pjsip_accept_lang_hdr;
+
+/** Create Accept-Language header. */
+#define pjsip_accept_lang_hdr_create pjsip_generic_string_hdr_create
+
+/** Alert-Info header. */
+typedef pjsip_generic_string_hdr pjsip_alert_info_hdr;
+
+/** Create Alert-Info header. */
+#define pjsip_alert_info_hdr_create pjsip_generic_string_hdr_create
+
+/** Authentication-Info header. */
+typedef pjsip_generic_string_hdr pjsip_auth_info_hdr;
+
+/** Create Authentication-Info header. */
+#define pjsip_auth_info_hdr_create pjsip_generic_string_hdr_create
+
+/** Call-Info header. */
+typedef pjsip_generic_string_hdr pjsip_call_info_hdr;
+
+/** Create Call-Info header. */
+#define pjsip_call_info_hdr_create pjsip_generic_string_hdr_create
+
+/** Content-Disposition header. */
+typedef pjsip_generic_string_hdr pjsip_content_disposition_hdr;
+
+/** Create Content-Disposition header. */
+#define pjsip_content_disposition_hdr_create pjsip_generic_string_hdr_create
+
+/** Content-Encoding header. */
+typedef pjsip_generic_string_hdr pjsip_content_encoding_hdr;
+
+/** Create Content-Encoding header. */
+#define pjsip_content_encoding_hdr_create pjsip_generic_string_hdr_create
+
+/** Content-Language header. */
+typedef pjsip_generic_string_hdr pjsip_content_lang_hdr;
+
+/** Create Content-Language header. */
+#define pjsip_content_lang_hdr_create pjsip_generic_string_hdr_create
+
+/** Date header. */
+typedef pjsip_generic_string_hdr pjsip_date_hdr;
+
+/** Create Date header. */
+#define pjsip_date_hdr_create pjsip_generic_string_hdr_create
+
+/** Error-Info header. */
+typedef pjsip_generic_string_hdr pjsip_err_info_hdr;
+
+/** Create Error-Info header. */
+#define pjsip_err_info_hdr_create pjsip_generic_string_hdr_create
+
+/** In-Reply-To header. */
+typedef pjsip_generic_string_hdr pjsip_in_reply_to_hdr;
+
+/** Create In-Reply-To header. */
+#define pjsip_in_reply_to_hdr_create pjsip_generic_string_hdr_create
+
+/** MIME-Version header. */
+typedef pjsip_generic_string_hdr pjsip_mime_version_hdr;
+
+/** Create MIME-Version header. */
+#define pjsip_mime_version_hdr_create pjsip_generic_string_hdr_create
+
+/** Organization header. */
+typedef pjsip_generic_string_hdr pjsip_organization_hdr;
+
+/** Create Organization header. */
+#define pjsip_organization_hdr_create pjsip_genric_string_hdr_create
+
+/** Priority header. */
+typedef pjsip_generic_string_hdr pjsip_priority_hdr;
+
+/** Create Priority header. */
+#define pjsip_priority_hdr_create pjsip_generic_string_hdr_create
+
+/** Proxy-Require header. */
+typedef pjsip_generic_string_hdr pjsip_proxy_require_hdr;
+
+/** Reply-To header. */
+typedef pjsip_generic_string_hdr pjsip_reply_to_hdr;
+
+/** Create Reply-To header. */
+#define pjsip_reply_to_hdr_create pjsip_generic_string_hdr_create
+
+/** Server header. */
+typedef pjsip_generic_string_hdr pjsip_server_hdr;
+
+/** Create Server header. */
+#define pjsip_server_hdr_create pjsip_generic_string_hdr_create
+
+/** Subject header. */
+typedef pjsip_generic_string_hdr pjsip_subject_hdr;
+
+/** Create Subject header. */
+#define pjsip_subject_hdr_create pjsip_generic_string_hdr_create
+
+/** Timestamp header. */
+typedef pjsip_generic_string_hdr pjsip_timestamp_hdr;
+
+/** Create Timestamp header. */
+#define pjsip_timestamp_hdr_create pjsip_generic_string_hdr_create
+
+/** User-Agent header. */
+typedef pjsip_generic_string_hdr pjsip_user_agent_hdr;
+
+/** Create User-Agent header. */
+#define pjsip_user_agent_hdr_create pjsip_generic_string_hdr_create
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}  PJSIP_MSG
+ */
+
+
+PJ_END_DECL
+
+#endif	/* __PJSIP_SIP_MSG_H__ */
+