summaryrefslogtreecommitdiff
path: root/nuttx/net/local
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/net/local')
-rw-r--r--nuttx/net/local/Make.defs2
-rw-r--r--nuttx/net/local/local.h14
-rw-r--r--nuttx/net/local/local_conn.c102
3 files changed, 111 insertions, 7 deletions
diff --git a/nuttx/net/local/Make.defs b/nuttx/net/local/Make.defs
index 2a6b3b27f..fc58f7211 100644
--- a/nuttx/net/local/Make.defs
+++ b/nuttx/net/local/Make.defs
@@ -37,7 +37,7 @@
ifeq ($(CONFIG_NET_LOCAL),y)
-# NET_CSRCS +=
+NET_CSRCS += local_conn.c
# Include UDP build support
diff --git a/nuttx/net/local/local.h b/nuttx/net/local/local.h
index 5d8aec50b..e44a1739e 100644
--- a/nuttx/net/local/local.h
+++ b/nuttx/net/local/local.h
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <sys/un.h>
#include <queue.h>
#include <stdint.h>
@@ -60,9 +61,9 @@
struct local_conn_s
{
- dq_entry_t node; /* Supports a doubly linked list */
- int16_t fd; /* File descriptor of underlying file */
- uint8_t crefs; /* Reference counts on this instance */
+ uint8_t lc_crefs; /* Reference counts on this instance */
+ int16_t lc_fd; /* File descriptor of underlying pipe */
+ char lc_path[UNIX_PATH_MAX]; /* Path assigned by bind() */
};
/****************************************************************************
@@ -88,12 +89,13 @@ struct socket; /* Forward reference */
* Name: local_initialize
*
* Description:
- * Initialize the local connection structures. Called once and only from
- * the UIP layer.
+ * Initialize the local, Unix domain connection structures. Called once
+ * and only from the common network initialization logic.
*
****************************************************************************/
-void local_initialize(void);
+/* void local_initialize(void) */
+#define local_initialize()
/****************************************************************************
* Name: local_alloc
diff --git a/nuttx/net/local/local_conn.c b/nuttx/net/local/local_conn.c
new file mode 100644
index 000000000..506b56b40
--- /dev/null
+++ b/nuttx/net/local/local_conn.c
@@ -0,0 +1,102 @@
+/****************************************************************************
+ * net/local/local_conn.c
+ *
+ * Copyright (C) 2015 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * 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 NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
+
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include "local/local.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: local_initialize
+ *
+ * Description:
+ * Initialize the local, Unix domain connection structures. Called once
+ * and only from the common network initialization logic.
+ *
+ ****************************************************************************/
+
+/* void local_initialize(void) */
+
+/****************************************************************************
+ * Name: local_alloc()
+ *
+ * Description:
+ * Allocate a new, uninitialized Unix domain socket connection structure.
+ * This is normally something done by the implementation of the socket()
+ * API
+ *
+ ****************************************************************************/
+
+FAR struct local_conn_s *local_alloc(void)
+{
+ return (FAR struct local_conn_s *)malloc(sizeof(struct local_conn_s));
+}
+
+/****************************************************************************
+ * Name: local_free()
+ *
+ * Description:
+ * Free a packet Unix domain connection structure that is no longer in use.
+ * This should be done by the implementation of close().
+ *
+ ****************************************************************************/
+
+void local_free(FAR struct local_conn_s *conn)
+{
+ DEBUGASSERT(conn != NULL);
+ free(conn);
+}
+
+#endif /* CONFIG_NET && CONFIG_NET_LOCAL */