From 80fc094734a4839d6a66cc87d8ead5f833bd069a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 22 Nov 2014 07:14:17 -0600 Subject: [PATCH] Make tcp_listener static scope; it is not used outside of tcp_conn.c --- net/netdev/netdev_rxnotify.c | 2 +- net/route/net_router.c | 2 +- net/tcp/tcp.h | 14 -------- net/tcp/tcp_conn.c | 70 +++++++++++++++++------------------- 4 files changed, 35 insertions(+), 53 deletions(-) diff --git a/net/netdev/netdev_rxnotify.c b/net/netdev/netdev_rxnotify.c index d3eba2d1ea..ce1b78f1ab 100644 --- a/net/netdev/netdev_rxnotify.c +++ b/net/netdev/netdev_rxnotify.c @@ -51,7 +51,7 @@ #include "netdev/netdev.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/net/route/net_router.c b/net/route/net_router.c index 8dde05c1f1..86c37b457e 100644 --- a/net/route/net_router.c +++ b/net/route/net_router.c @@ -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. */ diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 67d902126a..9316408ad8 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -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() * diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index 666480012c..da8fc266a0 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -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() *