mirror of
https://github.com/nmap/nmap.git
synced 2026-01-08 07:29:03 +00:00
Implementation of UNIX-domain sockets for Nsock.
Implementation of UNIX-domain sockets functionality for Nsock. Also some minor necessary changes to existing Nsock functions, to work properly with UNIX-domain sockets.
This commit is contained in:
@@ -76,6 +76,16 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
|
||||
#ifndef SUN_LEN
|
||||
#include <string.h>
|
||||
# define SUN_LEN(ptr) (sizeof(*(ptr)) - sizeof((ptr)->sun_path)) \
|
||||
+ strlen ((ptr)->sun_path))
|
||||
#endif
|
||||
#endif /* HAVE_SYS_UN_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -423,6 +433,24 @@ typedef void (*nsock_ev_handler)(nsock_pool, nsock_event, void *);
|
||||
/* Initialize an unconnected UDP socket. */
|
||||
int nsock_setup_udp(nsock_pool nsp, nsock_iod ms_iod, int af);
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
|
||||
/* Request a UNIX domain sockets connection to the same system (by path to socket).
|
||||
* This function connects to the socket of type SOCK_STREAM. ss should be a
|
||||
* sockaddr_storage, sockaddr_un as appropriate (just like what you would pass to
|
||||
* connect). sslen should be the sizeof the structure you are passing in. */
|
||||
nsock_event_id nsock_connect_unixsock_stream(nsock_pool nsp, nsock_iod nsiod, nsock_ev_handler handler,
|
||||
int timeout_msecs, void *userdata, struct sockaddr *ss,
|
||||
size_t sslen);
|
||||
|
||||
/* Request a UNIX domain sockets connection to the same system (by path to socket).
|
||||
* This function connects to the socket of type SOCK_DGRAM. ss should be a
|
||||
* sockaddr_storage, sockaddr_un as appropriate (just like what you would pass to
|
||||
* connect). sslen should be the sizeof the structure you are passing in. */
|
||||
nsock_event_id nsock_connect_unixsock_datagram(nsock_pool nsp, nsock_iod nsiod, nsock_ev_handler handler,
|
||||
void *userdata, struct sockaddr *ss, size_t sslen);
|
||||
#endif /* HAVE_SYS_UN_H */
|
||||
|
||||
/* Request a TCP connection to another system (by IP address). The in_addr is
|
||||
* normal network byte order, but the port number should be given in HOST BYTE
|
||||
* ORDER. ss should be a sockaddr_storage, sockaddr_in6, or sockaddr_in as
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
#undef HAVE_NET_BPF_H
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
#undef HAVE_SSL_SET_TLSEXT_HOST_NAME
|
||||
|
||||
#undef HAVE_EPOLL
|
||||
|
||||
Reference in New Issue
Block a user