1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 15:39:03 +00:00

Avoid hidden overloaded virtual functions

Since the functions were hidden for the comiler, I specified every
function that was being hidden in the IPv*Header.h header files.
This allows us to use both overloaded functions and the original one
instead of having one being hidden by the others.
Here is the compiler warning output before the fix:

warning: 'file::function' hides overloaded virtual function
note: hidden overloaded virtual function 'file2::function' declared
here: different qualifiers
This commit is contained in:
vincent
2016-07-01 11:36:20 +00:00
parent 900f015726
commit 9703feace9
2 changed files with 11 additions and 4 deletions

View File

@@ -249,6 +249,7 @@ class IPv4Header : public NetworkLayerElement {
u8 getNextProto() const; u8 getNextProto() const;
int setNextHeader(u8 val); int setNextHeader(u8 val);
u8 getNextHeader() const; u8 getNextHeader() const;
virtual u8 getNextHeader(){return 0;}
/* Checksum */ /* Checksum */
int setSum(); int setSum();
@@ -261,15 +262,17 @@ class IPv4Header : public NetworkLayerElement {
int setDestinationAddress(struct in_addr d); int setDestinationAddress(struct in_addr d);
const u8 *getDestinationAddress() const; const u8 *getDestinationAddress() const;
struct in_addr getDestinationAddress(struct in_addr *result) const; struct in_addr getDestinationAddress(struct in_addr *result) const;
virtual u8 *getDestinationAddress(){return NULL;}
/* Source IP */ /* Source IP */
int setSourceAddress(u32 d); int setSourceAddress(u32 d);
int setSourceAddress(struct in_addr d); int setSourceAddress(struct in_addr d);
const u8 *getSourceAddress() const; const u8 *getSourceAddress() const;
struct in_addr getSourceAddress(struct in_addr *result) const; struct in_addr getSourceAddress(struct in_addr *result) const;
virtual u8 *getSourceAddress(){return NULL;}
u16 getAddressLength() const; u16 getAddressLength() const;
virtual u16 getAddressLength(){return 0;}
/* IP Options */ /* IP Options */
int setOpts(const char *txt); int setOpts(const char *txt);

View File

@@ -213,6 +213,7 @@ class IPv6Header : public NetworkLayerElement {
int setNextHeader(u8 val); int setNextHeader(u8 val);
int setNextHeader(const char *p); int setNextHeader(const char *p);
u8 getNextHeader() const; u8 getNextHeader() const;
virtual u8 getNextHeader(){return 0;}
/* Hop Limit */ /* Hop Limit */
int setHopLimit(u8 val); int setHopLimit(u8 val);
@@ -223,14 +224,17 @@ class IPv6Header : public NetworkLayerElement {
int setSourceAddress(struct in6_addr val); int setSourceAddress(struct in6_addr val);
const u8 *getSourceAddress() const; const u8 *getSourceAddress() const;
struct in6_addr getSourceAddress(struct in6_addr *result) const; struct in6_addr getSourceAddress(struct in6_addr *result) const;
virtual u8 *getSourceAddress(){return NULL;}
/* Destination Address*/ /* Destination Address*/
int setDestinationAddress(u8 *val); int setDestinationAddress(u8 *val);
int setDestinationAddress(struct in6_addr val); int setDestinationAddress(struct in6_addr val);
const u8 *getDestinationAddress() const; const u8 *getDestinationAddress() const;
struct in6_addr getDestinationAddress(struct in6_addr *result) const; struct in6_addr getDestinationAddress(struct in6_addr *result) const;
virtual u8 *getDestinationAddress(){return NULL;}
u16 getAddressLength() const; u16 getAddressLength() const;
virtual u16 getAddressLength(){return 0;}
}; };
#endif #endif