diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-05 13:59:22 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-05 13:59:22 -0600 |
commit | 38bcf8b809ca54b970a179d42051b7e57e655bf4 (patch) | |
tree | 24be334c43ac60b1e5d9d42bc6ddee1c643c434d /nuttx/net/pkt | |
parent | bcde33e42fcaf628825fe4305a9276c18ebb5160 (diff) | |
download | px4-nuttx-38bcf8b809ca54b970a179d42051b7e57e655bf4.tar.gz px4-nuttx-38bcf8b809ca54b970a179d42051b7e57e655bf4.tar.bz2 px4-nuttx-38bcf8b809ca54b970a179d42051b7e57e655bf4.zip |
NET: Most of the contents of include/nuttx/net/pkt.h moved to net/pkt/pkt.h
Diffstat (limited to 'nuttx/net/pkt')
-rw-r--r-- | nuttx/net/pkt/pkt.h | 123 | ||||
-rw-r--r-- | nuttx/net/pkt/pkt_callback.c | 1 | ||||
-rw-r--r-- | nuttx/net/pkt/pkt_conn.c | 4 | ||||
-rw-r--r-- | nuttx/net/pkt/pkt_poll.c | 1 | ||||
-rw-r--r-- | nuttx/net/pkt/pkt_send.c | 1 |
5 files changed, 123 insertions, 7 deletions
diff --git a/nuttx/net/pkt/pkt.h b/nuttx/net/pkt/pkt.h index dee1fecbf..61fd45387 100644 --- a/nuttx/net/pkt/pkt.h +++ b/nuttx/net/pkt/pkt.h @@ -59,6 +59,23 @@ * Public Type Definitions ****************************************************************************/ +/* Representation of a uIP packet socket connection */ + +struct devif_callback_s; /* Forward reference */ + +struct pkt_conn_s +{ + dq_entry_t node; /* Supports a double linked list */ + uint8_t lmac[6]; /* The local Ethernet address in network byte order */ + uint8_t ifindex; + uint16_t proto; + uint8_t crefs; /* Reference counts on this instance */ + + /* Defines the list of packet callbacks */ + + struct devif_callback_s *list; +}; + /**************************************************************************** * Public Data ****************************************************************************/ @@ -76,24 +93,127 @@ extern "C" ****************************************************************************/ struct eth_hdr_s; /* Forward reference */ -struct pkt_conn_s; /* Forward refernce */ /* Defined in pkt_conn.c ****************************************************/ +/**************************************************************************** + * Name: pkt_initialize() + * + * Description: + * Initialize the packet socket connection structures. Called once and + * only from the UIP layer. + * + ****************************************************************************/ void pkt_initialize(void); + +/**************************************************************************** + * Name: pkt_palloc() + * + * Description: + * Allocate a new, uninitialized packet socket connection structure. This + * is normally something done by the implementation of the socket() API + * + ****************************************************************************/ + FAR struct pkt_conn_s *pkt_alloc(void); + +/**************************************************************************** + * Name: pkt_free() + * + * Description: + * Free a packet socket connection structure that is no longer in use. + * This should be done by the implementation of close(). + * + ****************************************************************************/ + void pkt_free(FAR struct pkt_conn_s *conn); + +/**************************************************************************** + * Name: pkt_active() + * + * Description: + * Find a connection structure that is the appropriate + * connection to be used with the provided Ethernet header + * + * Assumptions: + * This function is called from UIP logic at interrupt level + * + ****************************************************************************/ + struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf); + +/**************************************************************************** + * Name: pkt_nextconn() + * + * Description: + * Traverse the list of allocated packet connections + * + * Assumptions: + * This function is called from UIP logic at interrupt level (or with + * interrupts disabled). + * + ****************************************************************************/ + struct pkt_conn_s *pkt_nextconn(FAR struct pkt_conn_s *conn); /* Defined in pkt_callback.c ************************************************/ +/**************************************************************************** + * Function: pkt_callback + * + * Description: + * Inform the application holding the packet socket of a change in state. + * + * Returned Value: + * OK if packet has been processed, otherwise ERROR. + * + * Assumptions: + * This function is called at the interrupt level with interrupts disabled. + * + ****************************************************************************/ uint16_t pkt_callback(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn, uint16_t flags); /* Defined in pkt_input.c ***************************************************/ +/**************************************************************************** + * Name: pkt_input + * + * Description: + * Handle incoming packet input + * + * Parameters: + * dev - The device driver structure containing the received packet + * + * Return: + * OK The packet has been processed and can be deleted + * ERROR Hold the packet and try again later. There is a listening socket + * but no recv in place to catch the packet yet. + * + * Assumptions: + * Called from the interrupt level or with interrupts disabled. + * + ****************************************************************************/ + +/* pkt_input() is prototyped in include/nuttx/net/pkt.h */ /* Defined in pkt_poll.c ****************************************************/ +/**************************************************************************** + * Name: pkt_poll + * + * Description: + * Poll a packet "connection" structure for availability of TX data + * + * Parameters: + * dev - The device driver structure to use in the send operation + * conn - The packet "connection" to poll for TX data + * + * Return: + * None + * + * Assumptions: + * Called from the interrupt level or with interrupts disabled. + * + ****************************************************************************/ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn); @@ -158,7 +278,6 @@ struct socket; ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, size_t len); - #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/net/pkt/pkt_callback.c b/nuttx/net/pkt/pkt_callback.c index dcc9e2c59..443cc8acc 100644 --- a/nuttx/net/pkt/pkt_callback.c +++ b/nuttx/net/pkt/pkt_callback.c @@ -45,7 +45,6 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/netdev.h> -#include <nuttx/net/pkt.h> #include "devif/devif.h" #include "pkt/pkt.h" diff --git a/nuttx/net/pkt/pkt_conn.c b/nuttx/net/pkt/pkt_conn.c index 471de1d3b..50a71c0c8 100644 --- a/nuttx/net/pkt/pkt_conn.c +++ b/nuttx/net/pkt/pkt_conn.c @@ -54,7 +54,6 @@ #include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/arp.h> -#include <nuttx/net/pkt.h> #include "devif/devif.h" #include "pkt/pkt.h" @@ -139,7 +138,8 @@ void pkt_initialize(void) * Name: pkt_palloc() * * Description: - * Alloc a new, uninitialized packet socket connection structure. + * Allocate a new, uninitialized packet socket connection structure. This + * is normally something done by the implementation of the socket() API * ****************************************************************************/ diff --git a/nuttx/net/pkt/pkt_poll.c b/nuttx/net/pkt/pkt_poll.c index 4701456be..130ca5a94 100644 --- a/nuttx/net/pkt/pkt_poll.c +++ b/nuttx/net/pkt/pkt_poll.c @@ -50,7 +50,6 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/netdev.h> #include <nuttx/net/udp.h> -#include <nuttx/net/pkt.h> #include "devif/devif.h" #include "pkt/pkt.h" diff --git a/nuttx/net/pkt/pkt_send.c b/nuttx/net/pkt/pkt_send.c index 1d3f94f7f..5e548fcef 100644 --- a/nuttx/net/pkt/pkt_send.c +++ b/nuttx/net/pkt/pkt_send.c @@ -56,7 +56,6 @@ #include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/ip.h> -#include <nuttx/net/pkt.h> #include "netdev/netdev.h" #include "devif/devif.h" |