Bug 790517: Import nrappkit library for mtransport rs=roc,jesup r=gerv
authorEKR <ekr@rtfm.com>
Thu, 04 Oct 2012 11:16:21 -0700
changeset 115853 cbce2911566ddcdaa25dff9b03e3ef51e89861db
parent 115852 8de22a14e8c8a1cf9e67ba7490f4198c81af2580
child 115854 0dfe80d8fc1da0f13fdef204303d0e8b808b90f5
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, jesup, gerv
bugs790517
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 790517: Import nrappkit library for mtransport rs=roc,jesup r=gerv
media/mtransport/third_party/nrappkit/COPYRIGHT
media/mtransport/third_party/nrappkit/IMPORT_FILES
media/mtransport/third_party/nrappkit/README
media/mtransport/third_party/nrappkit/README_MOZILLA
media/mtransport/third_party/nrappkit/VERSION
media/mtransport/third_party/nrappkit/nrappkit.gyp
media/mtransport/third_party/nrappkit/src/event/async_timer.h
media/mtransport/third_party/nrappkit/src/event/async_wait.h
media/mtransport/third_party/nrappkit/src/event/async_wait_int.h
media/mtransport/third_party/nrappkit/src/log/r_log.c
media/mtransport/third_party/nrappkit/src/log/r_log.h
media/mtransport/third_party/nrappkit/src/plugin/nr_plugin.h
media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h
media/mtransport/third_party/nrappkit/src/port/linux/include/linux_funcs.h
media/mtransport/third_party/nrappkit/src/port/linux/include/sys/ttycom.h
media/mtransport/third_party/nrappkit/src/port/linux/port-impl.mk
media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h
media/mtransport/third_party/nrappkit/src/registry/c2ru.c
media/mtransport/third_party/nrappkit/src/registry/c2ru.h
media/mtransport/third_party/nrappkit/src/registry/registry.c
media/mtransport/third_party/nrappkit/src/registry/registry.h
media/mtransport/third_party/nrappkit/src/registry/registry_int.h
media/mtransport/third_party/nrappkit/src/registry/registry_local.c
media/mtransport/third_party/nrappkit/src/registry/registry_vtbl.h
media/mtransport/third_party/nrappkit/src/registry/registrycb.c
media/mtransport/third_party/nrappkit/src/share/nr_api.h
media/mtransport/third_party/nrappkit/src/share/nr_common.h
media/mtransport/third_party/nrappkit/src/share/nr_reg_keys.h
media/mtransport/third_party/nrappkit/src/stats/nrstats.h
media/mtransport/third_party/nrappkit/src/util/byteorder.c
media/mtransport/third_party/nrappkit/src/util/byteorder.h
media/mtransport/third_party/nrappkit/src/util/hex.c
media/mtransport/third_party/nrappkit/src/util/hex.h
media/mtransport/third_party/nrappkit/src/util/libekr/assoc.h
media/mtransport/third_party/nrappkit/src/util/libekr/debug.c
media/mtransport/third_party/nrappkit/src/util/libekr/debug.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_assoc.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_assoc.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_bitfield.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_bitfield.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_common.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_data.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_data.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_defaults.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_includes.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_list.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_list.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_memory.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_memory.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_replace.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_thread.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_time.c
media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h
media/mtransport/third_party/nrappkit/src/util/libekr/r_types.h
media/mtransport/third_party/nrappkit/src/util/p_buf.c
media/mtransport/third_party/nrappkit/src/util/p_buf.h
media/mtransport/third_party/nrappkit/src/util/util.c
media/mtransport/third_party/nrappkit/src/util/util.h
media/mtransport/third_party/nrappkit/upstream.diff
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/COPYRIGHT
@@ -0,0 +1,159 @@
+
+Copyright (C) 2006, Network Resonance, Inc.
+All Rights Reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. Neither the name of Network Resonance, Inc. nor the name of any
+   contributors to this software may be used to endorse or promote 
+   products derived from this software without specific prior written
+   permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+
+This distribution also contains material from ssldump, tcpdump, and
+FreeBSD. The licenses are on the individual source files but follow
+here as well.
+
+SSLDUMP LICENSE
+Copyright (C) 1999-2001 RTFM, Inc.
+All Rights Reserved
+
+This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+<ekr@rtfm.com> and licensed by RTFM, Inc.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+
+   This product includes software developed by Eric Rescorla for
+   RTFM, Inc.
+
+4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+   used to endorse or promote products derived from this
+   software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ERIC RESCORLA AND RTFM ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+TCPDUMP LICENSE
+The manual page for this software is partially excerpted from
+the tcpdump manual page, which is subject to the following license:
+Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
+	The Regents of the University of California.  All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that: (1) source code distributions
+retain the above copyright notice and this paragraph in its entirety, (2)
+distributions including binary code include the above copyright notice and
+this paragraph in its entirety in the documentation or other materials
+provided with the distribution, and (3) all advertising materials mentioning
+features or use of this software display the following acknowledgement:
+``This product includes software developed by the University of California,
+Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+the University nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior
+written permission.
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+The compilation of software known as FreeBSD is distributed under the
+following terms:
+
+Copyright (C) 1992-2004 The FreeBSD Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The 4.4BSD and 4.4BSD-Lite software is distributed under the following
+terms:
+
+All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
+Releases is copyrighted by The Regents of the University of California.
+
+Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
+	The Regents of the University of California.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/IMPORT_FILES
@@ -0,0 +1,89 @@
+              # API
+              src/plugin/nr_plugin.h
+              src/share/nr_api.h
+              src/share/nr_common.h
+              src/share/nr_reg_keys.h
+
+              # libekr
+              src/util/libekr/assoc.h
+              src/util/libekr/debug.c
+              src/util/libekr/debug.h
+              src/util/libekr/r_assoc.c
+              src/util/libekr/r_assoc.h
+              src/util/libekr/r_bitfield.c
+              src/util/libekr/r_bitfield.h
+              src/util/libekr/r_common.h
+              src/util/libekr/r_crc32.c
+              src/util/libekr/r_crc32.h
+              src/util/libekr/r_data.c
+              src/util/libekr/r_data.h
+              src/util/libekr/r_defaults.h
+              src/util/libekr/r_errors.c
+              src/util/libekr/r_errors.h
+              src/util/libekr/r_includes.h
+              src/util/libekr/r_list.c
+              src/util/libekr/r_list.h
+              src/util/libekr/r_macros.h
+              src/util/libekr/r_memory.c
+              src/util/libekr/r_memory.h
+              src/util/libekr/r_replace.c
+              src/util/libekr/r_thread.h
+              src/util/libekr/r_time.c
+              src/util/libekr/r_time.h
+              src/util/libekr/r_types.h
+              src/util/libekr/debug.c
+              src/util/libekr/debug.h
+
+	      # Utilities
+              src/util/byteorder.c
+              src/util/byteorder.h
+              src/util/hex.c
+              src/util/hex.h
+              src/util/p_buf.c
+              src/util/p_buf.h
+              src/util/util.c
+              src/util/util.h
+
+	      # Events
+              src/event/async_timer.h
+              src/event/async_wait.h
+              src/event/async_wait_int.h
+
+	      # Logging
+              src/log/r_log.c
+              src/log/r_log.h
+
+	      # Registry
+              src/registry/c2ru.c
+              src/registry/c2ru.h
+              src/registry/registry.c
+              src/registry/registry.h
+              src/registry/registry_int.h
+              src/registry/registry_local.c
+              src/registry/registry_vtbl.h
+              src/registry/registrycb.c
+
+              src/port/darwin/include/csi_platform.h
+              src/port/win32/include/csi_platform.h
+              src/port/linux/include/csi_platform.h
+              src/port/linux/include/linux_funcs.h
+              src/port/linux/include/sys/ttycom.h
+              src/port/linux/port-impl.mk
+	      # sys/queue.h manually copied into src/port/generic
+
+              # Stats
+              src/stats/nrstats.h
+              
+              # Meta-files
+              COPYRIGHT
+              VERSION
+              README
+
+
+
+
+
+
+
+              
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/README
@@ -0,0 +1,133 @@
+$Id: README,v 1.3 2007/11/21 00:09:10 adamcain Exp $ 
+
+nrappkit 1.0b2
+Copyright (C) 2006 Network Resonance, Inc.
+
+
+nrappkit is a toolkit for building standalone applications and
+appliances. It provides:
+
+- registry-based configuration (with change callbacks)
+- extensible command and configuration shell
+- extensible statistics system
+- configurable logging system
+- event and timer handling
+- generic plugin system
+- launcher daemon
+
+The contents of nrappkit were extracted from Network Resonance's
+product on the theory that they were generally useful for 
+application developers. 
+
+THIS PACKAGE DOES NOT GRANT A LICENSE OR RIGHT TO ANY OTHER NETWORK
+RESONANCE TECHNOLOGY OR SOFTWARE.
+
+
+
+BUILDING
+
+Builds are done semi-manually with port directories for each
+platform. There are pre-existing ports to FreeBSD, Linux (Ubuntu
+and Fedora Core), and Darwin (MacOSX). To build the system:
+
+	cd src/make/<platform>
+	gmake
+
+Some of the platforms come in several variants. Most notably,
+if a platform exists in "regular" and "-appliance" variant,
+this means that the regular variant just builds binaries intended
+to be run out of the make directory (for development) and the
+appliance variant is intended to be installed in a real system.
+
+By default we want to install things owned as user "pcecap".
+Either make this user or edit the Makefile to be a user you
+like (e.g., nobody).
+
+If you want to include the 'nrsh' command-line configuration
+tool in your build, you will need to make sure the line
+  BUILD_NRSH=yes
+appears (uncommented-out) in your platform Makefile.  You will 
+also need to to build OpenSSL and libedit and point your nrappkit
+Makefile to the correct paths. You can obtain these packages at:
+    openssl-0.9.7l
+    http://www.openssl.org/source/openssl-0.9.7l.tar.gz
+
+    libedit-20060829-2.9
+    http://freshmeat.net/redir/editline/53029/url_tgz/libedit-20060829-2.9.tar.gz
+
+
+INSTALLING
+If you're doing an appliance as opposed to a development build,
+you'll want to install it. This is easy:
+
+	su
+ 	gmake install
+
+Most binaries and libraries ends up in /usr/local/pcecap while
+data files are in /var/pcecap. However, you can tweak
+this in the Makefile. By default it's all owned by pcecap.
+
+To ensure that dynamic libraries are loaded correctly at runtime,
+you'd want to make sure the right directory is included in your
+LD_LIBRARY_PATH or via ldconfig.
+
+
+QUICK TOUR
+The build makes the following binaries that you may find useful:
+
+- captured    -- the launcher (the name is historical)
+- registryd   -- the registry daemon
+- nrregctl    -- a registry control program
+- nrsh        -- the command shell (when included in build)
+- nrstatsctl  -- the stats control program
+
+Using the nrcapctl script is the easiest way to interact with
+the applications. It is run as "nrcapctl <command>" with the
+following commands recognized:
+
+  startup            -- fires up captured, which in turn runs and
+                        initializes the registry
+
+  shutdown           -- kills captured and its child processes
+
+  status             -- prints the running status of captured in
+                        human-readable form
+
+  stat               -- prints the running status of captured in
+                        a form easily parsed by scripts
+
+  enable             -- alters the mode.txt file so that captured
+                        starts 
+
+  disable            -- alters the mode.txt file so that captured
+                        does not start
+
+  clear-statistics   -- equivalent to "nrstatsctl -z" (requires
+                        that captured be running)
+
+Note: the "start" and "stop" nrcapctl commands do nothing as they
+use components not included in nrappkit. However the associated
+script logic in nrcapctl demonstrates how additional applications
+might be launched using nrcapctl and particular registry settings.
+
+
+EXTENDING
+When things come up, they're pretty dumb. You'll probably want to
+write your own applications, otherwise it's not clear why you're doing
+this. The general idea is that you write your application using the
+facilities that nrappkit provides and then write plugins to the
+nrappkit components as necessary. So, for example, say you want
+to write a network daemon. You would:
+
+ - configure the launcher to launch your daemon (using the registry,
+   naturally).
+ - make calls to the registry to get configuration data
+ - make calls to the logging system to log data
+ - implement a stats module to record statistics
+ - write a plugin to nrsh to let people configure your parameters
+
+Examples of some of this stuff can be found in examples/demo_plugin.
+Otherwise, read the source. More documentation will be on the way,
+hopefully.
+
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/README_MOZILLA
@@ -0,0 +1,22 @@
+This import of nrappkit is a subset of the distribution at:
+
+  nrappkit.sourceforge.net
+
+
+The last revision included in this import was on Nov 25, 2008.
+This import includes a small nunber of portability fixes that
+have been submitted to the upstream repository and are included
+in upstream.diff.
+
+
+Out of the list in the README, we use:
+
+- registry-based configuration (with change callbacks)
+  [but without the registry daemon]
+- configurable logging system
+- event and timer handling
+  [though partly reimplemented]
+ 
+Also, we use a bunch of the generic utilities such as string handling,
+generic hash tables in C, yet another concrete type mapping, etc.
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/VERSION
@@ -0,0 +1,1 @@
+1.0b2
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/nrappkit.gyp
@@ -0,0 +1,235 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# nrappkit.gyp
+#
+#
+{
+  'targets' : [
+      {
+        	'target_name' : 'nrappkit',
+          'type' : 'static_library',
+
+          'include_dirs' : [
+              # EXTERNAL
+              
+
+
+              # INTERNAL
+	      'src/event',
+	      'src/log',
+              'src/port/generic/include',
+	      'src/registry',
+	      'src/share',
+	      'src/stats',
+	      'src/util',
+	      'src/util/libekr'
+          ],
+
+          'sources' : [
+	      # Shared
+#              './src/share/nr_api.h',
+              './src/share/nr_common.h',
+#              './src/share/nr_dynlib.h',
+              './src/share/nr_reg_keys.h',
+#              './src/share/nr_startup.c',
+#              './src/share/nr_startup.h',
+#              './src/share/nrappkit_static_plugins.c',
+	       './src/port/generic/include'
+
+              # libekr
+              './src/util/libekr/assoc.h',
+              './src/util/libekr/debug.c',
+              './src/util/libekr/debug.h',
+              './src/util/libekr/r_assoc.c',
+              './src/util/libekr/r_assoc.h',
+#              './src/util/libekr/r_assoc_test.c',
+              './src/util/libekr/r_bitfield.c',
+              './src/util/libekr/r_bitfield.h',
+              './src/util/libekr/r_common.h',
+              './src/util/libekr/r_crc32.c',
+              './src/util/libekr/r_crc32.h',
+              './src/util/libekr/r_data.c',
+              './src/util/libekr/r_data.h',
+              './src/util/libekr/r_defaults.h',
+              './src/util/libekr/r_errors.c',
+              './src/util/libekr/r_errors.h',
+              './src/util/libekr/r_includes.h',
+              './src/util/libekr/r_list.c',
+              './src/util/libekr/r_list.h',
+              './src/util/libekr/r_macros.h',
+              './src/util/libekr/r_memory.c',
+              './src/util/libekr/r_memory.h',
+              './src/util/libekr/r_replace.c',
+              './src/util/libekr/r_thread.h',
+              './src/util/libekr/r_time.c',
+              './src/util/libekr/r_time.h',
+              './src/util/libekr/r_types.h',
+              './src/util/libekr/debug.c',
+              './src/util/libekr/debug.h',
+
+	      # Utilities
+              './src/util/byteorder.c',
+              './src/util/byteorder.h',
+              #'./src/util/escape.c',
+              #'./src/util/escape.h',
+              #'./src/util/filename.c',
+              #'./src/util/getopt.c',
+              #'./src/util/getopt.h',
+              './src/util/hex.c',
+              './src/util/hex.h',
+	      #'./src/util/mem_util.c',
+              #'./src/util/mem_util.h',
+              #'./src/util/mutex.c',
+              #'./src/util/mutex.h',
+              './src/util/p_buf.c',
+              './src/util/p_buf.h',
+              #'./src/util/ssl_util.c',
+              #'./src/util/ssl_util.h',
+              './src/util/util.c',
+              './src/util/util.h',
+              #'./src/util/util_db.c',
+              #'./src/util/util_db.h',
+
+	      # Events
+#              './src/event/async_timer.c',
+              './src/event/async_timer.h',
+#              './src/event/async_wait.c',
+              './src/event/async_wait.h',
+              './src/event/async_wait_int.h',
+
+	      # Logging
+              './src/log/r_log.c',
+              './src/log/r_log.h',
+              #'./src/log/r_log_plugin.c',
+
+	      # Registry
+              './src/registry/c2ru.c',
+              './src/registry/c2ru.h',
+              #'./src/registry/mod_registry/mod_registry.c',
+              #'./src/registry/nrregctl.c',
+              #'./src/registry/nrregistryctl.c',
+              './src/registry/registry.c',
+              './src/registry/registry.h',
+              './src/registry/registry_int.h',
+              './src/registry/registry_local.c',
+              #'./src/registry/registry_plugin.c',
+              './src/registry/registry_vtbl.h',
+              './src/registry/registrycb.c',
+              #'./src/registry/registryd.c',
+              #'./src/registry/regrpc.h',
+              #'./src/registry/regrpc_client.c',
+              #'./src/registry/regrpc_client.h',
+              #'./src/registry/regrpc_client_cb.c',
+              #'./src/registry/regrpc_clnt.c',
+              #'./src/registry/regrpc_server.c',
+              #'./src/registry/regrpc_svc.c',
+              #'./src/registry/regrpc_xdr.c',
+
+	      # Statistics
+              #'./src/stats/nrstats.c',
+              #'./src/stats/nrstats.h',
+              #'./src/stats/nrstats_app.c',
+              #'./src/stats/nrstats_int.h',
+              #'./src/stats/nrstats_memory.c',
+          ],
+          
+          'defines' : [
+              'SANITY_CHECKS',
+          ],
+          
+          'conditions' : [
+              ## Mac
+              [ 'OS == "mac"', {
+                'cflags_mozilla': [
+                    '-Werror',
+                    '-Wall',
+                    '-Wno-parentheses',
+                    '-Wno-strict-prototypes',
+                    '-Wmissing-prototypes',
+                 ],
+                 'defines' : [
+                     'DARWIN',
+                     'HAVE_LIBM=1',
+                     'HAVE_STRDUP=1',
+                     'HAVE_STRLCPY=1',
+                     'HAVE_SYS_TIME_H=1',
+                     'HAVE_VFPRINTF=1',
+                     'NEW_STDIO'
+                     'RETSIGTYPE=void',
+                     'TIME_WITH_SYS_TIME_H=1',
+                     '__UNUSED__="__attribute__((unused))"',
+                 ],
+
+		 'include_dirs': [
+		     'src/port/darwin/include'
+		 ],
+		 
+		 'sources': [
+              	      './src/port/darwin/include/csi_platform.h',
+		 ],
+              }],
+              
+              ## Win
+              [ 'OS == "win"', {
+                 'defines' : [
+                     'WIN',
+                     '__UNUSED__=""',
+                     'HAVE_STRDUP=1',
+                     'SIZEOF_SHORT=2',
+                     'SIZEOF_UNSIGNED_SHORT=2',
+                     'SIZEOF_INT=4',
+                     'SIZEOF_UNSIGNED_INT=4',
+                     'SIZEOF_LONG=4',
+                     'SIZEOF_UNSIGNED_LONG=4',
+                     'SIZEOF_LONG_LONG=8',
+                     'SIZEOF_UNSIGNED_LONG_LONG=8',
+                     'NO_REG_RPC'
+                 ],
+
+		 'include_dirs': [
+		     'src/port/win32/include'
+		 ],
+
+		 'sources': [
+              	      './src/port/win32/include/csi_platform.h',
+		 ],
+              }],
+
+              
+              ## Linux
+              [ 'OS == "linux"', {
+                'cflags': [
+                    '-Werror',
+                    '-Wall',
+                    '-Wno-parentheses',
+                    '-Wno-strict-prototypes',
+                    '-Wmissing-prototypes',
+                 ],
+                 'defines' : [
+                     'LINUX',
+                     'HAVE_LIBM=1',
+                     'HAVE_STRDUP=1',
+                     'HAVE_STRLCPY=1',
+                     'HAVE_SYS_TIME_H=1',
+                     'HAVE_VFPRINTF=1',
+                     'NEW_STDIO'
+                     'RETSIGTYPE=void',
+                     'TIME_WITH_SYS_TIME_H=1',
+                     '__UNUSED__="__attribute__((unused))"',
+                 ],
+
+		 'include_dirs': [
+		     'src/port/linux/include'
+		 ],
+		 
+		 'sources': [
+              	      './src/port/linux/include/csi_platform.h',
+		 ],
+              }]
+          ]
+      }]
+}
+
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/event/async_timer.h
@@ -0,0 +1,54 @@
+/**
+   async_timer.h
+
+   
+   Copyright (C) 2004, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Sun Feb 22 19:35:24 2004
+ */
+
+
+#ifndef _async_timer_h
+#define _async_timer_h
+
+
+int NR_async_timer_init(void);
+int NR_async_timer_set(int delay_ms,NR_async_cb cb,void *cb_arg,char *function,int line,void **handle);
+int NR_async_timer_cancel(void *handle);
+int NR_async_timer_update_time(struct timeval *tv);
+int NR_async_timer_next_timeout(int *delay_ms);
+int NR_async_timer_sanity_check_for_cb_deleted(NR_async_cb cb,void *cb_arg);
+
+#define NR_ASYNC_TIMER_SET(d,c,a,hp) NR_async_timer_set(d,c,a,(char *)__FUNCTION__,__LINE__,hp)
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/event/async_wait.h
@@ -0,0 +1,83 @@
+/**
+   async_wait.h
+
+   
+   Copyright (C) 2001-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Thu Dec 20 20:14:49 2001
+ */
+
+
+#ifndef _async_wait_h
+#define _async_wait_h
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <csi_platform.h>
+
+typedef void (*NR_async_cb)(NR_SOCKET resource,int how,void *arg);
+
+#define NR_ASYNC_WAIT_READ 0
+#define NR_ASYNC_WAIT_WRITE 1
+
+
+int NR_async_wait_init(void);
+int NR_async_wait(NR_SOCKET sock, int how, NR_async_cb cb,void *cb_arg,
+                            char *function,int line);
+int NR_async_cancel(NR_SOCKET sock,int how);
+int NR_async_schedule(NR_async_cb cb,void *arg,char *function,int line);
+int NR_async_event_wait(int *eventsp);
+int NR_async_event_wait2(int *eventsp,struct timeval *tv);
+
+
+#ifdef NR_DEBUG_ASYNC
+#define NR_ASYNC_WAIT(s,h,cb,arg) do { \
+fprintf(stderr,"NR_async_wait(%d,%s,%s) at %s(%d)\n",s,#h,#cb,__FUNCTION__,__LINE__); \
+       NR_async_wait(s,h,cb,arg,(char *)__FUNCTION__,__LINE__);            \
+} while (0)
+#define NR_ASYNC_SCHEDULE(cb,arg) do { \
+fprintf(stderr,"NR_async_schedule(%s) at %s(%d)\n",#cb,__FUNCTION__,__LINE__);\
+       NR_async_schedule(cb,arg,(char *)__FUNCTION__,__LINE__);            \
+} while (0)
+#define NR_ASYNC_CANCEL(s,h) do { \
+       fprintf(stderr,"NR_async_cancel(%d,%s) at %s(%d)\n",s,#h,(char *)__FUNCTION__,__LINE__); \
+NR_async_cancel(s,h); \
+} while (0)
+#else
+#define NR_ASYNC_WAIT(a,b,c,d) NR_async_wait(a,b,c,d,(char *)__FUNCTION__,__LINE__)
+#define NR_ASYNC_SCHEDULE(a,b) NR_async_schedule(a,b,(char *)__FUNCTION__,__LINE__)
+#define NR_ASYNC_CANCEL NR_async_cancel
+#endif
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/event/async_wait_int.h
@@ -0,0 +1,62 @@
+/**
+   async_wait_int.h
+
+   
+   Copyright (C) 2004, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Sun Feb 22 19:16:01 2004
+ */
+
+
+#ifndef _async_wait_int_h
+#define _async_wait_int_h
+
+
+typedef struct callback_ {
+     NR_async_cb cb;
+     void *arg;
+     int how;
+     int resource;
+     void *backptr;
+
+     char *func;
+     int free_func;
+     int line;
+     TAILQ_ENTRY(callback_) entry;
+} callback;
+
+int nr_async_create_cb(NR_async_cb cb,void *arg,int how,
+  int resource,char *func,int line,callback **cbp);
+int nr_async_destroy_cb(callback **cbp);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/log/r_log.c
@@ -0,0 +1,678 @@
+/**
+   r_log.c
+
+   
+   Copyright (C) 2001, RTFM, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Mon Dec  3 15:24:38 2001
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adamcain Exp $";
+
+
+#ifdef LINUX
+#define _BSD_SOURCE
+#endif
+
+#include "r_log.h"
+#include "hex.h"
+
+#include <string.h>
+#ifndef _MSC_VER
+#include <strings.h>
+#include <syslog.h>
+#endif
+#include <registry.h>
+#include <time.h>
+
+
+#include "nr_common.h"
+#include "nr_reg_keys.h"
+
+
+#define LOGGING_DEFAULT_LEVEL  5
+
+int NR_LOG_LOGGING = 0;
+
+static char *log_level_strings[]={
+     "EMERG",
+     "ALERT",
+     "CRIT",
+     "ERR",
+     "WARNING",
+     "NOTICE",
+     "INFO",
+     "DEBUG"
+};
+
+static char *log_level_reg_strings[]={
+     "emergency",
+     "alert",
+     "critical",
+     "error",
+     "warning",
+     "notice",
+     "info",
+     "debug"
+};
+
+#define LOGGING_REG_PREFIX "logging"
+
+#define MAX_ERROR_STRING_SIZE   512
+
+static char log_fmt_buf[MAX_ERROR_STRING_SIZE];
+
+#define R_LOG_INITTED1   1
+#define R_LOG_INITTED2   2
+
+#define LOG_NUM_DESTINATIONS 3
+
+typedef struct log_type_ {
+     char *facility_name;
+     int level[LOG_NUM_DESTINATIONS];
+     NR_registry dest_facility_key[LOG_NUM_DESTINATIONS];
+} log_type;
+
+#define MAX_LOG_TYPES 1024
+
+static log_type log_types[MAX_LOG_TYPES];
+static int log_type_ct;
+
+
+typedef struct log_destination_ {
+     char *dest_name;
+     int enabled;
+     int default_level;
+     r_dest_vlog *dest_vlog;
+} log_destination;
+
+
+#define LOG_LEVEL_UNDEFINED        -1
+#define LOG_LEVEL_NONE             -2
+#define LOG_LEVEL_USE_DEST_DEFAULT -3
+
+static int stderr_vlog(int facility,int level,const char *format,va_list ap);
+static int syslog_vlog(int facility,int level,const char *format,va_list ap);
+static int noop_vlog(int facility,int level,const char *format,va_list ap);
+
+static log_destination log_destinations[LOG_NUM_DESTINATIONS]={
+     {
+          "stderr",
+          0,
+          LOGGING_DEFAULT_LEVEL,
+          stderr_vlog,
+     },
+     {
+          "syslog",
+#ifndef WIN32
+          1,
+#else
+          0,
+#endif
+          LOGGING_DEFAULT_LEVEL,
+          syslog_vlog,
+     },
+     {
+          "extra",
+          0,
+          LOGGING_DEFAULT_LEVEL,
+          noop_vlog,
+     },
+};
+
+static int r_log_level=LOGGING_DEFAULT_LEVEL;
+static int r_log_level_environment=0;
+static int r_log_initted=0;
+static int r_log_env_verbose=0;
+
+static void r_log_facility_change_cb(void *cb_arg, char action, NR_registry name);
+static void r_log_facility_delete_cb(void *cb_arg, char action, NR_registry name);
+static void r_log_destination_change_cb(void *cb_arg, char action, NR_registry name);
+static void r_log_default_level_change_cb(void *cb_arg, char action, NR_registry name);
+static int r_log_get_default_level(void);
+static int r_log_get_destinations(int usereg);
+static int r_logging_dest(int dest_index, int facility, int level);
+static int _r_log_init(int usereg);
+static int r_log_get_reg_level(NR_registry name, int *level);
+
+int r_log_register(char *facility_name,int *log_facility)
+  {
+    int i,j;
+    int level;
+    int r,_status;
+    char *buf=0;
+    NR_registry dest_prefix, dest_facility_prefix;
+ 
+    for(i=0;i<log_type_ct;i++){
+      if(!strcmp(facility_name,log_types[i].facility_name)){
+        *log_facility=i;
+        return(0);
+      }
+    }
+
+    if(log_type_ct==MAX_LOG_TYPES){
+      ABORT(R_INTERNAL);
+    }
+
+    i=log_type_ct;
+
+    /* Initial registration completed, increment log_type_ct */
+    log_types[i].facility_name=r_strdup(facility_name);
+    *log_facility=log_type_ct;
+    log_type_ct++;
+    
+    for(j=0; j<LOG_NUM_DESTINATIONS; j++){
+      log_types[i].level[j]=LOG_LEVEL_UNDEFINED;
+
+      if(NR_reg_initted()){
+
+        if(snprintf(dest_prefix,sizeof(NR_registry),
+          "logging.%s.facility",log_destinations[j].dest_name)>=sizeof(NR_registry))
+          ABORT(R_INTERNAL);
+
+        if (r=NR_reg_make_registry(dest_prefix,facility_name,dest_facility_prefix))
+          ABORT(r);
+
+        if(snprintf(log_types[i].dest_facility_key[j],sizeof(NR_registry),
+          "%s.level",dest_facility_prefix)>=sizeof(NR_registry))
+          ABORT(R_INTERNAL);
+
+        if(!r_log_get_reg_level(log_types[i].dest_facility_key[j],&level)){
+          log_types[i].level[j]=level;
+        }
+
+        /* Set a callback for the facility's level */
+        if(r=NR_reg_register_callback(log_types[i].dest_facility_key[j],
+          NR_REG_CB_ACTION_ADD|NR_REG_CB_ACTION_CHANGE,
+          r_log_facility_change_cb,(void *)&(log_types[i].level[j])))
+          ABORT(r);
+        if(r=NR_reg_register_callback(log_types[i].dest_facility_key[j],
+          NR_REG_CB_ACTION_DELETE,
+          r_log_facility_delete_cb,(void *)&(log_types[i].level[j])))
+          ABORT(r);
+
+      }
+    }
+
+    _status=0;
+  abort:
+    if(_status)
+      RFREE(buf);
+    return(_status);
+  }
+     
+int r_log_facility(int facility,char **typename)
+  {
+    if(facility >= 0 && facility < log_type_ct){
+      *typename=log_types[facility].facility_name;
+      return(0);
+    }
+    return(R_NOT_FOUND);
+  }
+
+static int r_log_get_reg_level(NR_registry name, int *out)
+  {
+    char level[32];
+    int r,_status;
+    int i;
+
+    if(r=NR_reg_get_string(name,level,sizeof(level)))
+      ABORT(r);
+
+    if(!strcasecmp(level,"none")){
+      *out=LOG_LEVEL_NONE;
+      return(0);
+    }
+
+    for(i=0;i<=LOG_DEBUG;i++){
+      if(!strcasecmp(level,log_level_reg_strings[i])){
+        *out=(int)i;
+        return(0);
+      }
+    }
+
+    if(i>LOG_DEBUG){
+      *out=LOG_LEVEL_UNDEFINED;
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+/* Handle the case where a value changes */
+static void r_log_facility_change_cb(void *cb_arg, char action, NR_registry name)
+  {
+    int *lt_level=(int *)cb_arg;
+    int level;
+    int r,_status;
+    
+    if(r=r_log_get_reg_level(name,&level))
+      ABORT(r);
+
+    *lt_level=level;
+
+    _status=0;
+  abort:
+    return;
+  }
+
+/* Handle the case where a value is deleted */
+static void r_log_facility_delete_cb(void *cb_arg, char action, NR_registry name)
+  {
+    int *lt_level=(int *)cb_arg;
+
+    *lt_level=LOG_LEVEL_UNDEFINED;
+  }
+
+int r_log(int facility,int level,const char *format,...)
+  {
+    va_list ap;
+
+    va_start(ap,format);
+    
+    r_vlog(facility,level,format,ap);
+    va_end(ap);
+    
+    return(0);
+  }
+
+int r_dump(int facility,int level,char *name,char *data,int len)
+  {
+    char *hex = 0;
+    int unused;
+
+    if(!r_logging(facility,level))
+      return(0);
+
+    hex=RMALLOC((len*2)+1);
+    if (!hex)
+      return(R_FAILED);
+
+    if (nr_nbin2hex((UCHAR*)data, len, hex, len*2+1, &unused))
+      strcpy(hex, "?");
+
+    if(name)
+      r_log(facility,level,"%s[%d]=%s",name,len,hex);
+    else
+      r_log(facility,level,"%s",hex);
+
+    RFREE(hex);
+    return(0);
+  }
+
+int r_vlog(int facility,int level,const char *format,va_list ap)
+  {
+    char *level_str="unknown";
+    char *facility_str="unknown";
+    char *fmt_str=(char *)format;
+    int i;
+
+    if(r_log_env_verbose){
+      if((level>=LOG_EMERG) && (level<=LOG_DEBUG))
+        level_str=log_level_strings[level];
+
+      if(facility >= 0 && facility < log_type_ct)
+        facility_str=log_types[facility].facility_name;
+
+      snprintf(log_fmt_buf, MAX_ERROR_STRING_SIZE, "(%s/%s) %s",
+        facility_str,level_str,format);
+
+      log_fmt_buf[MAX_ERROR_STRING_SIZE-1]=0;
+      fmt_str=log_fmt_buf;
+    }
+
+    for(i=0; i<LOG_NUM_DESTINATIONS; i++){
+      if(r_logging_dest(i,facility,level)){
+        log_destinations[i].dest_vlog(facility,level,fmt_str,ap);
+      }
+    }
+    return(0);
+  }
+
+int stderr_vlog(int facility,int level,const char *format,va_list ap)
+  {
+#if 0 /* remove time stamping, for now */
+    char cbuf[30];
+    time_t tt;
+
+    tt=time(0);
+
+    ctime_r(&tt,cbuf);
+    cbuf[strlen(cbuf)-1]=0;
+    
+    fprintf(stderr,"%s: ",cbuf);
+#endif
+
+    vfprintf(stderr,format,ap);
+      fprintf(stderr,"\n");
+    return(0);
+    }
+
+int syslog_vlog(int facility,int level,const char *format,va_list ap)
+  {
+#ifndef WIN32
+    vsyslog(level|LOG_LOCAL0,format,ap);
+#endif
+    return(0);
+  }
+
+int noop_vlog(int facility,int level,const char *format,va_list ap)
+  {
+    return(0);
+  }
+
+int r_log_e(int facility,int level,const char *format,...)
+  {
+    va_list ap;
+
+    va_start(ap,format);
+    r_vlog_e(facility,level,format,ap);
+    va_end(ap);
+
+    return(0);
+  }
+
+int r_vlog_e(int facility,int level,const char *format,va_list ap)
+  {
+    if(r_logging(facility,level)) {
+      int formatlen = strlen(format);
+
+      if(formatlen+2 > MAX_ERROR_STRING_SIZE)
+        return(1);
+
+      strncpy(log_fmt_buf, format, formatlen);
+      strcpy(&log_fmt_buf[formatlen], ": ");
+      snprintf(&log_fmt_buf[formatlen+2], MAX_ERROR_STRING_SIZE - formatlen - 2, "%s",
+#ifdef WIN32
+               strerror(WSAGetLastError()));
+#else
+               strerror(errno));
+#endif
+      log_fmt_buf[MAX_ERROR_STRING_SIZE-1]=0;
+
+      r_vlog(facility,level,log_fmt_buf,ap);
+    }
+    return(0);
+  }
+
+int r_log_nr(int facility,int level,int r,const char *format,...)
+  {
+    va_list ap;
+
+    va_start(ap,format);
+    r_vlog_nr(facility,level,r,format,ap);
+    va_end(ap);
+
+    return(0);
+  }
+
+int r_vlog_nr(int facility,int level,int r,const char *format,va_list ap)
+  {
+    if(r_logging(facility,level)) {
+      int formatlen = strlen(format);
+
+      if(formatlen+2 > MAX_ERROR_STRING_SIZE)
+        return(1);
+      strncpy(log_fmt_buf, format, formatlen);
+      strcpy(&log_fmt_buf[formatlen], ": ");
+      snprintf(&log_fmt_buf[formatlen+2], MAX_ERROR_STRING_SIZE - formatlen - 2, "%s",
+               nr_strerror(r));
+
+      log_fmt_buf[MAX_ERROR_STRING_SIZE-1]=0;
+
+      r_vlog(facility,level,log_fmt_buf,ap);
+    }
+    return(0);
+  }
+
+static int r_logging_dest(int dest_index, int facility, int level)
+  {
+    int thresh;
+
+    _r_log_init(0);
+
+    if(!log_destinations[dest_index].enabled)
+      return(0);
+
+    if(level <= r_log_level_environment)
+      return(1);
+
+    if(r_log_initted<R_LOG_INITTED2)
+      return(level<=r_log_level);
+          
+    if(facility < 0 || facility > log_type_ct)
+      thresh=r_log_level;
+    else{
+      if(log_types[facility].level[dest_index]==LOG_LEVEL_NONE)
+        return(0);
+
+      if(log_types[facility].level[dest_index]>=0)
+        thresh=log_types[facility].level[dest_index];
+      else if(log_destinations[dest_index].default_level!=LOG_LEVEL_UNDEFINED)
+        thresh=log_destinations[dest_index].default_level;
+      else
+        thresh=r_log_level;
+    }
+
+    if(level<=thresh)
+      return(1);
+
+    return(0);
+  }
+
+int r_logging(int facility, int level)
+  {
+    int i;
+
+    _r_log_init(0);
+
+    /* return 1 if logging is on for any dest */
+
+    for(i=0; i<LOG_NUM_DESTINATIONS; i++){
+      if(r_logging_dest(i,facility,level))
+        return(1);
+    }
+
+    return(0);
+  }
+
+
+static int r_log_get_default_level(void)
+  {
+    char *log;
+    int _status;
+    
+    log=getenv("R_LOG_LEVEL");    
+
+    if(log){
+      r_log_level=atoi(log);
+      r_log_level_environment=atoi(log);
+    }
+    else{
+      r_log_level=LOGGING_DEFAULT_LEVEL;
+    }
+
+    _status=0;
+  //abort:
+    return(_status);
+  }
+
+
+static int r_log_get_destinations(int usereg)
+  {
+    char *log;
+    int i;
+    int r,_status;
+
+    log=getenv("R_LOG_DESTINATION");
+    if(log){
+      for(i=0; i<LOG_NUM_DESTINATIONS; i++)
+        log_destinations[i].enabled=!strcmp(log,log_destinations[i].dest_name);
+    }
+    else if(usereg){
+      NR_registry reg_key;
+      int i;
+      int value;
+      char c;
+
+      /* Get the data out of the registry */
+      for(i=0; i<LOG_NUM_DESTINATIONS; i++){
+        /* set callback for default level */
+        if(snprintf(reg_key,sizeof(reg_key),"%s.%s.level",LOGGING_REG_PREFIX,
+          log_destinations[i].dest_name)>=sizeof(reg_key))
+          ABORT(R_INTERNAL);
+
+        NR_reg_register_callback(reg_key,
+          NR_REG_CB_ACTION_ADD|NR_REG_CB_ACTION_CHANGE|NR_REG_CB_ACTION_DELETE,
+          r_log_default_level_change_cb,0);
+
+        if(r=r_log_get_reg_level(reg_key,&value)){
+          if(r==R_NOT_FOUND)
+            log_destinations[i].default_level=LOG_LEVEL_UNDEFINED;
+          else
+            ABORT(R_INTERNAL);
+        }
+        else
+          log_destinations[i].default_level=value;
+
+        /* set callback for the enabled key for this logging dest */
+        if(snprintf(reg_key,sizeof(reg_key),"%s.%s.enabled",LOGGING_REG_PREFIX,
+          log_destinations[i].dest_name)>=sizeof(reg_key))
+          ABORT(R_INTERNAL);
+
+        NR_reg_register_callback(reg_key,
+          NR_REG_CB_ACTION_ADD|NR_REG_CB_ACTION_CHANGE|NR_REG_CB_ACTION_DELETE,
+          r_log_destination_change_cb,0);
+
+        if(r=NR_reg_get_char(reg_key,&c)){
+          if(r==R_NOT_FOUND)
+            log_destinations[i].enabled=0;
+          else
+            ABORT(r);
+        }
+        else
+          log_destinations[i].enabled=c;
+      }
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+static void r_log_destination_change_cb(void *cb_arg, char action, NR_registry name)
+  {
+    r_log_get_destinations(1);
+  }
+
+static void r_log_default_level_change_cb(void *cb_arg, char action, NR_registry name)
+  {
+    r_log_get_destinations(1);
+  }
+
+
+int r_log_init()
+  {
+    _r_log_init(1);
+
+    return 0;
+  }
+
+int _r_log_init(int use_reg)
+  {
+#ifndef WIN32
+    char *log;
+#endif
+
+    if(!use_reg){
+      if(r_log_initted<R_LOG_INITTED1){
+        r_log_get_default_level();
+        r_log_get_destinations(0);
+
+        r_log_initted=R_LOG_INITTED1;
+      }
+    }
+    else{
+      if(r_log_initted<R_LOG_INITTED2){
+        int facility;
+        
+        r_log_get_default_level();
+        r_log_get_destinations(1);
+        
+        r_log_register("generic",&facility);
+        r_log_register("logging",&NR_LOG_LOGGING);
+
+        r_log_initted=R_LOG_INITTED2;
+      }
+    }
+
+#ifdef WIN32
+    r_log_env_verbose=1;
+#else
+    log=getenv("R_LOG_VERBOSE");
+    if(log)
+      r_log_env_verbose=atoi(log);
+#endif
+
+    return(0);
+  }
+
+int r_log_set_extra_destination(int default_level, r_dest_vlog *dest_vlog)
+  {
+    int i;
+    log_destination *dest = 0;
+
+    for(i=0; i<LOG_NUM_DESTINATIONS; i++){
+      if(!strcmp("extra",log_destinations[i].dest_name)){
+        dest=&log_destinations[i];
+        break;
+      }
+    }
+
+    if(!dest)
+      return(R_INTERNAL);
+
+    if (dest_vlog==0){
+      dest->enabled=0;
+      dest->dest_vlog=noop_vlog;
+    }
+    else{
+      dest->enabled=1;
+      dest->default_level=default_level;
+      dest->dest_vlog=dest_vlog;
+    }
+
+    return(0);
+  }
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/log/r_log.h
@@ -0,0 +1,70 @@
+/**
+   r_log.h
+
+   
+   Copyright (C) 2001, RTFM, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Mon Dec  3 15:14:45 2001
+ */
+
+
+#ifndef _r_log_h
+#define _r_log_h
+
+#ifndef WIN32
+#include <syslog.h>
+#endif
+#include <stdarg.h>
+#include <r_common.h>
+
+int r_log(int facility,int level,const char *fmt,...);
+int r_vlog(int facility,int level,const char *fmt,va_list ap);
+int r_dump(int facility,int level,char *name,char *data,int len);
+
+int r_log_e(int facility,int level,const char *fmt,...);
+int r_vlog_e(int facility,int level,const char *fmt,va_list ap);
+int r_log_nr(int facility,int level,int r,const char *fmt,...);
+int r_vlog_nr(int facility,int level,int r,const char *fmt,va_list ap);
+
+int r_log_register(char *tipename,int *facility);
+int r_log_facility(int facility,char **tipename);
+int r_logging(int facility, int level);
+int r_log_init(void);
+
+#define LOG_GENERIC 0
+#define LOG_COMMON 0
+
+typedef int r_dest_vlog(int facility,int level,const char *format,va_list ap);
+int r_log_set_extra_destination(int default_level, r_dest_vlog *dest_vlog);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/plugin/nr_plugin.h
@@ -0,0 +1,57 @@
+/**
+   nr_plugin.h
+
+   
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@networkresonance.com  Mon Jun 19 18:18:54 2006
+ */
+
+
+#ifndef _nr_plugin_h
+#define _nr_plugin_h
+
+typedef int (NR_plugin_hook)(void);
+
+typedef struct NR_plugin_hook_def_ {
+     char *type;
+     NR_plugin_hook *func;
+} NR_plugin_hook_def;
+
+typedef struct NR_plugin_def_ {
+     int api_version; // Should be 1
+     char *name;
+     char *version;
+     NR_plugin_hook_def *hooks;
+} NR_plugin_def;
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
@@ -0,0 +1,57 @@
+/**
+   platform.h
+
+   
+   Copyright (C) 2005, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@network-resonance.com  Tue Mar 15 14:28:12 PST 2005
+ */
+
+
+#ifndef _platform_h
+#define _platform_h
+
+#include <unistd.h>
+
+#define STDIO_BYTES_BUFFERED(fp) (fp->_r)
+
+#ifdef NR_SOCKET_IS_VOID_PTR
+typedef void* NR_SOCKET;
+#else
+typedef int NR_SOCKET;
+#define NR_SOCKET_READ(sock,buf,count)   read((sock),(buf),(count))
+#define NR_SOCKET_WRITE(sock,buf,count)  write((sock),(buf),(count))
+#define NR_SOCKET_CLOSE(sock)            close(sock)
+#endif
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
@@ -0,0 +1,563 @@
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ * $FreeBSD: src/sys/sys/queue.h,v 1.58 2004/04/07 04:19:49 imp Exp $
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+#ifndef DARWIN
+#include <stddef.h>
+#define __offsetof offsetof
+#endif
+
+#define STAILQ_FOREACH_SAFE(var, head, field, tvar)                     \
+         for ((var) = STAILQ_FIRST((head));                              \
+             (var) && ((tvar) = STAILQ_NEXT((var), field), 1);           \
+             (var) = (tvar))
+
+// #define __offsetof(type, field) ((size_t)(&((type *)0)->field))
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction.  Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A singly-linked tail queue is headed by a pair of pointers, one to the
+ * head of the list and the other to the tail of the list. The elements are
+ * singly linked for minimum space and pointer manipulation overhead at the
+ * expense of O(n) removal for arbitrary elements. New elements can be added
+ * to the list after an existing element, at the head of the list, or at the
+ * end of the list. Elements being removed from the head of the tail queue
+ * should use the explicit macro for this purpose for optimum efficiency.
+ * A singly-linked tail queue may only be traversed in the forward direction.
+ * Singly-linked tail queues are ideal for applications with large datasets
+ * and few or no removals or for implementing a FIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ *
+ *
+ *				SLIST	LIST	STAILQ	TAILQ
+ * _HEAD			+	+	+	+
+ * _HEAD_INITIALIZER		+	+	+	+
+ * _ENTRY			+	+	+	+
+ * _INIT			+	+	+	+
+ * _EMPTY			+	+	+	+
+ * _FIRST			+	+	+	+
+ * _NEXT			+	+	+	+
+ * _PREV			-	-	-	+
+ * _LAST			-	-	+	+
+ * _FOREACH			+	+	+	+
+ * _FOREACH_SAFE		+	+	+	+
+ * _FOREACH_REVERSE		-	-	-	+
+ * _FOREACH_REVERSE_SAFE	-	-	-	+
+ * _INSERT_HEAD			+	+	+	+
+ * _INSERT_BEFORE		-	+	-	+
+ * _INSERT_AFTER		+	+	+	+
+ * _INSERT_TAIL			-	-	+	+
+ * _CONCAT			-	-	+	+
+ * _REMOVE_HEAD			+	-	+	-
+ * _REMOVE			+	+	+	+
+ *
+ */
+#define	QUEUE_MACRO_DEBUG 0
+#if QUEUE_MACRO_DEBUG
+/* Store the last 2 places the queue element or head was altered */
+struct qm_trace {
+	char * lastfile;
+	int lastline;
+	char * prevfile;
+	int prevline;
+};
+
+#define	TRACEBUF	struct qm_trace trace;
+#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
+
+#define	QMD_TRACE_HEAD(head) do {					\
+	(head)->trace.prevline = (head)->trace.lastline;		\
+	(head)->trace.prevfile = (head)->trace.lastfile;		\
+	(head)->trace.lastline = __LINE__;				\
+	(head)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#define	QMD_TRACE_ELEM(elem) do {					\
+	(elem)->trace.prevline = (elem)->trace.lastline;		\
+	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
+	(elem)->trace.lastline = __LINE__;				\
+	(elem)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#else
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRASHIT(x)
+#endif	/* QUEUE_MACRO_DEBUG */
+
+/*
+ * Singly-linked List declarations.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+
+#define	SLIST_FIRST(head)	((head)->slh_first)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var);							\
+	    (var) = SLIST_NEXT((var), field))
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
+	for ((varp) = &SLIST_FIRST((head));				\
+	    ((var) = *(varp)) != NULL;					\
+	    (varp) = &SLIST_NEXT((var), field))
+
+#define	SLIST_INIT(head) do {						\
+	SLIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
+	SLIST_NEXT((slistelm), field) = (elm);				\
+} while (0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
+	SLIST_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if (SLIST_FIRST((head)) == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = SLIST_FIRST((head));		\
+		while (SLIST_NEXT(curelm, field) != (elm))		\
+			curelm = SLIST_NEXT(curelm, field);		\
+		SLIST_NEXT(curelm, field) =				\
+		    SLIST_NEXT(SLIST_NEXT(curelm, field), field);	\
+	}								\
+} while (0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
+} while (0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;/* first element */			\
+	struct type **stqh_last;/* addr of last next element */		\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (0)
+
+#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
+
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for((var) = STAILQ_FIRST((head));				\
+	   (var);							\
+	   (var) = STAILQ_NEXT((var), field))
+
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_INIT(head) do {						\
+	STAILQ_FIRST((head)) = NULL;					\
+	(head)->stqh_last = &STAILQ_FIRST((head));			\
+} while (0)
+
+#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_NEXT((tqelm), field) = (elm);				\
+} while (0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	STAILQ_NEXT((elm), field) = NULL;				\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
+} while (0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)					\
+		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if (STAILQ_FIRST((head)) == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = STAILQ_FIRST((head));		\
+		while (STAILQ_NEXT(curelm, field) != (elm))		\
+			curelm = STAILQ_NEXT(curelm, field);		\
+		if ((STAILQ_NEXT(curelm, field) =			\
+		     STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
+			(head)->stqh_last = &STAILQ_NEXT((curelm), field);\
+	}								\
+} while (0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if ((STAILQ_FIRST((head)) =					\
+	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
+		(head)->stqh_last = &STAILQ_FIRST((head));		\
+} while (0)
+
+#define	STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do {			\
+	if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL)	\
+		(head)->stqh_last = &STAILQ_FIRST((head));		\
+} while (0)
+
+/*
+ * List declarations.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List functions.
+ */
+
+#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
+
+#define	LIST_FIRST(head)	((head)->lh_first)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = LIST_FIRST((head));				\
+	    (var);							\
+	    (var) = LIST_NEXT((var), field))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	LIST_INIT(head) do {						\
+	LIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
+		LIST_NEXT((listelm), field)->field.le_prev =		\
+		    &LIST_NEXT((elm), field);				\
+	LIST_NEXT((listelm), field) = (elm);				\
+	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
+} while (0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	LIST_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
+} while (0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
+		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
+	LIST_FIRST((head)) = (elm);					\
+	(elm)->field.le_prev = &LIST_FIRST((head));			\
+} while (0)
+
+#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	if (LIST_NEXT((elm), field) != NULL)				\
+		LIST_NEXT((elm), field)->field.le_prev = 		\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
+} while (0)
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT((elm)->field.tqe_next);					\
+	TRASHIT((elm)->field.tqe_prev);					\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+
+#ifdef _KERNEL
+
+/*
+ * XXX insque() and remque() are an old way of handling certain queues.
+ * They bogusly assumes that all queue heads look alike.
+ */
+
+struct quehead {
+	struct quehead *qh_link;
+	struct quehead *qh_rlink;
+};
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+
+static __inline void
+insque(void *a, void *b)
+{
+	struct quehead *element = (struct quehead *)a,
+		 *head = (struct quehead *)b;
+
+	element->qh_link = head->qh_link;
+	element->qh_rlink = head;
+	head->qh_link = element;
+	element->qh_link->qh_rlink = element;
+}
+
+static __inline void
+remque(void *a)
+{
+	struct quehead *element = (struct quehead *)a;
+
+	element->qh_link->qh_rlink = element->qh_rlink;
+	element->qh_rlink->qh_link = element->qh_link;
+	element->qh_rlink = 0;
+}
+
+#else /* !(__GNUC__ || __INTEL_COMPILER) */
+
+void	insque(void *a, void *b);
+void	remque(void *a);
+
+#endif /* __GNUC__ || __INTEL_COMPILER */
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_QUEUE_H_ */
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h
@@ -0,0 +1,55 @@
+/**
+   platform.h
+
+   
+   Copyright (C) 2004, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Mon Dec 13 17:26:51 2004
+ */
+
+
+#ifndef _platform_h
+#define _platform_h
+
+#include <linux_funcs.h>
+
+#ifdef NR_SOCKET_IS_VOID_PTR
+typedef void* NR_SOCKET;
+#else
+typedef int NR_SOCKET;
+#define NR_SOCKET_READ(sock,buf,count)   read((sock),(buf),(count))
+#define NR_SOCKET_WRITE(sock,buf,count)  write((sock),(buf),(count))
+#define NR_SOCKET_CLOSE(sock)            close(sock)
+#endif
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/linux/include/linux_funcs.h
@@ -0,0 +1,65 @@
+/**
+   linux_funcs.h
+
+   
+   Copyright (C) 2004, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Mon Dec 13 16:28:22 2004
+ */
+
+
+#ifndef _linux_funcs_h
+#define _linux_funcs_h
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Hack version of addr2ascii (in util/util.c) */
+char *addr2ascii(int af, const void *addrp, int len,char *buf);
+
+#define ETHERTYPE_VLAN 0x8100
+
+#define STDIO_BYTES_BUFFERED(fp) (fp->_IO_read_end - fp->_IO_read_ptr)
+
+size_t strlcat(char *dst, const char *src, size_t siz);
+#ifndef strlcpy
+#define strlcpy(a,b,c) \
+	(strncpy((a),(b),(c)), \
+	 ((c)<= 0 ? 0 : ((a)[(c)-1]='\0')), \
+	 strlen((b)))
+#endif
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/linux/include/sys/ttycom.h
@@ -0,0 +1,38 @@
+/*
+ *    
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ */
+#ifndef __LINUX_TTYCOM_H
+#define __LINUX_TTYCOM_H
+
+#include <asm/ioctls.h>
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/linux/port-impl.mk
@@ -0,0 +1,31 @@
+#    
+#    Copyright (C) 2006, Network Resonance, Inc.
+#    All Rights Reserved
+#    
+#    Redistribution and use in source and binary forms, with or without
+#    modification, are permitted provided that the following conditions
+#    are met:
+#    
+#    1. Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#    2. Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#    3. Neither the name of Network Resonance, Inc. nor the name of any
+#       contributors to this software may be used to endorse or promote 
+#       products derived from this software without specific prior written
+#       permission.
+#    
+#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+#    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+#    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+#    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+#    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#    POSSIBILITY OF SUCH DAMAGE.
+#    
+#EXTATTR_IMPL=xattr
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h
@@ -0,0 +1,108 @@
+/**
+   platform.h
+
+   
+   Copyright (C) 2005, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@network-resonance.com  Tue Mar 15 14:28:12 PST 2005
+ */
+
+
+#ifndef _csi_platform_h
+#define _csi_platform_h
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400  // This prevents weird "'TryEnterCriticalSection': identifier not found"
+                             // compiler errors when poco/win32_mutex.h is included
+#endif
+
+#define UINT8 UBLAH_IGNORE_ME_PLEASE
+#define INT8 BLAH_IGNORE_ME_PLEASE
+#include <winsock2.h>
+#undef UINT8
+#undef INT8
+#include <r_types.h>
+
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+
+#define strcasestr stristr
+
+/* Hack version of addr2ascii (in util/util.c) */
+char *addr2ascii(int af, const void *addrp, int len,char *buf);
+
+/* Hack version of strlcpy (in util/util.c) */
+size_t strlcat(char *dst, const char *src, size_t siz);
+
+/* Hack version of getopt() (in util/getopt.c) */
+int getopt(int argc, char *argv[], char *opstring);
+extern char *optarg;
+extern int optind;
+extern int opterr;
+
+/* Hack version of gettimeofday() (in util/util.c) */
+int gettimeofday(struct timeval *tv, void *tz);
+
+#ifdef NR_SOCKET_IS_VOID_PTR
+typedef void* NR_SOCKET;
+#else
+typedef SOCKET NR_SOCKET;
+#define NR_SOCKET_READ(sock,buf,count)   recv((sock),(buf),(count),0)
+#define NR_SOCKET_WRITE(sock,buf,count)  send((sock),(buf),(count),0)
+#define NR_SOCKET_CLOSE(sock)            closesocket(sock)
+#endif
+
+#define EHOSTUNREACH    WSAEHOSTUNREACH
+
+#define LOG_EMERG       0
+#define LOG_ALERT       1
+#define LOG_CRIT        2
+#define LOG_ERR         3
+#define LOG_WARNING     4
+#define LOG_NOTICE      5
+#define LOG_INFO        6
+#define LOG_DEBUG       7
+
+// Until we refine the Windows port....
+
+#define IFNAMSIZ        256  /* big enough for FriendlyNames */
+#define in_addr_t   UINT4
+
+#ifndef strlcpy
+#define strlcpy(a,b,c) \
+        (strncpy((a),(b),(c)), \
+         ((c)<= 0 ? 0 : ((a)[(c)-1]='\0')), \
+         strlen((b)))
+#endif
+
+#endif  /* _csi_platform_h */
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/c2ru.c
@@ -0,0 +1,320 @@
+/*
+ *
+ *    c2ru.c
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/c2ru.c,v $
+ *    $Revision: 1.3 $
+ *    $Date: 2007/06/26 22:37:50 $
+ *
+ *    c2r utility methods
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#include <sys/queue.h>
+#include <string.h>
+#include <registry.h>
+#include "nr_common.h"
+#include <r_errors.h>
+#include <r_macros.h>
+#include <ctype.h>
+#include "c2ru.h"
+
+
+#define NRGET(func, type, get) \
+int                                                                  \
+func(NR_registry parent, char *child, type **out)                    \
+{                                                                    \
+  int r, _status;                                                    \
+  NR_registry registry;                                              \
+  type tmp;                                                          \
+                                                                     \
+  if ((r = nr_c2ru_make_registry(parent, child, registry)))          \
+    ABORT(r);                                                        \
+                                                                     \
+  if ((r = get(registry, &tmp))) {                                   \
+    if (r != R_NOT_FOUND)                                            \
+      ABORT(r);                                                      \
+    *out = 0;                                                        \
+  }                                                                  \
+  else {                                                             \
+    *out = RCALLOC(sizeof(tmp));                                     \
+    if (*out == 0)                                                   \
+      ABORT(R_NO_MEMORY);                                            \
+    **out = tmp;                                                     \
+  }                                                                  \
+                                                                     \
+  _status = 0;                                                       \
+abort:                                                               \
+  return (_status);                                                  \
+}
+
+int
+nr_c2ru_get_char(NR_registry parent, char *child, char **out)
+{
+  int r, _status;
+  NR_registry registry;
+  char tmp;
+
+  if ((r = nr_c2ru_make_registry(parent, child, registry)))
+    ABORT(r);
+
+  if ((r = NR_reg_get_char(registry, &tmp))) {
+    if (r != R_NOT_FOUND)
+      ABORT(r);
+    *out = 0;
+  }
+  else {
+    *out = RCALLOC(sizeof(tmp));
+    if (*out == 0)
+      ABORT(R_NO_MEMORY);
+    **out = tmp;
+  }
+
+  _status = 0;
+abort:
+  return (_status);
+}
+NRGET(nr_c2ru_get_uchar,    UCHAR,   NR_reg_get_uchar)
+NRGET(nr_c2ru_get_int2,     INT2,    NR_reg_get_int2)
+NRGET(nr_c2ru_get_uint2,    UINT2,   NR_reg_get_uint2)
+NRGET(nr_c2ru_get_int4,     INT4,    NR_reg_get_int4)
+NRGET(nr_c2ru_get_uint4,    UINT4,   NR_reg_get_uint4)
+NRGET(nr_c2ru_get_int8,     INT8,    NR_reg_get_int8)
+NRGET(nr_c2ru_get_uint8,    UINT8,   NR_reg_get_uint8)
+NRGET(nr_c2ru_get_double,   double,  NR_reg_get_double)
+NRGET(nr_c2ru_get_string,   char*,   NR_reg_alloc_string)
+NRGET(nr_c2ru_get_data,     Data,    NR_reg_alloc_data)
+
+
+#define NRSET(func, type, set) \
+int                                                                  \
+func(NR_registry parent, char *child, type *in)                      \
+{                                                                    \
+  int r, _status;                                                    \
+  NR_registry registry;                                              \
+                                                                     \
+  if (in == 0)                                                       \
+    return 0;                                                        \
+                                                                     \
+  if ((r = nr_c2ru_make_registry(parent, child, registry)))          \
+    ABORT(r);                                                        \
+                                                                     \
+  if ((r = set(registry, *in)))                                      \
+    ABORT(r);                                                        \
+                                                                     \
+  _status = 0;                                                       \
+abort:                                                               \
+  return (_status);                                                  \
+}
+
+NRSET(nr_c2ru_set_char,      char,       NR_reg_set_char)
+NRSET(nr_c2ru_set_uchar,     UCHAR,      NR_reg_set_uchar)
+NRSET(nr_c2ru_set_int2,      INT2,       NR_reg_set_int2)
+NRSET(nr_c2ru_set_uint2,     UINT2,      NR_reg_set_uint2)
+NRSET(nr_c2ru_set_int4,      INT4,       NR_reg_set_int4)
+NRSET(nr_c2ru_set_uint4,     UINT4,      NR_reg_set_uint4)
+NRSET(nr_c2ru_set_int8,      INT8,       NR_reg_set_int8)
+NRSET(nr_c2ru_set_uint8,     UINT8,      NR_reg_set_uint8)
+NRSET(nr_c2ru_set_double,    double,     NR_reg_set_double)
+NRSET(nr_c2ru_set_string,    char*,      NR_reg_set_string)
+
+int
+nr_c2ru_set_data(NR_registry parent, char *child, Data *in)
+{
+  int r, _status;
+  NR_registry registry;
+
+  if (in == 0)
+    return 0;
+
+  if ((r = nr_c2ru_make_registry(parent, child, registry)))
+    ABORT(r);
+
+  if ((r = NR_reg_set_bytes(registry, in->data, in->len)))
+    ABORT(r);
+
+  _status = 0;
+abort:
+  return (_status);
+}
+
+#define NRFREE(func, type) \
+int                                                                  \
+func(type *in)                                                       \
+{                                                                    \
+  if (in)                                                            \
+    RFREE(in);                                                       \
+  return 0;                                                          \
+}
+
+NRFREE(nr_c2ru_free_char,      char)
+NRFREE(nr_c2ru_free_uchar,     UCHAR)
+NRFREE(nr_c2ru_free_int2,      INT2)
+NRFREE(nr_c2ru_free_uint2,     UINT2)
+NRFREE(nr_c2ru_free_int4,      INT4)
+NRFREE(nr_c2ru_free_uint4,     UINT4)
+NRFREE(nr_c2ru_free_int8,      INT8)
+NRFREE(nr_c2ru_free_uint8,     UINT8)
+NRFREE(nr_c2ru_free_double,    double)
+
+
+int
+nr_c2ru_free_string(char **in)
+{
+  if (*in)
+    RFREE(*in);
+  if (in)
+    RFREE(in);
+  return 0;
+}
+
+int
+nr_c2ru_free_data(Data *in)
+{
+  int r, _status;
+
+  if (in) {
+    if ((r=r_data_destroy(&in)))
+      ABORT(r);
+  }
+
+  _status = 0;
+abort:
+  return (_status);
+}
+
+int
+nr_c2ru_get_children(NR_registry parent, char *child, void *ptr, size_t size, int (*get)(NR_registry, void*))
+{
+  int r, _status;
+  NR_registry registry;
+  unsigned int count;
+  int i;
+  NR_registry name;
+  struct entry { TAILQ_ENTRY(entry) entries; } *entry;
+  TAILQ_HEAD(, entry) *tailq = (void*)ptr;
+
+  TAILQ_INIT(tailq);
+
+  if ((r=nr_c2ru_make_registry(parent, child, registry)))
+    ABORT(r);
+
+  if ((r=NR_reg_get_child_count(registry, &count))) {
+    if (r != R_NOT_FOUND)
+      ABORT(r);
+  }
+  else {
+    for (i = 0; i < count; ++i) {
+      if ((r=NR_reg_get_child_registry(registry, i, name))) {
+        /* ignore R_NOT_FOUND errors */
+        if (r == R_NOT_FOUND)
+          continue;
+        else
+          ABORT(r);
+      }
+
+      if ((r=get(name, &entry))) {
+        /* ignore R_NOT_FOUND errors */
+        if (r == R_NOT_FOUND)
+          continue;
+        else
+          ABORT(r);
+      }
+
+      TAILQ_INSERT_TAIL(tailq, entry, entries);
+    }
+  }
+
+  _status = 0;
+abort:
+  return (_status);
+}
+
+int
+nr_c2ru_set_children(NR_registry parent, char *child, void *ptr, int (*set)(NR_registry, void*), int (*label)(NR_registry, void*, char[NR_REG_MAX_NR_REGISTRY_LEN])) 
+{
+  int r, _status;
+  NR_registry registry;
+  int i;
+  NR_registry name;
+  char buffer[NR_REG_MAX_NR_REGISTRY_LEN];
+  struct entry { TAILQ_ENTRY(entry) entries; } *entry;
+  TAILQ_HEAD(, entry) *tailq = (void*)ptr;
+
+  if ((r=nr_c2ru_make_registry(parent, child, registry)))
+    ABORT(r);
+
+  (void)NR_reg_del(registry);
+
+  i = 0;
+  TAILQ_FOREACH(entry, tailq, entries) {
+    if (label == 0 || (r=label(registry, entry, buffer))) {
+      snprintf(buffer, sizeof(buffer), "%d", i);
+    }
+    if ((r=nr_c2ru_make_registry(registry, buffer, name)))
+      ABORT(r);
+
+    if ((r=set(name, entry)))
+      ABORT(r);
+
+    ++i;
+  }
+
+  _status = 0;
+abort:
+  return (_status);
+}
+
+int
+nr_c2ru_free_children(void *ptr, int (*free)(void*))
+{
+  struct entry { TAILQ_ENTRY(entry) entries; } *entry;
+  TAILQ_HEAD(, entry) *tailq = (void*)ptr;
+
+  while (! TAILQ_EMPTY(tailq)) {
+    entry = TAILQ_FIRST(tailq);
+    TAILQ_REMOVE(tailq, entry, entries);
+    (void)free(entry);
+  }
+
+  return 0;
+}
+
+/* requires parent already in legal form */
+int
+nr_c2ru_make_registry(NR_registry parent, char *child, NR_registry out)
+{
+    return NR_reg_make_registry(parent, child, out);
+}
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/c2ru.h
@@ -0,0 +1,96 @@
+/*
+ *
+ *    c2ru.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/c2ru.h,v $
+ *    $Revision: 1.2 $
+ *    $Date: 2006/08/16 19:39:13 $
+ *
+ *    c2r utility methods
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __C2RU_H__
+#define __C2RU_H__
+
+#include <sys/types.h>
+#include <r_types.h>
+#include <r_data.h>
+#include "registry_int.h"
+
+int nr_c2ru_get_char(NR_registry parent, char *child, char **out);
+int nr_c2ru_get_uchar(NR_registry parent, char *child, UCHAR **out);
+int nr_c2ru_get_int2(NR_registry parent, char *child, INT2 **out);
+int nr_c2ru_get_uint2(NR_registry parent, char *child, UINT2 **out);
+int nr_c2ru_get_int4(NR_registry parent, char *child, INT4 **out);
+int nr_c2ru_get_uint4(NR_registry parent, char *child, UINT4 **out);
+int nr_c2ru_get_int8(NR_registry parent, char *child, INT8 **out);
+int nr_c2ru_get_uint8(NR_registry parent, char *child, UINT8 **out);
+int nr_c2ru_get_double(NR_registry parent, char *child, double **out);
+int nr_c2ru_get_data(NR_registry parent, char *child, Data **out);
+int nr_c2ru_get_string(NR_registry parent, char *child, char ***out);
+
+int nr_c2ru_set_char(NR_registry parent, char *child, char *data);
+int nr_c2ru_set_uchar(NR_registry parent, char *child, UCHAR *data);
+int nr_c2ru_set_int2(NR_registry parent, char *child, INT2 *data);
+int nr_c2ru_set_uint2(NR_registry parent, char *child, UINT2 *data);
+int nr_c2ru_set_int4(NR_registry parent, char *child, INT4 *data);
+int nr_c2ru_set_uint4(NR_registry parent, char *child, UINT4 *data);
+int nr_c2ru_set_int8(NR_registry parent, char *child, INT8 *data);
+int nr_c2ru_set_uint8(NR_registry parent, char *child, UINT8 *data);
+int nr_c2ru_set_double(NR_registry parent, char *child, double *data);
+int nr_c2ru_set_registry(NR_registry parent, char *child);
+int nr_c2ru_set_data(NR_registry parent, char *child, Data *data);
+int nr_c2ru_set_string(NR_registry parent, char *child, char **data);
+
+int nr_c2ru_free_char(char *data);
+int nr_c2ru_free_uchar(UCHAR *data);
+int nr_c2ru_free_int2(INT2 *data);
+int nr_c2ru_free_uint2(UINT2 *data);
+int nr_c2ru_free_int4(INT4 *data);
+int nr_c2ru_free_uint4(UINT4 *data);
+int nr_c2ru_free_int8(INT8 *data);
+int nr_c2ru_free_uint8(UINT8 *data);
+int nr_c2ru_free_double(double *data);
+int nr_c2ru_free_data(Data *data);
+int nr_c2ru_free_string(char **data);
+
+int nr_c2ru_get_children(NR_registry parent, char *child, void *ptr, size_t size, int (*get)(NR_registry, void*));
+int nr_c2ru_set_children(NR_registry parent, char *child, void *ptr, int (*set)(NR_registry, void*), int (*label)(NR_registry, void*, char[NR_REG_MAX_NR_REGISTRY_LEN]));
+int nr_c2ru_free_children(void *ptr, int (*free)(void*));
+
+int nr_c2ru_make_registry(NR_registry parent, char *child, NR_registry out);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registry.c
@@ -0,0 +1,604 @@
+/*
+ *
+ *    registry.c
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry.c,v $
+ *    $Revision: 1.6 $
+ *    $Date: 2007/11/21 00:09:12 $
+ *
+ *    Datastore for tracking configuration and related info.
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#include <assert.h>
+#include <string.h>
+#ifndef _MSC_VER
+#include <strings.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#endif
+#ifdef OPENSSL
+#include <openssl/ssl.h>
+#endif
+#include <ctype.h>
+#include "registry.h"
+#include "registry_int.h"
+#include "registry_vtbl.h"
+#include "r_assoc.h"
+#include "nr_common.h"
+#include "r_log.h"
+#include "r_errors.h"
+#include "r_macros.h"
+#include "c2ru.h"
+
+/* vtbl used to switch hit between local and remote invocations */
+static nr_registry_module *reg_vtbl = 0;
+
+/* must be in the order the types are numbered */
+static char *typenames[] = { "char", "UCHAR", "INT2", "UINT2", "INT4", "UINT4", "INT8", "UINT8", "double", "Data", "string", "registry" }; 
+
+int NR_LOG_REGISTRY=0;
+
+NR_registry NR_TOP_LEVEL_REGISTRY = "";
+
+int
+NR_reg_init(void *mode)
+{
+    int r, _status;
+    nr_registry_module *module = (nr_registry_module*)mode;
+#ifdef SANITY_CHECKS
+    NR_registry registry;
+#endif
+
+    if (reg_vtbl) {
+        if (reg_vtbl != module) {
+          r_log(LOG_GENERIC,LOG_ERR,"Can't reinitialize registry in different mode");
+          ABORT(R_INTERNAL);
+        }
+
+        return(0);
+    }
+
+    reg_vtbl = module;
+
+    if ((r=reg_vtbl->vtbl->init(mode)))
+        ABORT(r);
+
+#ifdef SANITY_CHECKS
+    if ((r=NR_reg_get_registry(NR_TOP_LEVEL_REGISTRY, registry)))
+        ABORT(r);
+    assert(strcmp(registry, NR_TOP_LEVEL_REGISTRY) == 0);
+#endif
+
+     r_log_init();
+     r_log_register("registry",&NR_LOG_REGISTRY);
+
+    _status=0;
+  abort:
+    r_log(NR_LOG_REGISTRY,
+          (_status ? LOG_ERR                        :  LOG_INFO),
+          (_status ? "Couldn't initialize registry" : "Initialized registry"));
+    return(_status);
+}
+
+int
+NR_reg_initted(void)
+{
+    return reg_vtbl!=0;
+}
+
+#define NRREGGET(func, method, type)                                \
+int                                                                 \
+func(NR_registry name, type *out)                                   \
+{                                                                   \
+    return reg_vtbl->vtbl->method(name, out);                             \
+}
+
+NRREGGET(NR_reg_get_char,     get_char,     char)
+NRREGGET(NR_reg_get_uchar,    get_uchar,    UCHAR)
+NRREGGET(NR_reg_get_int2,     get_int2,     INT2)
+NRREGGET(NR_reg_get_uint2,    get_uint2,    UINT2)
+NRREGGET(NR_reg_get_int4,     get_int4,     INT4)
+NRREGGET(NR_reg_get_uint4,    get_uint4,    UINT4)
+NRREGGET(NR_reg_get_int8,     get_int8,     INT8)
+NRREGGET(NR_reg_get_uint8,    get_uint8,    UINT8)
+NRREGGET(NR_reg_get_double,   get_double,   double)
+
+int
+NR_reg_get_registry(NR_registry name, NR_registry out)
+{
+    return reg_vtbl->vtbl->get_registry(name, out);
+}
+
+int
+NR_reg_get_bytes(NR_registry name, UCHAR *out, size_t size, size_t *length)
+{
+    return reg_vtbl->vtbl->get_bytes(name, out, size, length);
+}
+
+int
+NR_reg_get_string(NR_registry name, char *out, size_t size)
+{
+    return reg_vtbl->vtbl->get_string(name, out, size);
+}
+
+int
+NR_reg_get_length(NR_registry name, size_t *length)
+{
+    return reg_vtbl->vtbl->get_length(name, length);
+}
+
+int
+NR_reg_get_type(NR_registry name, NR_registry_type type)
+{
+    return reg_vtbl->vtbl->get_type(name, type);
+}
+
+#define NRREGSET(func, method, type)                            \
+int                                                             \
+func(NR_registry name, type data)                               \
+{                                                               \
+    return reg_vtbl->vtbl->method(name, data);                        \
+}
+
+NRREGSET(NR_reg_set_char,     set_char,     char)
+NRREGSET(NR_reg_set_uchar,    set_uchar,    UCHAR)
+NRREGSET(NR_reg_set_int2,     set_int2,     INT2)
+NRREGSET(NR_reg_set_uint2,    set_uint2,    UINT2)
+NRREGSET(NR_reg_set_int4,     set_int4,     INT4)
+NRREGSET(NR_reg_set_uint4,    set_uint4,    UINT4)
+NRREGSET(NR_reg_set_int8,     set_int8,     INT8)
+NRREGSET(NR_reg_set_uint8,    set_uint8,    UINT8)
+NRREGSET(NR_reg_set_double,   set_double,   double)
+NRREGSET(NR_reg_set_string,   set_string,   char*)
+
+int
+NR_reg_set_registry(NR_registry name)
+{
+    return reg_vtbl->vtbl->set_registry(name);
+}
+
+int
+NR_reg_set_bytes(NR_registry name, unsigned char *data, size_t length)
+{
+    return reg_vtbl->vtbl->set_bytes(name, data, length);
+}
+
+
+int
+NR_reg_del(NR_registry name)
+{
+    return reg_vtbl->vtbl->del(name);
+}
+
+int
+NR_reg_fin(NR_registry name)
+{
+    return reg_vtbl->vtbl->fin(name);
+}
+
+int
+NR_reg_get_child_count(char *parent, unsigned int *count)
+{
+    assert(sizeof(count) == sizeof(size_t));
+    return reg_vtbl->vtbl->get_child_count(parent, (size_t*)count);
+}
+
+int
+NR_reg_get_child_registry(char *parent, unsigned int i, NR_registry child)
+{
+    int r, _status;
+    size_t count;
+    NR_registry *children=0;
+
+    if ((r=reg_vtbl->vtbl->get_child_count(parent, &count)))
+      ABORT(r);
+
+    if (i >= count)
+        ABORT(R_NOT_FOUND);
+    else {
+        count++;
+        children = (NR_registry *)RCALLOC(count * sizeof(NR_registry));
+        if (!children)
+            ABORT(R_NO_MEMORY);
+
+        if ((r=reg_vtbl->vtbl->get_children(parent, children, count, &count)))
+            ABORT(r);
+
+        if (i >= count)
+            ABORT(R_NOT_FOUND);
+
+        strncpy(child, children[i], sizeof(NR_registry));
+    }
+
+    _status=0;
+  abort:
+    RFREE(children);
+    return(_status);
+}
+
+int
+NR_reg_get_children(NR_registry parent, NR_registry *children, size_t size, size_t *length)
+{
+    return reg_vtbl->vtbl->get_children(parent, children, size, length);
+}
+
+int
+NR_reg_dump()
+{
+    int r, _status;
+
+    if ((r=reg_vtbl->vtbl->dump(0)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+// convenience methods, call RFREE on the returned data
+int
+NR_reg_alloc_data(NR_registry name, Data *data)
+{
+    int r, _status;
+    size_t length;
+    UCHAR  *tmp = 0;
+    size_t sanity_check;
+
+    if ((r=NR_reg_get_length(name, &length)))
+      ABORT(r);
+
+    if (!(tmp = (void*)RMALLOC(length)))
+      ABORT(R_NO_MEMORY);
+
+    if ((r=NR_reg_get_bytes(name, tmp, length, &sanity_check)))
+      ABORT(r);
+
+    assert(length == sanity_check);
+
+    data->len = length;
+    data->data = tmp;
+
+    _status=0;
+  abort:
+    if (_status) {
+      if (tmp) RFREE(tmp);
+    }
+    return(_status);
+}
+
+int
+NR_reg_alloc_string(NR_registry name, char **data)
+{
+    int r, _status;
+    size_t length;
+    char  *tmp = 0;
+
+    if ((r=NR_reg_get_length(name, &length)))
+      ABORT(r);
+
+    if (!(tmp = (void*)RMALLOC(length+1)))
+      ABORT(R_NO_MEMORY);
+
+    if ((r=NR_reg_get_string(name, tmp, length+1)))
+      ABORT(r);
+
+    assert(length == strlen(tmp));
+
+    *data = tmp;
+
+    _status=0;
+  abort:
+    if (_status) {
+      if (tmp) RFREE(tmp);
+    }
+    return(_status);
+}
+
+
+char *
+nr_reg_type_name(int type)
+{
+    if ((type < NR_REG_TYPE_CHAR) || (type > NR_REG_TYPE_REGISTRY))
+       return(NULL);
+
+    return(typenames[type]);
+}
+
+int
+nr_reg_compute_type(char *typename, int *type)
+{
+    int _status;
+    int i;
+
+#ifdef SANITY_CHECKS
+    assert(!strcasecmp(typenames[NR_REG_TYPE_CHAR],     "char"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_UCHAR],    "UCHAR"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_INT2],     "INT2"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_UINT2],    "UINT2"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_INT4],     "INT4"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_UINT4],    "UINT4"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_INT8],     "INT8"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_UINT8],    "UINT8"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_DOUBLE],   "double"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_BYTES],    "Data"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_STRING],   "string"));
+    assert(!strcasecmp(typenames[NR_REG_TYPE_REGISTRY], "registry"));
+    assert(sizeof(typenames)/sizeof(*typenames) == (NR_REG_TYPE_REGISTRY+1));
+#endif
+
+    for (i = 0; i < sizeof(typenames)/sizeof(*typenames); ++i) {
+      if (!strcasecmp(typenames[i], typename)) {
+        *type = i;
+        return 0;
+      }
+    }
+    ABORT(R_BAD_ARGS);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+/* More convenience functions: the same as their parents but they
+   take a prefix and a suffix */
+#define NRGET2(func, type, get) \
+int                                                                  \
+func(NR_registry parent, char *child, type *out)                     \
+{                                                                    \
+  int r, _status;                                                    \
+  NR_registry registry;                                              \
+                                                                     \
+  if ((r = NR_reg_make_registry(parent, child, registry)))           \
+    ABORT(r);                                                        \
+                                                                     \
+  if ((r = get(registry, out))) {                                    \
+    ABORT(r);                                                        \
+  }                                                                  \
+                                                                     \
+  _status = 0;                                                       \
+abort:                                                               \
+  return (_status);                                                  \
+}
+
+NRGET2(NR_reg_get2_char,     char,    NR_reg_get_char)
+NRGET2(NR_reg_get2_uchar,    UCHAR,   NR_reg_get_uchar)
+NRGET2(NR_reg_get2_int2,     INT2,    NR_reg_get_int2)
+NRGET2(NR_reg_get2_uint2,    UINT2,   NR_reg_get_uint2)
+NRGET2(NR_reg_get2_int4,     INT4,    NR_reg_get_int4)
+NRGET2(NR_reg_get2_uint4,    UINT4,   NR_reg_get_uint4)
+NRGET2(NR_reg_get2_int8,     INT8,    NR_reg_get_int8)
+NRGET2(NR_reg_get2_uint8,    UINT8,   NR_reg_get_uint8)
+NRGET2(NR_reg_get2_double,   double,  NR_reg_get_double)
+NRGET2(NR_reg_alloc2_string,   char*,   NR_reg_alloc_string)
+NRGET2(NR_reg_alloc2_data,     Data,    NR_reg_alloc_data)
+
+int
+NR_reg_get2_bytes(NR_registry parent, char *child, UCHAR *out, size_t size, size_t *length)
+{
+    int r, _status;
+    NR_registry registry;
+  
+    if ((r=NR_reg_make_registry(parent, child, registry)))
+      ABORT(r);
+  
+    if ((r=NR_reg_get_bytes(registry, out, size, length)))
+      ABORT(r);
+  
+    _status = 0;
+abort:                                                               
+    return (_status);
+}
+ 
+int
+NR_reg_get2_string(NR_registry parent, char *child, char *out, size_t size)
+{
+    int r, _status;
+    NR_registry registry;
+  
+    if ((r=NR_reg_make_registry(parent, child, registry)))
+      ABORT(r);
+  
+    if ((r=NR_reg_get_string(registry, out, size)))
+      ABORT(r);
+  
+    _status = 0;
+abort:                                                               
+    return (_status);
+}
+ 
+/* More convenience functions: the same as their parents but they
+   take a prefix and a suffix */
+#define NRSET2(func, type, set) \
+int                                                                  \
+func(NR_registry parent, char *child, type in)                       \
+{                                                                    \
+  int r, _status;                                                    \
+  NR_registry registry;                                              \
+                                                                     \
+  if ((r = NR_reg_make_registry(parent, child, registry)))           \
+    ABORT(r);                                                        \
+                                                                     \
+  if ((r = set(registry, in))) {                                     \
+    ABORT(r);                                                        \
+  }                                                                  \
+                                                                     \
+  _status = 0;                                                       \
+abort:                                                               \
+  return (_status);                                                  \
+}
+
+NRSET2(NR_reg_set2_char,     char,    NR_reg_set_char)
+NRSET2(NR_reg_set2_uchar,    UCHAR,   NR_reg_set_uchar)
+NRSET2(NR_reg_set2_int2,     INT2,    NR_reg_set_int2)
+NRSET2(NR_reg_set2_uint2,    UINT2,   NR_reg_set_uint2)
+NRSET2(NR_reg_set2_int4,     INT4,    NR_reg_set_int4)
+NRSET2(NR_reg_set2_uint4,    UINT4,   NR_reg_set_uint4)
+NRSET2(NR_reg_set2_int8,     INT8,    NR_reg_set_int8)
+NRSET2(NR_reg_set2_uint8,    UINT8,   NR_reg_set_uint8)
+NRSET2(NR_reg_set2_double,   double,  NR_reg_set_double)
+NRSET2(NR_reg_set2_string,   char*,   NR_reg_set_string)
+
+int
+NR_reg_set2_bytes(NR_registry prefix, char *name, UCHAR *data, size_t length)
+{
+    int r, _status;
+    NR_registry registry;
+
+    if ((r = NR_reg_make_registry(prefix, name, registry)))
+      ABORT(r);
+
+    if ((r = NR_reg_set_bytes(registry, data, length)))
+      ABORT(r);
+
+    _status = 0;
+abort:
+    return (_status);
+}
+
+
+int
+NR_reg_make_child_registry(NR_registry parent, NR_registry descendant, unsigned int generation, NR_registry child)
+{
+    int _status;
+    size_t length;
+
+    length = strlen(parent);
+
+    if (strncasecmp(parent, descendant, length))
+        ABORT(R_BAD_ARGS);
+
+    while (descendant[length] != '\0') {
+        if (descendant[length] == '.') {
+            if (generation == 0)
+                break;
+
+            --generation;
+        }
+
+        ++length;
+        if (length >= sizeof(NR_registry))
+            ABORT(R_BAD_ARGS);
+    }
+
+    strncpy(child, descendant, length);
+    child[length] = '\0';
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+NR_reg_get2_child_count(NR_registry base, NR_registry name, unsigned int *count)
+  {
+    int r, _status;                                                    
+    NR_registry registry;                                              
+    
+    if ((r=nr_c2ru_make_registry(base, name, registry)))
+      ABORT(r);
+    
+    if (r=NR_reg_get_child_count(registry,count))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int
+NR_reg_get2_child_registry(NR_registry base, NR_registry name, unsigned int i, NR_registry child)
+  {
+    int r, _status;
+    NR_registry registry;
+
+    if ((r=nr_c2ru_make_registry(base, name, registry)))
+      ABORT(r);
+    
+    if (r=NR_reg_get_child_registry(registry, i, child))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+
+/* requires parent already in legal form */
+int
+NR_reg_make_registry(NR_registry parent, char *child, NR_registry out)
+{
+    int r, _status;
+    int plen;
+    int clen;
+    char *c;
+    int i;
+
+    if ((r=nr_reg_is_valid(parent)))
+        ABORT(r);
+
+    if (*child == '.')
+        ABORT(R_BAD_ARGS);
+
+    plen = strlen(parent);
+    clen = strlen(child);
+    if ((plen + clen + 2) > sizeof(NR_registry))
+        ABORT(R_BAD_ARGS);
+
+    if (out != parent)
+        strcpy(out, parent);
+ 
+    c = &(out[plen]);
+
+    if (parent[0] != '\0') {
+        *c = '.';
+        ++c;
+    }
+
+    for (i = 0; i < clen; ++i, ++c) {
+        *c = child[i];
+        if (isspace(*c) || *c == '.' || *c == '/' || ! isprint(*c))
+            *c = '_';
+    }
+    if (i == 0 || child[i-1] == '.')
+        ABORT(R_BAD_ARGS);
+ 
+    *c = '\0';
+
+    _status = 0;
+abort:
+    return _status;
+}
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registry.h
@@ -0,0 +1,154 @@
+/*
+ *
+ *    registry.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry.h,v $
+ *    $Revision: 1.3 $
+ *    $Date: 2007/07/17 17:58:16 $
+ *
+ *    Datastore for tracking configuration and related info.
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __REGISTRY_H__
+#define __REGISTRY_H__
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <r_types.h>
+#include <r_data.h>
+
+#define NR_REG_MAX_NR_REGISTRY_LEN     128
+#define NR_REG_MAX_TYPE_LEN            32
+
+typedef char NR_registry[NR_REG_MAX_NR_REGISTRY_LEN];
+typedef char NR_registry_type[NR_REG_MAX_TYPE_LEN];
+
+extern NR_registry NR_TOP_LEVEL_REGISTRY;
+
+extern void *NR_REG_MODE_LOCAL;
+extern void *NR_REG_MODE_REMOTE;
+
+int NR_reg_init(void *mode);  
+
+int NR_reg_initted(void);
+
+int NR_reg_get_char(NR_registry name, char *out);
+int NR_reg_get_uchar(NR_registry name, UCHAR *out);
+int NR_reg_get_int2(NR_registry name, INT2 *out);
+int NR_reg_get_uint2(NR_registry name, UINT2 *out);
+int NR_reg_get_int4(NR_registry name, INT4 *out);
+int NR_reg_get_uint4(NR_registry name, UINT4 *out);
+int NR_reg_get_int8(NR_registry name, INT8 *out);
+int NR_reg_get_uint8(NR_registry name, UINT8 *out);
+int NR_reg_get_double(NR_registry name, double *out);
+int NR_reg_get_registry(NR_registry name, NR_registry out);
+
+int NR_reg_get_bytes(NR_registry name, UCHAR *out, size_t size, size_t *length);
+int NR_reg_get_string(NR_registry name, char *out, size_t size);
+int NR_reg_get_length(NR_registry name, size_t *length);
+int NR_reg_get_type(NR_registry name, NR_registry_type type);
+
+
+int NR_reg_get2_char(NR_registry prefix, char *name, char *);
+int NR_reg_get2_uchar(NR_registry prefix, char *name, UCHAR *);
+int NR_reg_get2_int2(NR_registry prefix, char *name, INT2 *);
+int NR_reg_get2_uint2(NR_registry prefix, char *name, UINT2 *);
+int NR_reg_get2_int4(NR_registry prefix, char *name, INT4 *);
+int NR_reg_get2_uint4(NR_registry prefix, char *name, UINT4 *);
+int NR_reg_get2_int8(NR_registry prefix, char *name,  INT8 *);
+int NR_reg_get2_uint8(NR_registry prefix, char *name, UINT8 *);
+int NR_reg_get2_double(NR_registry prefix, char *name, double *);
+int NR_reg_get2_bytes(NR_registry prefix, char *name, UCHAR *out, size_t size, size_t *length);
+int NR_reg_get2_string(NR_registry prefix, char *name, char *out, size_t size);
+
+int NR_reg_alloc2_string(NR_registry prefix, char *name, char **);
+int NR_reg_alloc2_data(NR_registry prefix, char *name, Data *);
+
+int NR_reg_set_char(NR_registry name, char data);
+int NR_reg_set_uchar(NR_registry name, UCHAR data);
+int NR_reg_set_int2(NR_registry name, INT2 data);
+int NR_reg_set_uint2(NR_registry name, UINT2 data);
+int NR_reg_set_int4(NR_registry name, INT4 data);
+int NR_reg_set_uint4(NR_registry name, UINT4 data);
+int NR_reg_set_int8(NR_registry name, INT8 data);
+int NR_reg_set_uint8(NR_registry name, UINT8 data);
+int NR_reg_set_double(NR_registry name, double data);
+
+int NR_reg_set_registry(NR_registry name);
+
+int NR_reg_set_bytes(NR_registry name, UCHAR *data, size_t length);
+int NR_reg_set_string(NR_registry name, char *data);
+
+int NR_reg_set2_char(NR_registry prefix, char *name, char data);
+int NR_reg_set2_uchar(NR_registry prefix, char *name, UCHAR data);
+int NR_reg_set2_int2(NR_registry prefix, char *name, INT2 data);
+int NR_reg_set2_uint2(NR_registry prefix, char *name, UINT2 data);
+int NR_reg_set2_int4(NR_registry prefix, char *name, INT4 data);
+int NR_reg_set2_uint4(NR_registry prefix, char *name, UINT4 data);
+int NR_reg_set2_int8(NR_registry prefix, char *name, INT8 data);
+int NR_reg_set2_uint8(NR_registry prefix, char *name, UINT8 data);
+int NR_reg_set2_double(NR_registry prefix, char *name, double data);
+
+int NR_reg_set2_bytes(NR_registry prefix, char *name, UCHAR *data, size_t length);
+int NR_reg_set2_string(NR_registry prefix, char *name, char *data);
+
+int NR_reg_del(NR_registry name);
+
+int NR_reg_fin(NR_registry name);
+
+int NR_reg_get_child_count(NR_registry parent, unsigned int *count);
+int NR_reg_get_child_registry(NR_registry parent, unsigned int i, NR_registry child);
+int NR_reg_get2_child_count(NR_registry base, NR_registry name, unsigned int *count);
+int NR_reg_get2_child_registry(NR_registry base, NR_registry name, unsigned int i, NR_registry child);
+int NR_reg_get_children(NR_registry parent, NR_registry children[], size_t size, size_t *length);
+
+int NR_reg_dump(void);
+
+/* convenience methods, call RFREE on the returned data */
+int NR_reg_alloc_data(NR_registry name, Data *data);
+int NR_reg_alloc_string(NR_registry name, char **data);
+
+#define NR_REG_CB_ACTION_ADD      (1<<0)
+#define NR_REG_CB_ACTION_CHANGE   (1<<1)
+#define NR_REG_CB_ACTION_DELETE   (1<<2)
+#define NR_REG_CB_ACTION_FINAL    (1<<6)
+int NR_reg_register_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name), void *cb_arg);
+int NR_reg_unregister_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name));
+
+int NR_reg_make_registry(NR_registry parent, char *child, NR_registry out);
+int NR_reg_make_child_registry(NR_registry parent, NR_registry descendant, unsigned int generation, NR_registry child);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registry_int.h
@@ -0,0 +1,97 @@
+#if 0
+#define NR_LOG_REGISTRY BLAHBLAH()
+#define LOG_REGISTRY BLAHBLAH()
+static int BLAHBLAH() {
+int blahblah;
+r_log_register("registry",&blahblah);
+return blahblah;
+}
+#endif
+
+/*
+ *
+ *    registry_int.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry_int.h,v $
+ *    $Revision: 1.3 $
+ *    $Date: 2007/06/26 22:37:51 $
+ *
+ *    Callback-related functions
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __REGISTRY_INT_H__
+#define __REGISTRY_INT_H__
+
+#include <sys/types.h>
+#include <r_types.h>
+#ifndef NO_REG_RPC
+#include <rpc/rpc.h>
+#endif
+
+extern int NR_LOG_REGISTRY;
+
+int nr_reg_is_valid(NR_registry name);
+
+#define NR_REG_TYPE_CHAR               0
+#define NR_REG_TYPE_UCHAR              1
+#define NR_REG_TYPE_INT2               2
+#define NR_REG_TYPE_UINT2              3
+#define NR_REG_TYPE_INT4               4
+#define NR_REG_TYPE_UINT4              5
+#define NR_REG_TYPE_INT8               6
+#define NR_REG_TYPE_UINT8              7
+#define NR_REG_TYPE_DOUBLE             8
+#define NR_REG_TYPE_BYTES              9
+#define NR_REG_TYPE_STRING             10
+#define NR_REG_TYPE_REGISTRY           11
+char *nr_reg_type_name(int type);
+int nr_reg_compute_type(char *type_name, int *type);
+
+char *nr_reg_action_name(int action);
+
+int nr_reg_cb_init(void);
+int nr_reg_client_cb_init(void);
+int nr_reg_register_for_callbacks(int fd, int connect_to_port);
+int nr_reg_raise_event(NR_registry name, int action);
+#ifndef NO_REG_RPC
+int nr_reg_get_client(CLIENT **client);
+#endif
+
+#define CALLBACK_SERVER_ADDR     "127.0.0.1"
+#define CALLBACK_SERVER_PORT     8082 
+#define CALLBACK_SERVER_BACKLOG  32
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registry_local.c
@@ -0,0 +1,1168 @@
+/*
+ *
+ *    registry.c
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry_local.c,v $
+ *    $Revision: 1.4 $
+ *    $Date: 2007/11/21 00:09:13 $
+ *
+ *    Datastore for tracking configuration and related info.
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#include <assert.h>
+#include <string.h>
+#ifndef WIN32
+#include <strings.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#endif
+#ifdef OPENSSL
+#include <openssl/ssl.h>
+#endif
+#include <ctype.h>
+#include "registry.h"
+#include "registry_int.h"
+#include "registry_vtbl.h"
+#include "r_assoc.h"
+#include "nr_common.h"
+#include "r_log.h"
+#include "r_errors.h"
+#include "r_macros.h"
+
+/* if C were an object-oriented language, nr_scalar_registry_node and
+ * nr_array_registry_node would subclass nr_registry_node, but it isn't
+ * object-oriented language, so this is used in cases where the pointer
+ * could be of either type */
+typedef struct nr_registry_node_ {
+    unsigned char  type;
+} nr_registry_node;
+
+typedef struct nr_scalar_registry_node_ {
+    unsigned char  type;
+    union {
+        char          _char;
+        UCHAR         _uchar;
+        INT2       _nr_int2;
+        UINT2      _nr_uint2;
+        INT4       _nr_int4;
+        UINT4      _nr_uint4;
+        INT8       _nr_int8;
+        UINT8      _nr_uint8;
+        double        _double;
+    } scalar;
+} nr_scalar_registry_node;
+
+/* string, bytes */
+typedef struct nr_array_registry_node_ {
+    unsigned char    type;
+    struct {
+        unsigned int     length;
+        unsigned char    data[1];
+    } array;
+} nr_array_registry_node;
+
+static int nr_reg_local_init(nr_registry_module *me);
+static int nr_reg_local_get_char(NR_registry name, char *data);
+static int nr_reg_local_get_uchar(NR_registry name, UCHAR *data);
+static int nr_reg_local_get_int2(NR_registry name, INT2 *data);
+static int nr_reg_local_get_uint2(NR_registry name, UINT2 *data);
+static int nr_reg_local_get_int4(NR_registry name, INT4 *data);
+static int nr_reg_local_get_uint4(NR_registry name, UINT4 *data);
+static int nr_reg_local_get_int8(NR_registry name, INT8 *data);
+static int nr_reg_local_get_uint8(NR_registry name, UINT8 *data);
+static int nr_reg_local_get_double(NR_registry name, double *data);
+static int nr_reg_local_get_registry(NR_registry name, NR_registry data);
+static int nr_reg_local_get_bytes(NR_registry name, UCHAR *data, size_t size, size_t *length);
+static int nr_reg_local_get_string(NR_registry name, char *data, size_t size);
+static int nr_reg_local_get_length(NR_registry name, size_t *len);
+static int nr_reg_local_get_type(NR_registry name, NR_registry_type type);
+static int nr_reg_local_set_char(NR_registry name, char data);
+static int nr_reg_local_set_uchar(NR_registry name, UCHAR data);
+static int nr_reg_local_set_int2(NR_registry name, INT2 data);
+static int nr_reg_local_set_uint2(NR_registry name, UINT2 data);
+static int nr_reg_local_set_int4(NR_registry name, INT4 data);
+static int nr_reg_local_set_uint4(NR_registry name, UINT4 data);
+static int nr_reg_local_set_int8(NR_registry name, INT8 data);
+static int nr_reg_local_set_uint8(NR_registry name, UINT8 data);
+static int nr_reg_local_set_double(NR_registry name, double data);
+static int nr_reg_local_set_registry(NR_registry name);
+static int nr_reg_local_set_bytes(NR_registry name, UCHAR *data, size_t length);
+static int nr_reg_local_set_string(NR_registry name, char *data);
+static int nr_reg_local_del(NR_registry name);
+static int nr_reg_local_get_child_count(NR_registry parent, size_t *count);
+static int nr_reg_local_get_children(NR_registry parent, NR_registry *data, size_t size, size_t *length);
+static int nr_reg_local_fin(NR_registry name);
+static int nr_reg_local_dump(int sorted);
+static int nr_reg_insert_node(char *name, void *node);
+static int nr_reg_change_node(char *name, void *node, void *old);
+static int nr_reg_get(char *name, int type, void *out);
+static int nr_reg_get_data(NR_registry name, nr_scalar_registry_node *node, void *out);
+static int nr_reg_get_array(char *name, unsigned char type, UCHAR *out, size_t size, size_t *length);
+static int nr_reg_set(char *name, int type, void *data);
+static int nr_reg_set_array(char *name, unsigned char type, UCHAR *data, size_t length);
+static int nr_reg_set_parent_registries(char *name);
+
+/* make these static OLD_REGISTRY */
+#if 0
+static int nr_reg_fetch_node(char *name, unsigned char type, nr_registry_node **node, int *free_node);
+static char *nr_reg_alloc_node_data(char *name, nr_registry_node *node, int *freeit);
+#else
+int nr_reg_fetch_node(char *name, unsigned char type, nr_registry_node **node, int *free_node);
+char *nr_reg_alloc_node_data(char *name, nr_registry_node *node, int *freeit);
+#endif
+static int nr_reg_rfree(void *ptr);
+#if 0  /* Unused currently */
+static int nr_reg_noop(void *ptr);
+#endif
+static int nr_reg_compute_length(char *name, nr_registry_node *node, size_t *length);
+char *nr_reg_action_name(int action);
+
+/* the registry, containing mappings like "foo.bar.baz" to registry
+ * nodes, which are either of type nr_scalar_registry_node or
+ * nr_array_registry_node */
+static r_assoc     *nr_registry = 0;
+
+#if 0  /* Unused currently */
+static nr_array_registry_node nr_top_level_node;
+#endif
+
+typedef struct nr_reg_find_children_arg_ {
+    size_t         size;
+    NR_registry   *children;
+    size_t         length;
+} nr_reg_find_children_arg;
+
+static int nr_reg_local_iter(char *prefix, int (*action)(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node), void *ptr);
+static int nr_reg_local_iter_delete(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node);
+static int nr_reg_local_find_children(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node);
+static int nr_reg_local_count_children(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node);
+static int nr_reg_local_dump_print(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node);
+
+
+
+int
+nr_reg_local_iter(NR_registry prefix, int (*action)(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node), void *ptr)
+{
+    int r, _status;
+    r_assoc_iterator iter;
+    char *name;
+    int namel;
+    nr_registry_node *node;
+    int prefixl;
+
+    if (prefix == 0)
+        ABORT(R_INTERNAL);
+
+    if ((r=r_assoc_init_iter(nr_registry, &iter)))
+        ABORT(r);
+
+    prefixl = strlen(prefix);
+
+    for (;;) {
+      if ((r=r_assoc_iter(&iter, (void*)&name, &namel, (void*)&node))) {
+        if (r == R_EOD)
+          break;
+        else
+          ABORT(r);
+      }
+
+      /* subtract to remove the '\0' character from the string length */
+      --namel;
+
+      /* sanity check that the name is null-terminated */
+      assert(namel >= 0);
+      assert(name[namel] == '\0');
+
+      if (namel < 0 || name[namel] != '\0' || node == 0)
+          break;
+
+      /* 3 cases where action will be called:
+       *   1) prefix == ""
+       *   2) prefix == name
+       *   3) name == prefix + '.'
+       */
+      if (prefixl == 0
+       || ((namel == prefixl || (namel > prefixl && name[prefixl] == '.'))
+         && !strncmp(prefix, name, prefixl))) {
+        if ((r=action(ptr, &iter, prefix, name, node)))
+          ABORT(r);
+      }
+    }
+
+    _status=0;
+  abort:
+
+    return(_status);
+}
+
+int
+nr_reg_local_iter_delete(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node)
+{
+    int r, _status;
+
+    if ((r=r_assoc_iter_delete(iter)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_local_find_children(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node)
+{
+  int _status;
+  int prefixl = strlen(prefix);
+  char *dot;
+  nr_reg_find_children_arg *arg = (void*)ptr;
+
+  assert(sizeof(*(arg->children)) == sizeof(NR_registry));
+
+  /* only grovel through immediate children */
+  if (prefixl == 0 || name[prefixl] == '.') {
+    if (name[prefixl] != '\0') {
+      dot = strchr(&name[prefixl+1], '.');
+      if (dot == 0) {
+        strncpy(arg->children[arg->length], name, sizeof(NR_registry)-1);
+        ++arg->length;
+
+        /* only grab as many as there are room for */
+        if (arg->length >= arg->size)
+          ABORT(R_INTERRUPTED);
+      }
+    }
+  }
+
+  _status = 0;
+ abort: 
+  return _status;
+}
+
+int
+nr_reg_local_count_children(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node)
+{
+  int prefixl = strlen(prefix);
+  char *dot;
+
+  /* only count children */
+  if (name[prefixl] == '.') {
+    dot = strchr(&name[prefixl+1], '.');
+    if (dot == 0)
+      ++(*(unsigned int *)ptr);
+  }
+  else if (name[0] != '\0') {
+    if (prefixl == 0)
+      ++(*(unsigned int *)ptr);
+  }
+
+  return 0;
+}
+
+int
+nr_reg_local_dump_print(void *ptr, r_assoc_iterator *iter, char *prefix, char *name, nr_registry_node *node)
+{
+    int _status;
+    int freeit = 0;
+    char *data;
+
+    /* only print leaf nodes */
+    if (node->type != NR_REG_TYPE_REGISTRY) {
+      data = nr_reg_alloc_node_data(name, node, &freeit);
+      if (ptr)
+        fprintf((FILE*)ptr, "%s: %s\n", name, data);
+      else
+        r_log(NR_LOG_REGISTRY, LOG_INFO, "%s: %s", name, data);
+      if (freeit)
+        RFREE(data);
+    }
+
+    _status=0;
+  //abort:
+    return(_status);
+}
+
+
+#if 0  /* Unused currently */
+int
+nr_reg_noop(void *ptr)
+{
+    return 0;
+}
+#endif
+
+int
+nr_reg_rfree(void *ptr)
+{
+    RFREE(ptr);
+    return 0;
+}
+
+int
+nr_reg_fetch_node(char *name, unsigned char type, nr_registry_node **node, int *free_node)
+{
+    int r, _status;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    *node = 0;
+    *free_node = 0;
+
+    if ((r=r_assoc_fetch(nr_registry, name, strlen(name)+1, (void*)node)))
+      ABORT(r);
+
+    if ((*node)->type != type)
+      ABORT(R_FAILED);
+
+    _status=0;
+  abort:
+    if (_status) {
+        if (*node)
+            r_log(NR_LOG_REGISTRY, LOG_DEBUG, "Couldn't fetch node '%s' ('%s'), found '%s' instead", 
+              name, nr_reg_type_name(type), nr_reg_type_name((*node)->type));
+        else 
+            r_log(NR_LOG_REGISTRY, LOG_DEBUG, "Couldn't fetch node '%s' ('%s')", 
+              name, nr_reg_type_name(type));
+    }
+    else {
+        r_log(NR_LOG_REGISTRY, LOG_DEBUG, "Fetched node '%s' ('%s')", 
+              name, nr_reg_type_name(type));
+    }
+    return(_status);
+}
+
+int
+nr_reg_insert_node(char *name, void *node)
+{
+    int r, _status;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    /* since the registry application is not multi-threaded, a node being
+     * inserted should always be a new node because the registry app must
+     * have looked for a node with this key but not found it, so it is
+     * being created/inserted now using R_ASSOC_NEW */
+    if ((r=r_assoc_insert(nr_registry, name, strlen(name)+1, node, 0, nr_reg_rfree, R_ASSOC_NEW)))
+      ABORT(r);
+
+    if ((r=nr_reg_set_parent_registries(name)))
+      ABORT(r);
+
+    if ((r=nr_reg_raise_event(name, NR_REG_CB_ACTION_ADD)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    if (r_logging(NR_LOG_REGISTRY, LOG_INFO)) {
+      int freeit;
+      char *data = nr_reg_alloc_node_data(name, (void*)node, &freeit);
+      r_log(NR_LOG_REGISTRY, LOG_INFO,
+             "insert '%s' (%s) %s: %s", name,
+             nr_reg_type_name(((nr_registry_node*)node)->type),
+             (_status ? "FAILED" : "succeeded"), data);
+      if (freeit)
+        RFREE(data);
+    }
+    return(_status);
+}
+
+int
+nr_reg_change_node(char *name, void *node, void *old)
+{
+    int r, _status;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    if (old != node) {
+        if ((r=r_assoc_insert(nr_registry, name, strlen(name)+1, node, 0, nr_reg_rfree, R_ASSOC_REPLACE)))
+          ABORT(r);
+    }
+
+    if ((r=nr_reg_raise_event(name, NR_REG_CB_ACTION_CHANGE)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    if (r_logging(NR_LOG_REGISTRY, LOG_INFO)) {
+      int freeit;
+      char *data = nr_reg_alloc_node_data(name, (void*)node, &freeit);
+      r_log(NR_LOG_REGISTRY, LOG_INFO,
+             "change '%s' (%s) %s: %s", name,
+             nr_reg_type_name(((nr_registry_node*)node)->type),
+             (_status ? "FAILED" : "succeeded"), data);
+      if (freeit)
+        RFREE(data);
+    }
+    return(_status);
+}
+
+char *
+nr_reg_alloc_node_data(char *name, nr_registry_node *node, int *freeit)
+{
+    char *s = 0;
+    int len;
+    int alloc = 0;
+    unsigned int i;
+
+    *freeit = 0;
+
+    switch (node->type) {
+    default:
+      alloc = 100;    /* plenty of room for any of the scalar types */
+      break;
+    case NR_REG_TYPE_REGISTRY:
+      alloc = strlen(name) + 1;
+      break;
+    case NR_REG_TYPE_BYTES:
+      alloc = (2 * ((nr_array_registry_node*)node)->array.length) + 1;
+      break;
+    case NR_REG_TYPE_STRING:
+      alloc = 0;
+      break;
+    }
+
+    if (alloc > 0) {
+      s = (void*)RMALLOC(alloc);
+      if (!s)
+        return "";
+
+      *freeit = 1;
+    }
+
+    len = alloc;
+
+    switch (node->type) {
+    case NR_REG_TYPE_CHAR:
+      i = ((nr_scalar_registry_node*)node)->scalar._char;
+      if (isprint(i) && ! isspace(i))
+          snprintf(s, len, "%c", (char)i);
+      else
+          snprintf(s, len, "\\%03o", (char)i);
+      break;
+    case NR_REG_TYPE_UCHAR:
+      snprintf(s, len, "0x%02x", ((nr_scalar_registry_node*)node)->scalar._uchar);
+      break;
+    case NR_REG_TYPE_INT2:
+      snprintf(s, len, "%d", ((nr_scalar_registry_node*)node)->scalar._nr_int2);
+      break;
+    case NR_REG_TYPE_UINT2:
+      snprintf(s, len, "%u", ((nr_scalar_registry_node*)node)->scalar._nr_uint2);
+      break;
+    case NR_REG_TYPE_INT4:
+      snprintf(s, len, "%d", ((nr_scalar_registry_node*)node)->scalar._nr_int4);
+      break;
+    case NR_REG_TYPE_UINT4:
+      snprintf(s, len, "%u", ((nr_scalar_registry_node*)node)->scalar._nr_uint4);
+      break;
+    case NR_REG_TYPE_INT8:
+      snprintf(s, len, "%lld", ((nr_scalar_registry_node*)node)->scalar._nr_int8);
+      break;
+    case NR_REG_TYPE_UINT8:
+      snprintf(s, len, "%llu", ((nr_scalar_registry_node*)node)->scalar._nr_uint8);
+      break;
+    case NR_REG_TYPE_DOUBLE:
+      snprintf(s, len, "%#f", ((nr_scalar_registry_node*)node)->scalar._double);
+      break;
+    case NR_REG_TYPE_REGISTRY:
+      snprintf(s, len, "%s", name);
+      break;
+    case NR_REG_TYPE_BYTES:
+      for (i = 0; i < ((nr_array_registry_node*)node)->array.length; ++i) {
+        sprintf(&s[2*i], "%02x", ((nr_array_registry_node*)node)->array.data[i]);
+      }
+      break;
+    case NR_REG_TYPE_STRING:
+      s = (char*)((nr_array_registry_node*)node)->array.data; 
+      break;
+    default:
+      assert(0); /* bad value */
+      *freeit = 0;
+      s = "";
+      break;
+    }
+
+    return s;
+}
+
+int
+nr_reg_get(char *name, int type, void *out)
+{
+    int r, _status;
+    nr_scalar_registry_node *node = 0;
+    int free_node = 0;
+
+    if ((r=nr_reg_fetch_node(name, type, (void*)&node, &free_node)))
+      ABORT(r);
+
+    if ((r=nr_reg_get_data(name, node, out)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    if (free_node) RFREE(node);
+    return(_status);
+}
+
+int
+nr_reg_get_data(NR_registry name, nr_scalar_registry_node *node, void *out)
+{
+    int _status;
+
+    switch (node->type) {
+    case NR_REG_TYPE_CHAR:
+      *(char*)out = node->scalar._char;
+      break;
+    case NR_REG_TYPE_UCHAR:
+      *(UCHAR*)out = node->scalar._uchar;
+      break;
+    case NR_REG_TYPE_INT2:
+      *(INT2*)out = node->scalar._nr_int2;
+      break;
+    case NR_REG_TYPE_UINT2:
+      *(UINT2*)out = node->scalar._nr_uint2;
+      break;
+    case NR_REG_TYPE_INT4:
+      *(INT4*)out = node->scalar._nr_int4;
+      break;
+    case NR_REG_TYPE_UINT4:
+      *(UINT4*)out = node->scalar._nr_uint4;
+      break;
+    case NR_REG_TYPE_INT8:
+      *(INT8*)out = node->scalar._nr_int8;
+      break;
+    case NR_REG_TYPE_UINT8:
+      *(UINT8*)out = node->scalar._nr_uint8;
+      break;
+    case NR_REG_TYPE_DOUBLE:
+      *(double*)out = node->scalar._double;
+      break;
+    default:
+      ABORT(R_INTERNAL);
+      break;
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_get_array(char *name, unsigned char type, unsigned char *out, size_t size, size_t *length)
+{
+    int r, _status;
+    nr_array_registry_node *node = 0;
+    int free_node = 0;
+
+    if ((r=nr_reg_fetch_node(name, type, (void*)&node, &free_node)))
+      ABORT(r);
+
+    if (size < node->array.length)
+      ABORT(R_BAD_ARGS);
+
+    if (out != 0)
+        memcpy(out, node->array.data, node->array.length);
+    if (length != 0)
+        *length = node->array.length;
+
+    _status=0;
+  abort:
+    if (node && free_node) RFREE(node);
+    return(_status);
+}
+
+int
+nr_reg_set(char *name, int type, void *data)
+{
+    int r, _status;
+    nr_scalar_registry_node *node = 0;
+    int create_node = 0;
+    int changed = 0;
+    int free_node = 0;
+
+    if ((r=nr_reg_fetch_node(name, type, (void*)&node, &free_node)))
+      if (r == R_NOT_FOUND) {
+        create_node = 1;
+        free_node = 1;
+      }
+      else
+        ABORT(r);
+
+    if (create_node) {
+      if (!(node=(void*)RCALLOC(sizeof(nr_scalar_registry_node))))
+        ABORT(R_NO_MEMORY);
+
+      node->type = type;
+    }
+    else {
+      if (node->type != type)
+        ABORT(R_BAD_ARGS);
+    }
+
+    switch (type) {
+#define CASE(TYPE, _name, type)                   \
+    case TYPE:                                    \
+      if (node->scalar._name != *(type*)data) {   \
+        node->scalar._name = *(type*)data;        \
+        if (! create_node)                        \
+          changed = 1;                            \
+      }                                           \
+      break;
+    CASE(NR_REG_TYPE_CHAR,       _char,       char)
+    CASE(NR_REG_TYPE_UCHAR,      _uchar,      UCHAR)
+    CASE(NR_REG_TYPE_INT2,    _nr_int2,    INT2)
+    CASE(NR_REG_TYPE_UINT2,   _nr_uint2,   UINT2)
+    CASE(NR_REG_TYPE_INT4,    _nr_int4,    INT4)
+    CASE(NR_REG_TYPE_UINT4,   _nr_uint4,   UINT4)
+    CASE(NR_REG_TYPE_INT8,    _nr_int8,    INT8)
+    CASE(NR_REG_TYPE_UINT8,   _nr_uint8,   UINT8)
+    CASE(NR_REG_TYPE_DOUBLE,     _double,     double)
+#undef CASE
+
+    case NR_REG_TYPE_REGISTRY:
+      /* do nothing */
+      break;
+
+    default:
+      ABORT(R_INTERNAL);
+      break;
+    }
+
+    if (create_node) {
+      if ((r=nr_reg_insert_node(name, node)))
+        ABORT(r);
+      free_node = 0;
+    }
+    else {
+      if (changed) {
+        if ((r=nr_reg_change_node(name, node, node)))
+          ABORT(r);
+        free_node = 0;
+      }
+    }
+
+    _status=0;
+  abort:
+    if (_status) {
+      if (node && free_node) RFREE(node);
+    }
+    return(_status);
+}
+
+int
+nr_reg_set_array(char *name, unsigned char type, UCHAR *data, size_t length)
+{
+    int r, _status;
+    nr_array_registry_node *old = 0;
+    nr_array_registry_node *node = 0;
+    int free_node = 0;
+    int added = 0;
+    int changed = 0;
+
+    if ((r=nr_reg_fetch_node(name, type, (void*)&old, &free_node))) {
+        if (r != R_NOT_FOUND)
+            ABORT(r);
+    }
+    else {
+      assert(free_node == 0);
+    }
+
+    if (old) {
+        if (old->type != type)
+            ABORT(R_BAD_ARGS);
+
+        if (old->array.length != length
+         || memcmp(old->array.data, data, length)) {
+            changed = 1;
+
+            if (old->array.length < length) {
+                if (!(node=(void*)RCALLOC(sizeof(nr_array_registry_node)+length)))
+                    ABORT(R_NO_MEMORY);
+            }
+            else {
+                node = old;
+            }
+        }
+    }
+    else {
+        if (!(node=(void*)RCALLOC(sizeof(nr_array_registry_node)+length)))
+            ABORT(R_NO_MEMORY);
+
+        added = 1;
+    }
+
+    if (added || changed) {
+        node->type = type;
+        node->array.length = length;
+        memcpy(node->array.data, data, length);
+    }
+
+    if (added) {
+        if ((r=nr_reg_insert_node(name, node)))
+            ABORT(r);
+    }
+    else if (changed) {
+        if ((r=nr_reg_change_node(name, node, old)))
+          ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_set_parent_registries(char *name)
+{
+    int r, _status;
+    char *parent = 0;
+    char *dot;
+
+    if ((parent = r_strdup(name)) == 0)
+      ABORT(R_NO_MEMORY);
+
+    if ((dot = strrchr(parent, '.')) != 0) {
+      *dot = '\0';
+      if ((r=NR_reg_set_registry(parent)))
+        ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    if (parent) RFREE(parent);
+    return(_status);
+}
+
+
+
+
+
+/* NON-STATIC METHODS */
+
+int
+nr_reg_is_valid(NR_registry name)
+{
+    int _status;
+    unsigned int length;
+    unsigned int i;
+
+    if (name == 0)
+      ABORT(R_BAD_ARGS);
+
+    /* make sure the key is null-terminated */
+    if (memchr(name, '\0', sizeof(NR_registry)) == 0)
+      ABORT(R_BAD_ARGS);
+
+    length = strlen(name);
+
+    /* cannot begin or end with a period */
+    if (name[0] == '.')
+      ABORT(R_BAD_ARGS);
+    if (strlen(name) > 0 && name[length-1] == '.')
+      ABORT(R_BAD_ARGS);
+
+    /* all characters cannot be space, and must be printable and not / */
+    for (i = 0; i < length; ++i) {
+      if (isspace(name[i]) || ! (isprint(name[i]) || name[i] == '/'))
+        ABORT(R_BAD_ARGS);
+    }
+ 
+    _status=0;
+  abort:
+    if (_status) {
+      r_log(NR_LOG_REGISTRY, LOG_DEBUG, "invalid name '%s'", name);
+    }
+    return(_status);
+}
+
+
+int
+nr_reg_compute_length(char *name, nr_registry_node *in, size_t *length)
+{
+    int _status;
+    nr_array_registry_node *node = (nr_array_registry_node*)in;
+
+    switch (node->type) {
+    case NR_REG_TYPE_STRING:
+      *length = node->array.length - 1;
+      break;
+    case NR_REG_TYPE_BYTES:
+      *length = node->array.length;
+      break;
+    case NR_REG_TYPE_CHAR:
+      *length = sizeof(char);
+      break;
+    case NR_REG_TYPE_UCHAR:
+      *length = sizeof(UCHAR);
+      break;
+    case NR_REG_TYPE_INT2:
+    case NR_REG_TYPE_UINT2:
+      *length = 2;
+      break;
+    case NR_REG_TYPE_INT4:
+    case NR_REG_TYPE_UINT4:
+      *length = 4;
+      break;
+    case NR_REG_TYPE_INT8:
+    case NR_REG_TYPE_UINT8:
+      *length = 8;
+      break;
+    case NR_REG_TYPE_DOUBLE:
+      *length = sizeof(double);
+      break;
+    case NR_REG_TYPE_REGISTRY:
+      *length = strlen(name);
+      break;
+    default:
+      ABORT(R_INTERNAL);
+      break;
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+
+/* VTBL METHODS */
+
+int
+nr_reg_local_init(nr_registry_module *me)
+{
+    int r, _status;
+
+    if (nr_registry == 0) {
+      if ((r=r_assoc_create(&nr_registry, r_assoc_crc32_hash_compute, 12)))
+        ABORT(r);
+
+      if ((r=nr_reg_cb_init()))
+            ABORT(r);
+
+      /* make sure NR_TOP_LEVEL_REGISTRY always exists */
+      if ((r=nr_reg_local_set_registry(NR_TOP_LEVEL_REGISTRY)))
+          ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+#define NRREGGET(func, TYPE, type)                                  \
+int                                                                 \
+func(NR_registry name, type *out)                                   \
+{                                                                   \
+    return nr_reg_get(name, TYPE, out);                             \
+}
+
+NRREGGET(nr_reg_local_get_char,     NR_REG_TYPE_CHAR,     char)
+NRREGGET(nr_reg_local_get_uchar,    NR_REG_TYPE_UCHAR,    UCHAR)
+NRREGGET(nr_reg_local_get_int2,     NR_REG_TYPE_INT2,     INT2)
+NRREGGET(nr_reg_local_get_uint2,    NR_REG_TYPE_UINT2,    UINT2)
+NRREGGET(nr_reg_local_get_int4,     NR_REG_TYPE_INT4,     INT4)
+NRREGGET(nr_reg_local_get_uint4,    NR_REG_TYPE_UINT4,    UINT4)
+NRREGGET(nr_reg_local_get_int8,     NR_REG_TYPE_INT8,     INT8)
+NRREGGET(nr_reg_local_get_uint8,    NR_REG_TYPE_UINT8,    UINT8)
+NRREGGET(nr_reg_local_get_double,   NR_REG_TYPE_DOUBLE,   double)
+
+int
+nr_reg_local_get_registry(NR_registry name, NR_registry out)
+{
+    int r, _status;
+    nr_scalar_registry_node *node = 0;
+    int free_node = 0;
+
+    if ((r=nr_reg_fetch_node(name, NR_REG_TYPE_REGISTRY, (void*)&node, &free_node)))
+      ABORT(r);
+
+    strncpy(out, name, sizeof(NR_registry));
+
+    _status=0;
+  abort:
+    if (free_node) RFREE(node);
+    return(_status);
+
+}
+
+int
+nr_reg_local_get_bytes(NR_registry name, UCHAR *out, size_t size, size_t *length)
+{
+    return nr_reg_get_array(name, NR_REG_TYPE_BYTES, out, size, length);
+}
+
+int
+nr_reg_local_get_string(NR_registry name, char *out, size_t size)
+{
+    return nr_reg_get_array(name, NR_REG_TYPE_STRING, (UCHAR*)out, size, 0);
+}
+
+int
+nr_reg_local_get_length(NR_registry name, size_t *length)
+{
+    int r, _status;
+    nr_registry_node *node = 0;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    if ((r=r_assoc_fetch(nr_registry, name, strlen(name)+1, (void*)&node)))
+      ABORT(r);
+
+    if ((r=nr_reg_compute_length(name, node, length)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_local_get_type(NR_registry name, NR_registry_type type)
+{
+    int r, _status;
+    nr_registry_node *node = 0;
+    char *str;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    if ((r=r_assoc_fetch(nr_registry, name, strlen(name)+1, (void*)&node)))
+      ABORT(r);
+
+    str = nr_reg_type_name(node->type);
+    if (! str)
+        ABORT(R_BAD_ARGS);
+
+    strncpy(type, str, sizeof(NR_registry_type));
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+
+#define NRREGSET(func, TYPE, type)                              \
+int                                                             \
+func(NR_registry name, type data)                               \
+{                                                               \
+    return nr_reg_set(name, TYPE, &data);                       \
+}
+
+NRREGSET(nr_reg_local_set_char,     NR_REG_TYPE_CHAR,     char)
+NRREGSET(nr_reg_local_set_uchar,    NR_REG_TYPE_UCHAR,    UCHAR)
+NRREGSET(nr_reg_local_set_int2,     NR_REG_TYPE_INT2,     INT2)
+NRREGSET(nr_reg_local_set_uint2,    NR_REG_TYPE_UINT2,    UINT2)
+NRREGSET(nr_reg_local_set_int4,     NR_REG_TYPE_INT4,     INT4)
+NRREGSET(nr_reg_local_set_uint4,    NR_REG_TYPE_UINT4,    UINT4)
+NRREGSET(nr_reg_local_set_int8,     NR_REG_TYPE_INT8,     INT8)
+NRREGSET(nr_reg_local_set_uint8,    NR_REG_TYPE_UINT8,    UINT8)
+NRREGSET(nr_reg_local_set_double,   NR_REG_TYPE_DOUBLE,   double)
+
+int
+nr_reg_local_set_registry(NR_registry name)
+{
+    return nr_reg_set(name, NR_REG_TYPE_REGISTRY, 0);
+}
+
+int
+nr_reg_local_set_bytes(NR_registry name, unsigned char *data, size_t length)
+{
+    return nr_reg_set_array(name, NR_REG_TYPE_BYTES, data, length);
+}
+
+int
+nr_reg_local_set_string(NR_registry name, char *data)
+{
+    return nr_reg_set_array(name, NR_REG_TYPE_STRING, (UCHAR*)data, strlen(data)+1);
+}
+
+int
+nr_reg_local_del(NR_registry name)
+{
+    int r, _status;
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    /* delete from NR_registry */
+    if ((r=nr_reg_local_iter(name, nr_reg_local_iter_delete, 0)))
+      ABORT(r);
+
+    if ((r=nr_reg_raise_event(name, NR_REG_CB_ACTION_DELETE)))
+      ABORT(r);
+
+    /* if deleting from the root, re-insert the root */
+    if (! strcasecmp(name, NR_TOP_LEVEL_REGISTRY)) {
+      if ((r=nr_reg_local_set_registry(NR_TOP_LEVEL_REGISTRY)))
+          ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    r_log(NR_LOG_REGISTRY,
+          (_status ? LOG_INFO               :  LOG_INFO),
+          "delete of '%s' %s", name,
+          (_status ? "FAILED"               : "succeeded"));
+    return(_status);
+}
+
+int
+nr_reg_local_get_child_count(char *parent, size_t *count)
+{
+    int r, _status;
+    nr_registry_node *ignore1;
+    int ignore2;
+
+
+    if ((r=nr_reg_is_valid(parent)))
+      ABORT(r);
+
+    /* test to see whether it is present */
+    if ((r=nr_reg_fetch_node(parent, NR_REG_TYPE_REGISTRY, &ignore1, &ignore2)))
+      ABORT(r);
+
+    /* sanity check that there isn't any memory to free */
+    assert(ignore2 == 0);
+
+    *count = 0;
+
+    if ((r=nr_reg_local_iter(parent, nr_reg_local_count_children, count)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_local_get_children(NR_registry parent, NR_registry *data, size_t size, size_t *length)
+{
+    int r, _status;
+    nr_reg_find_children_arg arg;
+
+    if ((r=nr_reg_is_valid(parent)))
+      ABORT(r);
+
+    arg.children = data;
+    arg.size = size;
+    arg.length = 0;
+
+    if ((r=nr_reg_local_iter(parent, nr_reg_local_find_children, (void*)&arg))) {
+        if (r == R_INTERRUPTED)
+            ABORT(R_BAD_ARGS);
+        else
+            ABORT(r);
+    }
+
+    assert(sizeof(*arg.children) == sizeof(NR_registry));
+    qsort(arg.children, arg.length, sizeof(*arg.children), (void*)strcasecmp);
+
+    *length = arg.length;
+
+    _status = 0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_local_fin(NR_registry name)
+{
+    int r, _status;
+
+    if ((r=nr_reg_raise_event(name, NR_REG_CB_ACTION_FINAL)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_local_dump(int sorted)
+{
+    int r, _status;
+
+    if ((r=nr_reg_local_iter(NR_TOP_LEVEL_REGISTRY, nr_reg_local_dump_print, 0)))
+      ABORT(r);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+
+
+static nr_registry_module_vtbl nr_reg_local_vtbl = {
+    nr_reg_local_init,
+    nr_reg_local_get_char,
+    nr_reg_local_get_uchar,
+    nr_reg_local_get_int2,
+    nr_reg_local_get_uint2,
+    nr_reg_local_get_int4,
+    nr_reg_local_get_uint4,
+    nr_reg_local_get_int8,
+    nr_reg_local_get_uint8,
+    nr_reg_local_get_double,
+    nr_reg_local_get_registry,
+    nr_reg_local_get_bytes,
+    nr_reg_local_get_string,
+    nr_reg_local_get_length,
+    nr_reg_local_get_type,
+    nr_reg_local_set_char,
+    nr_reg_local_set_uchar,
+    nr_reg_local_set_int2,
+    nr_reg_local_set_uint2,
+    nr_reg_local_set_int4,
+    nr_reg_local_set_uint4,
+    nr_reg_local_set_int8,
+    nr_reg_local_set_uint8,
+    nr_reg_local_set_double,
+    nr_reg_local_set_registry,
+    nr_reg_local_set_bytes,
+    nr_reg_local_set_string,
+    nr_reg_local_del,
+    nr_reg_local_get_child_count,
+    nr_reg_local_get_children,
+    nr_reg_local_fin,
+    nr_reg_local_dump
+};
+
+static nr_registry_module nr_reg_local_module = { 0, &nr_reg_local_vtbl };
+
+void *NR_REG_MODE_LOCAL = &nr_reg_local_module;
+
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registry_vtbl.h
@@ -0,0 +1,96 @@
+/*
+ *
+ *    registry_vtbl.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry_vtbl.h,v $
+ *    $Revision: 1.2 $
+ *    $Date: 2006/08/16 19:39:14 $
+ *
+ *    
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __REGISTRY_VTBL_H__
+#define __REGISTRY_VTBL_H__
+
+typedef struct nr_registry_module_ nr_registry_module;
+
+typedef struct nr_registry_module_vtbl_ {
+    int (*init)(nr_registry_module*);
+
+    int (*get_char)(NR_registry name, char *out);
+    int (*get_uchar)(NR_registry name, UCHAR *out);
+    int (*get_int2)(NR_registry name, INT2 *out);
+    int (*get_uint2)(NR_registry name, UINT2 *out);
+    int (*get_int4)(NR_registry name, INT4 *out);
+    int (*get_uint4)(NR_registry name, UINT4 *out);
+    int (*get_int8)(NR_registry name, INT8 *out);
+    int (*get_uint8)(NR_registry name, UINT8 *out);
+    int (*get_double)(NR_registry name, double *out);
+    int (*get_registry)(NR_registry name, NR_registry out);
+
+    int (*get_bytes)(NR_registry name, UCHAR *out, size_t size, size_t *length);
+    int (*get_string)(NR_registry name, char *out, size_t size);
+    int (*get_length)(NR_registry name, size_t *length);
+    int (*get_type)(NR_registry name, NR_registry_type type);
+
+    int (*set_char)(NR_registry name, char data);
+    int (*set_uchar)(NR_registry name, UCHAR data);
+    int (*set_int2)(NR_registry name, INT2 data);
+    int (*set_uint2)(NR_registry name, UINT2 data);
+    int (*set_int4)(NR_registry name, INT4 data);
+    int (*set_uint4)(NR_registry name, UINT4 data);
+    int (*set_int8)(NR_registry name, INT8 data);
+    int (*set_uint8)(NR_registry name, UINT8 data);
+    int (*set_double)(NR_registry name, double data);
+    int (*set_registry)(NR_registry name);
+
+    int (*set_bytes)(NR_registry name, UCHAR *data, size_t length);
+    int (*set_string)(NR_registry name, char *data);
+
+    int (*del)(NR_registry name);
+
+    int (*get_child_count)(NR_registry parent, size_t *count);
+    int (*get_children)(NR_registry parent, NR_registry *data, size_t size, size_t *length);
+
+    int (*fin)(NR_registry name);
+
+    int (*dump)(int sorted);
+} nr_registry_module_vtbl;
+
+struct nr_registry_module_ {
+    void *handle;
+    nr_registry_module_vtbl *vtbl;
+};
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/registry/registrycb.c
@@ -0,0 +1,440 @@
+/*
+ *
+ *    registrycb.c
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registrycb.c,v $
+ *    $Revision: 1.3 $
+ *    $Date: 2007/06/26 22:37:51 $
+ *
+ *    Callback-related functions
+ *
+ *    
+ *    Copyright (C) 2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#include <assert.h>
+#include <string.h>
+#include "registry.h"
+#include "registry_int.h"
+#include "r_assoc.h"
+#include "r_errors.h"
+#include "nr_common.h"
+#include "r_log.h"
+#include "r_macros.h"
+
+static char CB_ACTIONS[] = { NR_REG_CB_ACTION_ADD,
+                             NR_REG_CB_ACTION_DELETE,
+                             NR_REG_CB_ACTION_CHANGE,
+                             NR_REG_CB_ACTION_FINAL };
+
+typedef struct nr_reg_cb_info_ {
+     char            action;
+     void          (*cb)(void *cb_arg, char action, NR_registry name);
+     void           *cb_arg;
+     NR_registry     name;
+} nr_reg_cb_info;
+
+/* callbacks that are registered, a mapping from names like "foo.bar.baz"
+ * to an r_assoc which contains possibly several nr_reg_cb_info*'s */
+static r_assoc     *nr_registry_callbacks = 0;
+
+//static size_t SIZEOF_CB_ID = (sizeof(void (*)()) + 1);
+#define SIZEOF_CB_ID  (sizeof(void (*)()) + 1)
+
+static int nr_reg_validate_action(char action);
+static int nr_reg_assoc_destroy(void *ptr);
+static int compute_cb_id(void *cb, char action, unsigned char cb_id[SIZEOF_CB_ID]);
+static int nr_reg_info_free(void *ptr);
+static int nr_reg_raise_event_recurse(char *name, char *tmp, int action);
+static int nr_reg_register_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name), void *cb_arg);
+static int nr_reg_unregister_callback(char *name, char action, void (*cb)(void *cb_arg, char action, NR_registry name));
+
+int
+nr_reg_cb_init()
+{
+    int r, _status;
+
+    if (nr_registry_callbacks == 0) {
+        if ((r=r_assoc_create(&nr_registry_callbacks, r_assoc_crc32_hash_compute, 12)))
+            ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    if (_status) {
+       r_log(NR_LOG_REGISTRY, LOG_DEBUG, "Couldn't init notifications: %s", nr_strerror(_status));
+    }
+    return(_status);
+}
+
+int
+nr_reg_validate_action(char action)
+{
+    int _status;
+    int i;
+
+    for (i = 0; i < sizeof(CB_ACTIONS); ++i) {
+        if (action == CB_ACTIONS[i])
+            return 0;
+    }
+    ABORT(R_BAD_ARGS);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+nr_reg_register_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name), void *cb_arg)
+{
+    int r, _status;
+    r_assoc *assoc;
+    int create_assoc = 0;
+    nr_reg_cb_info *info;
+    int create_info = 0;
+    unsigned char cb_id[SIZEOF_CB_ID];
+
+    if (name == 0 || cb == 0)
+      ABORT(R_BAD_ARGS);
+
+    if (nr_registry_callbacks == 0)
+      ABORT(R_FAILED);
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    if ((r=nr_reg_validate_action(action)))
+      ABORT(r);
+
+    if ((r=r_assoc_fetch(nr_registry_callbacks, name, strlen(name)+1, (void*)&assoc))) {
+      if (r == R_NOT_FOUND)
+        create_assoc = 1;
+      else
+        ABORT(r);
+    }
+
+    if (create_assoc) {
+      if ((r=r_assoc_create(&assoc, r_assoc_crc32_hash_compute, 5)))
+        ABORT(r);
+
+      if ((r=r_assoc_insert(nr_registry_callbacks, name, strlen(name)+1, assoc, 0, nr_reg_assoc_destroy, R_ASSOC_NEW)))
+        ABORT(r);
+    }
+
+    if ((r=compute_cb_id(cb, action, cb_id)))
+      ABORT(r);
+
+    if ((r=r_assoc_fetch(assoc, (char*)cb_id, SIZEOF_CB_ID, (void*)&info))) {
+      if (r == R_NOT_FOUND)
+        create_info = 1;
+      else
+        ABORT(r);
+    }
+
+    if (create_info) {
+      if (!(info=(void*)RCALLOC(sizeof(*info))))
+        ABORT(R_NO_MEMORY);
+    }
+
+    strncpy(info->name, name, sizeof(info->name));
+    info->action = action;
+    info->cb = cb;
+    info->cb_arg = cb_arg;
+
+    if (create_info) {
+      if ((r=r_assoc_insert(assoc, (char*)cb_id, SIZEOF_CB_ID, info, 0, nr_reg_info_free, R_ASSOC_NEW)))
+        ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "register callback %X on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
+
+    if (_status) {
+      if (create_info && info) RFREE(info);
+      if (create_assoc && assoc) nr_reg_assoc_destroy(&assoc);
+    }
+    return(_status);
+}
+
+int
+nr_reg_unregister_callback(char *name, char action, void (*cb)(void *cb_arg, char action, NR_registry name))
+{
+    int r, _status;
+    r_assoc *assoc;
+    int size;
+    unsigned char cb_id[SIZEOF_CB_ID];
+
+    if (name == 0 || cb == 0)
+      ABORT(R_BAD_ARGS);
+
+    if (nr_registry_callbacks == 0)
+      ABORT(R_FAILED);
+
+    if ((r=nr_reg_is_valid(name)))
+      ABORT(r);
+
+    if ((r=nr_reg_validate_action(action)))
+      ABORT(r);
+
+    if ((r=r_assoc_fetch(nr_registry_callbacks, name, strlen(name)+1, (void*)&assoc))) {
+      if (r != R_NOT_FOUND)
+        ABORT(r);
+    }
+    else {
+      if ((r=compute_cb_id(cb, action, cb_id)))
+        ABORT(r);
+
+      if ((r=r_assoc_delete(assoc, (char*)cb_id, SIZEOF_CB_ID))) {
+        if (r != R_NOT_FOUND)
+          ABORT(r);
+      }
+
+      if ((r=r_assoc_num_elements(assoc, &size)))
+        ABORT(r);
+
+      if (size == 0) {
+        if ((r=r_assoc_delete(nr_registry_callbacks, name, strlen(name)+1)))
+          ABORT(r);
+      }
+    }
+
+    _status=0;
+  abort:
+    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "unregister callback %X on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
+
+    return(_status);
+}
+
+int
+compute_cb_id(void *cb, char action, unsigned char cb_id[SIZEOF_CB_ID])
+{
+   /* callbacks are identified by the pointer to the cb function plus
+    * the action being watched */
+   assert(sizeof(cb) == sizeof(void (*)()));
+   assert(sizeof(cb) == (SIZEOF_CB_ID - 1));
+
+   memcpy(cb_id, &(cb), sizeof(cb));
+   cb_id[SIZEOF_CB_ID-1] = action;
+
+   return 0;
+}
+
+char *
+nr_reg_action_name(int action)
+{
+    char *name = "*Unknown*";
+
+    switch (action) {
+    case NR_REG_CB_ACTION_ADD:     name = "add";     break;
+    case NR_REG_CB_ACTION_DELETE:  name = "delete";  break;
+    case NR_REG_CB_ACTION_CHANGE:  name = "change";  break;
+    case NR_REG_CB_ACTION_FINAL:   name = "final";  break;
+    }
+
+    return name;
+}
+
+int
+nr_reg_assoc_destroy(void *ptr)
+{
+  return r_assoc_destroy((r_assoc**)&ptr);
+}
+
+int
+nr_reg_info_free(void *ptr)
+{
+  RFREE(ptr);
+  return 0;
+}
+
+/* call with tmp=0 */
+int
+nr_reg_raise_event_recurse(char *name, char *tmp, int action)
+{
+    int r, _status;
+    r_assoc *assoc;
+    nr_reg_cb_info *info;
+    r_assoc_iterator iter;
+    char *key;
+    int keyl;
+    char *c;
+    int free_tmp = 0;
+    int count;
+
+    if (tmp == 0) {
+      if (!(tmp = (char*)r_strdup(name)))
+        ABORT(R_NO_MEMORY);
+      free_tmp = 1;
+    }
+
+    if ((r=r_assoc_fetch(nr_registry_callbacks, tmp, strlen(tmp)+1, (void*)&assoc))) {
+      if (r != R_NOT_FOUND)
+        ABORT(r);
+
+      r_log(NR_LOG_REGISTRY, LOG_DEBUG, "No callbacks found on '%s'", tmp);
+    }
+    else {
+      if (!r_assoc_num_elements(assoc, &count)) {
+          r_log(NR_LOG_REGISTRY, LOG_DEBUG, "%d callback%s found on '%s'",
+                count, ((count == 1) ? "" : "s"), tmp);
+      }
+
+      if ((r=r_assoc_init_iter(assoc, &iter)))
+          ABORT(r);
+
+      for (;;) {
+        if ((r=r_assoc_iter(&iter, (void*)&key, &keyl, (void*)&info))) {
+          if (r == R_EOD)
+            break;
+          else
+            ABORT(r);
+        }
+
+        if (info->action == action) {
+          r_log(NR_LOG_REGISTRY, LOG_DEBUG,
+                "Invoking callback %X for '%s'",
+                info->cb,
+                nr_reg_action_name(info->action));
+
+          (void)info->cb(info->cb_arg, action, name);
+        }
+        else {
+          r_log(NR_LOG_REGISTRY, LOG_DEBUG,
+                "Skipping callback %X for '%s'",
+                info->cb,
+                nr_reg_action_name(info->action));
+        }
+      }
+    }
+
+    if (strlen(tmp) > 0) {
+        c = strrchr(tmp, '.');
+        if (c != 0)
+          *c = '\0';
+        else
+          tmp[0] = '\0';
+
+        if ((r=nr_reg_raise_event_recurse(name, tmp, action)))
+          ABORT(r);
+    }
+
+    _status=0;
+  abort:
+    if (free_tmp && tmp != 0) RFREE(tmp);
+    return(_status);
+}
+
+
+/* NON-STATIC METHODS */
+
+int
+nr_reg_raise_event(char *name, int action)
+{
+    int r, _status;
+    int count;
+    char *event = nr_reg_action_name(action);
+
+    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "raising event '%s' on '%s'", event, name);
+
+    if (name == 0)
+      ABORT(R_BAD_ARGS);
+
+    if ((r=nr_reg_validate_action(action)))
+      ABORT(r);
+
+    if ((r=r_assoc_num_elements(nr_registry_callbacks, &count)))
+      ABORT(r);
+
+    if (count > 0) {
+      if ((r=nr_reg_raise_event_recurse(name, 0, action)))
+        ABORT(r);
+    }
+    else {
+      r_log(NR_LOG_REGISTRY, LOG_DEBUG, "No callbacks found");
+      return 0;
+    }
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+
+/* PUBLIC METHODS */
+
+int
+NR_reg_register_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name), void *cb_arg)
+{
+    int r, _status;
+    int i;
+
+    for (i = 0; i < sizeof(CB_ACTIONS); ++i) {
+        if (action & CB_ACTIONS[i]) {
+            if ((r=nr_reg_register_callback(name, CB_ACTIONS[i], cb, cb_arg)))
+                ABORT(r);
+
+            action &= ~(CB_ACTIONS[i]);
+        }
+    }
+
+    if (action)
+        ABORT(R_BAD_ARGS);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+int
+NR_reg_unregister_callback(char *name, char action, void (*cb)(void *cb_arg, char action, NR_registry name))
+{
+    int r, _status;
+    int i;
+
+    for (i = 0; i < sizeof(CB_ACTIONS); ++i) {
+        if (action & CB_ACTIONS[i]) {
+            if ((r=nr_reg_unregister_callback(name, CB_ACTIONS[i], cb)))
+                ABORT(r);
+
+            action &= ~(CB_ACTIONS[i]);
+        }
+    }
+
+    if (action)
+        ABORT(R_BAD_ARGS);
+
+    _status=0;
+  abort:
+    return(_status);
+}
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/share/nr_api.h
@@ -0,0 +1,51 @@
+/**
+   nr_pce.h
+
+   
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@networkresonance.com  Wed Jul 19 13:18:39 2006
+ */
+
+
+#ifndef _nr_pce_h
+#define _nr_pce_h
+
+#include <sys/queue.h>
+#include <csi_platform.h>
+#include <r_common.h>
+#include <r_log.h>
+#include <nrstats.h>
+#include <nr_plugin.h>
+#include <async_wait.h>
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/share/nr_common.h
@@ -0,0 +1,108 @@
+/**
+   nr_common.h
+
+   
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+ */
+
+
+#ifndef _nr_common_h
+#define _nr_common_h
+
+#include <csi_platform.h>
+
+#ifdef USE_MPATROL
+#define USEDEBUG 1
+#include <mpatrol.h>
+#endif
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include <string.h>
+#include <time.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+#include <errno.h>
+#else
+#include <sys/errno.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <r_log.h>
+
+extern int NR_LOG_REASSD;
+
+#include "registry.h"
+#include "nrstats.h"
+ 
+typedef struct nr_captured_packet_ {
+     UCHAR cap_interface;       /* 1 for primary, 2 for secondary */
+     struct timeval ts;     /* The time this packet was captured */
+     UINT4 len;             /* The length of the packet */
+     UINT8 packet_number;   /* The listener's packet index */
+} nr_captured_packet;
+
+#ifndef NR_ROOT_PATH
+#define NR_ROOT_PATH "/usr/local/ctc/"
+#endif
+
+#define NR_ARCHIVE_DIR NR_ROOT_PATH  "archive/"
+#define NR_TEMP_DIR NR_ROOT_PATH  "tmp/"
+#define NR_ARCHIVE_STATEFILE NR_ROOT_PATH  "archive/state"
+#define NR_CAPTURED_PID_FILENAME  NR_ROOT_PATH "captured.pid"
+#define NR_REASSD_PID_FILENAME  NR_ROOT_PATH "reassd.pid"
+#define NR_MODE_FILENAME  NR_ROOT_PATH "mode.txt"
+
+char *nr_revision_number(void);
+
+
+
+
+/* Memory buckets for CTC memory types */
+#define NR_MEM_TCP       1
+#define NR_MEM_HTTP      2
+#define NR_MEM_DELIVERY  3
+#define NR_MEM_OUT_HM    4
+#define NR_MEM_OUT_SSL   5
+#define NR_MEM_SSL       7
+#define NR_MEM_COMMON    8
+#define NR_MEM_CODEC     9
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/share/nr_reg_keys.h
@@ -0,0 +1,167 @@
+/*
+ *
+ *    nr_reg_keys.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/share/nr_reg_keys.h,v $
+ *    $Revision: 1.3 $
+ *    $Date: 2008/01/29 00:34:00 $
+ *
+ *    
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __NR_REG_KEYS_H__
+#define __NR_REG_KEYS_H__
+
+#include <stdio.h>
+
+#define NR_REG_NAME_LENGTH_MIN                                        1
+#define NR_REG_NAME_LENGTH_MAX                                        32
+
+#define NR_REG_HOSTNAME            "hostname"
+#define NR_REG_ADDRESS             "address"
+#define NR_REG_NETMASKSIZE         "netmasksize"
+#define NR_REG_ADDRESS_NETMASKSIZE "address/netmasksize"   /* use only in clic files */
+#define NR_REG_PORT                "port"
+
+#define NR_REG_LOGGING_SYSLOG_ENABLED                                 "logging.syslog.enabled"
+#define NR_REG_LOGGING_SYSLOG_SERVERS                                 "logging.syslog.servers"
+#define NR_REG_LOGGING_SYSLOG_FACILITY                                "logging.syslog.facility"
+#define NR_REG_LOGGING_SYSLOG_LEVEL                                   "logging.syslog.level"
+
+#define NR_REG_CAPTURED_DAEMONS                                       "captured.daemons"
+
+#define NR_REG_LISTEND_ENABLED                                        "listend.enabled"
+
+#define NR_REG_LISTEND_MAX_INPUT_BUFFER_SIZE                          "listend.max_input_buffer_size"
+#define NR_REG_LISTEND_MAX_INPUT_BUFFER_SIZE_MIN                      1               // 1 byte?
+#define NR_REG_LISTEND_MAX_INPUT_BUFFER_SIZE_MAX                      (10ULL*1024*1024*1024)     // 10 GB
+
+#define NR_REG_LISTEND_INTERFACE                                      "listend.interface"
+#define NR_REG_LISTEND_INTERFACE_PRIMARY                              "listend.interface.primary"
+#define NR_REG_LISTEND_INTERFACE_SECONDARY                            "listend.interface.secondary"
+#define NR_REG_LISTEND_LISTEN_ON_BOTH_INTERFACES                      "listend.interface.listen_on_both_interfaces"
+#define NR_REG_LISTEND_ENABLE_VLAN                                    "listend.enable_vlan"
+
+#define NR_REG_LISTEND_LISTEN_TO                                      "listend.listen_to"
+#define NR_REG_LISTEND_IGNORE                                         "listend.ignore"
+
+#define NR_REG_LISTEND_PORT_MIN                                       0
+#define NR_REG_LISTEND_PORT_MAX                                       65535
+
+#define NR_REG_REASSD_MAX_MEMORY_CONSUMPTION                          "reassd.max_memory_consumption"
+#define NR_REG_REASSD_MAX_MEMORY_CONSUMPTION_MIN                      (10*1024)    // 100 KB
+#define NR_REG_REASSD_MAX_MEMORY_CONSUMPTION_MAX                      (10ULL*1024*1024*1024)     // 10 GB
+
+#define NR_REG_REASSD_DECODER_TCP_IGNORE_CHECKSUMS                    "reassd.decoder.tcp.ignore_checksums"
+
+#define NR_REG_REASSD_DECODER_TCP_MAX_CONNECTIONS_IN_SYN_STATE        "reassd.decoder.tcp.max_connections_in_syn_state"
+#define NR_REG_REASSD_DECODER_TCP_MAX_CONNECTIONS_IN_SYN_STATE_MIN    1
+#define NR_REG_REASSD_DECODER_TCP_MAX_CONNECTIONS_IN_SYN_STATE_MAX    500000
+
+#define NR_REG_REASSD_DECODER_TCP_MAX_SIMULTANEOUS_CONNECTIONS        "reassd.decoder.tcp.max_simultaneous_connections"
+#define NR_REG_REASSD_DECODER_TCP_MAX_SIMULTANEOUS_CONNECTIONS_MIN    1
+#define NR_REG_REASSD_DECODER_TCP_MAX_SIMULTANEOUS_CONNECTIONS_MAX    1000000  // 1 million
+
+#define NR_REG_REASSD_DECODER_SSL_MAX_SESSION_CACHE_SIZE              "reassd.decoder.ssl.max_session_cache_size"
+#define NR_REG_REASSD_DECODER_SSL_MAX_SESSION_CACHE_SIZE_MIN          0
+#define NR_REG_REASSD_DECODER_SSL_MAX_SESSION_CACHE_SIZE_MAX          (1ULL*1024*1024*1024)   // 1GB
+
+#define NR_REG_REASSD_DECODER_SSL_REVEAL_LOCAL_KEYS                   "reassd.decoder.ssl.reveal.local.keys"
+
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_RESPONSE_TIMEOUT           "reassd.decoder.http.hanging_response_timeout"
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_RESPONSE_TIMEOUT_MIN       1
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_RESPONSE_TIMEOUT_MAX       1023
+
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_TRANSMISSION_TIMEOUT       "reassd.decoder.http.hanging_transmission_timeout"
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_TRANSMISSION_TIMEOUT_MIN   1
+#define NR_REG_REASSD_DECODER_HTTP_HANGING_TRANSMISSION_TIMEOUT_MAX   1023
+
+#define NR_REG_REASSD_DECODER_HTTP_MAX_HTTP_MESSAGE_SIZE              "reassd.decoder.http.max_http_message_size"
+#define NR_REG_REASSD_DECODER_HTTP_MAX_HTTP_MESSAGE_SIZE_MIN          0
+#define NR_REG_REASSD_DECODER_HTTP_MAX_HTTP_MESSAGE_SIZE_MAX          (10ULL*1024*1024*1024)
+
+/* PCE-only: */
+#define NR_REG_LISTEND_ARCHIIVE                                       "listend.archive"
+#define NR_REG_LISTEND_ARCHIVE_MAX_SIZE                               "listend.archive.max_size"
+#define NR_REG_LISTEND_ARCHIVE_MAX_SIZE_MIN                           0
+#define NR_REG_LISTEND_ARCHIVE_MAX_SIZE_MAX                           (10ULL*1024*1024*1024*1024)  // 10 TB
+
+#define NR_REG_LISTEND_ARCHIVE_RECORDING_ENABLED                      "listend.archive.recording_enabled"
+
+#define NR_REG_REASSD_DECODER_NET_DELIVER_BATCH_INTERVAL              "reassd.decoder.net_deliver.batch_interval"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_BATCH_INTERVAL_MIN          0
+#define NR_REG_REASSD_DECODER_NET_DELIVER_BATCH_INTERVAL_MAX          1023
+
+#define NR_REG_REASSD_DECODER_NET_DELIVER_MAX_QUEUE_DEPTH             "reassd.decoder.net_deliver.max_queue_depth"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_MAX_QUEUE_DEPTH_MIN         0
+#define NR_REG_REASSD_DECODER_NET_DELIVER_MAX_QUEUE_DEPTH_MAX         (1ULL*1024*1024*1024)     // 1 GB
+
+#define NR_REG_REASSD_DECODER_NET_DELIVER_MY_KEY_CERTIFICATE          "reassd.decoder.net_deliver.my_key.certificate"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_MY_KEY_PRIVATE_KEY          "reassd.decoder.net_deliver.my_key.private_key"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_PEER                        "reassd.decoder.net_deliver.peer"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_PEER_PORT_MIN               0
+#define NR_REG_REASSD_DECODER_NET_DELIVER_PEER_PORT_MAX               65535
+
+#define NR_REG_REASSD_DECODER_NET_DELIVER_POLLING_INTERVAL            "reassd.decoder.net_deliver.polling_interval"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_POLLING_INTERVAL_MIN        1
+#define NR_REG_REASSD_DECODER_NET_DELIVER_POLLING_INTERVAL_MAX        1023
+
+#define NR_REG_REASSD_DECODER_NET_DELIVER_STATELESS                   "reassd.decoder.net_deliver.stateless"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_WATCHDOG_TIMER              "reassd.decoder.net_deliver.watchdog_timer"
+#define NR_REG_REASSD_DECODER_NET_DELIVER_WATCHDOG_TIMER_MIN          0
+#define NR_REG_REASSD_DECODER_NET_DELIVER_WATCHDOG_TIMER_MAX          666
+
+/* ASA-only: */
+#define NR_REG_MIGRATE_ENABLED                                        "migrate.enabled"
+
+#define NR_REG_MIGRATE_INACTIVITY_TIMEOUT                             "migrate.inactivity_timeout"
+#define NR_REG_MIGRATE_INACTIVITY_TIMEOUT_MIN                         0
+#define NR_REG_MIGRATE_INACTIVITY_TIMEOUT_MAX                         1023
+
+#define NR_REG_MIGRATE_MIN_LOCAL_SIZE                                 "migrate.min_local_size"
+#define NR_REG_MIGRATE_MIN_OVERLAP_SIZE                               "migrate.min_overlap_size"
+#define NR_REG_MIGRATE_RETRANSMIT_FREQUENCY                           "migrate.retransmit_frequency"
+#define NR_REG_MIGRATE_RETRIES                                        "migrate.retries"
+#define NR_MIGRATE_LOCATION_NUMBER_MIN                                0
+#define NR_MIGRATE_LOCATION_NUMBER_MAX                                255
+
+#define NR_REG_REVELATION_ENABLE                                      "revelation.enabled"
+#define NR_REG_REVELATION_MAX_PER_HOUR                                "revelation.max_per_hour"
+#define NR_REG_REVELATION_MAX_PER_HOUR_PER_PORTAL                     "revelation.max_per_hour_per_portal"
+
+/* Appliance-only: */
+#define NR_REG_SNMP_ENABLED                                           "snmp.enabled"
+#define NR_REG_CLOCK_TIMEZONE                                         "clock.timezone"
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/stats/nrstats.h
@@ -0,0 +1,118 @@
+/*
+ *
+ *    nrstats.h
+ *
+ *    $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/stats/nrstats.h,v $
+ *    $Revision: 1.4 $
+ *    $Date: 2007/06/26 22:37:55 $
+ *
+ *    API for keeping and sharing statistics
+ *
+ *    
+ *    Copyright (C) 2003-2005, Network Resonance, Inc.
+ *    Copyright (C) 2006, Network Resonance, Inc.
+ *    All Rights Reserved
+ *    
+ *    Redistribution and use in source and binary forms, with or without
+ *    modification, are permitted provided that the following conditions
+ *    are met:
+ *    
+ *    1. Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *    2. Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *    3. Neither the name of Network Resonance, Inc. nor the name of any
+ *       contributors to this software may be used to endorse or promote 
+ *       products derived from this software without specific prior written
+ *       permission.
+ *    
+ *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *    POSSIBILITY OF SUCH DAMAGE.
+ *    
+ *
+ */
+
+#ifndef __NRSTATS_H__
+#define __NRSTATS_H__
+
+#include <sys/types.h>
+#ifdef WIN32
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+#include <r_types.h>
+
+#ifndef CAPTURE_USER
+#define CAPTURE_USER "pcecap"
+#endif
+
+#define NR_MAX_STATS_TYPES         256   /* max number of stats objects */
+#define NR_MAX_STATS_TYPE_NAME     26
+
+typedef struct NR_stats_type_ {
+      char name[NR_MAX_STATS_TYPE_NAME];
+      int (*reset)(void *stats);
+      int (*print)(void *stats, char *stat_namespace, void (*output)(void *handle, const char *fmt, ...), void *handle);
+      int  (*get_lib_name)(char **libname);
+      unsigned int size;
+} NR_stats_type;
+
+typedef struct NR_stats_app_ {
+        time_t               last_counter_reset;
+        time_t               last_restart;
+        UINT8                total_restarts;
+        char                 version[64];
+} NR_stats_app;
+
+extern NR_stats_type *NR_stats_type_app;
+
+/* everything measured in bytes */
+typedef struct NR_stats_memory_ {
+        UINT8                current_size;
+        UINT8                max_size;
+        UINT8                in_use;
+        UINT8                in_use_max;         
+} NR_stats_memory;
+
+extern NR_stats_type *NR_stats_type_memory;
+
+/*  all functions below return 0 on success, else they return an
+ *  error code */
+
+/* if errprintf is null, warnings and errors will be sent to /dev/null */
+extern int NR_stats_startup(char *app_name, char *user_name, void (*errprintf)(void *handle, const char *fmt, ...), void *errhandle);
+extern int NR_stats_shutdown(void);
+#define NR_STATS_CREATE  (1<<0)
+extern int NR_stats_get(char *module_name, NR_stats_type *type, int flag, void **stats);
+extern int NR_stats_clear(void *stats);   /* zeroizes */
+extern int NR_stats_reset(void *stats);   /* zeros "speedometers" */
+extern int NR_stats_register(NR_stats_type *type);
+extern int NR_stats_acquire_mutex(void *stats);
+extern int NR_stats_release_mutex(void *stats);
+// TODO: should _get_names take an app_name argument (0==all)????
+extern int NR_stats_get_names(unsigned int *nnames, char ***names);
+extern int NR_stats_get_by_name(char *name, NR_stats_type **type, void **stats);
+extern int NR_stats_get_lib_name(void *stats, char **lib_name);
+extern int NR_stats_rmids(void);
+
+extern char *NR_prefix_to_stats_module(char *prefix);
+
+#define NR_INCREMENT_STAT(stat) do { \
+       stat++; if(stat>stat##_max) stat##_max=stat; \
+     } while (0)
+#define NR_UPDATE_STAT(stat,newval) do { \
+       stat=newval; if(stat>stat##_max) stat##_max=stat; \
+     } while (0)       
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/byteorder.c
@@ -0,0 +1,76 @@
+/**
+   byteorder.c
+
+   
+   Copyright (C) 2007, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@networkresonance.com  Wed May 16 16:46:00 PDT 2007
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: byteorder.c,v 1.2 2007/06/26 22:37:55 adamcain Exp $";
+
+#include "nr_common.h"
+#ifndef WIN32
+#include <arpa/inet.h>
+#endif
+#include "r_types.h"
+#include "byteorder.h"
+
+#define IS_BIG_ENDIAN (htonl(0x1) == 0x1)
+
+#define BYTE(n,i)   (((UCHAR*)&(n))[(i)])
+#define SWAP(n,x,y) tmp=BYTE((n),(x)), \
+                    BYTE((n),(x))=BYTE((n),(y)), \
+                    BYTE((n),(y))=tmp
+
+UINT8
+htonll(UINT8 hostlonglong)
+{
+    UINT8 netlonglong = hostlonglong;
+    UCHAR tmp;
+
+    if (!IS_BIG_ENDIAN) {
+        SWAP(netlonglong, 0, 7);
+        SWAP(netlonglong, 1, 6);
+        SWAP(netlonglong, 2, 5);
+        SWAP(netlonglong, 3, 4);
+    }
+
+    return netlonglong;
+}
+
+UINT8
+ntohll(UINT8 netlonglong)
+{
+    return htonll(netlonglong);
+}
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/byteorder.h
@@ -0,0 +1,47 @@
+/**
+   byteorder.h
+
+   
+   Copyright (C) 2007, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@networkresonance.com  Wed May 16 16:46:00 PDT 2007
+ */
+
+
+#ifndef _byteorder_h
+#define _byteorder_h
+
+UINT8 htonll(UINT8 hostlonglong);
+
+UINT8 ntohll(UINT8 netlonglong);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/hex.c
@@ -0,0 +1,110 @@
+/**
+   hex.c
+
+   
+   Copyright (C) 2001-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@network-resonance.com
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: hex.c,v 1.3 2007/06/26 22:37:56 adamcain Exp $";
+
+#include <sys/types.h>
+#include <string.h>
+#include <ctype.h>
+#include "r_common.h"
+#include "hex.h"
+#include "r_log.h"
+
+static char bin2hex_map[][3] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff" };
+
+static int hex2bin_map[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 /* '0' */, 1 /* '1' */, 2 /* '2' */, 3 /* '3' */, 4 /* '4' */, 5 /* '5' */, 6 /* '6' */, 7 /* '7' */, 8 /* '8' */, 9 /* '9' */, -1, -1, -1, -1, -1, -1, -1, 10 /* 'A' */, 11 /* 'B' */, 12 /* 'C' */, 13 /* 'D' */, 14 /* 'E' */, 15 /* 'F' */, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10 /* 'a' */, 11 /* 'b' */, 12 /* 'c' */, 13 /* 'd' */, 14 /* 'e' */, 15 /* 'f' */, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
+
+int
+nr_nbin2hex(UCHAR *bin, int binlen, char hex[], size_t size, int *len)
+{
+    int _status;
+    int i;
+
+    if (size < (2*binlen))
+        ABORT(R_BAD_ARGS);
+
+    for (i = 0; i < binlen; ++i) {
+        *hex++ = bin2hex_map[bin[i]][0]; 
+        *hex++ = bin2hex_map[bin[i]][1]; 
+    }
+
+    if (size >= (2*binlen)+1)
+        *hex = '\0';
+
+    *len = (2*binlen);
+
+    _status=0;
+  abort:
+    return(_status);
+}
+
+
+int
+nr_nhex2bin(char *hex, int hexlen, UCHAR bin[], size_t size, int *len)
+{
+    int _status;
+    int binlen;
+    int h1;
+    int h2;
+    int i;
+
+    if (hexlen % 2) 
+        ABORT(R_BAD_ARGS);
+
+    binlen = hexlen/2;
+ 
+    if (size < binlen)
+        ABORT(R_BAD_ARGS);
+
+    for (i = 0; i < binlen; ++i) {
+        h1 = hex2bin_map[(int)*hex++];
+        h2 = hex2bin_map[(int)*hex++];
+
+        if (h1 == -1 || h2 == -1)
+            ABORT(R_BAD_ARGS);
+
+        bin[i] = (h1 << 4) | h2; 
+    }
+
+    *len = binlen;
+
+    _status=0;
+  abort:
+    return(_status);
+}
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/hex.h
@@ -0,0 +1,47 @@
+/**
+   hex.h
+
+   
+   Copyright (C) 2001-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   briank@network-resonance.com
+ */
+
+
+#ifndef _hex_h
+#define _hex_h
+
+int nr_nbin2hex(UCHAR *bin, int binlen, char hex[], size_t size, int *len);
+int nr_nhex2bin(char *hex, int hexlen, UCHAR bin[], size_t size, int *len);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/assoc.h
@@ -0,0 +1,90 @@
+/**
+   assoc.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   assoc.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: assoc.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Sun Jan 17 17:56:35 1999
+ */
+
+
+#ifndef _assoc_h
+#define _assoc_h
+
+typedef struct assoc_ assoc;
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/debug.c
@@ -0,0 +1,131 @@
+/**
+   debug.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   debug.c
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: debug.c,v 1.3 2007/06/26 22:37:57 adamcain Exp $
+
+
+   ekr@rtfm.com  Wed Jan  6 17:08:58 1999
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: debug.c,v 1.3 2007/06/26 22:37:57 adamcain Exp $";
+
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "r_common.h"
+#include "debug.h"
+
+int nr_debug(int class,char *format,...)
+  {
+    va_list ap;
+
+    va_start(ap,format);
+#ifdef WIN32
+    vprintf(format,ap);
+    printf("\n");
+#else
+    vfprintf(stderr,format,ap);
+    fprintf(stderr,"\n");
+#endif
+    return(0);
+  }
+
+int nr_xdump(name,data,len)
+  char *name;
+  UCHAR *data;
+  int len;
+  {
+    int i;
+
+    if(name){
+      printf("%s[%d]=\n",name,len);
+    }
+    for(i=0;i<len;i++){
+      
+      if((len>8) && i && !(i%12)){
+        printf("\n"); 
+      }
+      printf("%.2x ",data[i]&255);
+    }
+    if(i%12)
+      printf("\n");
+    return(0);
+  }
+
+  
+  
+  
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/debug.h
@@ -0,0 +1,94 @@
+/**
+   debug.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   debug.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: debug.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Wed Jan  6 17:13:00 1999
+ */
+
+
+#ifndef _debug_h
+#define _debug_h
+
+// Remove debugging mess from ssldump
+// #define DBG(a)
+
+int nr_debug(int class,char *format,...);
+int nr_xdump(char *name,UCHAR *data, int len);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_assoc.c
@@ -0,0 +1,541 @@
+/**
+   r_assoc.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_assoc.c
+
+   This is an associative array implementation, using an open-chained
+   hash bucket technique.
+
+   Note that this implementation permits each data entry to have
+   separate copy constructors and destructors. This currently wastes
+   space, but could be implemented while saving space by using
+   the high order bit of the length value or somesuch.
+
+   The major problem with this code is it's not resizable, though it
+   could be made so.
+   
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_assoc.c,v 1.4 2007/06/08 17:41:49 adamcain Exp $
+
+   ekr@rtfm.com  Sun Jan 17 17:57:15 1999
+ */
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_assoc.c,v 1.4 2007/06/08 17:41:49 adamcain Exp $";
+
+#include <r_common.h>
+#include <string.h>
+#include "r_assoc.h"
+
+typedef struct r_assoc_el_ {
+     char *key;
+     int key_len;
+     void *data;
+     struct r_assoc_el_ *prev;
+     struct r_assoc_el_ *next;
+     int (*copy)(void **n,void *old);
+     int (*destroy)(void *ptr);
+} r_assoc_el;
+     
+struct r_assoc_ {
+     int size;
+     int bits;
+     int (*hash_func)(char *key,int len,int size);
+     r_assoc_el **chains;
+     UINT4 num_elements;
+};
+
+#define DEFAULT_TABLE_BITS 5
+
+static int destroy_assoc_chain(r_assoc_el *chain);
+static int r_assoc_fetch_bucket(r_assoc *assoc,
+  char *key,int len,r_assoc_el **bucketp);
+static int copy_assoc_chain(r_assoc_el **knewp, r_assoc_el *old);
+
+int r_assoc_create(assocp,hash_func,bits)
+  r_assoc **assocp;
+  int (*hash_func)(char *key,int len,int size);
+  int bits;
+  {
+    r_assoc *assoc=0;
+    int _status;
+    
+    if(!(assoc=(r_assoc *)RCALLOC(sizeof(r_assoc))))
+      ABORT(R_NO_MEMORY);
+    assoc->size=(1<<bits);
+    assoc->bits=bits;
+    assoc->hash_func=hash_func;
+    
+    if(!(assoc->chains=(r_assoc_el **)RCALLOC(sizeof(r_assoc_el *)*
+      assoc->size)))
+      ABORT(R_NO_MEMORY);
+
+    *assocp=assoc;
+    
+    _status=0;
+  abort:
+    if(_status){
+      r_assoc_destroy(&assoc);
+    }
+    return(_status);
+  }
+
+int r_assoc_destroy(assocp)
+  r_assoc **assocp;
+  {
+    r_assoc *assoc;
+    int i;
+	    
+    if(!assocp || !*assocp)
+      return(0);
+
+    assoc=*assocp;
+    for(i=0;i<assoc->size;i++)
+      destroy_assoc_chain(assoc->chains[i]);
+
+    RFREE(assoc->chains);
+    RFREE(*assocp);
+
+    return(0);
+  }
+
+static int destroy_assoc_chain(chain)
+  r_assoc_el *chain;
+  {
+    r_assoc_el *nxt;
+    
+    while(chain){
+      nxt=chain->next;
+
+      if(chain->destroy)
+	chain->destroy(chain->data);
+
+      RFREE(chain->key);
+      
+      RFREE(chain);
+      chain=nxt;
+    }
+
+    return(0);
+  }
+
+static int copy_assoc_chain(knewp,old)
+  r_assoc_el **knewp;
+  r_assoc_el *old;
+  {
+    r_assoc_el *knew=0,*ptr,*tmp;
+    int r,_status;
+
+    ptr=0; /* Pacify GCC's uninitialized warning.
+              It's not correct */
+    if(!old) {
+      *knewp=0;
+      return(0);
+    }
+    for(;old;old=old->next){
+      if(!(tmp=(r_assoc_el *)RCALLOC(sizeof(r_assoc_el))))
+	ABORT(R_NO_MEMORY);
+      
+      if(!knew){
+	knew=tmp;
+	ptr=knew;
+      }
+      else{
+	ptr->next=tmp;
+	tmp->prev=ptr;
+        ptr=tmp;
+      }
+
+      ptr->destroy=old->destroy;
+      ptr->copy=old->copy;
+	
+      if(old->copy){
+	if(r=old->copy(&ptr->data,old->data))
+	  ABORT(r);
+      }
+      else
+	ptr->data=old->data;
+
+      if(!(ptr->key=(char *)RMALLOC(old->key_len)))
+	ABORT(R_NO_MEMORY);
+      memcpy(ptr->key,old->key,ptr->key_len=old->key_len);
+    }
+
+    *knewp=knew;
+    
+    _status=0;
+  abort:
+    if(_status){
+      destroy_assoc_chain(knew);
+    }
+    return(_status);
+  }
+
+static int r_assoc_fetch_bucket(assoc,key,len,bucketp)
+  r_assoc *assoc;
+  char *key;
+  int len;
+  r_assoc_el **bucketp;
+  {
+    UINT4 hash_value;
+    r_assoc_el *bucket;
+    
+    hash_value=assoc->hash_func(key,len,assoc->bits);
+
+    for(bucket=assoc->chains[hash_value];bucket;bucket=bucket->next){
+      if(bucket->key_len == len && !memcmp(bucket->key,key,len)){
+	*bucketp=bucket;
+	return(0);
+      }
+    }
+
+    return(R_NOT_FOUND);
+  }
+
+int r_assoc_fetch(assoc,key,len,datap)
+  r_assoc *assoc;
+  char *key;
+  int len;
+  void **datap;
+  {
+    r_assoc_el *bucket;
+    int r;
+
+    if(r=r_assoc_fetch_bucket(assoc,key,len,&bucket)){
+      if(r!=R_NOT_FOUND)
+	ERETURN(r);
+      return(r);
+    }
+
+    *datap=bucket->data;
+    return(0);
+  }
+
+int r_assoc_insert(assoc,key,len,data,copy,destroy,how)
+  r_assoc *assoc;
+  char *key;
+  int len;
+  void *data;
+  int (*copy)(void **knew,void *old);
+  int (*destroy)(void *ptr);
+  int how;
+  {
+    r_assoc_el *bucket,*new_bucket=0;
+    int r,_status;
+    
+    if(r=r_assoc_fetch_bucket(assoc,key,len,&bucket)){
+      /*Note that we compute the hash value twice*/
+      UINT4 hash_value;
+
+      if(r!=R_NOT_FOUND)
+	ABORT(r);
+      hash_value=assoc->hash_func(key,len,assoc->bits);
+    
+      if(!(new_bucket=(r_assoc_el *)RCALLOC(sizeof(r_assoc_el))))
+	ABORT(R_NO_MEMORY);
+      if(!(new_bucket->key=(char *)RMALLOC(len)))
+	ABORT(R_NO_MEMORY);
+      memcpy(new_bucket->key,key,len);
+      new_bucket->key_len=len;
+      
+      /*Insert at the list head. Is FIFO a good algorithm?*/
+      if(assoc->chains[hash_value])
+        assoc->chains[hash_value]->prev=new_bucket;
+      new_bucket->next=assoc->chains[hash_value];
+      assoc->chains[hash_value]=new_bucket;
+      bucket=new_bucket;
+    }
+    else{
+      if(!(how&R_ASSOC_REPLACE))
+	ABORT(R_ALREADY);
+
+      if(bucket->destroy)
+	bucket->destroy(bucket->data);
+    }
+
+    bucket->data=data;
+    bucket->copy=copy;
+    bucket->destroy=destroy;
+    assoc->num_elements++;
+    
+    _status=0;
+  abort:
+    if(_status && new_bucket){
+      RFREE(new_bucket->key);
+      RFREE(new_bucket);
+    }
+    return(_status);
+  }
+
+int r_assoc_delete(assoc,key,len)
+  r_assoc *assoc;
+  char *key;
+  int len;
+  {
+    int r;
+    r_assoc_el *bucket;
+    UINT4 hash_value;
+
+    if(r=r_assoc_fetch_bucket(assoc,key,len,&bucket)){
+      if(r!=R_NOT_FOUND)
+	ERETURN(r);
+      return(r);
+    }
+
+    /* Now remove the element from the hash chain */
+    if(bucket->prev){
+      bucket->prev->next=bucket->next;
+    }
+    else {
+      hash_value=assoc->hash_func(key,len,assoc->bits);
+      assoc->chains[hash_value]=bucket->next;
+    }
+
+    if(bucket->next)
+      bucket->next->prev=bucket->prev;
+
+    /* Remove the data */
+    if(bucket->destroy)
+      bucket->destroy(bucket->data);
+    
+    RFREE(bucket->key);
+    RFREE(bucket);
+    assoc->num_elements--;
+    
+    return(0);
+  }
+
+int r_assoc_copy(knewp,old)
+  r_assoc **knewp;
+  r_assoc *old;
+  {
+    int r,_status,i;
+    r_assoc *knew;
+    
+    if(!(knew=(r_assoc *)RCALLOC(sizeof(r_assoc))))
+      ABORT(R_NO_MEMORY);
+    knew->size=old->size;
+    knew->bits=old->bits;
+    knew->hash_func=old->hash_func;
+    
+    if(!(knew->chains=(r_assoc_el **)RCALLOC(sizeof(r_assoc_el)*old->size)))
+      ABORT(R_NO_MEMORY);
+    for(i=0;i<knew->size;i++){
+      if(r=copy_assoc_chain(knew->chains+i,old->chains[i]))
+	ABORT(r);
+    }
+    knew->num_elements=old->num_elements;
+    
+    *knewp=knew;
+    
+    _status=0;
+  abort:
+    if(_status){
+      r_assoc_destroy(&knew);
+    }
+    return(_status);
+  }
+
+int r_assoc_num_elements(r_assoc *assoc,int *sizep)
+  {
+    *sizep=assoc->num_elements;
+
+    return(0);
+  }
+
+int r_assoc_init_iter(assoc,iter)
+  r_assoc *assoc;
+  r_assoc_iterator *iter;
+  {
+    int i;
+    
+    iter->assoc=assoc;
+    iter->prev_chain=-1;
+    iter->prev=0;
+
+    iter->next_chain=assoc->size;
+    iter->next=0;
+    
+    for(i=0;i<assoc->size;i++){
+      if(assoc->chains[i]!=0){
+	iter->next_chain=i;
+	iter->next=assoc->chains[i];
+	break;
+      }
+    }
+
+    return(0);
+  }
+
+int r_assoc_iter(iter,key,keyl,val)
+  r_assoc_iterator *iter;
+  void **key;
+  int *keyl;
+  void **val;
+  {
+    int i;
+    r_assoc_el *ret;
+    
+    if(!iter->next)
+      return(R_EOD);
+    ret=iter->next;
+
+    *key=ret->key;
+    *keyl=ret->key_len;
+    *val=ret->data;
+    
+    /* Now increment */
+    iter->prev_chain=iter->next_chain;
+    iter->prev=iter->next;
+
+    /* More on this chain */
+    if(iter->next->next){
+      iter->next=iter->next->next;
+    }
+    else{
+      iter->next=0;
+      
+      /* FInd the next occupied chain*/
+      for(i=iter->next_chain+1;i<iter->assoc->size;i++){
+	if(iter->assoc->chains[i]){
+	  iter->next_chain=i;
+	  iter->next=iter->assoc->chains[i];
+	  break;
+	}
+      }
+    }
+
+    return(0);
+  }
+
+/* Delete the last returned value*/
+int r_assoc_iter_delete(iter)
+  r_assoc_iterator *iter;
+  {
+    /* First unhook it from the list*/
+    if(!iter->prev->prev){
+      /* First element*/
+      iter->assoc->chains[iter->prev_chain]=iter->prev->next;
+    }
+    else{
+      iter->prev->prev->next=iter->prev->next;
+    }
+
+    if(iter->prev->next){
+      iter->prev->next->prev=iter->prev->prev;
+    }
+
+    if (iter->prev->destroy)
+      iter->prev->destroy(iter->prev->data);
+    
+    iter->assoc->num_elements--;
+    RFREE(iter->prev->key);
+    RFREE(iter->prev);
+    return(0);
+  }
+    
+    
+/*This is a hack from AMS. Supposedly, it's pretty good for strings, even
+ though it doesn't take into account all the data*/
+int r_assoc_simple_hash_compute(key,len,bits)
+  char *key;
+  int len;
+  int bits;
+  {
+    UINT4 h=0;
+
+    h=key[0] +(key[len-1] * len);
+
+    h &= (1<<bits) - 1;
+
+    return(h);
+  }
+
+
+int r_crc32(char *data,int len,UINT4 *crcval);
+
+int r_assoc_crc32_hash_compute(data,len,bits)
+  char *data;
+  int len;
+  int bits;
+  {
+    UINT4 res;
+    UINT4 mask;
+    
+    /* First compute the CRC value */
+    if(r_crc32(data,len,&res))
+      ERETURN(R_INTERNAL);
+
+    mask=~(0xffffffff<<bits);
+
+    return(res & mask);
+  }
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_assoc.h
@@ -0,0 +1,126 @@
+/**
+   r_assoc.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_assoc.h
+
+   Associative array code. This code has the advantage that different
+   elements can have different create and destroy operators. Unfortunately,
+   this can waste space.
+   
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_assoc.h,v 1.3 2007/06/08 22:16:08 adamcain Exp $
+
+
+   ekr@rtfm.com  Sun Jan 17 17:57:18 1999
+ */
+
+
+#ifndef _r_assoc_h
+#define _r_assoc_h
+
+typedef struct r_assoc_ r_assoc;
+
+int r_assoc_create(r_assoc **assocp,
+                             int (*hash_func)(char *,int,int),
+                             int bits);
+int r_assoc_insert(r_assoc *assoc,char *key,int len,
+  void *value,int (*copy)(void **knew,void *old),
+  int (*destroy)(void *ptr),int how);
+#define R_ASSOC_REPLACE		  0x1
+#define R_ASSOC_NEW		  0x2
+
+int r_assoc_fetch(r_assoc *assoc,char *key, int len, void **value);
+int r_assoc_delete(r_assoc *assoc,char *key, int len);
+
+int r_assoc_copy(r_assoc **knew,r_assoc *old);
+int r_assoc_destroy(r_assoc **assocp);
+int r_assoc_simple_hash_compute(char *key, int len,int bits);
+int r_assoc_crc32_hash_compute(char *key, int len,int bits);
+
+/*We need iterators, but I haven't written them yet*/
+typedef struct r_assoc_iterator_ {
+     r_assoc *assoc;
+     int prev_chain;
+     struct r_assoc_el_ *prev;
+     int next_chain;
+     struct r_assoc_el_ *next;
+} r_assoc_iterator;
+
+int r_assoc_init_iter(r_assoc *assoc,r_assoc_iterator *);
+int r_assoc_iter(r_assoc_iterator *iter,void **key,int *keyl, void **val);
+int r_assoc_iter_delete(r_assoc_iterator *);
+
+int r_assoc_num_elements(r_assoc *assoc,int *sizep);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_bitfield.c
@@ -0,0 +1,152 @@
+/**
+   r_bitfield.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_bitfield.c
+
+   Copyright (C) 2001 RTFM, Inc.
+   All Rights Reserved.
+
+   ekr@rtfm.com  Wed Oct  3 11:15:23 2001
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_bitfield.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $";
+
+#include <string.h>
+#include <r_common.h>
+#include <string.h>
+#include "r_bitfield.h"
+
+int r_bitfield_create(setp,size)
+  r_bitfield **setp;
+  UINT4 size;
+  {
+    r_bitfield *set=0;
+    int _status;
+    int num_words=size/32+!!(size%32);
+    
+    if(!(set=(r_bitfield *)RMALLOC(sizeof(r_bitfield))))
+      ABORT(R_NO_MEMORY);
+
+    if(!(set->data=(UINT4 *)RMALLOC(num_words*4)))
+      ABORT(R_NO_MEMORY);
+    memset(set->data,0,4*num_words);
+    
+    set->base=0;
+    set->len=num_words;
+
+    *setp=set;
+    
+    _status=0;
+  abort:
+    if(_status){
+      r_bitfield_destroy(&set);
+    }
+    return(_status);
+  }
+
+int r_bitfield_destroy(setp)
+  r_bitfield **setp;
+  {
+    r_bitfield *set;
+    
+    if(!setp || !*setp)
+      return(0);
+
+    set=*setp;
+
+    RFREE(set->data);
+    RFREE(set);
+
+    *setp=0;
+    return(0);
+  }
+
+int r_bitfield_set(set,bit)
+  r_bitfield *set;
+  int bit;
+  {
+    int word=(bit-set->base)/32;
+    int bbit=(bit-set->base)%32;
+    int _status;
+
+    /* Resize? */
+    if(word>set->len){
+      UINT4 newlen=set->len;
+      UINT4 *tmp;
+      
+      while(newlen<word)
+	newlen*=2;
+      
+      if(!(tmp=(UINT4 *)RMALLOC(newlen)))
+	ABORT(R_NO_MEMORY);
+      
+      memcpy(tmp,set->data,set->len*4);
+      memset(tmp+set->len*4,0,(newlen-set->len)*4);
+
+      RFREE(set->data);
+      set->data=tmp;
+    }
+
+    set->data[word]|=1<<bbit;
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int r_bitfield_isset(set,bit)
+  r_bitfield *set;
+  int bit;
+  {
+    int word=(bit-set->base)/32;
+    int bbit=(bit-set->base)%32;
+    int _status;
+
+    if(bit<set->base)
+      return(0);
+
+    /* Resize? */
+    if(word>set->len)
+      return(0);
+
+    return(set->data[word]&(1<<bbit));
+
+    _status=0;
+    return(_status);
+  }
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_bitfield.h
@@ -0,0 +1,63 @@
+/**
+   r_bitfield.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_bitfield.h
+
+   Copyright (C) 2001 RTFM, Inc.
+   All Rights Reserved.
+
+   ekr@rtfm.com  Wed Oct  3 10:43:50 2001
+ */
+
+
+#ifndef _r_bitfield_h
+#define _r_bitfield_h
+
+typedef struct r_bitfield_ {
+     UINT4 *data;
+     UINT4 len;
+     UINT4 base;
+} r_bitfield;
+
+int r_bitfield_set(r_bitfield *,int bit);
+int r_bitfield_isset(r_bitfield *,int bit);
+int r_bitfield_create(r_bitfield **setp,UINT4 size);
+int r_bitfield_destroy(r_bitfield **setp);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_common.h
@@ -0,0 +1,100 @@
+/**
+   r_common.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_common.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_common.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Dec 22 10:40:07 1998
+ */
+
+
+#ifndef _r_common_h
+#define _r_common_h
+
+#include "r_defaults.h"
+#include "r_includes.h"
+#include "r_types.h"
+#include "r_macros.h"
+#include "r_errors.h"
+#include "r_data.h"
+
+/* defines for possibly replaced functions */
+#ifndef HAVE_STRDUP
+char *strdup(char *in);
+#endif
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c
@@ -0,0 +1,177 @@
+/**
+   r_crc32.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   crc32.c
+
+   Copyright (C) 2003, RTFM, Inc.
+   All Rights Reserved.
+
+   ekr@rtfm.com  Fri Jan 31 13:57:43 2003
+
+   THE FOLLOWING CODE WAS EXTRACTED FROM FreeBSD
+   The comment below was the original header
+
+   The main function was modified to process a buffer
+   rather than a file
+ */
+
+/*
+ * This code implements the AUTODIN II polynomial used by Ethernet,
+ * and can be used to calculate multicast address hash indices.
+ * It assumes that the low order bits will be transmitted first,
+ * and consequently the low byte should be sent first when
+ * the crc computation is finished.  The crc should be complemented
+ * before transmission.
+ * The variable corresponding to the macro argument "crc" should
+ * be an unsigned long and should be preset to all ones for Ethernet
+ * use.  An error-free packet will leave 0xDEBB20E3 in the crc.
+ *			Spencer Garrett <srg@quick.com>
+ */
+
+
+#include <sys/types.h>
+#include <r_types.h>
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_crc32.c,v 1.4 2008/11/26 03:22:02 adamcain Exp $";
+
+#ifdef WIN32
+#define u_int32_t  UINT4
+#endif
+
+#define CRC(crc, ch)	 (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
+
+/* generated using the AUTODIN II polynomial
+ *	x^32 + x^26 + x^23 + x^22 + x^16 +
+ *	x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
+ */
+static const u_int32_t crctab[256] = {
+	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
+	0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+	0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+	0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
+	0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+	0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+	0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
+	0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
+	0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+	0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+	0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
+	0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
+	0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+	0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+	0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
+	0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+	0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+	0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+	0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
+	0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
+	0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+	0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+	0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+	0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+	0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+	0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
+	0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+	0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+	0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+	0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
+	0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+	0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
+	0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+	0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+	0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+	0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
+	0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+	0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
+	0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+	0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+	0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+	0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
+	0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+	0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+	0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+	0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+	0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+	0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
+	0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+	0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
+	0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+	0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
+};
+
+#include <stdio.h>
+#include <sys/types.h>
+
+
+int r_crc32 (char *buf,int dlen,u_int32_t *cval);
+
+int
+r_crc32(buf, dlen, cval)
+  char *buf;
+  int dlen;
+  u_int32_t *cval;
+{
+    u_int32_t crc = ~0;
+    char *p ;
+    int i;
+    u_int32_t crc32_total = 0 ;
+
+    p=buf;
+    
+    for(i=0;i<dlen;i++){
+      CRC(crc, *p) ;
+      CRC(crc32_total, *p) ;
+      p++;
+    }
+    
+    *cval = ~crc ;
+    
+    return 0 ;
+}
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.h
@@ -0,0 +1,14 @@
+/**
+   r_crc32.h
+
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   All Rights Reserved.
+
+ */
+
+#ifndef _r_crc32_
+#define _r_crc32_
+
+int r_crc32 (char *buf,int dlen, UINT4 *cval);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_data.c
@@ -0,0 +1,249 @@
+/**
+   r_data.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_data.c
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_data.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+   ekr@rtfm.com  Tue Aug 17 15:39:50 1999
+ */
+
+
+static char *RCSSTRING __UNUSED__ =(char *)"$Id: r_data.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $";
+
+#include <string.h>
+#include <r_common.h>
+#include <r_data.h>
+#include <string.h>
+
+int r_data_create(dp,d,l)
+  Data **dp;
+  UCHAR *d;
+  int l;
+  {
+    Data *d_=0;
+    int _status;
+    
+    if(!(d_=(Data *)RCALLOC(sizeof(Data))))
+      ABORT(R_NO_MEMORY);
+    if(!(d_->data=(UCHAR *)RMALLOC(l)))
+      ABORT(R_NO_MEMORY);
+
+    memcpy(d_->data,d,l);
+    d_->len=l;
+
+    *dp=d_;
+
+    _status=0;
+  abort:
+    if(_status)
+      r_data_destroy(&d_);
+
+    return(_status);
+  }
+
+
+int r_data_alloc_mem(d,l)
+  Data *d;
+  int l;
+  {
+    int _status;
+    
+    if(!(d->data=(UCHAR *)RMALLOC(l)))
+      ABORT(R_NO_MEMORY);
+    d->len=l;
+    
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int r_data_alloc(dp,l)
+  Data **dp;
+  int l;
+  {
+    Data *d_=0;
+    int _status;
+    
+    if(!(d_=(Data *)RCALLOC(sizeof(Data))))
+      ABORT(R_NO_MEMORY);
+    if(!(d_->data=(UCHAR *)RCALLOC(l)))
+      ABORT(R_NO_MEMORY);
+
+    d_->len=l;
+    
+    *dp=d_;
+    _status=0;
+  abort:
+    if(_status)
+      r_data_destroy(&d_);
+
+    return(_status);
+  }
+
+int r_data_make(dp,d,l)
+  Data *dp;
+  UCHAR *d;
+  int l;
+  {
+    if(!(dp->data=(UCHAR *)RMALLOC(l)))
+      ERETURN(R_NO_MEMORY);
+
+    memcpy(dp->data,d,l);
+    dp->len=l;
+
+    return(0);
+  }
+  
+int r_data_destroy(dp)
+  Data **dp;
+  {
+    if(!dp || !*dp)
+      return(0);
+
+    if((*dp)->data)
+      RFREE((*dp)->data);
+
+    RFREE(*dp);
+    *dp=0;
+
+    return(0);
+  }
+
+int r_data_destroy_v(v)
+  void *v;
+  {
+    Data *d;
+    
+    if(!v)
+      return(0);
+
+    d=(Data *)v;
+    r_data_zfree(d);
+
+    RFREE(d);
+
+    return(0);
+  }
+
+int r_data_destroy_vp(v)
+  void **v;
+  {
+    Data *d;
+    
+    if(!v || !*v)
+      return(0);
+
+    d=(Data *)*v;
+    r_data_zfree(d);
+
+    *v=0;
+    RFREE(d);
+
+    return(0);
+  }
+
+int r_data_copy(dst,src)
+  Data *dst;
+  Data *src;
+  {
+    if(!(dst->data=(UCHAR *)RMALLOC(src->len)))
+      ERETURN(R_NO_MEMORY);
+    memcpy(dst->data,src->data,dst->len=src->len);
+    return(0);
+  }
+
+int r_data_zfree(d)
+  Data *d;
+  {
+    if(!d)
+      return(0);
+    if(!d->data)
+      return(0);
+    memset(d->data,0,d->len);
+    RFREE(d->data);
+    return(0);
+  }
+
+int r_data_compare(d1,d2)
+  Data *d1;
+  Data *d2;
+  {
+    if(d1->len<d2->len)
+      return(-1);
+    if(d2->len<d1->len)
+      return(-1);
+    return(memcmp(d1->data,d2->data,d1->len));
+  }
+  
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_data.h
@@ -0,0 +1,108 @@
+/**
+   r_data.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_data.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_data.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Wed Feb 10 14:18:19 1999
+ */
+
+
+#ifndef _r_data_h
+#define _r_data_h
+
+typedef struct Data_ {
+     UCHAR *data;
+     int len;
+} Data;
+
+int r_data_create(Data **dp,UCHAR *d,int l);
+int r_data_alloc(Data **dp, int l);
+int r_data_make(Data *dp, UCHAR *d,int l);
+int r_data_alloc_mem(Data *d,int l);
+int r_data_destroy(Data **dp);
+int r_data_destroy_v(void *v);
+int r_data_destroy_vp(void **vp);
+int r_data_copy(Data *dst,Data *src);
+int r_data_zfree(Data *d);
+int r_data_compare(Data *d1,Data *d2);
+
+#define INIT_DATA(a,b,c) (a).data=b; (a).len=c
+#define ATTACH_DATA(a,b) (a).data=b; (a).len=sizeof(b)
+#define ZERO_DATA(a) (a).data=0; (a).len=0
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_defaults.h
@@ -0,0 +1,91 @@
+/**
+   r_defaults.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_defaults.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_defaults.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Dec 22 10:39:14 1998
+ */
+
+
+#ifndef _r_defaults_h
+#define _r_defaults_h
+
+/*The needs defines don't belong here*/
+#define R_NEEDS_STDLIB_H
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.c
@@ -0,0 +1,139 @@
+/**
+   r_errors.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_errors.c
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_errors.c,v 1.5 2008/11/26 03:22:02 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Feb 16 16:37:05 1999
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_errors.c,v 1.5 2008/11/26 03:22:02 adamcain Exp $";
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include "r_common.h"
+#include "r_errors.h"
+
+static struct {
+    int    errnum;
+    char  *str;
+} errors[] = NR_ERROR_MAPPING;  
+
+int nr_verr_exit(char *fmt,...)
+  {
+    va_list ap;
+
+    va_start(ap,fmt);
+    vfprintf(stderr,fmt,ap);
+
+    if (fmt[0] != '\0' && fmt[strlen(fmt)-1] != '\n')
+        fprintf(stderr,"\n");
+
+    exit(1);
+  }
+
+char *
+nr_strerror(int errnum)
+{
+    static char unknown_error[256];
+    int i;
+    char *error = 0;
+
+    for (i = 0; i < sizeof(errors)/sizeof(*errors); ++i) {
+        if (errnum == errors[i].errnum) {
+            error = errors[i].str;
+            break;
+        }
+    }
+
+    if (! error) {
+        snprintf(unknown_error, sizeof(unknown_error), "Unknown error: %d", errnum);
+        error = unknown_error;
+    }
+
+    return error;
+}
+
+int
+nr_strerror_r(int errnum, char *strerrbuf, size_t buflen)
+{
+    char *error = nr_strerror(errnum);
+    snprintf(strerrbuf, buflen, "%s", error);
+    return 0;
+}
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.h
@@ -0,0 +1,127 @@
+/**
+   r_errors.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_errors.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_errors.h,v 1.4 2007/10/12 20:53:24 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Dec 22 10:59:49 1998
+ */
+
+
+#ifndef _r_errors_h
+#define _r_errors_h
+
+#define R_NO_MEMORY      1 /*out of memory*/
+#define R_NOT_FOUND	 2 /*Item not found*/
+#define R_INTERNAL	 3 /*Unspecified internal error*/
+#define R_ALREADY	 4 /*Action already done*/
+#define R_EOD            5 /*end of data*/
+#define R_BAD_ARGS       6 /*Bad arguments*/
+#define R_BAD_DATA	 7 /*Bad data*/
+#define R_WOULDBLOCK     8 /*Operation would block */
+#define R_QUEUED         9 /*Operation was queued */
+#define R_FAILED        10 /*Operation failed */
+#define R_REJECTED      11 /* We don't care about this */
+#define R_INTERRUPTED   12 /* Operation interrupted */
+#define R_IO_ERROR      13 /* I/O Error */
+#define R_NOT_PERMITTED 14 /* Permission denied */
+#define R_RETRY         15 /* Retry possible */
+
+#define NR_ERROR_MAPPING {\
+    { R_NO_MEMORY,        "Cannot allocate memory" },\
+    { R_NOT_FOUND,        "Item not found" },\
+    { R_INTERNAL,         "Internal failure" },\
+    { R_ALREADY,          "Action already performed" },\
+    { R_EOD,              "End of data" },\
+    { R_BAD_ARGS,         "Invalid argument" },\
+    { R_BAD_DATA,         "Invalid data" },\
+    { R_WOULDBLOCK,       "Operation would block" },\
+    { R_QUEUED,           "Operation queued" },\
+    { R_FAILED,           "Operation failed" },\
+    { R_REJECTED,         "Operation rejected" },\
+    { R_INTERRUPTED,      "Operation interrupted" },\
+    { R_IO_ERROR,         "I/O error" },\
+    { R_NOT_PERMITTED,    "Permission Denied" },\
+    { R_RETRY,            "Retry may be possible" },\
+    }
+
+int nr_verr_exit(char *fmt,...);
+
+char *nr_strerror(int errnum);
+int   nr_strerror_r(int errnum, char *strerrbuf, size_t buflen);
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_includes.h
@@ -0,0 +1,98 @@
+/**
+   r_includes.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_includes.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_includes.h,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Dec 22 11:38:50 1998
+ */
+
+
+#ifndef _r_includes_h
+#define _r_includes_h
+
+#ifdef R_NEEDS_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef R_NEEDS_MEMORY_H
+#include <memory.h>
+#endif
+
+#include <stdio.h>
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_list.c
@@ -0,0 +1,276 @@
+/**
+   r_list.c
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_list.c
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_list.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Jan 19 08:36:39 1999
+ */
+
+
+static char *RCSSTRING __UNUSED__ ="$Id: r_list.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $";
+
+#include <r_common.h>
+#include "r_list.h"
+
+typedef struct r_list_el_ {
+     void *data;
+     struct r_list_el_ *next;
+     struct r_list_el_ *prev;
+     int (*copy)(void **new,void *old);
+     int (*destroy)(void **ptr);
+} r_list_el;
+
+struct r_list_ {
+     struct r_list_el_ *first;
+     struct r_list_el_ *last;
+};
+
+int r_list_create(listp)
+  r_list **listp;
+  {
+    r_list *list=0;
+    int _status;
+
+    if(!(list=(r_list *)RCALLOC(sizeof(r_list))))
+      ABORT(R_NO_MEMORY);
+
+    list->first=0;
+    list->last=0;
+    *listp=list;
+    
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int r_list_destroy(listp)
+  r_list **listp;
+  {
+    r_list *list;
+    r_list_el *el;
+    
+    if(!listp || !*listp)
+      return(0);
+    list=*listp;
+
+    el=list->first;
+    
+    while(el){
+      r_list_el *el_t;
+      
+      if(el->destroy && el->data)
+        el->destroy(&el->data);
+      el_t=el;
+      el=el->next;
+      RFREE(el_t);
+    }
+
+    RFREE(list);
+    *listp=0;
+      
+    return(0);
+  }
+    
+int r_list_copy(outp,in)
+  r_list**outp;
+  r_list *in;
+  {
+    r_list *out=0;
+    r_list_el *el,*el2,*last=0;
+    int r, _status;
+
+    if(!in){
+      *outp=0;
+      return(0);
+    }
+
+    if(r=r_list_create(&out))
+      ABORT(r);
+
+    for(el=in->first;el;el=el->next){
+      if(!(el2=(r_list_el *)RCALLOC(sizeof(r_list_el))))
+        ABORT(R_NO_MEMORY);
+
+      if(el->copy && el->data){
+        if(r=el->copy(&el2->data,el->data))
+          ABORT(r);
+      }
+
+      el2->copy=el->copy;
+      el2->destroy=el->destroy;
+
+      if(!(out->first))
+        out->first=el2;
+
+      el2->prev=last;
+      if(last) last->next=el2;
+      last=el2;
+    }
+
+    out->last=last;
+
+    *outp=out;
+    
+    _status=0;
+  abort:
+    if(_status)
+      r_list_destroy(&out);
+    return(_status);
+  }
+
+int r_list_insert(list,value,copy,destroy)
+  r_list *list;
+  void *value;
+  int (*copy)(void **out, void *in);
+  int (*destroy)(void **val);
+  {
+    r_list_el *el=0;
+    int _status;
+    
+    if(!(el=(r_list_el *)RCALLOC(sizeof(r_list_el))))
+      ABORT(R_NO_MEMORY);
+    el->data=value;
+    el->copy=copy;
+    el->destroy=destroy;
+
+    el->prev=0;
+    el->next=list->first;
+    if(list->first){
+      list->first->prev=el;
+    }
+    list->first=el;
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int r_list_append(list,value,copy,destroy)
+  r_list *list;
+  void *value;
+  int (*copy)(void **out, void *in);
+  int (*destroy)(void **val);
+  {
+    r_list_el *el=0;
+    int _status;
+    
+    if(!(el=(r_list_el *)RCALLOC(sizeof(r_list_el))))
+      ABORT(R_NO_MEMORY);
+    el->data=value;
+    el->copy=copy;
+    el->destroy=destroy;
+
+    el->prev=list->last;
+    el->next=0;
+    
+    if(list->last) list->last->next=el;
+    else list->first=el;
+    
+    list->last=el;
+
+    _status=0;
+  abort:
+    return(_status);
+  }
+
+int r_list_init_iter(list,iter)
+  r_list *list;
+  r_list_iterator *iter;
+  {
+    iter->list=list;
+    iter->ptr=list->first;
+
+    return(0);
+  }
+
+int r_list_iter(iter,val)
+  r_list_iterator *iter;
+  void **val;
+  {
+    if(!iter->ptr)
+      return(R_EOD);
+
+    *val=iter->ptr->data;
+    iter->ptr=iter->ptr->next;
+    
+    return(0);
+  }
+
+    
+      
+    
+    
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_list.h
@@ -0,0 +1,106 @@
+/**
+   r_list.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_list.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_list.h,v 1.3 2007/06/08 17:41:49 adamcain Exp $
+
+
+   ekr@rtfm.com  Tue Jan 19 08:36:48 1999
+ */
+
+
+#ifndef _r_list_h
+#define _r_list_h
+
+typedef struct r_list_ r_list;
+
+typedef struct r_list_iterator_ {
+     r_list *list;
+     struct r_list_el_ *ptr;
+} r_list_iterator;
+
+int r_list_create(r_list **listp);
+int r_list_destroy(r_list **listp);
+int r_list_copy(r_list **out,r_list *in);
+int r_list_insert(r_list *list,void *value,
+  int (*copy)(void **knew,void *old),
+  int (*destroy)(void **ptr));  
+int r_list_append(r_list *list,void *value,
+  int (*copy)(void **knew,void *old),
+  int (*destroy)(void **ptr));
+int r_list_init_iter(r_list *list,r_list_iterator *iter);
+int r_list_iter(r_list_iterator *iter,void **val);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h
@@ -0,0 +1,137 @@
+/**
+   r_macros.h
+
+   
+   Copyright (C) 2002-2003, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+ */
+
+/**
+   r_macros.h
+
+
+   Copyright (C) 1999-2000 RTFM, Inc.
+   All Rights Reserved
+
+   This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
+   <ekr@rtfm.com> and licensed by RTFM, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. All advertising materials mentioning features or use of this software
+      must display the following acknowledgement:
+   
+      This product includes software developed by Eric Rescorla for
+      RTFM, Inc.
+
+   4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
+      used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
+
+   $Id: r_macros.h,v 1.3 2007/06/26 22:37:57 adamcain Exp $
+
+   ekr@rtfm.com  Tue Dec 22 10:37:32 1998
+ */
+
+
+#ifndef _r_macros_h
+#define _r_macros_h
+
+/* Haven't removed all PROTO_LIST defs yet */
+#define PROTO_LIST(a) a
+
+#ifndef WIN32
+#ifndef __GNUC__
+#define __FUNCTION__ "unknown"
+#endif
+#endif
+
+#ifdef R_TRACE_ERRORS
+#ifdef WIN32
+#define REPORT_ERROR_(caller,a) printf("%s: error %d at %s:%d (function %s)\n", \
+	caller,a,__FILE__,__LINE__,__FUNCTION__)
+#else
+#define REPORT_ERROR_(caller,a) fprintf(stderr,"%s: error %d at %s:%d (function %s)\n", \
+	caller,a,__FILE__,__LINE__,__FUNCTION__)
+#endif
+#else
+#define REPORT_ERROR_(caller,a)
+#endif  
+
+#ifndef ERETURN
+#define ERETURN(a) do {int _r=a; if(!_r) _r=-1; REPORT_ERROR_("ERETURN",_r); return(_r);} while(0)
+#endif
+
+#ifndef ABORT
+#define ABORT(a) do { int _r=a; if(!_r) _r=-1; REPORT_ERROR_("ABORT",_r); _status=_r; goto abort;} while(0)
+#endif
+
+#ifndef FREE
+#define FREE(a) if(a) free(a)
+#endif
+#ifndef MIN
+#define MIN(a,b) ((a)>(b))?(b):(a)
+#endif
+
+#ifndef MAX
+#define MAX(a,b) ((b)>(a))?(b):(a)
+#endif
+
+#ifdef DEBUG
+#define DBG(a) debug a
+int debug(int cls, char *format,...);
+#else
+#define DBG(a)
+#endif
+
+#define UNIMPLEMENTED do { fprintf(stderr,"%s:%d Function %s unimplemented\n",__FILE__,__LINE__,__FUNCTION__); abort(); } while(0)
+
+#include "r_memory.h"
+
+#endif 
new file mode 100644
--- /dev/null
+++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_memory.c
@@ -0,0 +1,201 @@
+/**
+   r_memory.c
+
+   
+   Copyright (C) 2004, Network Resonance, Inc.
+   Copyright (C) 2006, Network Resonance, Inc.
+   All Rights Reserved
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of Network Resonance, Inc. nor the name of any
+      contributors to this software may be used to endorse or promote 
+      products derived from this software without specific prior written
+      permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   
+
+   ekr@rtfm.com  Thu Apr 22 20:40:45 2004
+ */
+
+
+static char *RCSSTRING __UNUSED__="$Id: r_memory.c,v 1.2 2006/08/16 19:39:17 adamcain Exp $";
+
+#include <string.h>
+#include <s