mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
a few more consts
This commit is contained in:
@@ -800,7 +800,7 @@ static double vectorize_isr(std::map<std::string, FPPacket>& resps) {
|
||||
const char *probe_name;
|
||||
const FPPacket *fp;
|
||||
const TCPHeader *tcp;
|
||||
std::map<std::string, FPPacket>::iterator it;
|
||||
std::map<std::string, FPPacket>::const_iterator it;
|
||||
|
||||
probe_name = SEQ_PROBE_NAMES[i];
|
||||
it = resps.find(probe_name);
|
||||
|
||||
20
output.cc
20
output.cc
@@ -2102,8 +2102,6 @@ void printserviceinfooutput(Target *currenths) {
|
||||
hostname_tbl[i][0] = ostype_tbl[i][0] = devicetype_tbl[i][0] = cpe_tbl[i][0] = '\0';
|
||||
|
||||
while ((p = currenths->ports.nextPort(p, &port, TCPANDUDPANDSCTP, PORT_OPEN))) {
|
||||
std::vector<char *>::iterator it;
|
||||
|
||||
// The following 2 lines (from portlist.h) tell us that we don't need to
|
||||
// worry about free()ing anything in the serviceDeductions struct. pass in
|
||||
// an allocated struct serviceDeductions (don't worry about initializing, and
|
||||
@@ -2149,7 +2147,7 @@ void printserviceinfooutput(Target *currenths) {
|
||||
}
|
||||
}
|
||||
|
||||
for (it = sd.cpe.begin(); it != sd.cpe.end(); it++) {
|
||||
for (std::vector<char *>::const_iterator it = sd.cpe.begin(); it != sd.cpe.end(); it++) {
|
||||
for (i = 0; i < MAX_SERVICE_INFO_FIELDS; i++) {
|
||||
if (cpe_tbl[i][0] && !strcmp(&cpe_tbl[i][0], *it))
|
||||
break;
|
||||
@@ -2221,7 +2219,7 @@ void printserviceinfooutput(Target *currenths) {
|
||||
|
||||
#ifndef NOLUA
|
||||
void printscriptresults(ScriptResults *scriptResults, stype scantype) {
|
||||
ScriptResults::iterator iter;
|
||||
ScriptResults::const_iterator iter;
|
||||
char *script_output;
|
||||
|
||||
if (scriptResults->size() > 0) {
|
||||
@@ -2246,7 +2244,7 @@ void printscriptresults(ScriptResults *scriptResults, stype scantype) {
|
||||
}
|
||||
|
||||
void printhostscriptresults(Target *currenths) {
|
||||
ScriptResults::iterator iter;
|
||||
ScriptResults::const_iterator iter;
|
||||
char *script_output;
|
||||
|
||||
if (currenths->scriptResults.size() > 0) {
|
||||
@@ -2274,7 +2272,7 @@ static void printtraceroute_normal(Target *currenths) {
|
||||
static const int HOP_COL = 0, RTT_COL = 1, HOST_COL = 2;
|
||||
NmapOutputTable Tbl(currenths->traceroute_hops.size() + 1, 3);
|
||||
struct probespec probe;
|
||||
std::list<TracerouteHop>::iterator it;
|
||||
std::list<TracerouteHop>::const_iterator it;
|
||||
int row;
|
||||
|
||||
/* No trace, must be localhost. */
|
||||
@@ -2314,7 +2312,7 @@ static void printtraceroute_normal(Target *currenths) {
|
||||
|
||||
if (!o.debugging) {
|
||||
/* Consolidate shared hops. */
|
||||
TracerouteHop *shared_hop = NULL;
|
||||
const TracerouteHop *shared_hop = NULL;
|
||||
struct sockaddr_storage addr;
|
||||
size_t sslen;
|
||||
|
||||
@@ -2381,7 +2379,7 @@ static void printtraceroute_normal(Target *currenths) {
|
||||
|
||||
static void printtraceroute_xml(Target *currenths) {
|
||||
struct probespec probe;
|
||||
std::list<TracerouteHop>::iterator it;
|
||||
std::list<TracerouteHop>::const_iterator it;
|
||||
|
||||
/* No trace, must be localhost. */
|
||||
if (currenths->traceroute_hops.size() == 0)
|
||||
@@ -2401,7 +2399,7 @@ static void printtraceroute_xml(Target *currenths) {
|
||||
xml_attribute("port", "%d", probe.pd.sctp.dport);
|
||||
xml_attribute("proto", "%s", proto2ascii_lowercase(probe.proto));
|
||||
} else if (probe.type == PS_ICMP || probe.type == PS_PROTO) {
|
||||
struct protoent *proto = nmap_getprotbynum(probe.proto);
|
||||
const struct protoent *proto = nmap_getprotbynum(probe.proto);
|
||||
if (proto == NULL)
|
||||
xml_attribute("proto", "%d", probe.proto);
|
||||
else
|
||||
@@ -2608,8 +2606,8 @@ struct data_file_record {
|
||||
were found. */
|
||||
void printdatafilepaths() {
|
||||
std::list<struct data_file_record> df;
|
||||
std::list<struct data_file_record>::iterator iter;
|
||||
std::map<std::string, std::string>::iterator map_iter;
|
||||
std::list<struct data_file_record>::const_iterator iter;
|
||||
std::map<std::string, std::string>::const_iterator map_iter;
|
||||
std::string dir;
|
||||
unsigned int num_dirs;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ reason_map_type reason_map;
|
||||
/* Function to Translate ICMP codes and types to *
|
||||
* Reason Codes */
|
||||
|
||||
static const reason_codes icmpv4_to_reason(int icmp_type, int icmp_code) {
|
||||
static reason_codes icmpv4_to_reason(int icmp_type, int icmp_code) {
|
||||
|
||||
switch(icmp_type){
|
||||
|
||||
@@ -200,7 +200,7 @@ static const reason_codes icmpv4_to_reason(int icmp_type, int icmp_code) {
|
||||
return ER_UNKNOWN;
|
||||
};
|
||||
|
||||
static const reason_codes icmpv6_to_reason(int icmp_type, int icmp_code) {
|
||||
static reason_codes icmpv6_to_reason(int icmp_type, int icmp_code) {
|
||||
|
||||
switch(icmp_type){
|
||||
|
||||
@@ -235,7 +235,7 @@ static const reason_codes icmpv6_to_reason(int icmp_type, int icmp_code) {
|
||||
return ER_UNKNOWN;
|
||||
};
|
||||
|
||||
const reason_codes icmp_to_reason(u8 proto, int icmp_type, int icmp_code) {
|
||||
reason_codes icmp_to_reason(u8 proto, int icmp_type, int icmp_code) {
|
||||
if (proto == IPPROTO_ICMP)
|
||||
return icmpv4_to_reason(icmp_type, icmp_code);
|
||||
else if (proto == IPPROTO_ICMPV6)
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
};
|
||||
|
||||
/* Function to translate ICMP code and typ to reason code */
|
||||
const reason_codes icmp_to_reason(u8 proto, int icmp_type, int icmp_code);
|
||||
reason_codes icmp_to_reason(u8 proto, int icmp_type, int icmp_code);
|
||||
|
||||
/* Passed to reason_str to determine if string should be in
|
||||
* plural of singular form */
|
||||
|
||||
10
services.cc
10
services.cc
@@ -208,7 +208,7 @@ static int nmap_services_init() {
|
||||
ps.proto = proto;
|
||||
|
||||
/* Now we make sure our service table doesn't have duplicates */
|
||||
std::map<port_spec, service_node>::iterator i;
|
||||
std::map<port_spec, service_node>::const_iterator i;
|
||||
i = service_table.find(ps);
|
||||
if (i != service_table.end()) {
|
||||
if (o.debugging)
|
||||
@@ -270,15 +270,15 @@ void free_services() {
|
||||
* Returns the number of ports added in total.
|
||||
*/
|
||||
|
||||
int addportsfromservmask(char *mask, u8 *porttbl, int range_type) {
|
||||
std::map<port_spec, service_node>::iterator i;
|
||||
int addportsfromservmask(const char *mask, u8 *porttbl, int range_type) {
|
||||
std::map<port_spec, service_node>::const_iterator i;
|
||||
int t = 0;
|
||||
|
||||
if (!services_initialized && nmap_services_init() == -1)
|
||||
fatal("%s: Couldn't get port numbers", __func__);
|
||||
|
||||
for (i = service_table.begin(); i != service_table.end(); i++) {
|
||||
service_node& current = i->second;
|
||||
const service_node& current = i->second;
|
||||
if (wildtest(mask, current.s_name)) {
|
||||
if ((range_type & SCAN_TCP_PORT) && strcmp(current.s_proto, "tcp") == 0) {
|
||||
porttbl[current.s_port] |= SCAN_TCP_PORT;
|
||||
@@ -368,7 +368,7 @@ static bool is_port_member(const struct scan_lists *ptsdata, const struct servic
|
||||
// This function doesn't support IP protocol scan so only call this
|
||||
// function if o.TCPScan() || o.UDPScan() || o.SCTPScan()
|
||||
|
||||
void gettoppts(double level, char *portlist, struct scan_lists * ports, char *exclude_ports) {
|
||||
void gettoppts(double level, const char *portlist, struct scan_lists * ports, const char *exclude_ports) {
|
||||
int ti=0, ui=0, si=0;
|
||||
struct scan_lists ptsdata = { 0 };
|
||||
bool ptsdata_initialized = false;
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
|
||||
#define SERVICE_TABLE_SIZE 1024
|
||||
|
||||
int addportsfromservmask(char *mask, u8 *porttbl, int range_type);
|
||||
int addportsfromservmask(const char *mask, u8 *porttbl, int range_type);
|
||||
struct servent *nmap_getservbyport(int port, const char *proto);
|
||||
void gettoppts(double level, char *portlist, struct scan_lists * ports, char *exclude_list = NULL);
|
||||
void gettoppts(double level, const char *portlist, struct scan_lists * ports, const char *exclude_list = NULL);
|
||||
|
||||
void free_services();
|
||||
|
||||
|
||||
2
utils.cc
2
utils.cc
@@ -80,7 +80,7 @@ extern NmapOps o;
|
||||
/* Test a wildcard mask against a test string. Wildcard mask can include '*' and
|
||||
'?' which work the same as they do in /bin/sh (except it's case insensitive).
|
||||
Return val of 1 means it DID match. 0 means it DIDN'T. - Doug Hoyte, 2005 */
|
||||
int wildtest(char *wild, char *test) {
|
||||
int wildtest(const char *wild, const char *test) {
|
||||
int i;
|
||||
|
||||
while (*wild != '\0' || *test != '\0') {
|
||||
|
||||
Reference in New Issue
Block a user