mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 05:09:00 +00:00
Refactor get_hostaddr_string to get_peeraddr_string.
All the information passed as arguments is present in an iod, and we only call this with members of one iod. Change it to accept just an iod as an argument.
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "nsock_internal.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "nbase_winconfig.h"
|
||||
/* nbase_winunix.h somehow reason.h to get included */
|
||||
@@ -77,28 +79,19 @@
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
#define PEER_STR_LEN sizeof(((struct sockaddr_un *) 0)->sun_path)
|
||||
#else
|
||||
#define PEER_STR_LEN sizeof("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]:xxxxx")
|
||||
#endif
|
||||
|
||||
/* Maximize the number of file descriptors (including sockets) allowed for this
|
||||
* process and return that maximum value (note -- you better not actually open
|
||||
* this many -- stdin, stdout, other files opened by libraries you use, etc. all
|
||||
* count toward this limit. Leave a little slack */
|
||||
int maximize_fdlimit(void);
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
/* Get the UNIX domain socket path or NULL if the socket family != AF_UNIX. */
|
||||
const char *get_unixsock_path(struct sockaddr_storage *addr);
|
||||
#endif
|
||||
/* Get the UNIX domain socket path or empty string if the address family != AF_UNIX. */
|
||||
const char *get_unixsock_path(const struct sockaddr_storage *addr);
|
||||
|
||||
/* Get the peer/host address string.
|
||||
* In case we have support for UNIX domain sockets, function returns
|
||||
* string containing path to UNIX socket if the address family is AF_UNIX,
|
||||
* otherwise it returns string containing "<address>:<port>". */
|
||||
char *get_hostaddr_string(struct sockaddr_storage *addr, size_t len, unsigned short port);
|
||||
/* Get the peer address string. In case of a Unix domain socket, returns the
|
||||
* path to UNIX socket, otherwise it returns string containing
|
||||
* "<address>:<port>". */
|
||||
char *get_peeraddr_string(const msiod *iod);
|
||||
|
||||
#endif /* NETUTILS_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user