Re: [Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
BTW in which Windows version GetAdaptersInfo() was added? It is missing from Win95 (and BCB 3.0) It exists in WinNT4.0 inside iphlpapi.dll (and in BCB 5.0 iphlpapi.h but is not documented in Win32 API that arrive with BCB 5.0) Chen. ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour
Re: [Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
Hi Xavi, _Przemek, thank you very much for answering me directly_ It's is possible. Just like many other things which still do not exists in MS-Windows and we will have to wait next 10 years until MS discover them and add some support for it in WinSOCK.X.Y.Z which will work correctly in version X.Y.Z + N. There is only one question: Why we should add such things? The fact that sth is possible on some platforms does not mean that it has to be implemented. [...] Why you added HB_SOCKET_IFINFO_GATEWAY? What programs do you plan to write which will need such information? How do you know that which gateway belongs to each IP address? It's possible that aliases uses different gateways (at least in normal systems). I do not see any code which tries to bind gateway addresses with IP addresses so HB_SOCKET_IFINFO_GATEWAY contains correct information only when the same gateway is used by all aliases. I did it to make something new, not important in itself. MS-Windows does not have interface names as other hosts. AFAIR windows ports of some *nix tools like ifconfing used IP address as interface name so I decided to use the same. You added code which replace this IP addres with localhost string for LOOPBACK interfaces. Why? AFAIK in Windows the adapter name is one GUID exept localhost. Do you know that it's possible to have more then one LOOPBACK interface with different addresses? Yes and with the appropriate GUID adapter name. [...] hb_arrayGetC() returns address to dynamically allocated memory block which should be freed by hb_itemFreeC(). Now this code causes memory leak. Is iphlpapi.dll loaded by application at startup and keep alive for whole application running time? THANK YOU!!! for test and respond. Yes, I've a pretty hb_out.log report compiling with HB_FM_STATISTICS. Remember what means a draft code. :) You can see the interest of people about it because your sample PRG code and my sample no presents nothing in Windows. If not then storing pointer to GetAdaptersInfo() in static variable seems to be a little bit risk because such address may change. I think that this may also happen with the system dlls. Remember my post about this .- http://lists.harbour-project.org/pipermail/harbour/2010-February/032151.html BTW in which Windows version GetAdaptersInfo() was added? This code does not detect aliases. It has to be redesigned to eliminate them. Well, what do you suggest? Best regards, Xavi ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour
Re: [Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
On Sun, 21 Feb 2010, Mindaugas Kavaliauskas wrote: Hi, Xavi has mentioned a popular GetAdaptersInfo() way to get interface list. Windows also support another method that is more similar to your implementation (but less info could be obtained using with method): http://tangentsoft.net/wskfaq/examples/getifaces.html http://msdn.microsoft.com/en-us/library/ms741621(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms738568(VS.85).aspx Thank you very much for information. I've just commited basic version. I hope that you or Xavi can finished it and address some of TODO notes I left in ChangeLog and source code. best regards, Przemek ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour
Re: [Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
Hi Xavi, I think we should remove Windows-only stuff from this function. Harbour core is meant to be portable, so anything where there is no provision for support on other platforms, should be moved to hbwin (like GUID). I also don't understand type. It's vague, and it returns a human readable (English) string, while if this is portable and useful information (and only if), it should rather return some sort of numeric value. To put it short, only HWADDR should be used from this new code, maybe gateway. Brgds, Viktor On 2010 Feb 21, at 21:44, Xavi wrote: Hi all, Thank you very much Mindaugas. Yes, I think it's possible to mix both GetAdaptersInfo, WSAIoctl to fill Przemek's array and add more elements to Windows. I attached a first draft, Could you test it and comets? #include hbsocket.ch proc main( noAlias ) local iface ? os(), version() ? interfaces: for each iface in hb_inetIfInfo( !empty( noAlias ), 0 ) ? Family :, iface[HB_SOCKET_IFINFO_FAMILY] ? Name .. :, iface[HB_SOCKET_IFINFO_NAME] ? Flags . :, iface[HB_SOCKET_IFINFO_FLAGS] ? Address ... :, iface[HB_SOCKET_IFINFO_ADDR] ? Mask .. :, iface[HB_SOCKET_IFINFO_NETMASK] ? Bradcast .. :, iface[HB_SOCKET_IFINFO_BROADCAST] ? P2P :, iface[HB_SOCKET_IFINFO_P2PADDR] ? MAC ... :, iface[HB_SOCKET_IFINFO_HWADDR] ? Type ...:, iface[HB_SOCKET_IFINFO_TYPE] ? Gateway ... :, iface[HB_SOCKET_IFINFO_GATEWAY] ? GUID .. :, iface[HB_SOCKET_IFINFO_GUID] ? '---' next ? Wait return Best regards, Xavi El 21/02/2010 2:25, Mindaugas Kavaliauskas escribió: Hi, + added new C function: PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases ); it returns array with existing interfaces description. This code was added for non MS-Windows based platforms only. Support for MS-Windows has to be added yet. Xavi has mentioned a popular GetAdaptersInfo() way to get interface list. Windows also support another method that is more similar to your implementation (but less info could be obtained using with method): http://tangentsoft.net/wskfaq/examples/getifaces.html http://msdn.microsoft.com/en-us/library/ms741621(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms738568(VS.85).aspx Regards, Mindaugas hbsocket.zip___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour
[Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
Revision: 13937 http://harbour-project.svn.sourceforge.net/harbour-project/?rev=13937view=rev Author: druzus Date: 2010-02-20 17:07:00 + (Sat, 20 Feb 2010) Log Message: --- 2010-02-20 18:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/task.c ! fixed casting for C++ builds * harbour/src/lang/msges.c ! added hack for Solaris builds where ES is macro TODDO: sync names of lang and corresponding code modules. * harbour/src/vm/dynlibhb.c * pacified warning * harbour/contrib/xpp/xppextrn.ch * harbour/contrib/xpp/dbcmdx.c * harbour/include/hbextern.ch * harbour/src/rdd/dbcmd53.c ! moved ordWildSeek() from XPP to HBRDD library. I have no idea if XPP has such function or if it's or not compatible with ORDWILDSEEK() functions I created for [x]Harbour * disable ordCount() and ordWildSeek() functions when HB_CLP_STRICT macro is set * harbour/include/hbsocket.ch + added macro values interface info flags: HB_SOCKET_IFF_* + added macro values for interface info array indexes: HB_SOCKET_IFINFO_* * harbour/include/hbsocket.h * harbour/src/rtl/hbsocket.c + added new C function: PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases ); it returns array with existing interfaces description. This code was added for non MS-Windows based platforms only. Support for MS-Windows has to be added yet. Some platforms may not fill all fields in the returned array. When some fields are not supported by platform or interface then they can contain NIL value. On some platforms this code can effectively work only with IP4 interfaces and IP6 ones will need different implementation. TODO: add support for alternative long interface introduced in some new systems using 'struct lifreq' with SIOCGLIF* ioctls instead of 'struct ifreq' and SIOCGIF* TODO: add support for extracting hardware addreses (i.e. ethernet macaddresses) for systems which do not support SIOCGIFHWADDR. Please test this code with OS2 using OpenWatcom and GCC (old and new socket API). I enabled HB_HAS_SOCKADDR_SA_LEN in OS2 builds. OpenWatocm OS2 header files have such fields but I do know if it's also present in GCC socket API. * harbour/include/hbextern.ch * harbour/src/rtl/hbinet.c + added new PRG function: hb_inetIfInfo( [lNoAliases] [, nAddrFamily] ) - aInfo lNoAliases is .F. by default so aliases are included nAddrFamily is HB_SOCKET_AF_INET by default aInfo is an array in which each entry is also array with the following fields: HB_SOCKET_IFINFO_FAMILY1 // adress family HB_SOCKET_IFINFO_NAME 2 // interface name HB_SOCKET_IFINFO_FLAGS 3 // flags HB_SOCKET_IFF_* HB_SOCKET_IFINFO_ADDR 4 // interface address HB_SOCKET_IFINFO_NETMASK 5 // subnetmask HB_SOCKET_IFINFO_BROADCAST 6 // broadcast address HB_SOCKET_IFINFO_P2PADDR 7 // point-to-point address HB_SOCKET_IFINFO_HWADDR8 // hardware address Please use this code on different non MS-Windows platforms: proc main( noAlias ) local iface ? os(), version() ? interfaces: for each iface in hb_inetIfInfo( !empty( noAlias ), 0 ) ? hb_valToExp( iface ) next ? return and check if it returns correct information about available interfaces. Modified Paths: -- trunk/harbour/ChangeLog trunk/harbour/contrib/hbxpp/dbcmdx.c trunk/harbour/contrib/hbxpp/hbxppext.ch trunk/harbour/include/hbextern.ch trunk/harbour/include/hbsocket.ch trunk/harbour/include/hbsocket.h trunk/harbour/src/lang/msges.c trunk/harbour/src/rdd/dbcmd53.c trunk/harbour/src/rtl/hbinet.c trunk/harbour/src/rtl/hbsocket.c trunk/harbour/src/vm/dynlibhb.c trunk/harbour/src/vm/task.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour
Re: [Harbour] SF.net SVN: harbour-project:[13937] trunk/harbour
Hi, + added new C function: PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases ); it returns array with existing interfaces description. This code was added for non MS-Windows based platforms only. Support for MS-Windows has to be added yet. Xavi has mentioned a popular GetAdaptersInfo() way to get interface list. Windows also support another method that is more similar to your implementation (but less info could be obtained using with method): http://tangentsoft.net/wskfaq/examples/getifaces.html http://msdn.microsoft.com/en-us/library/ms741621(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms738568(VS.85).aspx Regards, Mindaugas ___ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour