1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Moving block_socket() and unblock_socket() from Nmap to Nbase for reuse in

Nsock and Ncat
This commit is contained in:
kris
2008-08-02 03:44:35 +00:00
parent 178a40f281
commit 910cb5ca48
2 changed files with 0 additions and 34 deletions

View File

@@ -1854,21 +1854,6 @@ int send_ip_raw( int sd, struct eth_nfo *eth,
return res;
}
int unblock_socket(int sd) {
#ifdef WIN32
u_long one = 1;
if(sd != 501) // Hack related to WinIP Raw Socket support
ioctlsocket (sd, FIONBIO, &one);
#else
int options;
/*Unblock our socket to prevent recvfrom from blocking forever
on certain target ports. */
options = O_NONBLOCK | fcntl(sd, F_GETFL);
fcntl(sd, F_SETFL, options);
#endif //WIN32
return 1;
}
/* returns -1 if we can't use select() on the pcap device, 0 for timeout, and
* >0 for success. If select() fails we bail out because it couldn't work with
* the file descriptor we got from my_pcap_get_selectable_fd()
@@ -3394,21 +3379,6 @@ int max_sd() {
return 0;
}
/* Convert a socket to blocking mode */
int block_socket(int sd) {
#ifdef WIN32
unsigned long options=0;
if(sd == 501) return 1;
ioctlsocket(sd, FIONBIO, &options);
#else
int options;
options = (~O_NONBLOCK) & fcntl(sd, F_GETFL);
fcntl(sd, F_SETFL, options);
#endif
return 1;
}
/* Give broadcast permission to a socket */
void broadcast_socket(int sd) {
int one = 1;

View File

@@ -700,7 +700,6 @@ bool setTargetNextHopMAC(Target *target);
int islocalhost(const struct in_addr * const addr);
int isipprivate(const struct in_addr * const addr);
int unblock_socket(int sd);
// Takes a protocol number like IPPROTO_TCP, IPPROTO_UDP, or
// IPPROTO_IP and returns a ascii representation (or "unknown" if it
@@ -746,9 +745,6 @@ void max_rcvbuf(int sd);
max allowed */
int max_sd();
/* Convert a socket to blocking mode */
int block_socket(int sd);
/* Give broadcast permission to a socket */
void broadcast_socket(int sd);