1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 02:49:01 +00:00

Use dnet headers for TCP and UDP. This allows us to remove netinet tcp.h and udp.h references, the udphdr_bsd stuff, and the TH_ECE/TH_CWR #defines in tcpip.h. That was easy, but we (Fyodor and I) came to the conclusion that IP and ICMP aren't worth the hassle to switch (I was testing TCP, UDP and IP in my branch). The struct icmp_hdr in dnet isn't setup anything like what we're using now. Then, struct ip_hdr uses ip_addr_t (typedef'd to uint32_t in that ip.h) instead of struct in_addr for the IP addresses, and that would require some dnet modifying to work right. We might be able to come up with some elegant solution for IP, but probably not for ICMP. For now, they're still left up to netinet (or tcpip.h).

This commit is contained in:
kris
2007-01-23 05:29:59 +00:00
parent cda944c804
commit 69754e8311
8 changed files with 89 additions and 123 deletions

33
tcpip.h
View File

@@ -142,8 +142,7 @@ void *realloc();
#include <sys/param.h> /* Defines MAXHOSTNAMELEN on BSD*/
#endif
/* Linux uses these defines in netinet/ip.h and netinet/tcp.h to
use the correct struct ip and struct tcphdr */
/* Linux uses these defines in netinet/ip.h to use the correct struct ip */
#ifndef __FAVOR_BSD
#define __FAVOR_BSD 1
#endif
@@ -183,14 +182,6 @@ void *realloc();
#include <netinet/ip.h>
#define NETINET_IP_H
#endif
#ifndef NETINET_TCP_H /* why the HELL does OpenBSD not do this? */
#include <netinet/tcp.h> /*#include <netinet/ip_tcp.h>*/
#define NETINET_TCP_H
#endif
#ifndef NETINET_UDP_H
#include <netinet/udp.h>
#define NETINET_UDP_H
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -237,14 +228,6 @@ typedef enum { devt_ethernet, devt_loopback, devt_p2p, devt_other } devtype;
#include "nmap.h"
#include "global_structures.h"
/* Explicit Congestion Notification (rfc 2481/3168) */
#ifndef TH_ECE
#define TH_ECE 0x40
#endif
#ifndef TH_CWR
#define TH_CWR 0x80
#endif
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
@@ -375,18 +358,6 @@ struct ip
#endif /* HAVE_STRUCT_IP */
#ifdef LINUX
typedef struct udphdr_bsd {
unsigned short uh_sport; /* source port */
unsigned short uh_dport; /* destination port */
unsigned short uh_ulen; /* udp length */
unsigned short uh_sum; /* udp checksum */
} udphdr_bsd;
#else
typedef struct udphdr udphdr_bsd;
#endif
#ifndef HAVE_STRUCT_ICMP
#define HAVE_STRUCT_ICMP
/* From Linux /usr/include/netinet/ip_icmp.h GLIBC */
@@ -759,7 +730,7 @@ int read_arp_reply_pcap(pcap_t *pd, u8 *sendermac, struct in_addr *senderIP,
parameters (if non-null) are filled with 0. Remember that the
correct way to check for errors is to look at the return value
since a zero ts or echots could possibly be valid. */
int gettcpopt_ts(struct tcphdr *tcp, u32 *timestamp, u32 *echots);
int gettcpopt_ts(struct tcp_hdr *tcp, u32 *timestamp, u32 *echots);
/* Maximize the receive buffer of a socket descriptor (up to 500K) */
void max_rcvbuf(int sd);