1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 08:59:01 +00:00

Make the following methods const:

Target::v4source
  Target::v4sourceip
  Target::SrcMACAddress
  Target::NextHopMACAddress
This commit is contained in:
david
2009-09-07 22:17:23 +00:00
parent 3bf3913924
commit 59491ec62d
2 changed files with 8 additions and 8 deletions

View File

@@ -266,7 +266,7 @@ void Target::setSourceSockAddr(struct sockaddr_storage *ss, size_t ss_len) {
}
// Returns IPv4 host address or {0} if unavailable.
struct in_addr Target::v4source() {
struct in_addr Target::v4source() const {
const struct in_addr *addy = v4sourceip();
struct in_addr in;
if (addy) return *addy;
@@ -275,7 +275,7 @@ struct in_addr Target::v4source() {
}
// Returns IPv4 host address or NULL if unavailable.
const struct in_addr *Target::v4sourceip() {
const struct in_addr *Target::v4sourceip() const {
struct sockaddr_in *sin = (struct sockaddr_in *) &sourcesock;
if (sin->sin_family == AF_INET) {
return &(sin->sin_addr);
@@ -451,11 +451,11 @@ const u8 *Target::MACAddress() const {
return (MACaddress_set)? MACaddress : NULL;
}
const u8 *Target::SrcMACAddress() {
const u8 *Target::SrcMACAddress() const {
return (SrcMACaddress_set)? SrcMACaddress : NULL;
}
const u8 *Target::NextHopMACAddress() {
const u8 *Target::NextHopMACAddress() const {
return (NextHopMACaddress_set)? NextHopMACaddress : NULL;
}

View File

@@ -155,8 +155,8 @@ class Target {
/* Note that it is OK to pass in a sockaddr_in or sockaddr_in6 casted
to sockaddr_storage */
void setSourceSockAddr(struct sockaddr_storage *ss, size_t ss_len);
struct in_addr v4source();
const struct in_addr *v4sourceip();
struct in_addr v4source() const;
const struct in_addr *v4sourceip() const;
/* The IPv4 or IPv6 literal string for the target host */
const char *targetipstr() { return targetipstring; }
/* Give the name from the last setHostName() call, which should be
@@ -236,8 +236,8 @@ class Target {
/* Returns a pointer to 6-byte MAC address, or NULL if none is set */
const u8 *MACAddress() const;
const u8 *SrcMACAddress();
const u8 *NextHopMACAddress();
const u8 *SrcMACAddress() const;
const u8 *NextHopMACAddress() const;
/* Set the device names so that they can be returned by deviceName()
and deviceFullName(). The normal name may not include alias