Make tcp_listener static scope; it is not used outside of tcp_conn.c

This commit is contained in:
Gregory Nutt 2014-11-22 07:14:17 -06:00
parent 5521868169
commit 80fc094734
4 changed files with 35 additions and 53 deletions

View File

@ -51,7 +51,7 @@
#include "netdev/netdev.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -83,7 +83,7 @@ static int net_match(FAR struct net_route_s *route, FAR void *arg)
FAR struct route_match_s *match = (FAR struct route_match_s *)arg;
/* To match, the masked target addresses must be the same. In the event
* of multiple matches, only the first is returned. There not (yet) any
* of multiple matches, only the first is returned. There is not (yet) any
* concept for the precedence of networks.
*/

View File

@ -331,20 +331,6 @@ FAR struct tcp_conn_s *tcp_active(struct tcp_iphdr_s *buf);
FAR struct tcp_conn_s *tcp_nextconn(FAR struct tcp_conn_s *conn);
/****************************************************************************
* Name: tcp_listener()
*
* Description:
* Given a local port number (in network byte order), find the TCP
* connection that listens on this this port.
*
* Primary uses: (1) to determine if a port number is available, (2) to
* To identify the socket that will accept new connections on a local port.
*
****************************************************************************/
FAR struct tcp_conn_s *tcp_listener(uint16_t portno);
/****************************************************************************
* Name: tcp_alloc_accept()
*

View File

@ -60,10 +60,6 @@
#include "devif/devif.h"
#include "tcp/tcp.h"
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
@ -88,6 +84,39 @@ static uint16_t g_last_tcp_port;
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: tcp_listener()
*
* Description:
* Given a local port number (in network byte order), find the TCP
* connection that listens on this this port.
*
* Primary uses: (1) to determine if a port number is available, (2) to
* To identify the socket that will accept new connections on a local port.
*
****************************************************************************/
static FAR struct tcp_conn_s *tcp_listener(uint16_t portno)
{
FAR struct tcp_conn_s *conn;
int i;
/* Check if this port number is in use by any active UIP TCP connection */
for (i = 0; i < CONFIG_NET_TCP_CONNS; i++)
{
conn = &g_tcp_connections[i];
if (conn->tcpstateflags != TCP_CLOSED && conn->lport == portno)
{
/* The port number is in use, return the connection */
return conn;
}
}
return NULL;
}
/****************************************************************************
* Name: tcp_selectport()
*
@ -462,39 +491,6 @@ FAR struct tcp_conn_s *tcp_nextconn(FAR struct tcp_conn_s *conn)
}
}
/****************************************************************************
* Name: tcp_listener()
*
* Description:
* Given a local port number (in network byte order), find the TCP
* connection that listens on this this port.
*
* Primary uses: (1) to determine if a port number is available, (2) to
* To identify the socket that will accept new connections on a local port.
*
****************************************************************************/
FAR struct tcp_conn_s *tcp_listener(uint16_t portno)
{
FAR struct tcp_conn_s *conn;
int i;
/* Check if this port number is in use by any active UIP TCP connection */
for (i = 0; i < CONFIG_NET_TCP_CONNS; i++)
{
conn = &g_tcp_connections[i];
if (conn->tcpstateflags != TCP_CLOSED && conn->lport == portno)
{
/* The port number is in use, return the connection */
return conn;
}
}
return NULL;
}
/****************************************************************************
* Name: tcp_alloc_accept()
*