TCP proxy prototype

- Clean up internal API client registration
- Add proxy server
- Add a reference count to the svm fifo

Change-Id: I5ace1c85497062ed412d26ae76a9e6741af1e984
Signed-off-by: Dave Barach <dave@barachs.net>
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index 86661e5..c04b9d8 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -296,6 +296,7 @@
 	  memset (f, 0, sizeof (*f));
 	  f->nitems = data_size_in_bytes;
 	  f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
+	  f->refcnt = 1;
 	  goto found;
 	}
       /* FALLTHROUGH */
@@ -344,6 +345,10 @@
   svm_fifo_segment_header_t *fsh;
   void *oldheap;
 
+  ASSERT (f->refcnt > 0);
+
+  if (--f->refcnt > 0)
+    return;
 
   sh = s->ssvm.sh;
   fsh = (svm_fifo_segment_header_t *) sh->opaque[0];