Nmap Development mailing list archives
Re: Nsock unconnected sockets
From: Kris Katterjohn <katterjohn () gmail com>
Date: Sun, 03 Oct 2010 22:03:41 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/03/2010 08:03 PM, David Fifield wrote:
Some questions: 1. What do you think of the names nsock_setup_udp and sock:setup? The way to understand how it works is to know that "setup" is what you use instead of "connect" when you want an unconnected socket. Is there a name other than "setup" that conveys that better?
I don't particularly like "setup" because with a name like that it sounds like you should call it for every socket, not just for unconnected ones. I can't think of a better separate function name right now either, but an API change of something like nmap.new_socket(<proto>, <family>) with optional arguments is what I first thought of as an alternative because your "setup" is akin to an actual socket() call anyway. However, I'm not sure if setup() can be called multiple times or not, or if new sockets should be created (in fact, I'm not sure about connect either).
2. What do you think of the NSE API, s:setup("udp") s:setup("udp", "ipv4") s:setup("udp", "ipv6") We have a precedent for using "udp" as a protocol identifier. I think that the strings "ipv4" and "ipv6" are better than constants like nmap.AF_INET and nmap.AF_INET6. Another possibility would be "in" and "in6" but I think the ones I've chosen are easier to remember.
Using "udp" sounds good, but my resolve() and address_family() functions use "inet" and "inet6", which I like best (I considered "ipv4" and "ipv6" for them, too). I don't like the nmap.AF_INET constants either, but using "inet" in there just seems better to me. In NSE we have new_socket, connect, bind, (the new) sendto, etc. which are all certainly modeled on the Sockets API, so maybe that's why "inet" seems better to me: it's basically the Sockets way of saying IP. It just seems to fit.
David Fifield
Cheers, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMqUQNAAoJEEQxgFs5kUfup5cQAMj6QAW8XZVW3DAlHAFV15rm eYRjVr4ki+qMtQuK1I8X8vTFfmnD3kA0TbrgPbOtqaA1HQnrUcHpcx9r2gyEgGHV yPYxrbJS1zf046WiNLocwIQE9T9f2WYgdp+O5gkM5OVU+G60L62LunmxFg7ZoRBY 4MPkffGOEQdYhrP7SBjWc5E9/56otEZzgAv1YIAMbAnz8BDnFDXpi2XAPsQEZKw6 I7aXcl1KoA+CFCSxr6w/G0e5lDQbp/2MF5wbm8Jj9exyKKEQYLU1CCAaWElVQgkB 0e7s59LeZD9MNZ/OfvZGjCF+cz9hKgakzub2AoK31mYF/7qgN6H6/1svSBxtmxxt qC5HWEbPomUfpMdZN4xSoS152MWDibOtNhZQp8ei4wIuPxZFBRlMYg2o2f/qdxrZ SG1BEwaKVgjB3xNDIeqp47rfJNYsnCmTFgm2ChJuaBIELgXSnTVcDvM7ZFY929uG IHjnDm1YJETtjzxWGCWZOuUuhifQFVkeIAxh08TrLpOR5tqCLxGUzIunRim5V2Pn Z/GknE+KGbv68hvXnOS5yRZebZ8INUFsctJ8DySuYPnGCeoBzrAun/bKAzMralwa qBdw5Z8ucdWIqUgX2Z0Q/XcAmE7eZwbo0pyMKRPtWWK2tjOfD0mMtcZPl9Qi/5Yr f9vXHSUFY/F+mOXPq505 =8gYq -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Nsock unconnected sockets David Fifield (Oct 03)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 03)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 04)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 04)
- Re: Nsock unconnected sockets David Fifield (Oct 05)
- Re: Nsock unconnected sockets David Fifield (Oct 09)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 10)
- Re: Nsock unconnected sockets Ron (Oct 14)
- Re: Nsock unconnected sockets David Fifield (Oct 15)
- Re: Nsock unconnected sockets Patrik Karlsson (Oct 15)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 03)