mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Constify data arguments in packet building and sending functions.
This commit is contained in:
parent
07f9b440f4
commit
bc0c6d17b4
2 changed files with 27 additions and 27 deletions
28
tcpip.cc
28
tcpip.cc
|
|
@ -658,7 +658,7 @@ u8 *build_ip_raw(const struct in_addr *source,
|
|||
u8 *build_ipv6_raw(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 nextheader, int hoplimit,
|
||||
char *data, u16 datalen, u32 *outpacketlen) {
|
||||
const char *data, u16 datalen, u32 *outpacketlen) {
|
||||
u8 *packet;
|
||||
|
||||
assert(source != NULL);
|
||||
|
|
@ -682,7 +682,7 @@ u8 *build_ipv6_raw(const struct in6_addr *source,
|
|||
static u8 *build_tcp(u16 sport, u16 dport, u32 seq, u32 ack, u8 reserved,
|
||||
u8 flags, u16 window, u16 urp,
|
||||
const u8 *tcpopt, int tcpoptlen,
|
||||
char *data, u16 datalen, u32 *packetlen) {
|
||||
const char *data, u16 datalen, u32 *packetlen) {
|
||||
struct tcp_hdr *tcp;
|
||||
u8 *packet;
|
||||
|
||||
|
|
@ -741,7 +741,7 @@ u8 *build_tcp_raw(const struct in_addr *source,
|
|||
const struct in_addr *victim, int ttl, u16 ipid, u8 tos,
|
||||
bool df, const u8 *ipopt, int ipoptlen, u16 sport, u16 dport,
|
||||
u32 seq, u32 ack, u8 reserved, u8 flags, u16 window,
|
||||
u16 urp, const u8 *tcpopt, int tcpoptlen, char *data,
|
||||
u16 urp, const u8 *tcpopt, int tcpoptlen, const char *data,
|
||||
u16 datalen, u32 *packetlen) {
|
||||
struct tcp_hdr *tcp;
|
||||
u32 tcplen;
|
||||
|
|
@ -767,7 +767,7 @@ u8 *build_tcp_raw_ipv6(const struct in6_addr *source,
|
|||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport, u32 seq, u32 ack,
|
||||
u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
const u8 *tcpopt, int tcpoptlen, char *data,
|
||||
const u8 *tcpopt, int tcpoptlen, const char *data,
|
||||
u16 datalen, u32 *packetlen) {
|
||||
struct tcp_hdr *tcp;
|
||||
u32 tcplen;
|
||||
|
|
@ -789,7 +789,7 @@ int send_tcp_raw(int sd, const struct eth_nfo *eth,
|
|||
const struct in_addr *victim, int ttl, bool df,
|
||||
u8 *ipops, int ipoptlen, u16 sport, u16 dport, u32 seq,
|
||||
u32 ack, u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
u8 *options, int optlen, char *data, u16 datalen) {
|
||||
u8 *options, int optlen, const char *data, u16 datalen) {
|
||||
struct sockaddr_storage dst;
|
||||
struct sockaddr_in *dst_in;
|
||||
unsigned int packetlen;
|
||||
|
|
@ -821,7 +821,7 @@ int send_tcp_raw_decoys(int sd, const struct eth_nfo *eth,
|
|||
u16 sport, u16 dport,
|
||||
u32 seq, u32 ack, u8 reserved, u8 flags,
|
||||
u16 window, u16 urp, u8 *options, int optlen,
|
||||
char *data, u16 datalen) {
|
||||
const char *data, u16 datalen) {
|
||||
int decoy;
|
||||
|
||||
for (decoy = 0; decoy < o.numdecoys; decoy++)
|
||||
|
|
@ -895,7 +895,7 @@ u8 *build_udp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
u8 *build_udp_raw_ipv6(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport,
|
||||
char *data, u16 datalen, u32 *packetlen) {
|
||||
const char *data, u16 datalen, u32 *packetlen) {
|
||||
struct udp_hdr *udp;
|
||||
u32 udplen;
|
||||
u8 *ipv6;
|
||||
|
|
@ -913,7 +913,7 @@ int send_udp_raw(int sd, const struct eth_nfo *eth,
|
|||
struct in_addr *source, const struct in_addr *victim,
|
||||
int ttl, u16 ipid,
|
||||
u8 *ipopt, int ipoptlen,
|
||||
u16 sport, u16 dport, char *data, u16 datalen) {
|
||||
u16 sport, u16 dport, const char *data, u16 datalen) {
|
||||
struct sockaddr_storage dst;
|
||||
struct sockaddr_in *dst_in;
|
||||
unsigned int packetlen;
|
||||
|
|
@ -939,7 +939,7 @@ int send_udp_raw_decoys(int sd, const struct eth_nfo *eth,
|
|||
const struct in_addr *victim,
|
||||
int ttl, u16 ipid,
|
||||
u8 *ipops, int ipoptlen,
|
||||
u16 sport, u16 dport, char *data, u16 datalen) {
|
||||
u16 sport, u16 dport, const char *data, u16 datalen) {
|
||||
int decoy;
|
||||
|
||||
for (decoy = 0; decoy < o.numdecoys; decoy++)
|
||||
|
|
@ -999,7 +999,7 @@ u8 *build_sctp_raw(const struct in_addr *source,
|
|||
const struct in_addr *victim, int ttl, u16 ipid,
|
||||
u8 tos, bool df, u8 *ipopt, int ipoptlen, u16 sport,
|
||||
u16 dport, u32 vtag, char *chunks, int chunkslen,
|
||||
char *data, u16 datalen, u32 *packetlen) {
|
||||
const char *data, u16 datalen, u32 *packetlen) {
|
||||
u8 *ip, *sctp;
|
||||
u32 sctplen;
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ u8 *build_sctp_raw(const struct in_addr *source,
|
|||
u8 *build_sctp_raw_ipv6(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport, u32 vtag,
|
||||
char *chunks, int chunkslen, char *data, u16 datalen,
|
||||
char *chunks, int chunkslen, const char *data, u16 datalen,
|
||||
u32 *packetlen) {
|
||||
u8 *ipv6, *sctp;
|
||||
u32 sctplen;
|
||||
|
|
@ -1038,7 +1038,7 @@ u8 *build_sctp_raw_ipv6(const struct in6_addr *source,
|
|||
u8 *build_icmp_raw(const struct in_addr *source,
|
||||
const struct in_addr *victim, int ttl, u16 ipid,
|
||||
u8 tos, bool df, u8 *ipopt, int ipoptlen, u16 seq,
|
||||
unsigned short id, u8 ptype, u8 pcode, char *data,
|
||||
unsigned short id, u8 ptype, u8 pcode, const char *data,
|
||||
u16 datalen, u32 *packetlen) {
|
||||
struct ppkt {
|
||||
u8 type;
|
||||
|
|
@ -1105,7 +1105,7 @@ u8 *build_icmp_raw(const struct in_addr *source,
|
|||
u8 *build_icmpv6_raw(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 seq, u16 id, u8 ptype, u8 pcode,
|
||||
char *data, u16 datalen, u32 *packetlen) {
|
||||
const char *data, u16 datalen, u32 *packetlen) {
|
||||
char *packet;
|
||||
struct icmpv6_hdr *icmpv6;
|
||||
union icmpv6_msg *msg;
|
||||
|
|
@ -1152,7 +1152,7 @@ u8 *build_icmpv6_raw(const struct in6_addr *source,
|
|||
u8 *build_igmp_raw(const struct in_addr *source,
|
||||
const struct in_addr *victim, int ttl, u16 ipid,
|
||||
u8 tos, bool df, u8 *ipopt, int ipoptlen, u8 ptype,
|
||||
u8 pcode, char *data, u16 datalen, u32 *packetlen) {
|
||||
u8 pcode, const char *data, u16 datalen, u32 *packetlen) {
|
||||
struct {
|
||||
u8 igmp_type;
|
||||
u8 igmp_code;
|
||||
|
|
|
|||
26
tcpip.h
26
tcpip.h
|
|
@ -299,7 +299,7 @@ u8 *build_ip_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
u8 *build_ipv6_raw(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 nextheader, int hoplimit,
|
||||
char *data, u16 datalen, u32 *outpacketlen);
|
||||
const char *data, u16 datalen, u32 *outpacketlen);
|
||||
|
||||
/* Builds a TCP packet (including an IP header) by packing the fields
|
||||
with the given information. It allocates a new buffer to store the
|
||||
|
|
@ -313,14 +313,14 @@ u8 *build_tcp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
u16 sport, u16 dport,
|
||||
u32 seq, u32 ack, u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
const u8 *options, int optlen,
|
||||
char *data, u16 datalen,
|
||||
const char *data, u16 datalen,
|
||||
u32 *packetlen);
|
||||
|
||||
u8 *build_tcp_raw_ipv6(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport, u32 seq, u32 ack,
|
||||
u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
const u8 *tcpopt, int tcpoptlen, char *data,
|
||||
const u8 *tcpopt, int tcpoptlen, const char *data,
|
||||
u16 datalen, u32 *packetlen);
|
||||
|
||||
/* Build and send a raw tcp packet. If TTL is -1, a partially random
|
||||
|
|
@ -332,7 +332,7 @@ int send_tcp_raw( int sd, const struct eth_nfo *eth,
|
|||
u16 sport, u16 dport,
|
||||
u32 seq, u32 ack, u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
u8 *options, int optlen,
|
||||
char *data, u16 datalen);
|
||||
const char *data, u16 datalen);
|
||||
|
||||
int send_tcp_raw_decoys( int sd, const struct eth_nfo *eth,
|
||||
const struct in_addr *victim,
|
||||
|
|
@ -341,7 +341,7 @@ int send_tcp_raw_decoys( int sd, const struct eth_nfo *eth,
|
|||
u16 sport, u16 dport,
|
||||
u32 seq, u32 ack, u8 reserved, u8 flags, u16 window, u16 urp,
|
||||
u8 *options, int optlen,
|
||||
char *data, u16 datalen);
|
||||
const char *data, u16 datalen);
|
||||
|
||||
/* Builds a UDP packet (including an IP header) by packing the fields
|
||||
with the given information. It allocates a new buffer to store the
|
||||
|
|
@ -359,21 +359,21 @@ u8 *build_udp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
u8 *build_udp_raw_ipv6(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport,
|
||||
char *data, u16 datalen, u32 *packetlen);
|
||||
const char *data, u16 datalen, u32 *packetlen);
|
||||
|
||||
int send_udp_raw( int sd, const struct eth_nfo *eth,
|
||||
struct in_addr *source, const struct in_addr *victim,
|
||||
int ttl, u16 ipid,
|
||||
u8* ipopt, int ipoptlen,
|
||||
u16 sport, u16 dport,
|
||||
char *data, u16 datalen);
|
||||
const char *data, u16 datalen);
|
||||
|
||||
int send_udp_raw_decoys( int sd, const struct eth_nfo *eth,
|
||||
const struct in_addr *victim,
|
||||
int ttl, u16 ipid,
|
||||
u8* ipops, int ip,
|
||||
u16 sport, u16 dport,
|
||||
char *data, u16 datalen);
|
||||
const char *data, u16 datalen);
|
||||
|
||||
/* Builds an SCTP packet (including an IP header) by packing the fields
|
||||
with the given information. It allocates a new buffer to store the
|
||||
|
|
@ -386,13 +386,13 @@ u8 *build_sctp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
u8* ipopt, int ipoptlen,
|
||||
u16 sport, u16 dport,
|
||||
u32 vtag, char *chunks, int chunkslen,
|
||||
char *data, u16 datalen,
|
||||
const char *data, u16 datalen,
|
||||
u32 *packetlen);
|
||||
|
||||
u8 *build_sctp_raw_ipv6(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 sport, u16 dport, u32 vtag,
|
||||
char *chunks, int chunkslen, char *data, u16 datalen,
|
||||
char *chunks, int chunkslen, const char *data, u16 datalen,
|
||||
u32 *packetlen);
|
||||
|
||||
/* Builds an ICMP packet (including an IP header) by packing the
|
||||
|
|
@ -407,12 +407,12 @@ u8 *build_icmp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
int ttl, u16 ipid, u8 tos, bool df,
|
||||
u8* ipopt, int ipoptlen,
|
||||
u16 seq, unsigned short id, u8 ptype, u8 pcode,
|
||||
char *data, u16 datalen, u32 *packetlen);
|
||||
const char *data, u16 datalen, u32 *packetlen);
|
||||
|
||||
u8 *build_icmpv6_raw(const struct in6_addr *source,
|
||||
const struct in6_addr *victim, u8 tc, u32 flowlabel,
|
||||
u8 hoplimit, u16 seq, u16 id, u8 ptype, u8 pcode,
|
||||
char *data, u16 datalen, u32 *packetlen);
|
||||
const char *data, u16 datalen, u32 *packetlen);
|
||||
|
||||
/* Builds an IGMP packet (including an IP header) by packing the fields
|
||||
with the given information. It allocates a new buffer to store the
|
||||
|
|
@ -425,7 +425,7 @@ u8 *build_igmp_raw(const struct in_addr *source, const struct in_addr *victim,
|
|||
int ttl, u16 ipid, u8 tos, bool df,
|
||||
u8* ipopt, int ipoptlen,
|
||||
u8 ptype, u8 pcode,
|
||||
char *data, u16 datalen, u32 *packetlen);
|
||||
const char *data, u16 datalen, u32 *packetlen);
|
||||
|
||||
|
||||
// Returns whether the packet receive time value obtaned from libpcap
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue