diff options
Diffstat (limited to 'nuttx/net/tcp/tcp.h')
-rw-r--r-- | nuttx/net/tcp/tcp.h | 107 |
1 files changed, 65 insertions, 42 deletions
diff --git a/nuttx/net/tcp/tcp.h b/nuttx/net/tcp/tcp.h index f7afc6ff0..863c227cc 100644 --- a/nuttx/net/tcp/tcp.h +++ b/nuttx/net/tcp/tcp.h @@ -103,6 +103,7 @@ struct net_driver_s; /* Forward reference */ struct devif_callback_s; /* Forward reference */ struct tcp_backlog_s; /* Forward reference */ +struct tcp_hdr_s; /* Forward reference */ struct tcp_conn_s { @@ -272,7 +273,7 @@ extern "C" struct tcp_iphdr_s; /* Forward reference */ /**************************************************************************** - * Name: tcp_initialize() + * Name: tcp_initialize * * Description: * Initialize the TCP/IP connection structures. Called only once and only @@ -283,12 +284,12 @@ struct tcp_iphdr_s; /* Forward reference */ void tcp_initialize(void); /**************************************************************************** - * Name: tcp_alloc() + * Name: tcp_alloc * * Description: * Find a free TCP/IP connection structure and allocate it * for use. This is normally something done by the implementation of the - * socket() API but is also called from the interrupt level when a TCP + * socket() API but is also called from the driver level when a TCP * packet is received while "listening" * ****************************************************************************/ @@ -296,7 +297,7 @@ void tcp_initialize(void); FAR struct tcp_conn_s *tcp_alloc(void); /**************************************************************************** - * Name: tcp_free() + * Name: tcp_free * * Description: * Free a connection structure that is no longer in use. This should be @@ -307,51 +308,51 @@ FAR struct tcp_conn_s *tcp_alloc(void); void tcp_free(FAR struct tcp_conn_s *conn); /**************************************************************************** - * Name: tcp_active() + * Name: tcp_active * * Description: * Find a connection structure that is the appropriate * connection to be used with the provided TCP/IP header * * Assumptions: - * This function is called from UIP logic at interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ -FAR struct tcp_conn_s *tcp_active(struct tcp_iphdr_s *buf); +FAR struct tcp_conn_s *tcp_active(FAR struct net_driver_s *dev, + FAR struct tcp_hdr_s *tcp); /**************************************************************************** - * Name: tcp_nextconn() + * Name: tcp_nextconn * * Description: * Traverse the list of active TCP connections * * Assumptions: - * This function is called from UIP logic at interrupt level (or with - * interrupts disabled). + * Called from network stack logic with the network stack locked * ****************************************************************************/ FAR struct tcp_conn_s *tcp_nextconn(FAR struct tcp_conn_s *conn); /**************************************************************************** - * Name: tcp_alloc_accept() + * Name: tcp_alloc_accept * * Description: - * Called when driver interrupt processing matches the incoming packet - * with a connection in LISTEN. In that case, this function will create - * a new connection and initialize it to send a SYNACK in return. + * Called when driver processing matches the incoming packet with a + * connection in LISTEN. In that case, this function will create a new + * connection and initialize it to send a SYNACK in return. * * Assumptions: - * This function is called from UIP logic at interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev, - FAR struct tcp_iphdr_s *buf); + FAR struct tcp_hdr_s *tcp); /**************************************************************************** - * Name: tcp_bind() + * Name: tcp_bind * * Description: * This function implements the lower level parts of the standard TCP @@ -409,7 +410,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, * Set the TCP/IP sequence number * * Assumptions: - * This function may called from the interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -422,7 +423,7 @@ void tcp_setsequence(FAR uint8_t *seqno, uint32_t value); * Get the TCP/IP sequence number * * Assumptions: - * This function may called from the interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -435,7 +436,7 @@ uint32_t tcp_getsequence(FAR uint8_t *seqno); * Add the length to get the next TCP sequence number. * * Assumptions: - * This function may called from the interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -449,7 +450,7 @@ uint32_t tcp_addsequence(FAR uint8_t *seqno, uint16_t len); * established. * * Assumptions: - * This function may called from the interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -462,7 +463,7 @@ void tcp_initsequence(FAR uint8_t *seqno); * Increment the TCP/IP sequence number * * Assumptions: - * This function is called from the interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -483,7 +484,7 @@ void tcp_nextsequence(void); * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -505,7 +506,7 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn); * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -560,7 +561,7 @@ int tcp_listen(FAR struct tcp_conn_s *conn); * Return true is there is a listener for the specified port * * Assumptions: - * Called at interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -573,7 +574,7 @@ bool tcp_islistener(uint16_t portno); * Accept the new connection for the specified listening port. * * Assumptions: - * Called at interrupt level + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -597,7 +598,7 @@ int tcp_accept_connection(FAR struct net_driver_s *dev, * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -617,7 +618,7 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -638,7 +639,7 @@ void tcp_reset(FAR struct net_driver_s *dev); * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -663,7 +664,7 @@ void tcp_ack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -685,7 +686,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -694,10 +695,10 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, /* Defined in tcp_input.c ***************************************************/ /**************************************************************************** - * Name: tcp_input + * Name: tcp_ipv4_input * * Description: - * Handle incoming TCP input + * Handle incoming TCP input with IPv4 header * * Parameters: * dev - The device driver structure containing the received TCP packet. @@ -706,11 +707,34 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from the Ethernet driver with the network stack locked * ****************************************************************************/ -void tcp_input(FAR struct net_driver_s *dev); +#ifdef CONFIG_NET_IPv4 +void tcp_ipv4_input(FAR struct net_driver_s *dev); +#endif + +/**************************************************************************** + * Name: tcp_ipv6_input + * + * Description: + * Handle incoming TCP input with IPv4 header + * + * Parameters: + * dev - The device driver structure containing the received TCP packet. + * + * Return: + * None + * + * Assumptions: + * Called from the Ethernet driver with the network stack locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_IPv6 +void tcp_ipv6_input(FAR struct net_driver_s *dev); +#endif /* Defined in tcp_callback.c ************************************************/ /**************************************************************************** @@ -720,7 +744,7 @@ void tcp_input(FAR struct net_driver_s *dev); * Inform the application holding the TCP socket of a change in state. * * Assumptions: - * This function is called at the interrupt level with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -749,7 +773,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * Assumptions: * - The caller has checked that TCP_NEWDATA is set in flags and that is no * other handler available to process the incoming data. - * - This function is called at the interrupt level with interrupts disabled. + * - Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -788,8 +812,7 @@ int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg); * is freed that has pending connections. * * Assumptions: - * The caller has disabled interrupts so that there can be no conflict - * with ongoing, interrupt driven activity + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -808,7 +831,7 @@ int tcp_backlogdestroy(FAR struct tcp_conn_s *conn); * function adds the new connection to the backlog. * * Assumptions: - * Called from the interrupt level with interrupts disabled + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -864,7 +887,7 @@ FAR struct tcp_conn_s *tcp_backlogremove(FAR struct tcp_conn_s *conn); * to remove the defunct connection from the list. * * Assumptions: - * Called from the interrupt level with interrupts disabled + * Called from network stack logic with the network stack locked * ****************************************************************************/ @@ -984,7 +1007,7 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_alloc(void); * buffered data. * * Assumptions: - * Called from interrupt level with interrupts disabled. + * Called from network stack logic with the network stack locked * ****************************************************************************/ |