diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-22 07:14:17 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-22 07:14:17 -0600 |
commit | a352116e5168d87b0560188aa1d08bf937c0d1fe (patch) | |
tree | 0683b3145a240055cd90a77534c8efed1aef6c49 | |
parent | 767aef4c84430f468a871af977bc3f3813cc91c2 (diff) | |
download | px4-nuttx-a352116e5168d87b0560188aa1d08bf937c0d1fe.tar.gz px4-nuttx-a352116e5168d87b0560188aa1d08bf937c0d1fe.tar.bz2 px4-nuttx-a352116e5168d87b0560188aa1d08bf937c0d1fe.zip |
Make tcp_listener static scope; it is not used outside of tcp_conn.c
-rw-r--r-- | nuttx/net/netdev/netdev_rxnotify.c | 2 | ||||
-rw-r--r-- | nuttx/net/route/net_router.c | 2 | ||||
-rw-r--r-- | nuttx/net/tcp/tcp.h | 14 | ||||
-rw-r--r-- | nuttx/net/tcp/tcp_conn.c | 70 |
4 files changed, 35 insertions, 53 deletions
diff --git a/nuttx/net/netdev/netdev_rxnotify.c b/nuttx/net/netdev/netdev_rxnotify.c index d3eba2d1e..ce1b78f1a 100644 --- a/nuttx/net/netdev/netdev_rxnotify.c +++ b/nuttx/net/netdev/netdev_rxnotify.c @@ -51,7 +51,7 @@ #include "netdev/netdev.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/nuttx/net/route/net_router.c b/nuttx/net/route/net_router.c index 8dde05c1f..86c37b457 100644 --- a/nuttx/net/route/net_router.c +++ b/nuttx/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/nuttx/net/tcp/tcp.h b/nuttx/net/tcp/tcp.h index 67d902126..9316408ad 100644 --- a/nuttx/net/tcp/tcp.h +++ b/nuttx/net/tcp/tcp.h @@ -332,20 +332,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() * * Description: diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c index 666480012..da8fc266a 100644 --- a/nuttx/net/tcp/tcp_conn.c +++ b/nuttx/net/tcp/tcp_conn.c @@ -61,10 +61,6 @@ #include "tcp/tcp.h" /**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** * Private Data ****************************************************************************/ @@ -89,6 +85,39 @@ static uint16_t g_last_tcp_port; ****************************************************************************/ /**************************************************************************** + * 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() * * Description: @@ -463,39 +492,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() * * Description: |