net: Make si_bind callback optional

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2023-03-06 12:06:06 +08:00
committed by Petro Karashchenko
parent f97d93903c
commit b3c1c55805
3 changed files with 8 additions and 65 deletions
+1 -32
View File
@@ -47,8 +47,6 @@
static int icmp_setup(FAR struct socket *psock);
static sockcaps_t icmp_sockcaps(FAR struct socket *psock);
static void icmp_addref(FAR struct socket *psock);
static int icmp_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
static int icmp_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
static int icmp_getpeername(FAR struct socket *psock,
@@ -72,7 +70,7 @@ const struct sock_intf_s g_icmp_sockif =
icmp_setup, /* si_setup */
icmp_sockcaps, /* si_sockcaps */
icmp_addref, /* si_addref */
icmp_bind, /* si_bind */
NULL, /* si_bind */
icmp_getsockname, /* si_getsockname */
icmp_getpeername, /* si_getpeername */
icmp_listen, /* si_listen */
@@ -279,35 +277,6 @@ static int icmp_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: icmp_bind
*
* Description:
* icmp_bind() gives the socket 'psock' the local address 'addr'. 'addr'
* is 'addrlen' bytes long. Traditionally, this is called "assigning a
* name to a socket." When a socket is created with socket(), it exists
* in a name space (address family) but has no name assigned.
*
* Input Parameters:
* psock Socket structure of the socket to bind
* addr Socket local address
* addrlen Length of 'addr'
*
* Returned Value:
* 0 on success; A negated errno value is returned on failure. See
* bind() for a list a appropriate error values.
*
****************************************************************************/
static int icmp_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr,
socklen_t addrlen)
{
/* An ICMP socket cannot be bound to a local address */
return -EBADF;
}
/****************************************************************************
* Name: icmp_getsockname
*