Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Help: fd_set porting to Win32?
From: " mixter () gmail com" <mixter () gmail com>
Date: Sat, 31 May 2008 16:30:41 +0200

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

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.

Thanks!

_______________________________________________
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:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]