Clean missing function headers

This commit is contained in:
Gregory Nutt 2014-08-16 10:24:06 -06:00
parent 4beb3c0ad7
commit 79e098b20e
8 changed files with 913 additions and 120 deletions

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,20 @@
* Public Functions
****************************************************************************/
/* This is called from the initialization logic to configure the socket layer */
/****************************************************************************
* Name: net_initialize
*
* Description:
* This is called from the OS initialization logic at power-up reset in
* order to configure the networking subsystem.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void net_initialize(void)
{

View File

@ -35,7 +35,7 @@
# Support for operations on network devices
NETDEV_CSRCS += netdev_register.c netdev_ioctl.c net_poll.c netdev_txnotify.c
NETDEV_CSRCS += netdev_register.c netdev_ioctl.c netdev_txnotify.c
NETDEV_CSRCS += netdev_findbyname.c netdev_findbyaddr.c netdev_count.c
NETDEV_CSRCS += netdev_foreach.c netdev_unregister.c netdev_sem.c
NETDEV_CSRCS += netdev_carrier.c

View File

@ -95,7 +95,7 @@ struct net_driver_s *g_netdevices = NULL;
* Function: netdev_register
*
* Description:
* Register a network device driver and assign a name to it so tht it can
* Register a network device driver and assign a name to it so that it can
* be found in subsequent network ioctl operations on the device.
*
* Parameters:

View File

@ -37,7 +37,7 @@
SOCK_CSRCS += bind.c connect.c getsockname.c recv.c recvfrom.c socket.c
SOCK_CSRCS += sendto.c net_sockets.c net_close.c net_dup.c net_dup2.c
SOCK_CSRCS += net_clone.c net_vfcntl.c
SOCK_CSRCS += net_clone.c net_poll.c net_vfcntl.c
# TCP/IP support

View File

@ -386,7 +386,7 @@ static inline int net_pollteardown(FAR struct socket *psock,
****************************************************************************/
/****************************************************************************
* Function: net_poll
* Function: psock_poll
*
* Description:
* The standard poll() operation redirects operations on socket descriptors

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_NET
#include <string.h>
#include <semaphore.h>
@ -52,6 +51,8 @@
#include "socket/socket.h"
#if CONFIG_NSOCKET_DESCRIPTORS > 0
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -72,7 +73,6 @@
* Private Functions
****************************************************************************/
#if CONFIG_NSOCKET_DESCRIPTORS > 0
static void _net_semtake(FAR struct socketlist *list)
{
/* Take the semaphore (perhaps waiting) */
@ -87,16 +87,23 @@ static void _net_semtake(FAR struct socketlist *list)
}
}
# define _net_semgive(list) sem_post(&list->sl_sem)
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
#if CONFIG_NSOCKET_DESCRIPTORS > 0
/* Initialize a list of sockets for a new task */
/****************************************************************************
* Name:
*
* Description:
* Initialize a list of sockets for a new task
*
* Input Parameters:
* list -- A reference to the pre-allocated socket list to be initialized.
*
* Returned Value:
* None
*
****************************************************************************/
void net_initlist(FAR struct socketlist *list)
{
@ -105,7 +112,19 @@ void net_initlist(FAR struct socketlist *list)
(void)sem_init(&list->sl_sem, 0, 1);
}
/* Release release resources held by the socket list */
/****************************************************************************
* Name: net_releaselist
*
* Description:
* Release resources held by the socket list
*
* Input Parameters:
* list -- A reference to the pre-allocated socket list to be un-initialized.
*
* Returned Value:
* None
*
****************************************************************************/
void net_releaselist(FAR struct socketlist *list)
{
@ -129,6 +148,21 @@ void net_releaselist(FAR struct socketlist *list)
(void)sem_destroy(&list->sl_sem);
}
/****************************************************************************
* Name: sockfd_allocate
*
* Description:
* Allocate a socket descriptor
*
* Input Parameters:
* Lowest socket descripor index to be used.
*
* Returned Value:
* On success, a socket desrciptor >= minsd is returned. A negater errno
* value is returned on failure.
*
****************************************************************************/
int sockfd_allocate(int minsd)
{
FAR struct socketlist *list;
@ -158,12 +192,25 @@ int sockfd_allocate(int minsd)
return i + __SOCKFD_OFFSET;
}
}
_net_semgive(list);
}
return ERROR;
}
/****************************************************************************
* Name: sock_release
*
* Description:
* Free a socket.
*
* Input Parameters:
*
* Returned Value:
*
****************************************************************************/
void sock_release(FAR struct socket *psock)
{
#if CONFIG_DEBUG
@ -192,11 +239,26 @@ void sock_release(FAR struct socket *psock)
memset(psock, 0, sizeof(struct socket));
}
_net_semgive(list);
}
}
}
/****************************************************************************
* Name: sockfd_release
*
* Description:
* Free the socket by its socket descriptor.
*
* Input Parameters:
* sockfd - Socket descriptor identifies the socket to be released.
*
* Returned Value:
* None
*
****************************************************************************/
void sockfd_release(int sockfd)
{
/* Get the socket structure for this sockfd */
@ -211,6 +273,21 @@ void sockfd_release(int sockfd)
}
}
/****************************************************************************
* Name: sockfd_socket
*
* Description:
* Given a socket descriptor, return the underlying socket structure.
*
* Input Parameters:
* sockfd - The socket descriptor index o use.
*
* Returned Value:
* On success, a reference to the socket structure associated with the
* the socket descriptor is returned. NULL is returned on any failure.
*
****************************************************************************/
FAR struct socket *sockfd_socket(int sockfd)
{
FAR struct socketlist *list;
@ -224,8 +301,8 @@ FAR struct socket *sockfd_socket(int sockfd)
return &list->sl_sockets[ndx];
}
}
return NULL;
}
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
#endif /* CONFIG_NET */
#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */

View File

@ -56,7 +56,24 @@
****************************************************************************/
/****************************************************************************
* Global Functions
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: net_vfcntl
*
* Description:
* Performs fcntl operations on socket
*
* Input Parameters:
* sockfd - Socket descriptor of the socket to operate on
* cmd - The fcntl command.
* ap - Command-specific arguments
*
* Returned Value:
* Zero (OK) is returned on success; -1 (ERROR) is returned on failure and
* the errno value is set appropriately.
*
****************************************************************************/
int net_vfcntl(int sockfd, int cmd, va_list ap)