Nmap Development mailing list archives

Re: payload file prototype


From: Jay Fink <jay.fink () gmail com>
Date: Tue, 16 Feb 2010 08:30:54 -0500

On Mon, Feb 15, 2010 at 9:49 PM, David Fifield <david () bamsoftware com> wrote:

Instead of that insert
call, it's easier to do this:

Payload[tmp_proto_port] = tmp_payload;


Yep - saw that in the documentation right after I emailed you :D

I don't know what you mean by the bare value and a loop. You might have
to do some things like defining operator< on proto_port to make it fit
the interface of std::map. Once you've done that, lookup is something
like

       std::map<struct proto_port, struct payload>::iterator it;
       it = Payload.find(tmp_proto_port);
       if (it == Payload.end())
               return NULL;
       else
               return &*it;

That is what I meant (more or less) - I wasn't sure how we could
easily access a struct inside of a map.

See for example hop_cache_lookup in traceroute.cc. Also look at HopIdent
for the operator< overloading.

Outstanding!

Thanks... yet again!

 j
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: