diff --git a/vlib-api/vlibmemory/api.h b/vlib-api/vlibmemory/api.h
new file mode 100644
index 0000000..7f2f6fa
--- /dev/null
+++ b/vlib-api/vlibmemory/api.h
@@ -0,0 +1,139 @@
+/*
+ *------------------------------------------------------------------
+ * api.h
+ * 
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#ifndef included_vlibmemory_api_h
+#define included_vlibmemory_api_h
+
+#include <vppinfra/error.h>
+#include <svm.h>
+#include <vlib/vlib.h>
+#include <vlibmemory/unix_shared_memory_queue.h>
+#include <vlib/unix/unix.h>
+#include <vlibapi/api.h>
+
+/* Allocated in shared memory */
+
+/*
+ * Ring-allocation scheme for client API messages 
+ * 
+ * Only one proc/thread has control of a given message buffer. 
+ * To free a buffer allocated from one of these rings, we clear 
+ * a field in the buffer (header), and leave. 
+ * 
+ * No locks, no hits, no errors...
+ */
+typedef struct ring_alloc_ {
+    unix_shared_memory_queue_t *rp;
+    u16 size;
+    u16 nitems;
+    u32 hits;
+    u32 misses;
+} ring_alloc_t;
+
+/*
+ * Initializers for the (shared-memory) rings
+ * _(size, n). Note: each msg has an 8 byte header.
+ * Might want to change that to an index sometime.
+ */
+#define foreach_vl_aring_size                   \
+_(64+8, 1024)                                   \
+_(256+8, 128)                                   \
+_(1024+8, 64)
+
+#define foreach_clnt_aring_size                 \
+_(1024+8, 1024)                                 \
+_(2048+8, 128)                                  \
+_(4096+8, 8)
+
+typedef struct vl_shmem_hdr_ {
+    int version;
+
+    /* getpid () for the VLIB client process */
+    volatile int vl_pid;
+
+    /* Client sends VLIB msgs here. */
+    unix_shared_memory_queue_t *vl_input_queue;
+
+    /* Vector of rings; one for each size. */
+
+    /* VLIB allocates buffers to send msgs to clients here. */
+    ring_alloc_t *vl_rings;
+
+    /* Clients allocate buffer to send msgs to VLIB here. */
+    ring_alloc_t *client_rings;
+
+    /* Number of detected application restarts */
+    u32 application_restarts;
+
+    /* Number of messages reclaimed during application restart */
+    u32 restart_reclaims;
+
+} vl_shmem_hdr_t;
+
+#define VL_SHM_VERSION 2
+
+#define VL_API_EPOCH_MASK 0xFF
+#define VL_API_EPOCH_SHIFT 8
+
+static inline u32 vl_msg_api_handle_get_epoch (u32 index)
+{
+    return (index & VL_API_EPOCH_MASK);
+}
+static inline u32 vl_msg_api_handle_get_index (u32 index)
+{
+    return (index >> VL_API_EPOCH_SHIFT);
+}
+
+static inline u32 vl_msg_api_handle_from_index_and_epoch (u32 index, u32 epoch)
+{
+    u32 handle;
+    ASSERT (index < 0x00FFFFFF);
+
+    handle = (index<<VL_API_EPOCH_SHIFT) | (epoch & VL_API_EPOCH_MASK);
+    return handle;
+}
+    
+
+
+void *vl_msg_api_alloc(int nbytes);
+void *vl_msg_api_alloc_as_if_client (int nbytes);
+void vl_msg_api_free(void *a);
+int vl_map_shmem (char *region_name, int is_vlib);
+void vl_register_mapped_shmem_region(svm_region_t *rp);
+void vl_unmap_shmem (void);
+void vl_msg_api_send_shmem (unix_shared_memory_queue_t *q, u8 *elem);
+void vl_msg_api_send_shmem_nolock (unix_shared_memory_queue_t *q, u8 *elem);
+void vl_msg_api_send (vl_api_registration_t *rp, u8 *elem);
+int vl_client_connect (char *name, int ctx_quota, int input_queue_size);
+void vl_client_disconnect (void);
+unix_shared_memory_queue_t *vl_api_client_index_to_input_queue (u32 index);
+vl_api_registration_t *vl_api_client_index_to_registration (u32 index);
+int vl_client_api_map (char *region_name);
+void vl_client_api_unmap (void);
+void vl_set_memory_region_name (char *name);
+void vl_set_memory_root_path (char *root_path);
+void vl_enable_disable_memory_api (vlib_main_t *vm, int yesno);
+void vl_client_disconnect_from_vlib (void);
+int vl_client_connect_to_vlib(char *svm_name, char *client_name, 
+                              int rx_queue_size);
+int vl_client_connect_to_vlib_no_rx_pthread (char *svm_name, char *client_name, 
+                                             int rx_queue_size);
+u16 vl_client_get_first_plugin_msg_id (char * plugin_name);
+
+#endif /* included_vlibmemory_api_h */
diff --git a/vlib-api/vlibmemory/memclnt.api b/vlib-api/vlibmemory/memclnt.api
new file mode 100644
index 0000000..6a108b8
--- /dev/null
+++ b/vlib-api/vlibmemory/memclnt.api
@@ -0,0 +1,110 @@
+/* Hey Emacs use -*- mode: C -*- */
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ *------------------------------------------------------------------
+ * memclnt.api - API message(s) to hook up clients, pass traffic
+ * to client processes on the same system element
+ * 
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+/*
+ * Create a client registration 
+ */
+manual_print 
+define memclnt_create {
+    i32 ctx_quota;              /* requested punt context quota */
+    u32 context;                /* opaque value to be returned in the reply */
+    u64 input_queue;            /* client's queue */
+    u8 name[64];                /* for show, find by name, whatever */
+    u32 api_versions[8];        /* client-server pairs use as desired */
+};
+
+define memclnt_create_reply {
+    i32 response;               /* Non-negative = success */
+    u64 handle;               /* handle by which vlib knows this client */
+    u32 index;                  /* index, used e.g. by API trace replay */
+    u32 context;                /* opaque value from the create request */
+};
+
+/*
+ * Delete a client registration 
+ */
+manual_print
+define memclnt_delete {
+    u32 index;                  /* index, used e.g. by API trace replay */
+    u64 handle;               /* handle by which vlib knows this client */
+};
+
+define memclnt_delete_reply {
+    i32 response;               /* Non-negative = success */
+    u64 handle;               /* in case the client wonders */
+};
+
+/* 
+ * Client RX thread exit
+ */
+
+define rx_thread_exit {
+    u8 dummy;
+};
+
+/*
+ * RPC
+ */
+define rpc_call {
+    u32 client_index;
+    u32 context;
+    u64 function;
+    u8 multicast;
+    u8 need_barrier_sync;
+    u8 send_reply;
+    u8 data[0];
+};
+
+define rpc_reply {
+    i32 retval;
+    u32 context;
+};
+
+/*
+ * Lookup message-ID base by name
+ */
+define get_first_msg_id {
+    u32 client_index;
+    u32 context;
+    u8 name[64];
+};
+
+define get_first_msg_id_reply {
+    u32 client_index;
+    u32 context;
+    i32 retval;
+    u16 first_msg_id;
+};
diff --git a/vlib-api/vlibmemory/memory_client.c b/vlib-api/vlibmemory/memory_client.c
new file mode 100644
index 0000000..126c74a
--- /dev/null
+++ b/vlib-api/vlibmemory/memory_client.c
@@ -0,0 +1,250 @@
+/* 
+ *------------------------------------------------------------------
+ * memory_client.c - API message handling, client code.
+ *
+ * Copyright (c) 2010 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <signal.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <time.h>
+#include <fcntl.h>
+#include <string.h>
+#include <vppinfra/clib.h>
+#include <vppinfra/vec.h>
+#include <vppinfra/hash.h>
+#include <vppinfra/bitmap.h>
+#include <vppinfra/fifo.h>
+#include <vppinfra/time.h>
+#include <vppinfra/mheap.h>
+#include <vppinfra/heap.h>
+#include <vppinfra/pool.h>
+#include <vppinfra/format.h>
+
+#include <vlib/vlib.h>
+#include <vlib/unix/unix.h>
+#include <vlibmemory/api.h>
+
+#include <vlibmemory/vl_memory_msg_enum.h>
+
+#define vl_typedefs             /* define message structures */
+#include <vlibmemory/vl_memory_api_h.h> 
+#undef vl_typedefs
+
+#define vl_endianfun             /* define message structures */
+#include <vlibmemory/vl_memory_api_h.h> 
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) clib_warning (__VA_ARGS__)
+#define vl_printfun
+#include <vlibmemory/vl_memory_api_h.h>
+#undef vl_printfun
+
+typedef struct {
+    u8 rx_thread_jmpbuf_valid;
+    u8 connected_to_vlib;
+    jmp_buf rx_thread_jmpbuf;
+    pthread_t rx_thread_handle;
+    /* Plugin message base lookup scheme */
+    volatile u8 first_msg_id_reply_ready;
+    u16 first_msg_id_reply;
+} memory_client_main_t;
+
+memory_client_main_t memory_client_main;
+
+static void *rx_thread_fn(void *arg)
+{
+    unix_shared_memory_queue_t *q;
+    memory_client_main_t *mm = &memory_client_main;
+    api_main_t *am = &api_main;
+
+    q = am->vl_input_queue;
+
+    /* So we can make the rx thread terminate cleanly */
+    if (setjmp(mm->rx_thread_jmpbuf) == 0) {
+        mm->rx_thread_jmpbuf_valid = 1;
+        while (1) {
+            vl_msg_api_queue_handler (q);
+        }
+    }
+    pthread_exit(0);
+}
+
+static void vl_api_rx_thread_exit_t_handler (
+    vl_api_rx_thread_exit_t *mp)
+{
+    memory_client_main_t *mm = &memory_client_main;
+    vl_msg_api_free (mp);
+    longjmp (mm->rx_thread_jmpbuf, 1);
+}
+
+static void noop_handler (void *notused)
+{
+}
+
+#define foreach_api_msg						\
+_(RX_THREAD_EXIT, rx_thread_exit)
+
+static int connect_to_vlib_internal (char *svm_name, char *client_name, 
+                                     int rx_queue_size, int want_pthread)
+{
+    int rv=0;
+    memory_client_main_t *mm = &memory_client_main;
+    
+    if ((rv = vl_client_api_map(svm_name))) {
+        clib_warning ("vl_client_api map rv %d", rv);
+        return rv;
+    }
+    
+#define _(N,n)                                                  \
+    vl_msg_api_set_handlers(VL_API_##N, #n,                     \
+                            vl_api_##n##_t_handler,             \
+                            noop_handler,                       \
+                            vl_api_##n##_t_endian,              \
+                            vl_api_##n##_t_print,               \
+                            sizeof(vl_api_##n##_t), 1); 
+    foreach_api_msg;
+#undef _
+
+    if (vl_client_connect(client_name, 0 /* punt quota */,
+                          rx_queue_size /* input queue */) < 0) {
+        vl_client_api_unmap();
+        return -1;
+    }
+
+    /* Start the rx queue thread */
+    
+    if (want_pthread) {
+        rv = pthread_create(&mm->rx_thread_handle, 
+                            NULL /*attr*/, rx_thread_fn, 0);
+        if (rv)
+            clib_warning("pthread_create returned %d", rv);
+    }
+    
+    mm->connected_to_vlib = 1;
+    return 0;
+}
+
+int vl_client_connect_to_vlib(char *svm_name, char *client_name, 
+                              int rx_queue_size)
+{
+    return connect_to_vlib_internal (svm_name, client_name, rx_queue_size,
+                                     1 /* want pthread */);
+}
+
+int vl_client_connect_to_vlib_no_rx_pthread (char *svm_name, char *client_name, 
+                                             int rx_queue_size)
+{
+    return connect_to_vlib_internal (svm_name, client_name, rx_queue_size,
+                                     0 /* want pthread */);
+}
+
+void vl_client_disconnect_from_vlib (void)
+{
+    memory_client_main_t *mm = &memory_client_main;
+    api_main_t *am = &api_main;
+    uword junk;
+
+    if (mm->rx_thread_jmpbuf_valid) {
+        vl_api_rx_thread_exit_t *ep;
+        ep = vl_msg_api_alloc (sizeof (*ep));
+        ep->_vl_msg_id = ntohs(VL_API_RX_THREAD_EXIT);
+        vl_msg_api_send_shmem (am->vl_input_queue, (u8 *)&ep);
+        pthread_join (mm->rx_thread_handle, (void **) &junk);
+    }
+    if (mm->connected_to_vlib) {
+        vl_client_disconnect();
+        vl_client_api_unmap();
+    }
+    memset (mm, 0, sizeof (*mm));
+}
+
+static void vl_api_get_first_msg_id_reply_t_handler
+(vl_api_get_first_msg_id_reply_t * mp)
+{
+    memory_client_main_t *mm = &memory_client_main;
+    i32 retval = ntohl(mp->retval);
+
+    mm->first_msg_id_reply = (retval >= 0) ? ntohs(mp->first_msg_id) : ~0;
+    mm->first_msg_id_reply_ready = 1;
+}
+
+u16 vl_client_get_first_plugin_msg_id (char * plugin_name)
+{
+    vl_api_get_first_msg_id_t * mp;
+    api_main_t * am = &api_main;
+    memory_client_main_t * mm = &memory_client_main;
+    f64 timeout;
+    void * old_handler;
+    clib_time_t clib_time;
+    u16 rv = ~0;
+
+    if (strlen(plugin_name) + 1 > sizeof (mp->name))
+        return (rv);
+
+    memset (&clib_time, 0, sizeof (clib_time));
+    clib_time_init (&clib_time);
+
+    /* Push this plugin's first_msg_id_reply handler */
+    old_handler = am->msg_handlers[VL_API_GET_FIRST_MSG_ID_REPLY];
+    am->msg_handlers[VL_API_GET_FIRST_MSG_ID_REPLY] = (void *)
+        vl_api_get_first_msg_id_reply_t_handler;
+
+    /* Ask the data-plane for the message-ID base of the indicated plugin */
+    mm->first_msg_id_reply_ready = 0;
+
+    mp = vl_msg_api_alloc (sizeof(*mp));
+    memset (mp, 0, sizeof (*mp));
+    mp->_vl_msg_id = ntohs(VL_API_GET_FIRST_MSG_ID);
+    mp->client_index = am->my_client_index;
+    strncpy ((char *) mp->name, plugin_name, sizeof (mp->name) - 1);
+
+    vl_msg_api_send_shmem (am->shmem_hdr->vl_input_queue, (u8 *)&mp);
+
+    /* Synchronously wait for the answer */
+    do {                                          
+        timeout = clib_time_now (&clib_time) + 1.0;       
+        
+        while (clib_time_now (&clib_time) < timeout) {    
+            if (mm->first_msg_id_reply_ready == 1) {         
+                rv = mm->first_msg_id_reply;
+                goto result;
+            }                                     
+        }                                         
+        /* Restore old handler */
+        am->msg_handlers[VL_API_GET_FIRST_MSG_ID_REPLY] = old_handler;
+
+        return rv;
+    } while(0);
+
+result:
+
+    /* Restore the old handler */
+    am->msg_handlers[VL_API_GET_FIRST_MSG_ID_REPLY] = old_handler;
+
+    if (rv == (u16) ~0)
+        clib_warning ("plugin '%s' not registered", plugin_name);
+
+    return rv;
+}
diff --git a/vlib-api/vlibmemory/memory_shared.c b/vlib-api/vlibmemory/memory_shared.c
new file mode 100644
index 0000000..de1eafd
--- /dev/null
+++ b/vlib-api/vlibmemory/memory_shared.c
@@ -0,0 +1,681 @@
+/* 
+ *------------------------------------------------------------------
+ * memclnt_shared.c - API message handling, common code for both clients
+ * and the vlib process itself.
+ * 
+ *
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <vppinfra/format.h>
+#include <vppinfra/byte_order.h>
+#include <vppinfra/error.h>
+#include <vlib/vlib.h>
+#include <vlib/unix/unix.h>
+#include <vlibmemory/api.h>
+#include <vlibmemory/unix_shared_memory_queue.h>
+
+#include <vlibmemory/vl_memory_msg_enum.h>   
+
+#define vl_typedefs 
+#include <vlibmemory/vl_memory_api_h.h>
+#undef vl_typedefs
+
+typedef struct msgbuf_ {
+    unix_shared_memory_queue_t *q;
+    u8 data[0];
+} msgbuf_t;
+
+static inline void *vl_msg_api_alloc_internal(int nbytes, int pool)
+{
+    int i;
+    msgbuf_t *rv;
+    ring_alloc_t *ap;
+    unix_shared_memory_queue_t *q;
+    void *oldheap;
+    vl_shmem_hdr_t *shmem_hdr;
+    api_main_t *am = &api_main;
+
+    shmem_hdr = am->shmem_hdr;
+
+    if (shmem_hdr == 0) {
+        clib_warning ("shared memory header NULL");
+        return 0;
+    }
+
+    /* account for the msgbuf_t header*/
+    nbytes += sizeof(msgbuf_t);
+
+    if (shmem_hdr->vl_rings == 0) {
+        clib_warning ("vl_rings NULL");
+        return 0;
+    }
+
+    if (shmem_hdr->client_rings == 0) {
+        clib_warning ("client_rings NULL");
+        return 0;
+    }
+
+    ap = pool ? shmem_hdr->vl_rings : shmem_hdr->client_rings;
+    for (i = 0; i < vec_len (ap); i++) {
+        /* Too big? */
+        if (nbytes > ap[i].size) {
+            continue;
+        }
+
+        q = ap[i].rp;
+        if (pool == 0) {
+            pthread_mutex_lock(&q->mutex);
+        }
+        rv = (msgbuf_t *) (&q->data[0] + q->head*q->elsize);
+        /*
+         * Is this item still in use? 
+         */
+        if (rv->q) {
+            /* yes, loser; try next larger pool */
+            ap[i].misses++;
+            if (pool == 0)
+                pthread_mutex_unlock(&q->mutex);
+            continue;
+        }
+        /* OK, we have a winner */
+        ap[i].hits++;
+        /*
+         * Remember the source queue, although we
+         * don't need to know the queue to free the item.
+         */
+        rv->q = q;
+        q->head++;
+        if (q->head == q->maxsize)
+            q->head = 0;
+                
+        if (pool == 0)
+            pthread_mutex_unlock(&q->mutex);
+        goto out;
+    }
+
+    /*
+     * Request too big, or head element of all size-compatible rings
+     * still in use. Fall back to shared-memory malloc.
+     */
+    am->ring_misses++;
+
+    pthread_mutex_lock (&am->vlib_rp->mutex);
+    oldheap = svm_push_data_heap (am->vlib_rp);
+    rv = clib_mem_alloc(nbytes + sizeof(msgbuf_t));
+    rv->q = 0;
+    svm_pop_heap (oldheap);
+    pthread_mutex_unlock (&am->vlib_rp->mutex);
+
+ out:
+    return(rv->data);
+}
+
+void *vl_msg_api_alloc (int nbytes)
+{
+    int pool;
+    api_main_t *am = &api_main;
+    vl_shmem_hdr_t *shmem_hdr = am->shmem_hdr;
+
+    /*
+     * Clients use pool-0, vlib proc uses pool 1
+     */
+    pool = (am->our_pid == shmem_hdr->vl_pid);
+    return vl_msg_api_alloc_internal (nbytes, pool);
+}
+
+void *vl_msg_api_alloc_as_if_client (int nbytes)
+{
+    return vl_msg_api_alloc_internal (nbytes, 0);
+}
+
+void vl_msg_api_free(void *a)
+{
+    msgbuf_t *rv;
+    void *oldheap;
+    api_main_t *am = &api_main;
+    
+    rv = (msgbuf_t *)(((u8 *)a) - sizeof(*rv));
+    /*
+     * Here's the beauty of the scheme.  Only one proc/thread has
+     * control of a given message buffer. To free a buffer, we just clear the 
+     * queue field, and leave. No locks, no hits, no errors...
+     */
+    if (rv->q) {
+        rv->q = 0;
+        return;
+    }
+
+    pthread_mutex_lock (&am->vlib_rp->mutex);
+    oldheap = svm_push_data_heap (am->vlib_rp);
+    clib_mem_free (rv);
+    svm_pop_heap (oldheap);
+    pthread_mutex_unlock (&am->vlib_rp->mutex);
+}
+
+static void vl_msg_api_free_nolock (void *a)
+{
+    msgbuf_t *rv;
+    void *oldheap;
+    api_main_t *am = &api_main;
+    
+    rv = (msgbuf_t *)(((u8 *)a) - sizeof(*rv));
+    /*
+     * Here's the beauty of the scheme.  Only one proc/thread has
+     * control of a given message buffer. To free a buffer, we just clear the 
+     * queue field, and leave. No locks, no hits, no errors...
+     */
+    if (rv->q) {
+        rv->q = 0;
+        return;
+    }
+
+    oldheap = svm_push_data_heap (am->vlib_rp);
+    clib_mem_free (rv);
+    svm_pop_heap (oldheap);
+}
+
+int vl_map_shmem (char *region_name, int is_vlib)
+{
+    svm_map_region_args_t *a = 0;
+    svm_region_t *vlib_rp, *root_rp;
+    void *oldheap;
+    vl_shmem_hdr_t *shmem_hdr=0;
+    api_main_t *am = &api_main;
+    int i;
+    struct timespec ts, tsrem;
+
+    if (is_vlib == 0)
+        svm_region_init();
+
+    vec_validate (a, 0);
+
+    a->name = region_name;
+    a->size = 16<<20;
+    a->flags = SVM_FLAGS_MHEAP;
+
+    vlib_rp = svm_region_find_or_create (a);
+    
+    vec_free (a);
+
+    if (vlib_rp == 0)
+        return (-2);
+
+    pthread_mutex_lock (&vlib_rp->mutex);
+    /* Has someone else set up the shared-memory variable table? */
+    if (vlib_rp->user_ctx) {
+        am->shmem_hdr = (void *) vlib_rp->user_ctx;
+        am->our_pid = getpid();
+        if (is_vlib) {
+            unix_shared_memory_queue_t *q;
+            uword old_msg;
+            /* 
+             * application restart. Reset cached pids, API message
+             * rings, list of clients; otherwise, various things
+             * fail. (e.g. queue non-empty notification) 
+             */
+
+            /* ghosts keep the region from disappearing properly */
+            svm_client_scan_this_region_nolock(vlib_rp);
+            am->shmem_hdr->application_restarts++;
+            q = am->shmem_hdr->vl_input_queue;
+            am->shmem_hdr->vl_pid = getpid();
+            q->consumer_pid = am->shmem_hdr->vl_pid;
+            /* Drain the input queue, freeing msgs */
+            for (i = 0; i < 10; i++) {
+                if (pthread_mutex_trylock (&q->mutex) == 0) {
+                    pthread_mutex_unlock (&q->mutex);
+                    goto mutex_ok;
+                }
+                ts.tv_sec = 0;
+                ts.tv_nsec = 10000*1000;  /* 10 ms */
+                while (nanosleep(&ts, &tsrem) < 0)
+                    ts = tsrem;
+            }
+            /* Mutex buggered, "fix" it */
+            memset (&q->mutex, 0, sizeof (q->mutex));
+            clib_warning ("forcibly release main input queue mutex");
+
+        mutex_ok:
+	    am->vlib_rp = vlib_rp;
+            while (unix_shared_memory_queue_sub (q, 
+                                                 (u8 *)&old_msg, 
+                                                 1 /* nowait */) 
+                   != -2 /* queue underflow */) {
+                vl_msg_api_free_nolock ((void *)old_msg);
+                am->shmem_hdr->restart_reclaims++;
+            }
+            pthread_mutex_unlock (&vlib_rp->mutex);
+            root_rp = svm_get_root_rp();
+            ASSERT(root_rp);
+            /* Clean up the root region client list */
+            pthread_mutex_lock (&root_rp->mutex);
+            svm_client_scan_this_region_nolock (root_rp);
+            pthread_mutex_unlock (&root_rp->mutex);
+        } else {
+            pthread_mutex_unlock (&vlib_rp->mutex);
+            /* 
+             * Make sure the vlib app is really there...
+             * Wait up to 100 seconds... 
+             */
+            for (i = 0; i < 10000; i++) {
+                /* Yup, it's there, off we go... */
+                if (kill (am->shmem_hdr->vl_pid, 0) >= 0)
+                    break;
+
+                ts.tv_sec = 0;
+                ts.tv_nsec = 10000*1000;  /* 10 ms */
+                while (nanosleep(&ts, &tsrem) < 0)
+                    ts = tsrem;
+            }
+        }
+
+        am->vlib_rp = vlib_rp;
+        vec_add1(am->mapped_shmem_regions, vlib_rp);
+        return 0;
+    }
+    /* Clients simply have to wait... */
+    if (!is_vlib) {
+        pthread_mutex_unlock (&vlib_rp->mutex);
+
+        /* Wait up to 100 seconds... */
+        for (i = 0; i < 10000; i++) {
+            ts.tv_sec = 0;
+            ts.tv_nsec = 10000*1000;  /* 10 ms */
+            while (nanosleep(&ts, &tsrem) < 0)
+                ts = tsrem;
+            if (vlib_rp->user_ctx)
+                goto ready;
+        }
+        /* Clean up and leave... */
+        svm_region_unmap (vlib_rp);
+        clib_warning ("region init fail");
+        return (-2);
+
+    ready:
+        am->shmem_hdr = (void *)vlib_rp->user_ctx;
+        am->our_pid = getpid();
+        am->vlib_rp = vlib_rp;
+        vec_add1(am->mapped_shmem_regions, vlib_rp);
+        return 0;
+    }
+
+    /* Nope, it's our problem... */
+
+    oldheap = svm_push_data_heap (vlib_rp);
+
+    vec_validate(shmem_hdr, 0);
+    shmem_hdr->version = VL_SHM_VERSION;
+
+    /* vlib main input queue */
+    shmem_hdr->vl_input_queue = 
+        unix_shared_memory_queue_init (1024, sizeof (uword), getpid(),
+                                       am->vlib_signal);
+
+    /* Set up the msg ring allocator */
+#define _(sz,n)                                                 \
+    do {                                                        \
+        ring_alloc_t _rp;                                       \
+        _rp.rp = unix_shared_memory_queue_init ((n), (sz), 0, 0); \
+        _rp.size = (sz);                                        \
+        _rp.nitems = n;                                         \
+        _rp.hits = 0;                                           \
+        _rp.misses = 0;                                         \
+        vec_add1(shmem_hdr->vl_rings, _rp);                     \
+    } while (0);
+
+    foreach_vl_aring_size;
+#undef _
+
+#define _(sz,n)                                                 \
+    do {                                                        \
+        ring_alloc_t _rp;                                       \
+        _rp.rp = unix_shared_memory_queue_init ((n), (sz), 0, 0); \
+        _rp.size = (sz);                                        \
+        _rp.nitems = n;                                         \
+        _rp.hits = 0;                                           \
+        _rp.misses = 0;                                         \
+        vec_add1(shmem_hdr->client_rings, _rp);                 \
+    } while (0);
+
+    foreach_clnt_aring_size;
+#undef _
+
+    am->shmem_hdr = shmem_hdr;
+    am->vlib_rp = vlib_rp;
+    am->our_pid = getpid();
+    if (is_vlib)
+        am->shmem_hdr->vl_pid = am->our_pid;
+    
+    svm_pop_heap (oldheap);
+
+    /* 
+     * After absolutely everything that a client might see is set up,
+     * declare the shmem region valid
+     */
+    vlib_rp->user_ctx = shmem_hdr;
+
+    pthread_mutex_unlock (&vlib_rp->mutex);
+    vec_add1(am->mapped_shmem_regions, vlib_rp);
+    return 0;
+}
+
+void vl_register_mapped_shmem_region(svm_region_t *rp)
+{
+    api_main_t *am = &api_main;
+
+    vec_add1(am->mapped_shmem_regions, rp);
+}
+
+void vl_unmap_shmem (void)
+{
+    svm_region_t *rp;
+    int i;
+    api_main_t *am = &api_main;
+
+    if (! svm_get_root_rp())
+      return;
+
+    for (i = 0; i < vec_len(am->mapped_shmem_regions); i++) {
+        rp = am->mapped_shmem_regions[i];
+        svm_region_unmap (rp);
+    }
+
+    vec_free(am->mapped_shmem_regions);
+    am->shmem_hdr = 0;
+
+    svm_region_exit ();
+    /* $$$ more careful cleanup, valgrind run... */
+    vec_free (am->msg_handlers);
+    vec_free (am->msg_endian_handlers);
+    vec_free (am->msg_print_handlers);
+}
+
+void vl_msg_api_send_shmem (unix_shared_memory_queue_t *q, u8 *elem)
+{
+    api_main_t *am = &api_main;
+    uword *trace = (uword *)elem;
+
+    if (am->tx_trace && am->tx_trace->enabled)
+        vl_msg_api_trace(am, am->tx_trace, (void *)trace[0]);
+
+    (void)unix_shared_memory_queue_add(q, elem, 0 /* nowait */);
+}
+
+void vl_msg_api_send_shmem_nolock (unix_shared_memory_queue_t *q, u8 *elem)
+{
+    api_main_t *am = &api_main;
+    uword *trace = (uword *)elem;
+
+    if (am->tx_trace && am->tx_trace->enabled)
+        vl_msg_api_trace(am, am->tx_trace, (void *)trace[0]);
+
+    (void)unix_shared_memory_queue_add_nolock (q, elem);
+}
+
+static void vl_api_memclnt_create_reply_t_handler (
+    vl_api_memclnt_create_reply_t *mp)
+{
+    api_main_t *am = &api_main;
+    int rv;
+
+    am->my_client_index = mp->index;
+    am->my_registration = (vl_api_registration_t *)(uword)
+        mp->handle;
+
+    rv = ntohl(mp->response);
+
+    if (rv < 0)
+        clib_warning ("WARNING: API mismatch detected");
+}        
+
+void vl_client_add_api_signatures (vl_api_memclnt_create_t *mp) 
+    __attribute__((weak));
+
+void vl_client_add_api_signatures (vl_api_memclnt_create_t *mp) 
+{
+    int i;
+
+    for (i = 0; i < ARRAY_LEN(mp->api_versions); i++)
+        mp->api_versions[i] = 0;
+}
+
+int vl_client_connect (char *name, int ctx_quota, int input_queue_size)
+{
+    svm_region_t *svm;
+    vl_api_memclnt_create_t *mp;
+    vl_api_memclnt_create_reply_t *rp;
+    unix_shared_memory_queue_t *vl_input_queue;
+    vl_shmem_hdr_t *shmem_hdr;
+    int rv=0;
+    void *oldheap;
+    api_main_t *am = &api_main;
+
+    if (am->my_registration) {
+        clib_warning ("client %s already connected...", name);
+        return -1;
+    }
+
+    if (am->vlib_rp == 0) {
+        clib_warning ("am->vlib_rp NULL");
+        return -1;
+    }
+
+    svm = am->vlib_rp;
+    shmem_hdr = am->shmem_hdr;
+
+    if (shmem_hdr == 0 || shmem_hdr->vl_input_queue == 0) {
+        clib_warning ("shmem_hdr / input queue NULL");
+        return -1;
+    }
+
+    pthread_mutex_lock (&svm->mutex);
+    oldheap = svm_push_data_heap(svm);
+    vl_input_queue = 
+        unix_shared_memory_queue_init (input_queue_size, sizeof(uword), 
+                                       getpid(), 0);
+    pthread_mutex_unlock(&svm->mutex);
+    svm_pop_heap (oldheap);
+
+    am->my_client_index = ~0;
+    am->my_registration = 0;
+    am->vl_input_queue = vl_input_queue;
+
+    mp = vl_msg_api_alloc(sizeof(vl_api_memclnt_create_t));
+    memset(mp, 0, sizeof (*mp));
+    mp->_vl_msg_id = ntohs(VL_API_MEMCLNT_CREATE);
+    mp->ctx_quota = ctx_quota;
+    mp->input_queue = (uword)vl_input_queue;
+    strncpy ((char *) mp->name, name, sizeof(mp->name)-1);
+
+    vl_client_add_api_signatures(mp);
+    
+    vl_msg_api_send_shmem (shmem_hdr->vl_input_queue, (u8 *)&mp);
+
+    while (1) {
+        int qstatus;
+        struct timespec ts, tsrem;
+        int i;
+
+        /* Wait up to 10 seconds */
+        for (i = 0; i < 1000; i++) {
+            qstatus = unix_shared_memory_queue_sub (vl_input_queue, (u8 *)&rp, 
+                                                    1 /* nowait */);
+            if (qstatus == 0)
+                goto read_one_msg;
+            ts.tv_sec = 0;
+            ts.tv_nsec = 10000*1000;  /* 10 ms */
+            while (nanosleep(&ts, &tsrem) < 0)
+                ts = tsrem;
+        }
+        /* Timeout... */
+        clib_warning ("memclnt_create_reply timeout");
+        return -1;
+
+    read_one_msg:
+        if (ntohs(rp->_vl_msg_id) != VL_API_MEMCLNT_CREATE_REPLY) {
+            clib_warning ("unexpected reply: id %d", ntohs(rp->_vl_msg_id));
+            continue;
+        }
+        rv = clib_net_to_host_u32(rp->response);
+
+        vl_msg_api_handler((void *)rp);
+        break;
+    }
+    return (rv);
+}
+
+static void vl_api_memclnt_delete_reply_t_handler (
+    vl_api_memclnt_delete_reply_t *mp)
+{
+    void *oldheap;
+    api_main_t *am = &api_main;
+
+    pthread_mutex_lock (&am->vlib_rp->mutex);
+    oldheap = svm_push_data_heap(am->vlib_rp);
+    unix_shared_memory_queue_free (am->vl_input_queue);
+    pthread_mutex_unlock (&am->vlib_rp->mutex);
+    svm_pop_heap (oldheap);
+
+    am->my_client_index = ~0;
+    am->my_registration = 0;
+    am->vl_input_queue = 0;
+}        
+
+void vl_client_disconnect (void)
+{
+    vl_api_memclnt_delete_t *mp;
+    vl_api_memclnt_delete_reply_t *rp;
+    unix_shared_memory_queue_t *vl_input_queue;
+    vl_shmem_hdr_t *shmem_hdr;
+    time_t begin;
+    api_main_t *am = &api_main;
+    
+    ASSERT(am->vlib_rp);
+    shmem_hdr = am->shmem_hdr;
+    ASSERT(shmem_hdr && shmem_hdr->vl_input_queue);
+
+    vl_input_queue = am->vl_input_queue;
+
+    mp = vl_msg_api_alloc(sizeof(vl_api_memclnt_delete_t));
+    memset(mp, 0, sizeof (*mp));
+    mp->_vl_msg_id = ntohs(VL_API_MEMCLNT_DELETE);
+    mp->index = am->my_client_index;
+    mp->handle = (uword) am->my_registration;
+
+    vl_msg_api_send_shmem (shmem_hdr->vl_input_queue, (u8 *)&mp);
+
+    /* 
+     * Have to be careful here, in case the client is disconnecting
+     * because e.g. the vlib process died, or is unresponsive.
+     */
+    
+    begin = time (0);
+    while (1) {
+        time_t now;
+
+        now = time (0);
+
+        if (now >= (begin + 2)) {
+            clib_warning ("peer unresponsive, give up");
+            am->my_client_index = ~0;
+            am->my_registration = 0;
+            am->shmem_hdr = 0;
+            break;
+        }
+        if (unix_shared_memory_queue_sub (vl_input_queue, (u8 *)&rp, 1) < 0)
+            continue;
+        
+        /* drain the queue */
+        if (ntohs(rp->_vl_msg_id) != VL_API_MEMCLNT_DELETE_REPLY) {
+            vl_msg_api_handler ((void *)rp);
+            continue;
+        }
+        vl_msg_api_handler((void *)rp);
+        break;
+    }
+}
+
+static inline vl_api_registration_t 
+*vl_api_client_index_to_registration_internal (u32 handle)
+{
+    vl_api_registration_t **regpp;
+    vl_api_registration_t *regp;
+    api_main_t *am = &api_main;
+    u32 index;
+
+    index = vl_msg_api_handle_get_index (handle);
+    if ((am->shmem_hdr->application_restarts & VL_API_EPOCH_MASK)
+        != vl_msg_api_handle_get_epoch (handle)) {
+        vl_msg_api_increment_missing_client_counter();
+        return 0;
+    }
+
+    regpp = am->vl_clients + index;
+
+    if (pool_is_free(am->vl_clients, regpp)) {
+        vl_msg_api_increment_missing_client_counter();
+        return 0;
+    }
+    regp = *regpp;
+    return (regp);
+}
+
+vl_api_registration_t *vl_api_client_index_to_registration (u32 index)
+{
+    return (vl_api_client_index_to_registration_internal (index));
+}
+
+unix_shared_memory_queue_t *vl_api_client_index_to_input_queue (u32 index)
+{
+    vl_api_registration_t *regp;
+
+    regp = vl_api_client_index_to_registration_internal (index);
+    if (!regp)
+        return 0;
+    return (regp->vl_input_queue);
+}
+
+#define foreach_api_client_msg                  \
+_(MEMCLNT_CREATE_REPLY, memclnt_create_reply)   \
+_(MEMCLNT_DELETE_REPLY, memclnt_delete_reply)
+
+int vl_client_api_map (char *region_name)
+{
+    int rv;
+
+    if ((rv = vl_map_shmem (region_name, 0 /* is_vlib */)) < 0) {
+        return rv;
+    }
+
+#define _(N,n)                                                          \
+    vl_msg_api_set_handlers(VL_API_##N, 0 /* name */,                   \
+                           vl_api_##n##_t_handler,                      \
+                           0/* cleanup */, 0/* endian */, 0/* print */, \
+                           sizeof(vl_api_##n##_t), 1); 
+    foreach_api_client_msg;
+#undef _
+    return 0;
+}
+
+void vl_client_api_unmap (void)
+{
+    vl_unmap_shmem();
+}
diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c
new file mode 100644
index 0000000..165cdf3
--- /dev/null
+++ b/vlib-api/vlibmemory/memory_vlib.c
@@ -0,0 +1,1124 @@
+/* 
+ *------------------------------------------------------------------
+ * memory_vlib.c 
+ *
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <pthread.h>
+#include <vppinfra/vec.h>
+#include <vppinfra/hash.h>
+#include <vppinfra/pool.h>
+#include <vppinfra/format.h>
+#include <vppinfra/byte_order.h>
+#include <vppinfra/elog.h>
+#include <stdarg.h>
+#include <vlib/vlib.h>
+#include <vlib/unix/unix.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+
+#define TRACE_VLIB_MEMORY_QUEUE 0
+
+#include <vlibmemory/vl_memory_msg_enum.h> /* enumerate all vlib messages */
+
+#define vl_typedefs             /* define message structures */
+#include <vlibmemory/vl_memory_api_h.h> 
+#undef vl_typedefs
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vlibmemory/vl_memory_api_h.h> 
+#undef vl_printfun
+
+static inline void *
+vl_api_memclnt_create_t_print (vl_api_memclnt_create_t *a,void *handle)
+{
+    vl_print(handle, "vl_api_memclnt_create_t:\n");
+    vl_print(handle, "name: %s\n", a->name);
+    vl_print(handle, "input_queue: 0x%wx\n", a->input_queue);
+    vl_print(handle, "context: %u\n", (unsigned) a->context);
+    vl_print(handle, "ctx_quota: %ld\n", (long) a->ctx_quota);
+    return handle;
+}
+
+static inline void *
+vl_api_memclnt_delete_t_print (vl_api_memclnt_delete_t *a,void *handle)
+{
+    vl_print(handle, "vl_api_memclnt_delete_t:\n");
+    vl_print(handle, "index: %u\n", (unsigned) a->index);
+    vl_print(handle, "handle: 0x%wx\n", a->handle);
+    return handle;
+}
+
+/* instantiate all the endian swap functions we know about */
+#define vl_endianfun
+#include <vlibmemory/vl_memory_api_h.h> 
+#undef vl_endianfun
+
+void vl_socket_api_send (vl_api_registration_t *rp, u8 *elem) 
+    __attribute__((weak));
+
+void 
+vl_socket_api_send (vl_api_registration_t *rp, u8 *elem) 
+{
+    static int count;
+
+    if (count++ < 5)
+        clib_warning ("need to link against -lvlibsocket, msg not sent!");
+}
+
+void vl_msg_api_send (vl_api_registration_t *rp, u8 *elem)
+{
+    if (PREDICT_FALSE(rp->registration_type > REGISTRATION_TYPE_SHMEM)) {
+        vl_socket_api_send (rp, elem);
+    } else {
+        vl_msg_api_send_shmem (rp->vl_input_queue, elem);
+    }
+}
+
+int vl_msg_api_version_check (vl_api_memclnt_create_t * mp) 
+    __attribute__((weak));
+
+int vl_msg_api_version_check (vl_api_memclnt_create_t * mp) { return 0; }
+
+/*
+ * vl_api_memclnt_create_t_handler
+ */
+void vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t *mp)
+{
+    vl_api_registration_t **regpp;
+    vl_api_registration_t *regp;
+    vl_api_memclnt_create_reply_t *rp;
+    svm_region_t *svm;
+    unix_shared_memory_queue_t *q;
+    int rv;
+    void *oldheap;
+    api_main_t *am = &api_main;
+
+    /* Indicate API version mismatch if appropriate */
+    rv = vl_msg_api_version_check (mp);
+
+    /*
+     * This is tortured. Maintain a vlib-address-space private
+     * pool of client registrations. We use the shared-memory virtual 
+     * address of client structure as a handle, to allow direct 
+     * manipulation of context quota vbls from the client library.
+     *
+     * This scheme causes trouble w/ API message trace replay, since
+     * some random VA from clib_mem_alloc() certainly won't 
+     * occur in the Linux sim. The (very) few places
+     * that care need to use the pool index.
+     *
+     * Putting the registration object(s) into a pool in shared memory and
+     * using the pool index as a handle seems like a great idea.
+     * Unfortunately, each and every reference to that pool would need 
+     * to be protected by a mutex:
+     *
+     *     Client                      VLIB
+     *     ------                      ----
+     *     convert pool index to 
+     *     pointer.
+     *     <deschedule>
+     *                                 expand pool
+     *                                 <deschedule>
+     *     kaboom!
+     */
+
+    pool_get(am->vl_clients, regpp);
+
+    svm = am->vlib_rp;
+
+    pthread_mutex_lock (&svm->mutex);
+    oldheap = svm_push_data_heap(svm);
+    *regpp = clib_mem_alloc(sizeof(vl_api_registration_t));
+
+    regp = *regpp;
+    memset(regp, 0, sizeof(*regp));
+    regp->registration_type = REGISTRATION_TYPE_SHMEM;
+    regp->vl_api_registration_pool_index = regpp - am->vl_clients;
+
+    q = regp->vl_input_queue = (unix_shared_memory_queue_t *)(uword)
+        mp->input_queue;
+
+    regp->name = format(0, "%s", mp->name);
+    vec_add1(regp->name, 0);
+
+    pthread_mutex_unlock(&svm->mutex);
+    svm_pop_heap (oldheap);
+
+    rp = vl_msg_api_alloc(sizeof(*rp));
+    rp->_vl_msg_id = ntohs(VL_API_MEMCLNT_CREATE_REPLY);
+    rp->handle = (uword)regp;
+    rp->index = vl_msg_api_handle_from_index_and_epoch 
+        (regp->vl_api_registration_pool_index, 
+         am->shmem_hdr->application_restarts);
+    rp->context = mp->context;
+    rp->response = ntohl(rv);
+
+    vl_msg_api_send_shmem(q, (u8 *)&rp);
+}
+
+/* Application callback to clean up leftover registrations from this client */
+int vl_api_memclnt_delete_callback (u32 client_index) 
+    __attribute__((weak));
+
+int vl_api_memclnt_delete_callback (u32 client_index) 
+{ return 0; }
+
+/*
+ * vl_api_memclnt_delete_t_handler
+ */
+void vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t *mp)
+{
+    vl_api_registration_t **regpp;
+    vl_api_registration_t *regp;
+    vl_api_memclnt_delete_reply_t *rp;
+    svm_region_t *svm;
+    void *oldheap;
+    api_main_t *am = &api_main;
+    u32 handle, client_index, epoch;
+
+    handle = mp->index;
+
+    if (vl_api_memclnt_delete_callback (handle))
+        return;
+
+    epoch = vl_msg_api_handle_get_epoch (handle);
+    client_index = vl_msg_api_handle_get_index (handle);
+
+    if (epoch != (am->shmem_hdr->application_restarts & VL_API_EPOCH_MASK)) {
+        clib_warning 
+            ("Stale clnt delete index %d old epoch %d cur epoch %d", 
+             client_index, epoch, 
+             (am->shmem_hdr->application_restarts & VL_API_EPOCH_MASK));
+        return;
+    }
+
+    regpp = am->vl_clients + client_index;
+
+    if (!pool_is_free(am->vl_clients, regpp)) {
+        regp = *regpp;
+        svm = am->vlib_rp;
+
+        /* $$$ check the input queue for e.g. punted sf's */
+
+        rp = vl_msg_api_alloc(sizeof(*rp));
+        rp->_vl_msg_id = ntohs(VL_API_MEMCLNT_DELETE_REPLY);
+        rp->handle = mp->handle;
+        rp->response = 1;
+        
+        vl_msg_api_send_shmem (regp->vl_input_queue, (u8 *)&rp);
+        
+        if (client_index != regp->vl_api_registration_pool_index) {
+            clib_warning ("mismatch client_index %d pool_index %d", 
+                          client_index, regp->vl_api_registration_pool_index);
+            vl_msg_api_free (rp);
+            return;
+        }
+
+        /* No dangling references, please */
+        *regpp = 0;
+
+        pool_put_index(am->vl_clients, 
+                       regp->vl_api_registration_pool_index);
+
+        pthread_mutex_lock (&svm->mutex);
+        oldheap = svm_push_data_heap(svm);
+        /* Poison the old registration */
+        memset (regp, 0xF1, sizeof (*regp));
+        clib_mem_free (regp);
+        pthread_mutex_unlock(&svm->mutex);
+        svm_pop_heap (oldheap);
+    } else {
+        clib_warning("unknown client ID %d", mp->index);
+    }
+}
+
+void vl_api_get_first_msg_id_t_handler (vl_api_get_first_msg_id_t * mp)
+{
+    vl_api_get_first_msg_id_reply_t * rmp;
+    unix_shared_memory_queue_t * q;
+    uword * p;
+    api_main_t *am = &api_main;
+    vl_api_msg_range_t * rp;
+    u8 name[64];
+    u16 first_msg_id = ~0;
+    int rv = -7; /* VNET_API_ERROR_INVALID_VALUE */
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (!q)
+        return;
+
+    if (am->msg_range_by_name == 0)
+        goto out;
+
+    strncpy ((char *)name, (char *) mp->name, ARRAY_LEN(name)-1);
+
+    p = hash_get_mem (am->msg_range_by_name, name);
+    if (p == 0)
+        goto out;
+
+    rp = vec_elt_at_index (am->msg_ranges, p[0]);
+
+    first_msg_id = rp->first_msg_id;
+    rv = 0;
+
+out:
+
+    rmp = vl_msg_api_alloc (sizeof (*rmp));
+    rmp->_vl_msg_id = ntohs(VL_API_GET_FIRST_MSG_ID_REPLY);
+    rmp->context = mp->context;
+    rmp->retval = ntohl(rv);
+    rmp->first_msg_id = ntohs(first_msg_id);
+    vl_msg_api_send_shmem (q, (u8 *)&rmp);
+}
+
+#define foreach_vlib_api_msg                    \
+_(MEMCLNT_CREATE, memclnt_create)               \
+_(MEMCLNT_DELETE, memclnt_delete)               \
+_(GET_FIRST_MSG_ID, get_first_msg_id)
+
+/*
+ * vl_api_init
+ */
+static int memory_api_init(char *region_name)
+{
+    int rv;
+    vl_msg_api_msg_config_t cfg;
+    vl_msg_api_msg_config_t *c = &cfg;
+    
+    if ((rv = vl_map_shmem(region_name, 1 /* is_vlib */)) < 0)
+        return rv;
+
+#define _(N,n) do {                                             \
+    c->id = VL_API_##N;                                         \
+    c->name = #n;                                               \
+    c->handler = vl_api_##n##_t_handler;                        \
+    c->cleanup = vl_noop_handler;                               \
+    c->endian = vl_api_##n##_t_endian;                          \
+    c->print = vl_api_##n##_t_print;                            \
+    c->size = sizeof(vl_api_##n##_t);                           \
+    c->traced = 1; /* trace, so these msgs print */             \
+    c->replay = 0; /* don't replay client create/delete msgs */ \
+    vl_msg_api_config(c);} while (0);
+    
+    foreach_vlib_api_msg;
+#undef _
+
+    return 0;
+}
+
+#define foreach_histogram_bucket                \
+_(400)                                          \
+_(200)                                          \
+_(100)                                          \
+_(10)
+
+typedef enum {
+#define _(n) SLEEP_##n##_US,
+    foreach_histogram_bucket
+#undef _
+    SLEEP_N_BUCKETS,
+} histogram_index_t;
+
+static u64 vector_rate_histogram[SLEEP_N_BUCKETS];
+
+static void memclnt_queue_signal (int signum);
+static void memclnt_queue_callback (vlib_main_t *vm);
+
+static uword
+memclnt_process (vlib_main_t * vm,
+                 vlib_node_runtime_t * node,
+                 vlib_frame_t * f)
+{
+    uword mp;
+    vl_shmem_hdr_t *shm;
+    unix_shared_memory_queue_t *q;
+    clib_error_t *e;
+    int rv;
+    api_main_t *am = &api_main;
+    f64 dead_client_scan_time;
+    f64 sleep_time, start_time;
+    f64 vector_rate;
+    
+    vlib_set_queue_signal_callback (vm, memclnt_queue_callback);
+    am->vlib_signal = SIGUSR1;
+    signal (am->vlib_signal, memclnt_queue_signal);
+    
+    if ((rv = memory_api_init(am->region_name)) < 0) {
+        clib_warning("memory_api_init returned %d, wait for godot...", rv);
+        vlib_process_suspend (vm, 1e70);
+    }
+
+    shm = am->shmem_hdr;
+    ASSERT(shm);
+    q = shm->vl_input_queue;
+    ASSERT(q);
+
+    e = vlib_call_init_exit_functions 
+        (vm, vm->api_init_function_registrations, 1 /* call_once */);
+    if (e)
+      clib_error_report (e);
+
+    sleep_time = 20.0;
+    dead_client_scan_time = vlib_time_now(vm) + 20.0;
+
+    /* $$$ pay attention to frame size, control CPU usage */
+    while (1) {
+	uword event_type __attribute__((unused));
+        i8 *headp;
+        int need_broadcast;
+
+        /*
+         * There's a reason for checking the queue before
+         * sleeping. If the vlib application crashes, it's entirely
+         * possible for a client to enqueue a connect request
+         * during the process restart interval.
+         *
+         * Unless some force of physics causes the new incarnation
+         * of the application to process the request, the client will
+         * sit and wait for Godot...
+         */
+        vector_rate = vlib_last_vector_length_per_node(vm);
+        start_time = vlib_time_now (vm);
+        while (1) {
+            pthread_mutex_lock (&q->mutex);
+            if (q->cursize == 0) {
+                pthread_mutex_unlock (&q->mutex);
+                
+                if (TRACE_VLIB_MEMORY_QUEUE)
+                {
+                    ELOG_TYPE_DECLARE (e) = {
+                        .format = "q-underflow: len %d",
+                        .format_args = "i4",
+                    };
+                    struct { u32 len; } * ed;
+                    ed = ELOG_DATA (&vm->elog_main, e);
+                    ed->len = 0;
+                }
+                sleep_time = 20.0;
+                break;
+            }
+            
+            headp = (i8 *) (q->data + sizeof(uword)*q->head);
+            memcpy (&mp, headp, sizeof(uword));
+            
+            q->head++;
+            need_broadcast = (q->cursize == q->maxsize/2);
+            q->cursize--;
+            
+            if (PREDICT_FALSE(q->head == q->maxsize))
+                q->head = 0;
+            pthread_mutex_unlock(&q->mutex);
+            if (need_broadcast)
+                (void) pthread_cond_broadcast(&q->condvar);
+            
+            vl_msg_api_handler_with_vm_node (am, (void *)mp, vm, node);
+
+            /* Allow no more than 10us without a pause */
+            if (vlib_time_now(vm) > start_time + 10e-6) {
+                int index = SLEEP_400_US;
+                if (vector_rate > 40.0) 
+                    sleep_time = 400e-6;
+                else if (vector_rate > 20.0) {
+                    index = SLEEP_200_US;
+                    sleep_time = 200e-6;
+                } else if (vector_rate >= 1.0) {
+                    index = SLEEP_100_US;
+                    sleep_time = 100e-6;
+                }
+                else {
+                    index = SLEEP_10_US;
+                    sleep_time = 10e-6;
+                }
+                vector_rate_histogram[index] += 1;
+                break;
+            }
+        }
+
+	event_type = vlib_process_wait_for_event_or_clock (vm, sleep_time);
+        vlib_process_get_events (vm, 0 /* event_data */);
+
+        if (vlib_time_now (vm) > dead_client_scan_time) {
+            vl_api_registration_t **regpp;
+            vl_api_registration_t *regp;
+            unix_shared_memory_queue_t *q;
+            static u32 * dead_indices;
+            static u32 * confused_indices;
+
+            vec_reset_length (dead_indices);
+            vec_reset_length (confused_indices);
+
+            pool_foreach (regpp, am->vl_clients, 
+            ({
+                regp = *regpp;
+
+                if (regp) {
+                    q = regp->vl_input_queue;
+                    if (kill (q->consumer_pid, 0) < 0) {
+                        vec_add1(dead_indices, regpp - am->vl_clients);
+                    }
+                } else {
+                    clib_warning ("NULL client registration index %d",
+                                  regpp - am->vl_clients);
+                    vec_add1 (confused_indices, regpp - am->vl_clients);
+                }
+            }));
+            /* This should "never happen," but if it does, fix it... */
+            if (PREDICT_FALSE (vec_len(confused_indices) > 0)) {
+                int i;
+                for (i = 0; i < vec_len (confused_indices); i++) {
+                    pool_put_index (am->vl_clients, confused_indices[i]);
+                }
+            }
+
+            if (PREDICT_FALSE (vec_len(dead_indices) > 0)) {
+                int i;
+                svm_region_t *svm;
+                void * oldheap;
+
+                /* Allow the application to clean up its registrations */
+                for (i = 0; i < vec_len(dead_indices); i++) {
+                    regpp = pool_elt_at_index (am->vl_clients, dead_indices[i]);
+                    if (regpp) {
+                        u32 handle;
+                        
+                        handle = vl_msg_api_handle_from_index_and_epoch 
+                            (dead_indices[i], shm->application_restarts);
+                        (void) vl_api_memclnt_delete_callback (handle);
+                    }
+                }
+
+                svm = am->vlib_rp;
+                pthread_mutex_lock (&svm->mutex);
+                oldheap = svm_push_data_heap(svm);
+                
+                for (i = 0; i < vec_len(dead_indices); i++) {
+                    regpp = pool_elt_at_index (am->vl_clients, dead_indices[i]);
+                    if (regpp) {
+                        /* Poison the old registration */
+                        memset (*regpp, 0xF3, sizeof (**regpp));
+                        clib_mem_free (*regpp);
+                        /* no dangling references, please */
+                        *regpp = 0;
+                    } else {
+                        svm_pop_heap (oldheap);
+                        clib_warning ("Duplicate free, client index %d", 
+                                      regpp - am->vl_clients);
+                        oldheap = svm_push_data_heap(svm);
+                    }
+                }
+
+                svm_client_scan_this_region_nolock (am->vlib_rp);
+
+                pthread_mutex_unlock(&svm->mutex);
+                svm_pop_heap (oldheap);
+                for (i = 0; i < vec_len (dead_indices); i++)
+                    pool_put_index (am->vl_clients, dead_indices[i]);
+            }
+
+            dead_client_scan_time = vlib_time_now (vm) + 20.0;
+        }
+            
+        if (TRACE_VLIB_MEMORY_QUEUE)
+        {
+            ELOG_TYPE_DECLARE (e) = {
+                .format = "q-awake: len %d",
+                .format_args = "i4",
+            };
+            struct { u32 len; } * ed;
+            ed = ELOG_DATA (&vm->elog_main, e);
+            ed->len = q->cursize;
+        }
+    }
+
+    return 0;
+}
+
+static clib_error_t *
+vl_api_show_histogram_command(vlib_main_t * vm,
+                              unformat_input_t * input, 
+                              vlib_cli_command_t * cli_cmd)
+{
+    u64 total_counts = 0;
+    int i;
+    
+    for (i = 0; i < SLEEP_N_BUCKETS; i++) {
+        total_counts += vector_rate_histogram [i];
+    }
+
+    if (total_counts == 0) {
+        vlib_cli_output (vm, "No control-plane activity.");
+        return 0;
+    }
+
+#define _(n)                                                    \
+    do {                                                        \
+        f64 percent;                                            \
+        percent = ((f64) vector_rate_histogram[SLEEP_##n##_US]) \
+            / (f64) total_counts;                               \
+        percent *= 100.0;                                       \
+        vlib_cli_output (vm, "Sleep %3d us: %llu, %.2f%%",n,    \
+                         vector_rate_histogram[SLEEP_##n##_US], \
+                         percent);                              \
+    } while (0);
+    foreach_histogram_bucket;
+#undef _
+
+    return 0;
+}
+
+VLIB_CLI_COMMAND (cli_show_api_histogram_command, static) = {
+    .path = "show api histogram",
+    .short_help = "show api histogram",
+    .function = vl_api_show_histogram_command,
+};
+
+static clib_error_t *
+vl_api_clear_histogram_command(vlib_main_t * vm,
+                               unformat_input_t * input, 
+                               vlib_cli_command_t * cli_cmd)
+{
+    int i;
+
+    for (i = 0; i < SLEEP_N_BUCKETS; i++)
+        vector_rate_histogram[i] = 0;
+    return 0;
+}
+
+VLIB_CLI_COMMAND (cli_clear_api_histogram_command, static) = {
+    .path = "clear api histogram",
+    .short_help = "clear api histogram",
+    .function = vl_api_clear_histogram_command,
+};
+
+
+VLIB_REGISTER_NODE (memclnt_node,static) = {
+    .function = memclnt_process,
+    .type = VLIB_NODE_TYPE_PROCESS,
+    .name = "api-rx-from-ring",
+    .state = VLIB_NODE_STATE_DISABLED,
+};
+
+static void
+memclnt_queue_signal (int signum)
+{
+    vlib_main_t * vm = vlib_get_main();
+
+    vm->queue_signal_pending = 1;
+}
+
+static void 
+memclnt_queue_callback (vlib_main_t *vm)
+{
+#if 0
+    /* If we need to manually suspend / resume the memclnt process */
+    vlib_node_t * n = vlib_get_node (vm, memclnt_node.index);
+    vlib_process_t * p = vlib_get_process_from_node (vm, n);
+#endif
+
+    vm->queue_signal_pending = 0;
+    vlib_process_signal_event 
+        (vm, memclnt_node.index, /* event_type */ 0, /* event_data */ 0);
+}
+
+void vl_enable_disable_memory_api (vlib_main_t *vm, int enable)
+{
+    vlib_node_set_state (vm, memclnt_node.index,
+			 (enable
+			  ? VLIB_NODE_STATE_POLLING
+			  : VLIB_NODE_STATE_DISABLED));
+}
+
+static uword
+api_rx_from_node (vlib_main_t * vm,
+                  vlib_node_runtime_t * node,
+                  vlib_frame_t * frame)
+{
+    uword n_packets = frame->n_vectors;
+    uword n_left_from;
+    u32 * from;
+    static u8 * long_msg;
+
+    vec_validate (long_msg, 4095);
+    n_left_from = frame->n_vectors;
+    from = vlib_frame_args (frame);
+
+    while (n_left_from > 0) {
+	u32 bi0;
+	vlib_buffer_t * b0;
+        void * msg;
+        uword msg_len;
+
+	bi0 = from[0];
+	b0 = vlib_get_buffer (vm, bi0);
+        from += 1;
+	n_left_from -= 1;
+
+        msg = b0->data + b0->current_data;
+        msg_len = b0->current_length;
+        if (b0->flags & VLIB_BUFFER_NEXT_PRESENT) {
+            ASSERT (long_msg != 0);
+            _vec_len (long_msg) = 0;
+            vec_add (long_msg, msg, msg_len);
+            while (b0->flags & VLIB_BUFFER_NEXT_PRESENT) {
+                b0 = vlib_get_buffer (vm, b0->next_buffer);
+                msg = b0->data + b0->current_data;
+                msg_len = b0->current_length;
+                vec_add (long_msg, msg, msg_len);
+            }
+            msg = long_msg;
+        }
+        vl_msg_api_handler_no_trace_no_free (msg);
+    }
+
+    /* Free what we've been given. */
+    vlib_buffer_free (vm, vlib_frame_args (frame), n_packets);
+
+    return n_packets;
+}
+
+VLIB_REGISTER_NODE (api_rx_from_node_node,static) = {
+    .function = api_rx_from_node,
+    .type = VLIB_NODE_TYPE_INTERNAL,
+    .vector_size = 4,
+    .name = "api-rx-from-node",
+};
+
+static clib_error_t *
+setup_memclnt_exit (vlib_main_t * vm)
+{
+    atexit (vl_unmap_shmem);
+    return 0;
+}
+
+VLIB_INIT_FUNCTION (setup_memclnt_exit);
+
+
+static clib_error_t *
+vl_api_ring_command(vlib_main_t * vm,
+                    unformat_input_t * input, 
+                    vlib_cli_command_t * cli_cmd)
+{
+    int i;
+    ring_alloc_t *ap;
+    vl_shmem_hdr_t *shmem_hdr;
+    api_main_t *am = &api_main;
+
+    shmem_hdr = am->shmem_hdr;
+
+    if (shmem_hdr == 0) {
+        vlib_cli_output (vm, "Shared memory segment not initialized...\n");
+        return 0;
+    }
+
+    vlib_cli_output (vm, "%8s %8s %8s %8s %8s\n",
+                "Owner", "Size", "Nitems", "Hits", "Misses");
+
+    ap = shmem_hdr->vl_rings;
+
+    for (i = 0; i < vec_len(shmem_hdr->vl_rings); i++) {
+        vlib_cli_output(vm, "%8s %8d %8d %8d %8d\n", 
+                        "vlib", ap->size, ap->nitems, ap->hits, ap->misses);
+        ap++;
+    }
+
+    ap = shmem_hdr->client_rings;
+
+    for (i = 0; i < vec_len(shmem_hdr->client_rings); i++) {
+        vlib_cli_output(vm, "%8s %8d %8d %8d %8d\n", 
+                        "clnt", ap->size, ap->nitems, ap->hits, ap->misses);
+        ap++;
+    }
+
+    vlib_cli_output (vm, "%d ring miss fallback allocations\n",
+                     am->ring_misses);
+
+    vlib_cli_output (vm, "%d application restarts, %d reclaimed msgs\n",
+                     shmem_hdr->application_restarts,
+                     shmem_hdr->restart_reclaims);
+    return 0;
+}
+
+void dump_socket_clients (vlib_main_t *vm, api_main_t *am)
+    __attribute__((weak));
+
+void dump_socket_clients (vlib_main_t *vm, api_main_t *am)
+{
+}
+
+static clib_error_t *
+vl_api_client_command(vlib_main_t * vm,
+                      unformat_input_t * input, 
+                      vlib_cli_command_t * cli_cmd)
+{
+    vl_api_registration_t **regpp, *regp;
+    unix_shared_memory_queue_t *q;
+    char *health;
+    api_main_t *am = &api_main;
+    u32 * confused_indices = 0;
+
+    if (!pool_elts (am->vl_clients))
+        goto socket_clients;
+    vlib_cli_output (vm, "Shared memory clients");
+    vlib_cli_output (vm, "%16s %8s %14s %18s %s",
+                     "Name", "PID", "Queue Length", "Queue VA", "Health");
+    
+    pool_foreach (regpp, am->vl_clients, 
+    ({
+        regp = *regpp;
+        
+        if (regp) {
+            q = regp->vl_input_queue;
+            if (kill (q->consumer_pid, 0) < 0) {
+                health = "DEAD";
+            } else {
+                health = "alive";
+            }
+            vlib_cli_output (vm, "%16s %8d %14d 0x%016llx %s\n",
+                             regp->name, q->consumer_pid, q->cursize, 
+                             q, health);
+        } else {
+            clib_warning ("NULL client registration index %d",
+                          regpp - am->vl_clients);
+            vec_add1 (confused_indices, regpp - am->vl_clients);
+        }
+    }));
+
+    /* This should "never happen," but if it does, fix it... */
+    if (PREDICT_FALSE (vec_len(confused_indices) > 0)) {
+        int i;
+        for (i = 0; i < vec_len (confused_indices); i++) {
+            pool_put_index (am->vl_clients, confused_indices[i]);
+        }
+    }
+    vec_free (confused_indices);
+
+    if (am->missing_clients)
+        vlib_cli_output (vm, "%u messages with missing clients",
+                         am->missing_clients);
+socket_clients:
+    dump_socket_clients (vm, am);
+
+    return 0;
+}
+
+VLIB_CLI_COMMAND (cli_show_api_command, static) = {
+    .path = "show api",
+    .short_help = "Show API information",
+};
+
+VLIB_CLI_COMMAND (cli_show_api_ring_command, static) = {
+    .path = "show api ring-stats",
+    .short_help = "Message ring statistics",
+    .function = vl_api_ring_command,
+};
+
+VLIB_CLI_COMMAND (cli_show_api_clients_command, static) = {
+    .path = "show api clients",
+    .short_help = "Client information",
+    .function = vl_api_client_command,
+};
+
+static clib_error_t *
+vl_api_message_table_command(vlib_main_t * vm,
+                             unformat_input_t * input, 
+                             vlib_cli_command_t * cli_cmd)
+{
+    api_main_t *am = &api_main;
+    int i;
+    int verbose = 0;
+    
+    if (unformat (input, "verbose"))
+        verbose = 1;
+
+
+    if (verbose == 0)
+        vlib_cli_output (vm, "%-4s %s", "ID", "Name");
+    else
+        vlib_cli_output (vm, "%-4s %-40s %6s %7s", "ID", "Name", "Bounce", 
+                         "MP-safe");
+
+    for (i = 1; i < vec_len (am->msg_names); i++) {
+        if (verbose == 0) {
+            vlib_cli_output (vm, "%-4d %s", i, 
+                             am->msg_names[i] ? am->msg_names[i] : 
+                             "  [no handler]");
+        } else {
+            vlib_cli_output (vm, "%-4d %-40s %6d %7d", i, 
+                             am->msg_names[i] ? am->msg_names[i] : 
+                             "  [no handler]", am->message_bounce[i], 
+                             am->is_mp_safe[i]);
+        }
+    }
+
+    return 0;
+}
+
+VLIB_CLI_COMMAND (cli_show_api_message_table_command, static) = {
+    .path = "show api message-table",
+    .short_help = "Message Table",
+    .function = vl_api_message_table_command,
+};
+
+void vl_api_trace_print_file_cmd(vlib_main_t *vm, u32 first, u32 last, 
+                                 u8 *filename)
+{
+    FILE *fp;
+    static vl_api_trace_t *tp = 0;
+    int endian_swap = 0;
+    u32 i;
+    u16 msg_id;
+    static u8 *msg_buf=0;
+    void (*endian_fp)(void *);
+    u8 *(*print_fp)(void *, void *);
+    int size;
+    api_main_t *am = &api_main;
+
+    /*
+     * On-demand: allocate enough space for the largest message 
+     */
+    if (msg_buf == 0) {
+        vec_validate(tp, 0);
+        int max_size = 0;
+        for (i = 0; i < vec_len(am->api_trace_cfg); i++) {
+            if (am->api_trace_cfg[i].size > max_size)
+                max_size = am->api_trace_cfg[i].size;
+        }
+        /* round size to a multiple of the cache-line size */
+        max_size = (max_size + (CLIB_CACHE_LINE_BYTES-1)) & 
+            (~(CLIB_CACHE_LINE_BYTES-1));
+        vec_validate (msg_buf, max_size-1);
+    }
+
+    fp = fopen ((char *)filename, "r");
+
+    if (fp == NULL) {
+        vlib_cli_output (vm, "Couldn't open %s\n", filename);
+        return;
+    }
+
+    /* first, fish the header record from the file */
+
+    if (fread(tp, sizeof(*tp), 1, fp) != 1) {
+        fclose(fp);
+        vlib_cli_output (vm, "Header read error\n");
+        return;
+    }
+
+    /* Endian swap required? */
+    if (clib_arch_is_big_endian != tp->endian) {
+        endian_swap = 1;
+    }
+    
+    for (i = 0; i <= last; i++) {
+        /* First 2 bytes are the message type */
+        if (fread(&msg_id, sizeof(u16), 1, fp) != 1) {
+            break;
+        }
+        msg_id = ntohs(msg_id);
+
+        fseek(fp, -2, SEEK_CUR);
+        
+        /* Mild sanity check */
+        if (msg_id >= vec_len(am->msg_handlers)) {
+            fclose(fp);
+            vlib_cli_output (vm, "msg_id %d out of bounds\n",
+                             msg_id);
+            return;
+        }
+
+        size = am->api_trace_cfg[msg_id].size;
+        
+        if (fread(msg_buf, size, 1, fp) != 1) {
+            fclose(fp);
+            vlib_cli_output (vm, "read error on %s\n", filename);
+            return;
+        }
+
+        if (i < first)
+            continue;
+
+        if (endian_swap) {
+            endian_fp = am->msg_endian_handlers[msg_id];
+            (*endian_fp)(msg_buf);
+        }
+            
+        vlib_cli_output (vm, "[%d]: %s\n", i, 
+                         am->msg_names[msg_id]);
+        
+        print_fp = (void *)am->msg_print_handlers[msg_id];
+        (*print_fp)(msg_buf, vm);
+        vlib_cli_output (vm, "-------------\n");
+    }
+    fclose(fp);
+}
+
+static clib_error_t *
+vl_api_trace_command(vlib_main_t * vm,
+                     unformat_input_t * input, 
+                     vlib_cli_command_t * cli_cmd)
+{
+    u32 nitems=1024;
+    vl_api_trace_which_t which=VL_API_TRACE_RX;
+    u8 *filename;
+    u32 first = 0;
+    u32 last  = ~0;
+    api_main_t *am = &api_main;
+
+    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
+        if (unformat (input, "rx nitems %u", &nitems)
+            || unformat (input, "rx"))
+            goto configure;
+        else if (unformat (input, "tx nitems %u", &nitems) 
+                 || unformat (input, "tx")) {
+            which = VL_API_TRACE_RX;
+            goto configure;
+        } else if (unformat (input, "on rx")) {
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_RX, 1);
+        } else if (unformat (input, "on tx")) {
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_TX, 1);
+        } else if (unformat (input, "on")) {
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_RX, 1);
+        } else if (unformat (input, "off")) {
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_RX, 0);
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_TX, 0);
+        } else if (unformat (input, "free")) {
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_RX, 0);
+            vl_msg_api_trace_onoff (am, VL_API_TRACE_TX, 0);
+            vl_msg_api_trace_free (am, VL_API_TRACE_RX);
+            vl_msg_api_trace_free (am, VL_API_TRACE_TX);
+        } else if (unformat (input, "print %s from %d to %d", &filename,
+                             &first, &last)
+                   || unformat (input, "print %s", &filename)) {
+            goto print;
+        } else if (unformat (input, "debug on")) {
+            am->msg_print_flag = 1;
+        } else if (unformat (input, "debug off")) {
+            am->msg_print_flag = 0;
+        }
+        else
+            return clib_error_return (0, "unknown input `%U'",
+                                      format_unformat_error, input);
+    }
+    return 0;
+
+ print:
+    vl_api_trace_print_file_cmd (vm, first, last, filename);
+    goto out;
+
+ configure:
+    if (vl_msg_api_trace_configure (am, which, nitems)) {
+        vlib_cli_output (vm, "warning: trace configure error (%d, %d)", 
+                         which, nitems);
+    }
+
+ out:
+    return 0;
+}
+
+VLIB_CLI_COMMAND (trace, static) = {
+    .path = "set api-trace",
+    .short_help = "API trace",
+    .function = vl_api_trace_command,
+};
+
+clib_error_t *
+vlibmemory_init (vlib_main_t * vm)
+{
+    /* Do this early, to avoid glibc malloc fubar */
+    svm_region_init();
+    return 0;
+}
+
+VLIB_INIT_FUNCTION (vlibmemory_init);
+
+void vl_set_memory_region_name (char *name)
+{
+    api_main_t *am = &api_main;
+
+    am->region_name = name;
+}
+
+void vl_set_memory_root_path (char *name)
+{
+    api_main_t *am = &api_main;
+
+    am->root_path = name;
+}
+
+static int range_compare (vl_api_msg_range_t * a0, vl_api_msg_range_t * a1)
+{
+    int len0, len1, clen;
+
+    len0 = vec_len (a0->name);
+    len1 = vec_len (a1->name);
+    clen = len0 < len1 ? len0 : len1;
+    return (strncmp ((char *) a0->name, (char *)a1->name, clen)); 
+}
+
+static u8 * format_api_msg_range (u8 * s, va_list * args)
+{
+    vl_api_msg_range_t * rp = va_arg (*args, vl_api_msg_range_t *);
+
+    if (rp == 0)
+        s = format (s, "%-20s%9s%9s", "Name", "First-ID", "Last-ID");
+    else
+        s = format (s, "%-20s%9d%9d", rp->name, rp->first_msg_id,
+                    rp->last_msg_id);
+            
+    return s;
+}
+
+static clib_error_t *
+vl_api_show_plugin_command(vlib_main_t * vm,
+                           unformat_input_t * input, 
+                           vlib_cli_command_t * cli_cmd)
+{
+    api_main_t *am = &api_main;
+    vl_api_msg_range_t * rp = 0;
+    int i;
+    
+    if (vec_len (am->msg_ranges) == 0) {
+        vlib_cli_output (vm, "No plugin API message ranges configured...");
+        return 0;
+    }
+        
+    rp = vec_dup (am->msg_ranges);
+
+    vec_sort_with_function (rp, range_compare);
+    
+    vlib_cli_output (vm, "Plugin API message ID ranges...\n");
+    vlib_cli_output (vm, "%U", format_api_msg_range, 0 /* header */);
+
+    for (i = 0; i < vec_len (rp); i++)
+        vlib_cli_output (vm, "%U", format_api_msg_range, rp+i);
+
+    return 0;
+}
+
+VLIB_CLI_COMMAND (cli_show_api_plugin_command, static) = {
+    .path = "show api plugin",
+    .short_help = "show api plugin",
+    .function = vl_api_show_plugin_command,
+};
diff --git a/vlib-api/vlibmemory/unix_shared_memory_queue.c b/vlib-api/vlibmemory/unix_shared_memory_queue.c
new file mode 100644
index 0000000..62fb240
--- /dev/null
+++ b/vlib-api/vlibmemory/unix_shared_memory_queue.c
@@ -0,0 +1,291 @@
+/* 
+ *------------------------------------------------------------------
+ * unix_shared_memory_queue.c - unidirectional shared-memory queues
+ *
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <vppinfra/mem.h>
+#include <vppinfra/format.h>
+#include <vppinfra/cache.h>
+#include <vlibmemory/unix_shared_memory_queue.h>
+#include <signal.h>
+
+/*
+ * unix_shared_memory_queue_init
+ * 
+ * nels = number of elements on the queue
+ * elsize = element size, presumably 4 and cacheline-size will
+ *          be popular choices.
+ * coid  = consumer coid, from ChannelCreate
+ * pid   = consumer pid
+ * pulse_code  = pulse code consumer expects
+ * pulse_value = pulse value consumer expects
+ * consumer_prio = consumer's priority, so pulses won't change
+ *                 the consumer's priority.
+ *
+ * The idea is to call this function in the queue consumer,
+ * and e-mail the queue pointer to the producer(s).
+ *
+ * The spp process / main thread allocates one of these
+ * at startup; its main input queue. The spp main input queue
+ * has a pointer to it in the shared memory segment header.
+ * 
+ * You probably want to be on an svm data heap before calling this 
+ * function.
+ */
+unix_shared_memory_queue_t *
+unix_shared_memory_queue_init(int nels, 
+                              int elsize, 
+                              int consumer_pid,
+                              int signal_when_queue_non_empty)
+{
+    unix_shared_memory_queue_t *q;
+    pthread_mutexattr_t attr;
+    pthread_condattr_t cattr;
+
+    q = clib_mem_alloc_aligned(sizeof(unix_shared_memory_queue_t) 
+                               + nels*elsize, CLIB_CACHE_LINE_BYTES);
+    memset(q, 0, sizeof (*q));
+
+    q->elsize = elsize;
+    q->maxsize = nels;
+    q->consumer_pid = consumer_pid;
+    q->signal_when_queue_non_empty = signal_when_queue_non_empty;
+
+    memset(&attr,0,sizeof(attr));
+    memset(&cattr,0,sizeof(attr));
+    
+    if (pthread_mutexattr_init(&attr))
+        clib_unix_warning("mutexattr_init");
+    if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
+        clib_unix_warning("pthread_mutexattr_setpshared");
+    if (pthread_mutex_init(&q->mutex, &attr))
+        clib_unix_warning("mutex_init");
+    if (pthread_mutexattr_destroy(&attr))
+        clib_unix_warning("mutexattr_destroy");
+    if (pthread_condattr_init(&cattr)) 
+        clib_unix_warning("condattr_init");
+    /* prints funny-looking messages in the Linux target */
+    if (pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED))
+        clib_unix_warning("condattr_setpshared");
+    if (pthread_cond_init(&q->condvar, &cattr))
+        clib_unix_warning("cond_init1");
+    if(pthread_condattr_destroy(&cattr))
+        clib_unix_warning("cond_init2");
+
+    return(q);
+}
+
+/*
+ * unix_shared_memory_queue_free
+ */
+void unix_shared_memory_queue_free(unix_shared_memory_queue_t *q)
+{
+    (void) pthread_mutex_destroy(&q->mutex);
+    (void) pthread_cond_destroy(&q->condvar);
+    clib_mem_free(q);
+}
+
+void unix_shared_memory_queue_lock (unix_shared_memory_queue_t *q)
+{
+    pthread_mutex_lock(&q->mutex);
+}
+
+void unix_shared_memory_queue_unlock (unix_shared_memory_queue_t *q)
+{
+    pthread_mutex_unlock(&q->mutex);
+}
+
+int unix_shared_memory_queue_is_full (unix_shared_memory_queue_t *q)
+{
+    return q->cursize == q->maxsize;
+}
+
+/*
+ * unix_shared_memory_queue_add_nolock
+ */
+int unix_shared_memory_queue_add_nolock (unix_shared_memory_queue_t *q, 
+                                         u8 *elem)
+{
+    i8 *tailp;
+    int need_broadcast=0;
+    
+    if (PREDICT_FALSE(q->cursize == q->maxsize)) {
+        while(q->cursize == q->maxsize) {
+            (void) pthread_cond_wait(&q->condvar, &q->mutex);
+        }
+    }
+        
+    tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
+    memcpy(tailp, elem, q->elsize);
+
+    q->tail++;
+    q->cursize++;
+
+    need_broadcast = (q->cursize == 1);
+
+    if (q->tail == q->maxsize)
+        q->tail = 0;
+
+    if (need_broadcast) {
+        (void) pthread_cond_broadcast(&q->condvar);
+        if (q->signal_when_queue_non_empty)
+            kill (q->consumer_pid, q->signal_when_queue_non_empty);
+    }
+    return 0;
+}
+
+int unix_shared_memory_queue_add_raw (unix_shared_memory_queue_t *q, 
+                                      u8 *elem)
+{
+    i8 *tailp;
+    
+    if (PREDICT_FALSE(q->cursize == q->maxsize)) {
+        while(q->cursize == q->maxsize)
+            ;
+    }
+        
+    tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
+    memcpy(tailp, elem, q->elsize);
+
+    q->tail++;
+    q->cursize++;
+
+    if (q->tail == q->maxsize)
+        q->tail = 0;
+    return 0;
+}
+
+
+/*
+ * unix_shared_memory_queue_add
+ */
+int unix_shared_memory_queue_add (unix_shared_memory_queue_t *q, 
+                                  u8 *elem, int nowait)
+{
+    i8 *tailp;
+    int need_broadcast=0;
+    
+    if (nowait) {
+        /* zero on success */
+        if (pthread_mutex_trylock (&q->mutex)) {
+            return (-1);
+        }
+    } else 
+        pthread_mutex_lock(&q->mutex);
+    
+    if (PREDICT_FALSE(q->cursize == q->maxsize)) {
+        if (nowait) {
+            pthread_mutex_unlock(&q->mutex);
+            return (-2);
+        }
+        while(q->cursize == q->maxsize) {
+            (void) pthread_cond_wait(&q->condvar, &q->mutex);
+        }
+    }
+        
+    tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
+    memcpy(tailp, elem, q->elsize);
+
+    q->tail++;
+    q->cursize++;
+
+    need_broadcast = (q->cursize == 1);
+
+    if (q->tail == q->maxsize)
+        q->tail = 0;
+
+    if (need_broadcast) {
+        (void) pthread_cond_broadcast(&q->condvar);
+        if (q->signal_when_queue_non_empty)
+            kill (q->consumer_pid, q->signal_when_queue_non_empty);
+    }
+    pthread_mutex_unlock(&q->mutex);
+
+    return 0;
+}
+
+/*
+ * unix_shared_memory_queue_sub
+ */
+int unix_shared_memory_queue_sub(unix_shared_memory_queue_t *q, 
+                                 u8 *elem, int nowait)
+{
+    i8 *headp;
+    int need_broadcast=0;
+    
+    if (nowait) {
+        /* zero on success */
+        if (pthread_mutex_trylock (&q->mutex)) {
+            return (-1);
+        }
+    } else 
+        pthread_mutex_lock(&q->mutex);
+    
+    if (PREDICT_FALSE(q->cursize == 0)) {
+        if (nowait) {
+            pthread_mutex_unlock(&q->mutex);
+            return (-2);
+        }
+        while (q->cursize == 0) {
+            (void) pthread_cond_wait(&q->condvar, &q->mutex);
+        }
+    }
+    
+    headp = (i8 *)(&q->data[0] + q->elsize*q->head);
+    memcpy(elem, headp, q->elsize);
+    
+    q->head++;
+    if (q->cursize == q->maxsize)
+        need_broadcast = 1;
+
+    q->cursize--;
+
+    if(q->head == q->maxsize)
+        q->head = 0;
+
+    if (need_broadcast) 
+        (void) pthread_cond_broadcast(&q->condvar);
+    
+    pthread_mutex_unlock(&q->mutex);
+
+    return 0;
+}
+
+int unix_shared_memory_queue_sub_raw (unix_shared_memory_queue_t *q, 
+                                      u8 *elem)
+{
+    i8 *headp;
+    
+    if (PREDICT_FALSE(q->cursize == 0)) {
+        while (q->cursize == 0) 
+            ;
+    }
+    
+    headp = (i8 *)(&q->data[0] + q->elsize*q->head);
+    memcpy(elem, headp, q->elsize);
+    
+    q->head++;
+    q->cursize--;
+
+    if(q->head == q->maxsize)
+        q->head = 0;
+    return 0;
+}
diff --git a/vlib-api/vlibmemory/unix_shared_memory_queue.h b/vlib-api/vlibmemory/unix_shared_memory_queue.h
new file mode 100644
index 0000000..86bc49f
--- /dev/null
+++ b/vlib-api/vlibmemory/unix_shared_memory_queue.h
@@ -0,0 +1,60 @@
+/* 
+ *------------------------------------------------------------------
+ * unix_shared_memory_queue.h - shared-memory queues
+ * 
+ * Copyright (c) 2009 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#ifndef included_unix_shared_memory_queue_h
+#define included_unix_shared_memory_queue_h
+
+#include <pthread.h>
+#include <vppinfra/mem.h>
+
+typedef struct _unix_shared_memory_queue {
+    pthread_mutex_t mutex;      /* 8 bytes */
+    pthread_cond_t condvar;     /* 8 bytes */
+    int head;
+    int tail;
+    int cursize;
+    int maxsize;
+    int elsize;
+    int consumer_pid;
+    int signal_when_queue_non_empty;
+    char data[0];
+} unix_shared_memory_queue_t;
+
+unix_shared_memory_queue_t *
+unix_shared_memory_queue_init(int nels, 
+                              int elsize, 
+                              int consumer_pid,
+                              int signal_when_queue_non_empty);
+void unix_shared_memory_queue_free(unix_shared_memory_queue_t *q);
+int unix_shared_memory_queue_add (unix_shared_memory_queue_t *q, 
+                                  u8 *elem, int nowait);
+int unix_shared_memory_queue_sub(unix_shared_memory_queue_t *q, 
+                                 u8 *elem, int nowait);
+void unix_shared_memory_queue_lock (unix_shared_memory_queue_t *q);
+void unix_shared_memory_queue_unlock (unix_shared_memory_queue_t *q);
+int unix_shared_memory_queue_is_full (unix_shared_memory_queue_t *q);
+int unix_shared_memory_queue_add_nolock (unix_shared_memory_queue_t *q, 
+                                         u8 *elem);
+
+int unix_shared_memory_queue_sub_raw (unix_shared_memory_queue_t *q, 
+                                      u8 *elem);
+int unix_shared_memory_queue_add_raw (unix_shared_memory_queue_t *q, 
+                                      u8 *elem);
+
+#endif /* included_unix_shared_memory_queue_h */
diff --git a/vlib-api/vlibmemory/vl_memory_api_h.h b/vlib-api/vlibmemory/vl_memory_api_h.h
new file mode 100644
index 0000000..f4bee91
--- /dev/null
+++ b/vlib-api/vlibmemory/vl_memory_api_h.h
@@ -0,0 +1,25 @@
+/* 
+ *------------------------------------------------------------------
+ * vl_memory_api_h.h - memory API headers, in a specific order.
+ *
+ * Copyright (c) 2009-2010 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+/*
+ * Add to the bottom of the #include list, or elves will steal your
+ * keyboard in the middle of the night! 
+ */
+#include <vlibmemory/memclnt.api.h>
+
diff --git a/vlib-api/vlibmemory/vl_memory_msg_enum.h b/vlib-api/vlibmemory/vl_memory_msg_enum.h
new file mode 100644
index 0000000..262a543
--- /dev/null
+++ b/vlib-api/vlibmemory/vl_memory_msg_enum.h
@@ -0,0 +1,33 @@
+/* 
+ *------------------------------------------------------------------
+ * vl_memory_msg_enum.h - Our view of how to number API messages
+ * Clients have their own view, which has to agree with ours.
+ *
+ * Copyright (c) 2009-2010 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __VL_MSG_ENUM_H__
+#define __VL_MSG_ENUM_H__
+
+#include <vppinfra/byte_order.h>
+
+#define vl_msg_id(n,h) n,
+typedef enum {
+    VL_ILLEGAL_MESSAGE_ID=0,
+#include <vlibmemory/vl_memory_api_h.h>
+} vl_msg_id_t;
+#undef vl_msg_id
+
+#endif /* __VL_MSG_ENUM_H__ */
