|
Nmap Development
mailing list archives
Re: Help: fd_set porting to Win32?
From: Kris Katterjohn <katterjohn () gmail com>
Date: Sat, 31 May 2008 12:29:49 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey Mixter,
mixter () gmail com wrote:
Help is appreciated with any clues on the following
porting fun to MSVC++. "Winsock2.h" defines fd_set as follows:
typedef struct fd_set {
u_int fd_count;
SOCKET fd_array[FD_SETSIZE];
} fd_set;
This typedef struct <name> { ... } <name>; is strange in itself,
but nothing I can possibly change. Now, I have to change some
occurrences of instantiation in Ncat, as follows:
struct fdset_set {
...
typedef struct fd_set master;
typedef struct fd_set read_fds;
} set[SET_SIZE];
This, in turn, is accepted but won't let me access the "set" members:
FD_ZERO(&set[i].read_fds);
if(FD_ISSET(set[i].socks4_client, &set[i].read_fds)){
Gives me the following errors:
1>\documents\svn-insecure\ncat\ncat_proxy.c(316) : error C2274:
'function-style cast' : illegal as right side of '.' operator
1>\documents\svn-insecure\ncat\ncat_proxy.c(316) : error C2227: left
of '->fd_count' must point to class/struct/union/generic type
1>\documents\svn-insecure\ncat\ncat_proxy.c(317) : error C2273:
'function-style cast' : illegal as right side of '->' operator
You have a typedef in the struct (which I'm surprised works), so that seems to
be why you're getting the C2274 error[1].
Please, is there any sane way to deal with fd_set on windows?
Already tried to find out why this does work in nmap, with no luck. I cannot
see what is included differently, plus sys/select.h just isn't there on Win32,
so I have to include winsock2.h which doesn't let me instantiate
fd_set as it was.
nbase_winunix.h defines these before it includes the Windows headers:
#define _WINSOCKAPI_
#define WIN32_LEAN_AND_MEAN
Have you tried defining these, or including nbase.h (which includes
nbase_winunix.h on Windows)?
nsock_internal.h includes nbase.h and also uses fd_set without problem, so
there is hope :)
Thanks!
Thanks,
Kris Katterjohn
[1] http://msdn.microsoft.com/en-us/library/kst1dcx0(VS.80).aspx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQIVAwUBSEGK6/9K37xXYl36AQKIBw//aFiNMFmiwtNuPyUfJ8ivyabYa3BpQfJd
7OVfC/NPByoNpbP3C0aTNiQPxkRXecVGQZR8mKEqRPTZH7Iwb+mmzf9QtKGfqdMA
BCNjBRU969WFYFAqYpLkFC8RYwf2me+fsML+0KeUlWSc/I0OZv8gd3cFaMcDHWRh
+/zqHwvVMRpjf+8U4jns/tkMXTXVFr+0g/IP8vVbnXISzpFJeaGrznNWTC2VzG/1
Klz21lm6RZle59OxW+mhKKrHnKw1QrQPkjKlQyTiYpY/nIdDnvpswnv0YcNPqGPf
6ccJ4EOGjCsXaTU+94tWUgDFhvboOD3tv9VeeO/2ZFUclvKs/M31Cr+gzfdQtk/i
d+Vm6q06EWp3qxi0gCvRoVJ98srS9Bu+943SCy5fqH7TCt7iUDy9Ty5kfXXmez5O
mieHugQzQrzoeb/YXD8IMcYUnULCtZI/eXzuia012k2y+d0PDabkB+caHQH2IdOR
iosjOehMkQ7zo6bQNGkSHKM3p/9ICHSBIMHhYyCTxDnMTshh9RGg0IiOxXpdiM2y
fb9t7QctXQZjfniiYIZQOzPGZ9mMFM4AYhRBK2fuKpLP2X3yTxcNHIJAd9Raid4R
g17oJZw73AuZGYxmiMF7XUodwzwcPvtWV++Jk9gkAGoPamt0Tf5y8WWg7czcFy/c
+du0MtFkt10=
=gpQ4
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
By Date
By Thread
Current thread:
|