mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
NET: Most of the contents of include/nuttx/net/pkt.h moved to net/pkt/pkt.h
This commit is contained in:
@@ -50,9 +50,6 @@
|
||||
|
||||
#include <nuttx/net/netconfig.h>
|
||||
|
||||
#ifdef CONFIG_NET_PKT
|
||||
# include <nuttx/net/pkt.h>
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP
|
||||
# include <nuttx/net/tcp.h>
|
||||
#endif
|
||||
|
||||
+4
-37
@@ -46,32 +46,12 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <queue.h>
|
||||
|
||||
#include <nuttx/net/netconfig.h>
|
||||
|
||||
/****************************************************************************
|
||||
* 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
|
||||
****************************************************************************/
|
||||
@@ -79,25 +59,12 @@ struct pkt_conn_s
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* uIP application functions
|
||||
*
|
||||
* Functions used by an application running of top of uIP. This includes
|
||||
* functions for opening and closing connections, sending and receiving
|
||||
* data, etc.
|
||||
*
|
||||
* Find a free connection structure and allocate it for use. This is
|
||||
* normally something done by the implementation of the socket() API
|
||||
/* This function provides the interface between Ethernet device drivers and
|
||||
* packet socket logic. All frames that are received should be provided to
|
||||
* pkt_input() prior to other routing.
|
||||
*/
|
||||
|
||||
FAR struct pkt_conn_s *pkt_alloc(void);
|
||||
|
||||
/* Free a 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);
|
||||
void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn);
|
||||
struct net_driver_s; /* Forward reference */
|
||||
int pkt_input(FAR struct net_driver_s *dev);
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_NET_PKT_H */
|
||||
|
||||
+121
-2
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
+2
-2
@@ -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
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
+1
-1
@@ -51,12 +51,12 @@
|
||||
|
||||
#include <nuttx/net/tcp.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
#include <nuttx/net/pkt.h>
|
||||
|
||||
#include "socket/socket.h"
|
||||
#include "netdev/netdev.h"
|
||||
#include "tcp/tcp.h"
|
||||
#include "udp/udp.h"
|
||||
#include "pkt/pkt.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/tcp.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
#include <nuttx/net/pkt.h>
|
||||
|
||||
#ifdef CONFIG_NET_SOLINGER
|
||||
# include <nuttx/clock.h>
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include <nuttx/net/ip.h>
|
||||
#include <nuttx/net/tcp.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
#include <nuttx/net/pkt.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
#include "devif/devif.h"
|
||||
@@ -70,7 +69,6 @@
|
||||
#include "pkt/pkt.h"
|
||||
#include "socket/socket.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
|
||||
#include <nuttx/net/tcp.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
#include <nuttx/net/pkt.h>
|
||||
|
||||
#include "socket/socket.h"
|
||||
#include "tcp/tcp.h"
|
||||
|
||||
Reference in New Issue
Block a user