net: Remove the empty si_getpeername implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-03-06 13:02:11 +08:00 committed by Petro Karashchenko
parent 9b3715050b
commit 2553b7701c
5 changed files with 4 additions and 150 deletions

View File

@ -53,8 +53,6 @@ static sockcaps_t can_sockcaps(FAR struct socket *psock);
static void can_addref(FAR struct socket *psock);
static int can_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
static int can_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
static int can_listen(FAR struct socket *psock, int backlog);
static int can_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
@ -75,7 +73,7 @@ const struct sock_intf_s g_can_sockif =
can_addref, /* si_addref */
can_bind, /* si_bind */
NULL, /* si_getsockname */
can_getpeername, /* si_getpeername */
NULL, /* si_getpeername */
can_listen, /* si_listen */
can_connect, /* si_connect */
can_accept, /* si_accept */
@ -340,41 +338,6 @@ static int can_bind(FAR struct socket *psock,
return OK;
}
/****************************************************************************
* Name: can_getpeername
*
* Description:
* The can_getpeername() function retrieves the remote-connected name
* of the specified packet socket, stores this address in the sockaddr
* structure pointed to by the 'addr' argument, and stores the length of
* this address in the object pointed to by the 'addrlen' argument.
*
* If the actual length of the address is greater than the length of the
* supplied sockaddr structure, the stored address will be truncated.
*
* If the socket has not been bound to a local name, the value stored in
* the object pointed to by address is unspecified.
*
* Parameters:
* psock Socket structure of the socket to be queried
* addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out]
*
* Returned Value:
* On success, 0 is returned, the 'addr' argument points to the address
* of the socket, and the 'addrlen' argument points to the length of the
* address. Otherwise, a negated errno value is returned. See
* getpeername() for the list of appropriate error numbers.
*
****************************************************************************/
static int can_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr,
FAR socklen_t *addrlen)
{
return -EOPNOTSUPP;
}
/****************************************************************************
* Name: can_listen
*

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_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
static int icmp_listen(FAR struct socket *psock, int backlog);
static int icmp_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
@ -70,7 +68,7 @@ const struct sock_intf_s g_icmp_sockif =
icmp_addref, /* si_addref */
NULL, /* si_bind */
NULL, /* si_getsockname */
icmp_getpeername, /* si_getpeername */
NULL, /* si_getpeername */
icmp_listen, /* si_listen */
icmp_connect, /* si_connect */
icmp_accept, /* si_accept */
@ -275,40 +273,6 @@ static int icmp_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: icmp_getpeername
*
* Description:
* The icmp_getpeername() function retrieves the remote-connected name of
* the specified packet socket, stores this address in the sockaddr
* structure pointed to by the 'addr' argument, and stores the length of
* this address in the object pointed to by the 'addrlen' argument.
*
* If the actual length of the address is greater than the length of the
* supplied sockaddr structure, the stored address will be truncated.
*
* If the socket has not been bound to a local name, the value stored in
* the object pointed to by address is unspecified.
*
* Parameters:
* psock Socket structure of the socket to be queried
* addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out]
*
* Returned Value:
* On success, 0 is returned, the 'addr' argument points to the address
* of the socket, and the 'addrlen' argument points to the length of the
* address. Otherwise, a negated errno value is returned. See
* getpeername() for the list of appropriate error numbers.
*
****************************************************************************/
static int icmp_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: icmp_listen
*

View File

@ -47,8 +47,6 @@
static int icmpv6_setup(FAR struct socket *psock);
static sockcaps_t icmpv6_sockcaps(FAR struct socket *psock);
static void icmpv6_addref(FAR struct socket *psock);
static int icmpv6_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
static int icmpv6_listen(FAR struct socket *psock, int backlog);
static int icmpv6_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
@ -70,7 +68,7 @@ const struct sock_intf_s g_icmpv6_sockif =
icmpv6_addref, /* si_addref */
NULL, /* si_bind */
NULL, /* si_getsockname */
icmpv6_getpeername, /* si_getpeername */
NULL, /* si_getpeername */
icmpv6_listen, /* si_listen */
icmpv6_connect, /* si_connect */
icmpv6_accept, /* si_accept */
@ -275,40 +273,6 @@ static int icmpv6_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: icmpv6_getpeername
*
* Description:
* The icmpv6_getpeername() function retrieves the remote-connected name of
* the specified packet socket, stores this address in the sockaddr
* structure pointed to by the 'addr' argument, and stores the length of
* this address in the object pointed to by the 'addrlen' argument.
*
* If the actual length of the address is greater than the length of the
* supplied sockaddr structure, the stored address will be truncated.
*
* If the socket has not been bound to a local name, the value stored in
* the object pointed to by address is unspecified.
*
* Parameters:
* psock Socket structure of the socket to be queried
* addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out]
*
* Returned Value:
* On success, 0 is returned, the 'addr' argument points to the address
* of the socket, and the 'addrlen' argument points to the length of the
* address. Otherwise, a negated errno value is returned. See
* getpeername() for the list of appropriate error numbers.
*
****************************************************************************/
static int icmpv6_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: icmpv6_listen
*

View File

@ -52,8 +52,6 @@ static sockcaps_t pkt_sockcaps(FAR struct socket *psock);
static void pkt_addref(FAR struct socket *psock);
static int pkt_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
static int pkt_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
static int pkt_listen(FAR struct socket *psock, int backlog);
static int pkt_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
@ -75,7 +73,7 @@ const struct sock_intf_s g_pkt_sockif =
pkt_addref, /* si_addref */
pkt_bind, /* si_bind */
NULL, /* si_getsockname */
pkt_getpeername, /* si_getpeername */
NULL, /* si_getpeername */
pkt_listen, /* si_listen */
pkt_connect, /* si_connect */
pkt_accept, /* si_accept */
@ -370,40 +368,6 @@ static int pkt_bind(FAR struct socket *psock,
}
}
/****************************************************************************
* Name: pkt_getpeername
*
* Description:
* The pkt_getpeername() function retrieves the remote-connected name of
* the specified packet socket, stores this address in the sockaddr
* structure pointed to by the 'addr' argument, and stores the length of
* this address in the object pointed to by the 'addrlen' argument.
*
* If the actual length of the address is greater than the length of the
* supplied sockaddr structure, the stored address will be truncated.
*
* If the socket has not been bound to a local name, the value stored in
* the object pointed to by address is unspecified.
*
* Parameters:
* psock Socket structure of the socket to be queried
* addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out]
*
* Returned Value:
* On success, 0 is returned, the 'addr' argument points to the address
* of the socket, and the 'addrlen' argument points to the length of the
* address. Otherwise, a negated errno value is returned. See
* getpeername() for the list of appropriate error numbers.
*
****************************************************************************/
static int pkt_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
return -EAFNOSUPPORT;
}
/****************************************************************************
* Name: pkt_listen
*

View File

@ -98,7 +98,6 @@ int psock_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
/* Let the address family's send() method handle the operation */
DEBUGASSERT(psock->s_sockif != NULL);
if (psock->s_sockif->si_getpeername == NULL)
{
return -EOPNOTSUPP;