mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 13:09:02 +00:00
Merge r30071 from nmap-npingchanges: Add the const specified to all relevant methods
This commit is contained in:
@@ -204,7 +204,7 @@ int ICMPv6Header::print(FILE *output, int detail) const {
|
|||||||
case ICMPv6_ECHOREPLY:
|
case ICMPv6_ECHOREPLY:
|
||||||
fprintf(output, " id=%u seq=%u", this->getIdentifier(), this->getSequence());
|
fprintf(output, " id=%u seq=%u", this->getIdentifier(), this->getSequence());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Print nothing */
|
/* Print nothing */
|
||||||
break;
|
break;
|
||||||
@@ -468,7 +468,7 @@ int ICMPv6Header::setReserved(u32 val){
|
|||||||
|
|
||||||
|
|
||||||
/** @warning Returned value is in host byte order */
|
/** @warning Returned value is in host byte order */
|
||||||
u32 ICMPv6Header::getReserved(){
|
u32 ICMPv6Header::getReserved() const {
|
||||||
u32 aux32=0;
|
u32 aux32=0;
|
||||||
u8 *auxpnt=(u8 *)&aux32;
|
u8 *auxpnt=(u8 *)&aux32;
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ int ICMPv6Header::setUnused(u32 val){
|
|||||||
} /* End of setUnused() */
|
} /* End of setUnused() */
|
||||||
|
|
||||||
|
|
||||||
u32 ICMPv6Header::getUnused(){
|
u32 ICMPv6Header::getUnused() const {
|
||||||
return this->getReserved();
|
return this->getReserved();
|
||||||
} /* End of getUnused() */
|
} /* End of getUnused() */
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ int ICMPv6Header::setFlags(u8 val){
|
|||||||
} /* End of setFlags() */
|
} /* End of setFlags() */
|
||||||
|
|
||||||
|
|
||||||
u8 ICMPv6Header::getFlags(){
|
u8 ICMPv6Header::getFlags() const {
|
||||||
switch(this->h.type){
|
switch(this->h.type){
|
||||||
|
|
||||||
case ICMPv6_ROUTERADVERT:
|
case ICMPv6_ROUTERADVERT:
|
||||||
@@ -618,7 +618,7 @@ int ICMPv6Header::setMTU(u32 mtu){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setMTU() */
|
} /* End of setMTU() */
|
||||||
|
|
||||||
u32 ICMPv6Header::getMTU(){
|
u32 ICMPv6Header::getMTU() const {
|
||||||
return ntohl(this->h_ptb->mtu);
|
return ntohl(this->h_ptb->mtu);
|
||||||
} /* End of getMTU() */
|
} /* End of getMTU() */
|
||||||
|
|
||||||
@@ -635,7 +635,7 @@ int ICMPv6Header::setPointer(u32 pnt){
|
|||||||
} /* End of setPointer() */
|
} /* End of setPointer() */
|
||||||
|
|
||||||
|
|
||||||
u32 ICMPv6Header::getPointer(){
|
u32 ICMPv6Header::getPointer() const {
|
||||||
return ntohl(this->h_pp->pointer);
|
return ntohl(this->h_pp->pointer);
|
||||||
} /* End of getPointer() */
|
} /* End of getPointer() */
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ int ICMPv6Header::setCurrentHopLimit(u8 val){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setCurrentHopLimit() */
|
} /* End of setCurrentHopLimit() */
|
||||||
|
|
||||||
u8 ICMPv6Header::getCurrentHopLimit(){
|
u8 ICMPv6Header::getCurrentHopLimit() const {
|
||||||
return this->h_ra->current_hop_limit;
|
return this->h_ra->current_hop_limit;
|
||||||
} /* End of getCurrentHopLimit() */
|
} /* End of getCurrentHopLimit() */
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@ int ICMPv6Header::setRouterLifetime(u16 val){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setRouterLifetime() */
|
} /* End of setRouterLifetime() */
|
||||||
|
|
||||||
u16 ICMPv6Header::getRouterLifetime(){
|
u16 ICMPv6Header::getRouterLifetime() const {
|
||||||
return this->h_ra->router_lifetime;
|
return this->h_ra->router_lifetime;
|
||||||
} /* End of getRouterLifetime() */
|
} /* End of getRouterLifetime() */
|
||||||
|
|
||||||
@@ -732,7 +732,7 @@ int ICMPv6Header::setReachableTime(u32 val){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setReachableTime() */
|
} /* End of setReachableTime() */
|
||||||
|
|
||||||
u32 ICMPv6Header::getReachableTime(){
|
u32 ICMPv6Header::getReachableTime() const {
|
||||||
return this->h_ra->reachable_time;
|
return this->h_ra->reachable_time;
|
||||||
} /* End of getReachableTime() */
|
} /* End of getReachableTime() */
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ int ICMPv6Header::setRetransmissionTimer(u32 val){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setRetransmissionTimer() */
|
} /* End of setRetransmissionTimer() */
|
||||||
|
|
||||||
u32 ICMPv6Header::getRetransmissionTimer(){
|
u32 ICMPv6Header::getRetransmissionTimer() const {
|
||||||
return this->h_ra->retransmission_timer;
|
return this->h_ra->retransmission_timer;
|
||||||
} /* End of getRetransmissionTimer() */
|
} /* End of getRetransmissionTimer() */
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ int ICMPv6Header::setTargetAddress(struct in6_addr addr){
|
|||||||
} /* End of setTargetAddress() */
|
} /* End of setTargetAddress() */
|
||||||
|
|
||||||
|
|
||||||
struct in6_addr ICMPv6Header::getTargetAddress(){
|
struct in6_addr ICMPv6Header::getTargetAddress() const {
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
memset(&addr, 0, sizeof(struct in6_addr));
|
memset(&addr, 0, sizeof(struct in6_addr));
|
||||||
|
|
||||||
@@ -810,7 +810,7 @@ int ICMPv6Header::setDestinationAddress(struct in6_addr addr){
|
|||||||
} /* End of setDestinationAddress() */
|
} /* End of setDestinationAddress() */
|
||||||
|
|
||||||
|
|
||||||
struct in6_addr ICMPv6Header::getDestinationAddress(){
|
struct in6_addr ICMPv6Header::getDestinationAddress() const {
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
memset(&addr, 0, sizeof(struct in6_addr));
|
memset(&addr, 0, sizeof(struct in6_addr));
|
||||||
|
|
||||||
@@ -839,7 +839,7 @@ int ICMPv6Header::setSegmentNumber(u8 val){
|
|||||||
return OP_SUCCESS;
|
return OP_SUCCESS;
|
||||||
} /* End of setSegmentNumber() */
|
} /* End of setSegmentNumber() */
|
||||||
|
|
||||||
u8 ICMPv6Header::getSegmentNumber(){
|
u8 ICMPv6Header::getSegmentNumber() const {
|
||||||
return this->h_rr->segment_number;
|
return this->h_rr->segment_number;
|
||||||
} /* End of getSegmentNumber() */
|
} /* End of getSegmentNumber() */
|
||||||
|
|
||||||
@@ -864,7 +864,7 @@ int ICMPv6Header::setMaxDelay(u16 val){
|
|||||||
} /* End of setMaxDelay() */
|
} /* End of setMaxDelay() */
|
||||||
|
|
||||||
|
|
||||||
u16 ICMPv6Header::getMaxDelay(){
|
u16 ICMPv6Header::getMaxDelay() const {
|
||||||
switch(this->h.type){
|
switch(this->h.type){
|
||||||
case ICMPv6_RTRRENUM:
|
case ICMPv6_RTRRENUM:
|
||||||
return ntohs(this->h_rr->max_delay);
|
return ntohs(this->h_rr->max_delay);
|
||||||
@@ -895,7 +895,7 @@ int ICMPv6Header::setQtype(u16 val){
|
|||||||
|
|
||||||
|
|
||||||
/** Returns NI Qtype */
|
/** Returns NI Qtype */
|
||||||
u16 ICMPv6Header::getQtype(){
|
u16 ICMPv6Header::getQtype() const {
|
||||||
return ntohs(this->h_ni->qtype);
|
return ntohs(this->h_ni->qtype);
|
||||||
} /* End of getQtype() */
|
} /* End of getQtype() */
|
||||||
|
|
||||||
@@ -908,7 +908,7 @@ int ICMPv6Header::setNodeInfoFlags(u16 val){
|
|||||||
|
|
||||||
|
|
||||||
/** Returns NI Flags */
|
/** Returns NI Flags */
|
||||||
u16 ICMPv6Header::getNodeInfoFlags(){
|
u16 ICMPv6Header::getNodeInfoFlags() const {
|
||||||
return ntohs(this->h_ni->flags);
|
return ntohs(this->h_ni->flags);
|
||||||
} /* End of getNodeInfoFlags() */
|
} /* End of getNodeInfoFlags() */
|
||||||
|
|
||||||
@@ -931,7 +931,7 @@ int ICMPv6Header::setG(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag G */
|
/* Get NI Flag G */
|
||||||
bool ICMPv6Header::getG(){
|
bool ICMPv6Header::getG() const {
|
||||||
return this->getNodeInfoFlags() & 0x0020;
|
return this->getNodeInfoFlags() & 0x0020;
|
||||||
} /* End of getG() */
|
} /* End of getG() */
|
||||||
|
|
||||||
@@ -949,7 +949,7 @@ int ICMPv6Header::setS(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag S */
|
/* Get NI Flag S */
|
||||||
bool ICMPv6Header::getS(){
|
bool ICMPv6Header::getS() const {
|
||||||
return this->getNodeInfoFlags() & 0x0010;
|
return this->getNodeInfoFlags() & 0x0010;
|
||||||
} /* End of getS() */
|
} /* End of getS() */
|
||||||
|
|
||||||
@@ -967,7 +967,7 @@ int ICMPv6Header::setL(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag L */
|
/* Get NI Flag L */
|
||||||
bool ICMPv6Header::getL(){
|
bool ICMPv6Header::getL() const {
|
||||||
return this->getNodeInfoFlags() & 0x0008;
|
return this->getNodeInfoFlags() & 0x0008;
|
||||||
} /* End of getL() */
|
} /* End of getL() */
|
||||||
|
|
||||||
@@ -985,7 +985,7 @@ int ICMPv6Header::setC(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag C */
|
/* Get NI Flag C */
|
||||||
bool ICMPv6Header::getC(){
|
bool ICMPv6Header::getC() const {
|
||||||
return this->getNodeInfoFlags() & 0x0004;
|
return this->getNodeInfoFlags() & 0x0004;
|
||||||
} /* End of getC() */
|
} /* End of getC() */
|
||||||
|
|
||||||
@@ -1003,7 +1003,7 @@ int ICMPv6Header::setA(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag A */
|
/* Get NI Flag A */
|
||||||
bool ICMPv6Header::getA(){
|
bool ICMPv6Header::getA() const {
|
||||||
return this->getNodeInfoFlags() & 0x0002;
|
return this->getNodeInfoFlags() & 0x0002;
|
||||||
} /* End of getA() */
|
} /* End of getA() */
|
||||||
|
|
||||||
@@ -1021,7 +1021,7 @@ int ICMPv6Header::setT(bool flag_value){
|
|||||||
|
|
||||||
|
|
||||||
/* Get NI Flag T */
|
/* Get NI Flag T */
|
||||||
bool ICMPv6Header::getT(){
|
bool ICMPv6Header::getT() const {
|
||||||
return this->getNodeInfoFlags() & 0x0001;
|
return this->getNodeInfoFlags() & 0x0001;
|
||||||
} /* End of getT() */
|
} /* End of getT() */
|
||||||
|
|
||||||
@@ -1039,7 +1039,7 @@ int ICMPv6Header::setNonce(const u8 *nonce){
|
|||||||
/* Returns a pointer to the nonce buffer.
|
/* Returns a pointer to the nonce buffer.
|
||||||
* @warning: The returned pointer is guaranteed to point to an 8-byte buffer.
|
* @warning: The returned pointer is guaranteed to point to an 8-byte buffer.
|
||||||
* However, what comes after the 8th byte is unspecified. */
|
* However, what comes after the 8th byte is unspecified. */
|
||||||
u8 *ICMPv6Header::getNonce(){
|
u8 *ICMPv6Header::getNonce() const {
|
||||||
return this->h_ni->nonce;
|
return this->h_ni->nonce;
|
||||||
} /* End of getNonce() */
|
} /* End of getNonce() */
|
||||||
|
|
||||||
@@ -1065,7 +1065,7 @@ int ICMPv6Header::setMulticastAddress(struct in6_addr addr){
|
|||||||
} /* End of setMulticastAddress() */
|
} /* End of setMulticastAddress() */
|
||||||
|
|
||||||
|
|
||||||
struct in6_addr ICMPv6Header::getMulticastAddress(){
|
struct in6_addr ICMPv6Header::getMulticastAddress() const {
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
memset(&addr, 0, sizeof(struct in6_addr));
|
memset(&addr, 0, sizeof(struct in6_addr));
|
||||||
|
|
||||||
@@ -1091,7 +1091,7 @@ struct in6_addr ICMPv6Header::getMulticastAddress(){
|
|||||||
* bytes but then the packet may contain ICMPv6 options. We only return 40
|
* bytes but then the packet may contain ICMPv6 options. We only return 40
|
||||||
* because we don't know in advance the total number of bytes for the message.
|
* because we don't know in advance the total number of bytes for the message.
|
||||||
* Same applies to the rest of types. */
|
* Same applies to the rest of types. */
|
||||||
int ICMPv6Header::getHeaderLengthFromType(u8 type){
|
int ICMPv6Header::getHeaderLengthFromType(u8 type) const {
|
||||||
|
|
||||||
switch( type ){
|
switch( type ){
|
||||||
case ICMPv6_UNREACH:
|
case ICMPv6_UNREACH:
|
||||||
|
|||||||
@@ -613,19 +613,19 @@ class ICMPv6Header : public ICMPHeader {
|
|||||||
u16 getSum() const;
|
u16 getSum() const;
|
||||||
|
|
||||||
int setReserved(u32 val);
|
int setReserved(u32 val);
|
||||||
u32 getReserved();
|
u32 getReserved() const;
|
||||||
int setUnused(u32 val);
|
int setUnused(u32 val);
|
||||||
u32 getUnused();
|
u32 getUnused() const;
|
||||||
|
|
||||||
int setFlags(u8 val);
|
int setFlags(u8 val);
|
||||||
u8 getFlags();
|
u8 getFlags() const;
|
||||||
|
|
||||||
int setMTU(u32 mtu);
|
int setMTU(u32 mtu);
|
||||||
u32 getMTU();
|
u32 getMTU() const;
|
||||||
|
|
||||||
/* Parameter problem */
|
/* Parameter problem */
|
||||||
int setPointer(u32 val);
|
int setPointer(u32 val);
|
||||||
u32 getPointer();
|
u32 getPointer() const;
|
||||||
|
|
||||||
/* Echo */
|
/* Echo */
|
||||||
int setIdentifier(u16 val);
|
int setIdentifier(u16 val);
|
||||||
@@ -636,55 +636,55 @@ class ICMPv6Header : public ICMPHeader {
|
|||||||
|
|
||||||
/* Router Advertisement */
|
/* Router Advertisement */
|
||||||
int setCurrentHopLimit(u8 val);
|
int setCurrentHopLimit(u8 val);
|
||||||
u8 getCurrentHopLimit();
|
u8 getCurrentHopLimit() const;
|
||||||
|
|
||||||
int setRouterLifetime(u16 val);
|
int setRouterLifetime(u16 val);
|
||||||
u16 getRouterLifetime();
|
u16 getRouterLifetime() const;
|
||||||
|
|
||||||
int setReachableTime(u32 val);
|
int setReachableTime(u32 val);
|
||||||
u32 getReachableTime();
|
u32 getReachableTime() const;
|
||||||
|
|
||||||
int setRetransmissionTimer(u32 val);
|
int setRetransmissionTimer(u32 val);
|
||||||
u32 getRetransmissionTimer();
|
u32 getRetransmissionTimer() const;
|
||||||
|
|
||||||
int setTargetAddress(struct in6_addr addr);
|
int setTargetAddress(struct in6_addr addr);
|
||||||
struct in6_addr getTargetAddress();
|
struct in6_addr getTargetAddress() const;
|
||||||
|
|
||||||
int setDestinationAddress(struct in6_addr addr);
|
int setDestinationAddress(struct in6_addr addr);
|
||||||
struct in6_addr getDestinationAddress();
|
struct in6_addr getDestinationAddress() const;
|
||||||
|
|
||||||
int setSegmentNumber(u8 val);
|
int setSegmentNumber(u8 val);
|
||||||
u8 getSegmentNumber();
|
u8 getSegmentNumber() const;
|
||||||
|
|
||||||
int setMaxDelay(u16 val);
|
int setMaxDelay(u16 val);
|
||||||
u16 getMaxDelay();
|
u16 getMaxDelay() const;
|
||||||
|
|
||||||
/* Node Information Queries */
|
/* Node Information Queries */
|
||||||
int setQtype(u16 val);
|
int setQtype(u16 val);
|
||||||
u16 getQtype();
|
u16 getQtype() const;
|
||||||
int setNodeInfoFlags(u16 val);
|
int setNodeInfoFlags(u16 val);
|
||||||
u16 getNodeInfoFlags();
|
u16 getNodeInfoFlags() const;
|
||||||
int setG(bool flag_value=true);
|
int setG(bool flag_value=true);
|
||||||
bool getG();
|
bool getG() const;
|
||||||
int setS(bool flag_value=true);
|
int setS(bool flag_value=true);
|
||||||
bool getS();
|
bool getS() const;
|
||||||
int setL(bool flag_value=true);
|
int setL(bool flag_value=true);
|
||||||
bool getL();
|
bool getL() const;
|
||||||
int setC(bool flag_value=true);
|
int setC(bool flag_value=true);
|
||||||
bool getC();
|
bool getC() const;
|
||||||
int setA(bool flag_value=true);
|
int setA(bool flag_value=true);
|
||||||
bool getA();
|
bool getA() const;
|
||||||
int setT(bool flag_value=true);
|
int setT(bool flag_value=true);
|
||||||
bool getT();
|
bool getT() const;
|
||||||
int setNonce(const u8 *nonce);
|
int setNonce(const u8 *nonce);
|
||||||
u8 *getNonce();
|
u8 *getNonce() const;
|
||||||
|
|
||||||
/* Multicast Listener Discovery */
|
/* Multicast Listener Discovery */
|
||||||
int setMulticastAddress(struct in6_addr addr);
|
int setMulticastAddress(struct in6_addr addr);
|
||||||
struct in6_addr getMulticastAddress();
|
struct in6_addr getMulticastAddress() const;
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
int getHeaderLengthFromType(u8 type);
|
int getHeaderLengthFromType(u8 type) const;
|
||||||
bool isError() const;
|
bool isError() const;
|
||||||
const char *type2string(int type, int code) const;
|
const char *type2string(int type, int code) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user