linux/*.h include files
I´m trying to compile a C program under cygwin but it uses some linux include files. (#include linux/in.h and #include linux/if_ether.h) Is there a downloadable package with these files? Could i copy the original linux .h files to the include directory? or the program will not run under cygwin? :) Atenciosamente, (Sincerelly,) Flavio Rabello fone: 55-27-3348-4096 fax: 55-27-3348-4289 Frase do dia: Why should I grow up ? This is more fun ! Public PGP key at server pgpkeys.mit.edu port 11371 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: linux/*.h include files
Flavio Rabello de Souza wrote: I´m trying to compile a C program under cygwin but it uses some linux include files. (#include linux/in.h and #include linux/if_ether.h) On my cygwin system I have both netinet/in.h and net/if.h . These are the 'standard' includes that they probably should have used if they wanted their code to be portable. Try them and see if that helps. These standard include files will usually in turn include the 'platform specific' header files for that system. It is best to never use the 'platform specific' version (e.g. linux/*.h, cygwin/*.h ) directly unless it is in code which would never compile and run on any other system. Steve. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: linux/*.h include files
thanks steve! But i still getting an error :( Looks like its not completelly implements the linux/if_ether.h and linux/in.h :) the error message i got: $ gcc -o sniffer sniffer.c sniffer.c: In function `main': sniffer.c:14: error: `PF_PACKET' undeclared (first use in this function) sniffer.c:14: error: (Each undeclared identifier is reported only once sniffer.c:14: error: for each function it appears in.) sniffer.c:15: error: `ETH_P_IP' undeclared (first use in this function) do you have any suggestion? At 14:55 17/10/2003, you wrote: Flavio Rabello de Souza wrote: I´m trying to compile a C program under cygwin but it uses some linux include files. (#include linux/in.h and #include linux/if_ether.h) On my cygwin system I have both netinet/in.h and net/if.h . These are the 'standard' includes that they probably should have used if they wanted their code to be portable. Try them and see if that helps. These standard include files will usually in turn include the 'platform specific' header files for that system. It is best to never use the 'platform specific' version (e.g. linux/*.h, cygwin/*.h ) directly unless it is in code which would never compile and run on any other system. Steve. Atenciosamente, (Sincerelly,) Flavio Rabello fone: 55-27-3348-4096 fax: 55-27-3348-4289 Frase do dia: Microsoft products work great ... until you install them ! Public PGP key at server pgpkeys.mit.edu port 11371 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: linux/*.h include files
Flavio Rabello de Souza wrote: But i still getting an error :( Looks like its not completelly implements the linux/if_ether.h and linux/in.h :) the error message i got: $ gcc -o sniffer sniffer.c sniffer.c: In function `main': sniffer.c:14: error: `PF_PACKET' undeclared (first use in this function) sniffer.c:14: error: (Each undeclared identifier is reported only once sniffer.c:14: error: for each function it appears in.) sniffer.c:15: error: `ETH_P_IP' undeclared (first use in this function) do you have any suggestion? Well you have not given enough information for us to guess what you are doing, and it's probably a little off topic here, but I'll try anyway... ;-) First I will say that I am not an expert in using raw sockets so I can not help you very much beyond this point with finding the definitions you need on cygwin, unless I find a little extra spare time on my hands (lol). But, if you are trying to compile the same sniffer.c program that I located on the web, which btw *IS* linux specific such as your errors indicate, then I would have to suggest that instead you look into using the libpcap library (for windows libwpcap http://winpcap.polito.it/default.htm). It impliments most of the functionality of raw sockets, and then some! It is designed for network diagnostics and security monitoring in mind, and it's supposed to be portable as well. If you are just trying to learn about networks and security it will be time well invested. http://cvs.tcpdump.org/cgi-bin/cvsweb/libpcap/README.Win32?rev=1.1 http://www.mail-archive.com/cgi-bin/htsearch?restrict=;exclude=;config=winpcap-users_winpcap_polito_it;method=and;format=short;words=cygwin;page=2 There are many Unix/Windows networking and security applications that use this library. Personally I just use windump from the cygwin command line, or ethereal via a windows gui. Windump is not a cygwin application. A little time invested in learning it may help you design your network applications faster, more portable, and more robust. Just do a quick google for libpcap and see for yourself! And while you are at it, google for libwpcap, which is the windows version. I hope this helps. Steve. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: linux/*.h include files
Flavio Rabello de Souza wrote: I´m trying to compile a C program under cygwin but it uses some linux include files. (#include linux/in.h and #include linux/if_ether.h) I did something similar when compiling tcpflow, but I just used a couple of missing header files from FreeBSD. See http://www.cygwin.com/ml/cygwin/2003-07/msg01772.html for details. In the case of Cygwin (and probably other platforms), those headers reside in 'netinet' not 'linux', so you'll probably have to modify the sources. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/