/*
Unix SMB/CIFS implementation.
Samba utility functions
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Tim Potter 2000-2001
Copyright (C) Jeremy Allison 1992-2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "system/filesys.h"
#include "memcache.h"
#include "../lib/async_req/async_sock.h"
#include "../lib/util/select.h"
#include "lib/socket/interfaces.h"
#include "../lib/util/tevent_unix.h"
#include "../lib/util/tevent_ntstatus.h"
#include "../lib/tsocket/tsocket.h"
const char *client_name(int fd)
{
return get_peer_name(fd,false);
}
const char *client_addr(int fd, char *addr, size_t addrlen)
{
return get_peer_addr(fd,addr,addrlen);
}
#if 0
/* Not currently used. JRA. */
int client_socket_port(int fd)
{
return get_socket_port(fd);
}
#endif
/****************************************************************************
Determine if a file descriptor is in fact a socket.
****************************************************************************/
bool is_a_socket(int fd)
{
int v;
socklen_t l;
l = sizeof(int);
return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
}
/****************************************************************************
Read from a socket.
****************
|