int zts_getpeername(int fd, struct sockaddr *addr, socklen_t *addrlen) { if (!addr) { return ZTS_ERR_INVALID_ARG; } if (*addrlen > (int)sizeof(struct sockaddr_storage) || *addrlen < (int)sizeof(struct sockaddr_in)) { return ZTS_ERR_INVALID_ARG; } return (!_run_service || !_run_lwip_tcpip) ? ZTS_ERR_SERVICE : lwip_getpeername(fd, addr, addrlen); }
int LWIP_SOCKETS_Driver::GetPeerName( SOCK_SOCKET socket, SOCK_sockaddr* name, int* namelen ) { NATIVE_PROFILE_PAL_NETWORK(); int ret; sockaddr_in addr; SOCK_SOCKADDR_TO_SOCKADDR(name, addr, namelen); ret = lwip_getpeername(socket, (sockaddr*)&addr, (u32_t*)namelen); SOCKADDR_TO_SOCK_SOCKADDR(name, addr, namelen); return ret; }
int getpeername(int s, struct sockaddr *name, socklen_t *namelen) { BT_HANDLE hSocket = (BT_HANDLE)s; return lwip_getpeername(hSocket->socket, name, namelen); }
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { int sock = socket_for_fd(sockfd); return lwip_getpeername(sock, addr, addrlen); }