helper function ResolveHostName replaced with InetAddress::resolveHostName; support...
authorVictor Kirhenshtein <victor@netxms.org>
Sat, 6 Aug 2016 19:50:24 +0000 (22:50 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Sat, 6 Aug 2016 19:50:24 +0000 (22:50 +0300)
34 files changed:
include/nms_util.h
src/agent/core/config.cpp
src/agent/core/register.cpp
src/agent/core/session.cpp
src/agent/core/snmptrapproxy.cpp
src/agent/subagents/ecs/.cproject [new file with mode: 0644]
src/agent/subagents/ecs/.project [new file with mode: 0644]
src/agent/subagents/ecs/.settings/language.settings.xml [new file with mode: 0644]
src/agent/subagents/ecs/ecs.cpp
src/agent/subagents/portCheck/custom.cpp
src/agent/subagents/portCheck/http.cpp
src/agent/subagents/portCheck/main.cpp
src/agent/subagents/portCheck/main.h
src/agent/subagents/portCheck/net.cpp
src/agent/subagents/portCheck/net.h
src/agent/subagents/portCheck/pop3.cpp
src/agent/subagents/portCheck/smtp.cpp
src/agent/subagents/portCheck/ssh.cpp
src/agent/subagents/portCheck/telnet.cpp
src/libnetxms/net.cpp
src/libnetxms/serial.cpp
src/libnetxms/tools.cpp
src/server/core/audit.cpp
src/server/core/cas_validator.cpp
src/server/core/client.cpp
src/server/core/email.cpp
src/server/core/epp.cpp
src/server/core/mdconn.cpp
src/server/core/node.cpp
src/server/core/radius.cpp
src/server/core/session.cpp
src/server/core/syslogd.cpp
src/server/core/tools.cpp
src/server/include/nms_core.h

index 30aad2d..754b228 100644 (file)
@@ -1283,7 +1283,7 @@ public:
        virtual ~SocketConnection();
 
        bool connectTCP(const TCHAR *hostName, WORD port, UINT32 timeout);
-       bool connectTCP(UINT32 ip, WORD port, UINT32 timeout);
+       bool connectTCP(const InetAddress& ip, WORD port, UINT32 timeout);
        void disconnect();
 
        bool canRead(UINT32 timeout);
@@ -1303,13 +1303,13 @@ class LIBNETXMS_EXPORTABLE TelnetConnection : public SocketConnection
 {
 protected:
        bool connectTCP(const TCHAR *hostName, WORD port, UINT32 timeout);
-       bool connectTCP(UINT32 ip, WORD port, UINT32 timeout);
+       bool connectTCP(const InetAddress& ip, WORD port, UINT32 timeout);
 
 public:
        static TelnetConnection *createConnection(const TCHAR *hostName, WORD port, UINT32 timeout);
 
    bool connect(const TCHAR *hostName, WORD port, UINT32 timeout);
-       bool connect(UINT32 ip, WORD port, UINT32 timeout);
+       bool connect(const InetAddress& ip, WORD port, UINT32 timeout);
        virtual int read(char *pBuff, int nSize, UINT32 timeout = INFINITE);
        int readLine(char *buffer, int size, UINT32 timeout = INFINITE);
 };
@@ -1528,14 +1528,6 @@ char LIBNETXMS_EXPORTABLE *Ip6ToStrA(const BYTE *addr, char *buffer);
 #endif
 TCHAR LIBNETXMS_EXPORTABLE *SockaddrToStr(struct sockaddr *addr, TCHAR *buffer);
 
-UINT32 LIBNETXMS_EXPORTABLE ResolveHostNameA(const char *name);
-UINT32 LIBNETXMS_EXPORTABLE ResolveHostNameW(const WCHAR *name);
-#ifdef UNICODE
-#define ResolveHostName ResolveHostNameW
-#else
-#define ResolveHostName ResolveHostNameA
-#endif
-
 void LIBNETXMS_EXPORTABLE *nx_memdup(const void *data, size_t size);
 void LIBNETXMS_EXPORTABLE nx_memswap(void *block1, void *block2, size_t size);
 
index f03a251..c1ed745 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS multiplatform core agent
-** Copyright (C) 2003-2013 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -54,9 +54,6 @@ static BOOL SaveConfig(TCHAR *pszConfig)
  */
 BOOL DownloadConfig(TCHAR *pszServer)
 {
-   UINT32 dwAddr;
-   SOCKET hSocket;
-   struct sockaddr_in sa;
    BOOL bRet = FALSE;
    TCHAR szBuffer[MAX_RESULT_LENGTH], *pszConfig;
    NXCPMessage msg, *pResponse;
@@ -75,22 +72,19 @@ BOOL DownloadConfig(TCHAR *pszServer)
    }
 #endif
 
-   dwAddr = ResolveHostName(pszServer);
-   if (dwAddr == INADDR_NONE)
+   InetAddress addr = InetAddress::resolveHostName(pszServer);
+   if (!addr.isValidUnicast())
    {
       _tprintf(_T("ERROR: Unable to resolve name of management server\n"));
       return FALSE;
    }
 
-   hSocket = socket(AF_INET, SOCK_STREAM, 0);
+   SOCKET hSocket = socket(addr.getFamily(), SOCK_STREAM, 0);
    if (hSocket != INVALID_SOCKET)
    {
-      // Fill in address structure
-      memset(&sa, 0, sizeof(sa));
-      sa.sin_addr.s_addr = dwAddr;
-      sa.sin_family = AF_INET;
-      sa.sin_port = htons(4701);
-      if (connect(hSocket, (struct sockaddr *)&sa, sizeof(sa)) != -1)
+      SockAddrBuffer sa;
+      addr.fillSockAddr(&sa, 4701);
+      if (connect(hSocket, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa)) != -1)
       {
          // Prepare request
          msg.setCode(CMD_GET_MY_CONFIG);
index a8a634f..ab13b56 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS multiplatform core agent
-** Copyright (C) 2003-2014 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -37,9 +37,7 @@ LONG H_PlatformName(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, AbstractCo
  */
 BOOL RegisterOnServer(const TCHAR *pszServer)
 {
-   DWORD dwAddr;
    SOCKET hSocket;
-   struct sockaddr_in sa;
    BOOL bRet = FALSE;
    TCHAR szBuffer[MAX_RESULT_LENGTH];
    NXCPMessage msg, *pResponse;
@@ -48,22 +46,19 @@ BOOL RegisterOnServer(const TCHAR *pszServer)
    NXCPEncryptionContext *pDummyCtx = NULL;
    int nLen;
 
-   dwAddr = ResolveHostName(pszServer);
-   if (dwAddr == INADDR_NONE)
+   InetAddress addr = InetAddress::resolveHostName(pszServer);
+   if (!addr.isValidUnicast())
    {
                nxlog_write(MSG_REGISTRATION_FAILED, EVENTLOG_WARNING_TYPE, "s", _T("Unable to resolve name of management server"));
       return FALSE;
    }
 
-   hSocket = socket(AF_INET, SOCK_STREAM, 0);
+   hSocket = socket(addr.getFamily(), SOCK_STREAM, 0);
    if (hSocket != INVALID_SOCKET)
    {
-      // Fill in address structure
-      memset(&sa, 0, sizeof(sa));
-      sa.sin_addr.s_addr = dwAddr;
-      sa.sin_family = AF_INET;
-      sa.sin_port = htons(4701);
-      if (connect(hSocket, (struct sockaddr *)&sa, sizeof(sa)) != -1)
+      SockAddrBuffer sa;
+      addr.fillSockAddr(&sa, 4701);
+      if (connect(hSocket, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa)) != -1)
       {
          // Prepare request
          msg.setCode(CMD_REGISTER_AGENT);
index 3b90416..6434edb 100644 (file)
@@ -34,7 +34,6 @@ void UnregisterSession(UINT32 dwIndex);
 UINT32 DeployPolicy(CommSession *session, NXCPMessage *request);
 UINT32 UninstallPolicy(CommSession *session, NXCPMessage *request);
 UINT32 GetPolicyInventory(CommSession *session, NXCPMessage *msg);
-void UpdatePolicyInventory();
 void ClearDataCollectionConfiguration();
 
 /**
@@ -109,6 +108,7 @@ CommSession::CommSession(SOCKET hSocket, const InetAddress &serverAddr, bool mas
    m_controlServer = controlServer;
    m_proxyConnection = false;
    m_acceptTraps = false;
+   m_acceptData = false;
    m_acceptFileUpdates = false;
    m_ipv6Aware = false;
    m_bulkReconciliationSupported = false;
index 2c1598e..deb7aa7 100644 (file)
@@ -68,32 +68,28 @@ THREAD_RESULT THREAD_CALL SNMPTrapReceiver(void *pArg)
    SetSocketReuseFlag(hSocket);
 
    // Fill in local address structure
-   struct sockaddr_in addr;
-   memset(&addr, 0, sizeof(struct sockaddr_in));
-   addr.sin_family = AF_INET;
-
-   //rework
-   addr.sin_addr.s_addr = ResolveHostName(g_szSNMPTrapListenAddress);
+   struct sockaddr_in sa;
+   memset(&sa, 0, sizeof(sa));
    if (!_tcscmp(g_szSNMPTrapListenAddress, _T("*")))
-       {
-               addr.sin_addr.s_addr = htonl(INADDR_ANY);
-       }
-       else
+   {
+      sa.sin_addr.s_addr = htonl(INADDR_ANY);
+   }
+   else
        {
       InetAddress bindAddress = InetAddress::resolveHostName(g_szSNMPTrapListenAddress, AF_INET);
       if (bindAddress.isValid() && (bindAddress.getFamily() == AF_INET))
       {
-                  addr.sin_addr.s_addr = htonl(bindAddress.getAddressV4());
+                  sa.sin_addr.s_addr = htonl(bindAddress.getAddressV4());
       }
       else
       {
-               addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+               sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
       }
        }
-   addr.sin_port = htons(g_dwSNMPTrapPort);
+   sa.sin_port = htons(g_dwSNMPTrapPort);
 
    // Bind socket
-   if (bind(hSocket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) != 0)
+   if (bind(hSocket, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) != 0)
    {
       DebugPrintf(INVALID_INDEX, 1, _T("SNMPTrapReceiver: cannot bind socket (%s)"), _tcserror(errno));
       closesocket(hSocket);
@@ -102,7 +98,7 @@ THREAD_RESULT THREAD_CALL SNMPTrapReceiver(void *pArg)
 
    TCHAR ipAddrStr[64];
    DebugPrintf(INVALID_INDEX, 3, _T("SNMPTrapReceiver: listening on %s:%d"),
-      IpToStr(ntohl(addr.sin_addr.s_addr), ipAddrStr), (int)ntohs(addr.sin_port));
+      IpToStr(ntohl(sa.sin_addr.s_addr), ipAddrStr), (int)ntohs(sa.sin_port));
 
    SNMP_TrapProxyTransport *pTransport = new SNMP_TrapProxyTransport(hSocket);
    pTransport->enableEngineIdAutoupdate(true);
@@ -113,11 +109,11 @@ THREAD_RESULT THREAD_CALL SNMPTrapReceiver(void *pArg)
    {
       BYTE *rawMessage = NULL;
       socklen_t nAddrLen = sizeof(struct sockaddr_in);
-      int iBytes = pTransport->readRawMessage(&rawMessage, 2000, (struct sockaddr *)&addr, &nAddrLen);
+      int iBytes = pTransport->readRawMessage(&rawMessage, 2000, (struct sockaddr *)&sa, &nAddrLen);
       if ((iBytes > 0) && (rawMessage != NULL))
       {
          UdpMessage *message = new UdpMessage();
-         message->ipAddr = ntohl(addr.sin_addr.s_addr);
+         message->ipAddr = ntohl(sa.sin_addr.s_addr);
          message->port = (short)g_dwSNMPTrapPort;
          message->lenght = iBytes;
          message->rawMessage = rawMessage;
diff --git a/src/agent/subagents/ecs/.cproject b/src/agent/subagents/ecs/.cproject
new file mode 100644 (file)
index 0000000..aaba7b2
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.600240095">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.600240095" moduleId="org.eclipse.cdt.core.settings" name="Default">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.600240095" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+                                       <folderInfo id="cdt.managedbuild.toolchain.gnu.base.600240095.535856997" name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.base.446148656" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+                                                       <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.base.502219527" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+                                                       <builder id="cdt.managedbuild.target.gnu.builder.base.921584145" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.1683587124" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.599705558" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
+                                                               <option id="gnu.cpp.compiler.option.include.paths.149512307" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.preprocessor.def.2010971140" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="_THREAD_SAFE"/>
+                                                                       <listOptionValue builtIn="false" value="TRE_WCHAR=1"/>
+                                                                       <listOptionValue builtIn="false" value="UNICODE"/>
+                                                                       <listOptionValue builtIn="false" value="_GNU_SOURCE"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.115476414" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1453501431" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
+                                                               <option id="gnu.c.compiler.option.include.paths.1480050266" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.preprocessor.def.symbols.1311145811" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="_THREAD_SAFE"/>
+                                                                       <listOptionValue builtIn="false" value="TRE_WCHAR=1"/>
+                                                                       <listOptionValue builtIn="false" value="UNICODE"/>
+                                                                       <listOptionValue builtIn="false" value="_GNU_SOURCE"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2145084621" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.base.1029353084" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1488398388" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.942945327" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.base.1401679704" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
+                                                               <option id="gnu.both.asm.option.include.paths.419250693" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1288941665" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="ecs.null.597736491" name="ecs"/>
+       </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.600240095;cdt.managedbuild.toolchain.gnu.base.600240095.535856997;cdt.managedbuild.tool.gnu.c.compiler.base.1453501431;cdt.managedbuild.tool.gnu.c.compiler.input.2145084621">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.600240095;cdt.managedbuild.toolchain.gnu.base.600240095.535856997;cdt.managedbuild.tool.gnu.cpp.compiler.base.599705558;cdt.managedbuild.tool.gnu.cpp.compiler.input.115476414">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+</cproject>
diff --git a/src/agent/subagents/ecs/.project b/src/agent/subagents/ecs/.project
new file mode 100644 (file)
index 0000000..5243ce7
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>ecs</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+       </natures>
+       <filteredResources>
+               <filter>
+                       <id>1470508543373</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.o</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1470508543379</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.lo</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1470508543383</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.la</arguments>
+                       </matcher>
+               </filter>
+       </filteredResources>
+</projectDescription>
diff --git a/src/agent/subagents/ecs/.settings/language.settings.xml b/src/agent/subagents/ecs/.settings/language.settings.xml
new file mode 100644 (file)
index 0000000..ee6522a
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project>
+       <configuration id="cdt.managedbuild.toolchain.gnu.base.600240095" name="Default">
+               <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
+                       <provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
+                       <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
+                       <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
+                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1092372519076156371" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+                               <language-scope id="org.eclipse.cdt.core.gcc"/>
+                               <language-scope id="org.eclipse.cdt.core.g++"/>
+                       </provider>
+                       <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
+               </extension>
+       </configuration>
+</project>
index b2c7386..1c03d4c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  ** Enhanced CheckSumm subagent
- ** Copyright (C) 2006 Alex Kirhenshtein
+ ** Copyright (C) 2006-2016 Raden Solutions
  **
  ** This program is free software; you can redistribute it and/or modify
  ** it under the terms of the GNU General Public License as published by
@@ -62,19 +62,15 @@ static unsigned char *GetHttpUrl(char *url, int *size)
 
        *size = 0;
 
-       DWORD hostAddr = ResolveHostNameA(host);
-       if (hostAddr != INADDR_NONE)
+       InetAddress hostAddr = InetAddress::resolveHostName(host);
+       if (hostAddr.isValidUnicast())
        {
-               SOCKET sd = socket(AF_INET, SOCK_STREAM, 0);
+               SOCKET sd = socket(hostAddr.getFamily(), SOCK_STREAM, 0);
                if (sd != INVALID_SOCKET)
                {
-                       struct sockaddr_in sa;
-
-                       sa.sin_family = AF_INET;
-                       sa.sin_port = htons(port);
-                       sa.sin_addr.s_addr = hostAddr;
-
-                       if (connect(sd, (struct sockaddr*)&sa, sizeof(sa)) == 0)
+                       SockAddrBuffer sa;
+                       hostAddr.fillSockAddr(&sa, port);
+                       if (ConnectEx(sd, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa), 5000) == 0)
                        {
                                char req[1024];
 
index d45e9dd..b2ba312 100644 (file)
@@ -35,7 +35,7 @@ LONG H_CheckCustom(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractC
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-   int result = CheckCustom(szHost, 0, nPort, dwTimeout);
+   int result = CheckCustom(szHost, InetAddress::INVALID, nPort, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -55,12 +55,12 @@ LONG H_CheckCustom(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractC
 /**
  * Check custom service
  */
-int CheckCustom(char *szAddr, UINT32 dwAddr, short nPort, UINT32 dwTimeout)
+int CheckCustom(char *szAddr, const InetAddress& addr, short nPort, UINT32 dwTimeout)
 {
        int nRet;
        SOCKET nSd;
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                nRet = PC_ERR_NONE;
index 4169657..bb19265 100644 (file)
  * Save HTTP(s) responce to file for later investigation
  * (Should be enabled by setting "FailedDirectory" in config
  */
-static void SaveResponse(char *host, UINT32 ip, char *buffer)
+static void SaveResponse(char *host, const InetAddress& ip, char *buffer)
 {
    if (g_szFailedDir[0] == 0)
       return;
 
    time_t now = time(NULL);
    char fileName[2048];
-   char tmp[32];
+   char tmp[64];
    snprintf(fileName, 2048, "%s%s%s-%d",
          g_szFailedDir, FS_PATH_SEPARATOR_A,
-         host != NULL ? host : IpToStrA(ip, tmp),
+         host != NULL ? host : ip.toStringA(tmp),
          (int)now);
    FILE *f = fopen(fileName, "wb");
    if (f != NULL)
@@ -68,7 +68,9 @@ LONG H_CheckHTTP(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-   int result = (arg[1] == 'S') ? CheckHTTPS(szHost, 0, nPort, szURI, szHeader, szMatch, dwTimeout) : CheckHTTP(szHost, 0, nPort, szURI, szHeader, szMatch, dwTimeout);
+   int result = (arg[1] == 'S') ?
+            CheckHTTPS(szHost, InetAddress::INVALID, nPort, szURI, szHeader, szMatch, dwTimeout) :
+            CheckHTTP(szHost, InetAddress::INVALID, nPort, szURI, szHeader, szMatch, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -88,7 +90,7 @@ LONG H_CheckHTTP(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 /**
  * Check HTTP service
  */
-int CheckHTTP(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHost, char *szMatch, UINT32 dwTimeout)
+int CheckHTTP(char *szAddr, const InetAddress& addr, short nPort, char *szURI, char *szHost, char *szMatch, UINT32 dwTimeout)
 {
        int nBytes, nRet = 0;
        SOCKET nSd;
@@ -104,7 +106,7 @@ int CheckHTTP(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHos
                return PC_ERR_BAD_PARAMS;
        }
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                char szTmp[4096];
@@ -164,7 +166,7 @@ int CheckHTTP(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHos
                                }
             else
             {
-               SaveResponse(szAddr, dwAddr, buff);
+               SaveResponse(szAddr, addr, buff);
             }
                        }
 
@@ -184,7 +186,7 @@ int CheckHTTP(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHos
 /**
  * Check HTTPS service
  */
-int CheckHTTPS(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHost, char *szMatch, UINT32 dwTimeout)
+int CheckHTTPS(char *szAddr, const InetAddress& addr, short nPort, char *szURI, char *szHost, char *szMatch, UINT32 dwTimeout)
 {
 #ifdef _WITH_ENCRYPTION
    if (szMatch[0] == 0)
@@ -224,8 +226,8 @@ int CheckHTTPS(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHo
                }
                else
                {
-                  UINT32 addr = htonl(dwAddr);
-                  BIO_set_conn_ip(out, &addr);
+                  UINT32 addrV4 = htonl(addr.getAddressV4());
+                  BIO_set_conn_ip(out, &addrV4);
                }
                int intPort = nPort;
                BIO_set_conn_int_port(out, &intPort);
@@ -303,7 +305,7 @@ int CheckHTTPS(char *szAddr, UINT32 dwAddr, short nPort, char *szURI, char *szHo
                         }
                         else
                         {
-                           SaveResponse(szAddr, dwAddr, buffer);
+                           SaveResponse(szAddr, addr, buffer);
                            AgentWriteDebugLog(7, _T("PortCheck: content do not match"));
                         }
                      }
index a8879a0..26005f0 100644 (file)
@@ -28,7 +28,6 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
 {
        BOOL bHandled = TRUE;
        WORD wType, wPort;
-       UINT32 dwAddress;
        char szRequest[1024 * 10];
        char szResponse[1024 * 10];
        UINT32 nRet;
@@ -40,7 +39,7 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
 
        wType = pRequest->getFieldAsUInt16(VID_SERVICE_TYPE);
        wPort = pRequest->getFieldAsUInt16(VID_IP_PORT);
-       dwAddress = pRequest->getFieldAsUInt32(VID_IP_ADDRESS);
+       InetAddress addr = pRequest->getFieldAsInetAddress(VID_IP_ADDRESS);
        pRequest->getFieldAsMBString(VID_SERVICE_REQUEST, szRequest, sizeof(szRequest));
        pRequest->getFieldAsMBString(VID_SERVICE_RESPONSE, szResponse, sizeof(szResponse));
 
@@ -50,18 +49,18 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
        {
                case NETSRV_CUSTOM:
                        // unsupported for now
-                       nRet = CheckCustom(NULL, dwAddress, wPort, 0);
+                       nRet = CheckCustom(NULL, addr, wPort, 0);
                        pResponse->setField(VID_RCC, ERR_SUCCESS);
                        pResponse->setField(VID_SERVICE_STATUS, (UINT32)nRet);
                        break;
                case NETSRV_SSH:
-                       nRet = CheckSSH(NULL, dwAddress, wPort, NULL, NULL, 0);
+                       nRet = CheckSSH(NULL, addr, wPort, NULL, NULL, 0);
 
                        pResponse->setField(VID_RCC, ERR_SUCCESS);
                        pResponse->setField(VID_SERVICE_STATUS, (UINT32)nRet);
                        break;
                case NETSRV_TELNET:
-                       nRet = CheckTelnet(NULL, dwAddress, wPort, NULL, NULL, 0);
+                       nRet = CheckTelnet(NULL, addr, wPort, NULL, NULL, 0);
 
                        pResponse->setField(VID_RCC, ERR_SUCCESS);
                        pResponse->setField(VID_SERVICE_STATUS, (UINT32)nRet);
@@ -78,7 +77,7 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
                                        *pPass = 0;
                                        pPass++;
 
-                                       nRet = CheckPOP3(NULL, dwAddress, wPort, pUser, pPass, 0);
+                                       nRet = CheckPOP3(NULL, addr, wPort, pUser, pPass, 0);
 
                                }
 
@@ -91,7 +90,7 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
 
                        if (szRequest[0] != 0)
                        {
-                               nRet = CheckSMTP(NULL, dwAddress, wPort, szRequest, 0);
+                               nRet = CheckSMTP(NULL, addr, wPort, szRequest, 0);
                                pResponse->setField(VID_RCC, ERR_SUCCESS);
                                pResponse->setField(VID_SERVICE_STATUS, (UINT32)nRet);
                        }
@@ -119,11 +118,11 @@ BOOL CommandHandler(UINT32 dwCommand, NXCPMessage *pRequest, NXCPMessage *pRespo
 
                if (wType == NETSRV_HTTP)
                {
-                  nRet = CheckHTTP(NULL, dwAddress, wPort, pURI, pHost, szResponse, 0);
+                  nRet = CheckHTTP(NULL, addr, wPort, pURI, pHost, szResponse, 0);
                }
                else
                {
-                  nRet = CheckHTTPS(NULL, dwAddress, wPort, pURI, pHost, szResponse, 0);
+                  nRet = CheckHTTPS(NULL, addr, wPort, pURI, pHost, szResponse, 0);
                }
                                }
 
index fe2f275..15260ea 100644 (file)
@@ -23,18 +23,18 @@ enum
 #define SCF_NEGATIVE_TIME_ON_ERROR  0x0001
 
 LONG H_CheckPOP3(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckPOP3(char *, UINT32, short, char *, char *, UINT32);
+int CheckPOP3(char *, const InetAddress&, short, char *, char *, UINT32);
 LONG H_CheckSSH(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckSSH(char *, UINT32, short, char *, char *, UINT32);
+int CheckSSH(char *, const InetAddress&, short, char *, char *, UINT32);
 LONG H_CheckSMTP(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckSMTP(char *, UINT32, short, char *, UINT32);
+int CheckSMTP(char *, const InetAddress&, short, char *, UINT32);
 LONG H_CheckHTTP(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckHTTP(char *, UINT32, short, char *, char *, char *, UINT32);
-int CheckHTTPS(char *, UINT32, short, char *, char *, char *, UINT32);
+int CheckHTTP(char *, const InetAddress&, short, char *, char *, char *, UINT32);
+int CheckHTTPS(char *, const InetAddress&, short, char *, char *, char *, UINT32);
 LONG H_CheckCustom(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckCustom(char *, UINT32, short, UINT32);
+int CheckCustom(char *, const InetAddress&, short, UINT32);
 LONG H_CheckTelnet(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
-int CheckTelnet(char *, UINT32, short, char *, char *, UINT32);
+int CheckTelnet(char *, const InetAddress&, short, char *, char *, UINT32);
 
 extern char g_szDomainName[];
 extern char g_szFailedDir[];
index 351b6d3..0486bb9 100644 (file)
 
 #include "net.h"
 
-SOCKET NetConnectTCP(const char *szHost, UINT32 dwAddr, unsigned short nPort, UINT32 dwTimeout)
+SOCKET NetConnectTCP(const char *szHost, const InetAddress& addr, unsigned short nPort, UINT32 dwTimeout)
 {
-       SOCKET nSocket;
+   InetAddress hostAddr = (szHost != NULL) ? InetAddress::resolveHostName(szHost) : addr;
+   if (!hostAddr.isValidUnicast())
+      return INVALID_SOCKET;
 
-       nSocket = socket(AF_INET, SOCK_STREAM, 0);
+       SOCKET nSocket = socket(hostAddr.getFamily(), SOCK_STREAM, 0);
        if (nSocket != INVALID_SOCKET)
        {
-               struct sockaddr_in sa;
-               sa.sin_family = AF_INET;
-               sa.sin_port = htons(nPort);
-               if (szHost != NULL)
-               {
-         sa.sin_addr.s_addr = ResolveHostNameA(szHost);
-               }
-               else
-               {
-                       sa.sin_addr.s_addr = htonl(dwAddr);
-               }
-
-               if (ConnectEx(nSocket, (struct sockaddr*)&sa, sizeof(sa), (dwTimeout != 0) ? dwTimeout : m_dwDefaultTimeout) < 0)
+               SockAddrBuffer sa;
+               hostAddr.fillSockAddr(&sa, nPort);
+               if (ConnectEx(nSocket, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa), (dwTimeout != 0) ? dwTimeout : m_dwDefaultTimeout) < 0)
                {
                        closesocket(nSocket);
                        nSocket = INVALID_SOCKET;
index b1d1ae2..1199425 100644 (file)
@@ -32,7 +32,7 @@ enum
        PROTOCOL_TCP
 };
 
-SOCKET NetConnectTCP(const char *, UINT32, unsigned short, UINT32);
+SOCKET NetConnectTCP(const char *, const InetAddress&, unsigned short, UINT32);
 bool NetCanRead(SOCKET, int);
 bool NetCanWrite(SOCKET, int);
 int NetRead(SOCKET, char *, int);
index b8707ae..a148b53 100644 (file)
@@ -29,7 +29,7 @@ LONG H_CheckPOP3(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-       int result = CheckPOP3(szHost, 0, 110, szUser, szPassword, dwTimeout);
+       int result = CheckPOP3(szHost, InetAddress::INVALID, 110, szUser, szPassword, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -49,12 +49,12 @@ LONG H_CheckPOP3(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 /**
  * Check POP3 service
  */
-int CheckPOP3(char *szAddr, UINT32 dwAddr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
+int CheckPOP3(char *szAddr, const InetAddress& addr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
 {
        int nRet = 0;
        SOCKET nSd;
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                char szBuff[512];
index 3e17f26..d622df5 100644 (file)
@@ -25,7 +25,7 @@ LONG H_CheckSMTP(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-       int result = CheckSMTP(szHost, 0, 25, szTo, dwTimeout);
+       int result = CheckSMTP(szHost, InetAddress::INVALID, 25, szTo, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -45,13 +45,13 @@ LONG H_CheckSMTP(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCom
 /**
  * Check SMTP service
  */
-int CheckSMTP(char *szAddr, UINT32 dwAddr, short nPort, char *szTo, UINT32 dwTimeout)
+int CheckSMTP(char *szAddr, const InetAddress& addr, short nPort, char *szTo, UINT32 dwTimeout)
 {
        int nRet = 0;
        SOCKET nSd;
        int nErr = 0; 
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                char szBuff[2048];
index e993983..f609e08 100644 (file)
@@ -35,7 +35,7 @@ LONG H_CheckSSH(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractComm
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-       int result = CheckSSH(szHost, 0, nPort, NULL, NULL, dwTimeout);
+       int result = CheckSSH(szHost, InetAddress::INVALID, nPort, NULL, NULL, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -55,12 +55,12 @@ LONG H_CheckSSH(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractComm
 /**
  * Check SSH service
  */
-int CheckSSH(char *szAddr, UINT32 dwAddr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
+int CheckSSH(char *szAddr, const InetAddress& addr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
 {
        int nRet = 0;
        SOCKET nSd;
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                char szBuff[512];
index 77edc4d..cf67ddc 100644 (file)
@@ -33,7 +33,7 @@ LONG H_CheckTelnet(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractC
 
        UINT32 dwTimeout = _tcstoul(szTimeout, NULL, 0);
    INT64 start = GetCurrentTimeMs();
-       int result = CheckTelnet(szHost, 0, nPort, NULL, NULL, dwTimeout);
+       int result = CheckTelnet(szHost, InetAddress::INVALID, nPort, NULL, NULL, dwTimeout);
    if (*arg == 'R')
    {
       if (result == PC_ERR_NONE)
@@ -53,12 +53,12 @@ LONG H_CheckTelnet(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractC
 /**
  * Check telnet service
  */
-int CheckTelnet(char *szAddr, UINT32 dwAddr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
+int CheckTelnet(char *szAddr, const InetAddress& addr, short nPort, char *szUser, char *szPass, UINT32 dwTimeout)
 {
        int nRet = 0;
        SOCKET nSd;
 
-       nSd = NetConnectTCP(szAddr, dwAddr, nPort, dwTimeout);
+       nSd = NetConnectTCP(szAddr, addr, nPort, dwTimeout);
        if (nSd != INVALID_SOCKET)
        {
                unsigned char szBuff[512];
index 1b9526f..cd26b14 100644 (file)
@@ -77,7 +77,10 @@ SocketConnection::~SocketConnection()
  */
 bool SocketConnection::connectTCP(const TCHAR *hostName, WORD port, UINT32 timeout)
 {
-   return connectTCP(ntohl(ResolveHostName(hostName)), port, timeout);
+   InetAddress addr = InetAddress::resolveHostName(hostName);
+   if (!addr.isValidUnicast())
+      return false;
+   return connectTCP(addr, port, timeout);
 }
 
 /**
@@ -88,17 +91,14 @@ bool SocketConnection::connectTCP(const TCHAR *hostName, WORD port, UINT32 timeo
  * @param timeout connection timeout in milliseconds
  * @return true if connection attempt was successful
  */
-bool SocketConnection::connectTCP(UINT32 ip, WORD port, UINT32 timeout)
+bool SocketConnection::connectTCP(const InetAddress& ip, WORD port, UINT32 timeout)
 {
-       m_socket = socket(AF_INET, SOCK_STREAM, 0);
+       m_socket = socket(ip.getFamily(), SOCK_STREAM, 0);
        if (m_socket != INVALID_SOCKET)
        {
-               struct sockaddr_in sa;
-               sa.sin_family = AF_INET;
-               sa.sin_port = htons(port);
-               sa.sin_addr.s_addr = htonl(ip);
-
-               if (ConnectEx(m_socket, (struct sockaddr*)&sa, sizeof(sa), (timeout != 0) ? timeout : 30000) < 0)
+               SockAddrBuffer sa;
+               ip.fillSockAddr(&sa, port);
+               if (ConnectEx(m_socket, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa), (timeout != 0) ? timeout : 30000) < 0)
                {
                        closesocket(m_socket);
                        m_socket = INVALID_SOCKET;
@@ -227,7 +227,10 @@ bool SocketConnection::waitForText(const char *text, int timeout)
  */
 bool TelnetConnection::connect(const TCHAR *hostName, WORD port, UINT32 timeout)
 {
-   return connect(ntohl(ResolveHostName(hostName)), port, timeout);
+   InetAddress addr = InetAddress::resolveHostName(hostName);
+   if (!addr.isValidUnicast())
+      return false;
+   return connect(addr, port, timeout);
 }
 
 /**
@@ -238,7 +241,7 @@ bool TelnetConnection::connect(const TCHAR *hostName, WORD port, UINT32 timeout)
  * @param timeout connection timeout in milliseconds
  * @return true if connection attempt was successful
  */
-bool TelnetConnection::connect(UINT32 ip, WORD port, UINT32 timeout)
+bool TelnetConnection::connect(const InetAddress& ip, WORD port, UINT32 timeout)
 {
    bool ret = SocketConnection::connectTCP(ip, port, timeout);
 
index 739e98d..f35e466 100644 (file)
@@ -53,6 +53,11 @@ Serial::Serial()
        m_nTimeout = 5000;
        m_hPort = INVALID_HANDLE_VALUE;
        m_pszPort = NULL;
+       m_nSpeed = 9600;
+       m_nDataBits = 8;
+       m_nParity = NOPARITY;
+       m_nStopBits = ONESTOPBIT;
+       m_nFlowControl = FLOW_NONE;
 #ifndef _WIN32
        memset(&m_originalSettings, 0, sizeof(m_originalSettings));
 #endif
index 4a027a9..7fa466b 100644 (file)
@@ -1337,51 +1337,6 @@ SOCKET LIBNETXMS_EXPORTABLE ConnectToHost(const InetAddress& addr, UINT16 port,
    return s;
 }
 
-/**
- * Resolve host name to IP address (UNICODE version)
- *
- * @param name host name or IP address
- * @return IP address in network byte order
- */
-UINT32 LIBNETXMS_EXPORTABLE ResolveHostNameW(const WCHAR *name)
-{
-   char mbName[256];
-   WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, name, -1, mbName, 256, NULL, NULL);
-   return ResolveHostNameA(mbName);
-}
-
-/**
- * Resolve host name to IP address (multibyte version)
- *
- * @param name host name or IP address
- * @return IP address in network byte order
- */
-UINT32 LIBNETXMS_EXPORTABLE ResolveHostNameA(const char *name)
-{
-   UINT32 addr = inet_addr(name);
-   if ((addr == INADDR_NONE) || (addr == INADDR_ANY))
-   {
-#if HAVE_GETHOSTBYNAME2_R
-      struct hostent h, *hs = NULL;
-      char buffer[1024];
-      int err;
-      gethostbyname2_r(name, AF_INET, &h, buffer, 1024, &hs, &err);
-#else
-      struct hostent *hs = gethostbyname(name);
-#endif
-      if (hs != NULL)
-      {
-         memcpy(&addr, hs->h_addr, sizeof(UINT32));
-      }
-      else
-      {
-         addr = INADDR_NONE;
-      }
-   }
-
-   return addr;
-}
-
 #ifndef VER_PLATFORM_WIN32_WINDOWS
 #define VER_PLATFORM_WIN32_WINDOWS 1
 #endif
index 98a5d69..4e21e4b 100644 (file)
@@ -26,7 +26,7 @@
  * Static data
  */
 static VolatileCounter m_recordId = 1;
-static UINT32 m_auditServerAddr = 0;
+static InetAddress m_auditServerAddr;
 static WORD m_auditServerPort;
 static int m_auditFacility;
 static int m_auditSeverity;
@@ -41,14 +41,13 @@ static void SendSyslogRecord(const TCHAR *text)
    static char month[12][5] = { "Jan ", "Feb ", "Mar ", "Apr ",
                                 "May ", "Jun ", "Jul ", "Aug ",
                                 "Sep ", "Oct ", "Nov ", "Dec " };
-       char message[1025];
-
-       if (m_auditServerAddr == 0)
+       if (!m_auditServerAddr.isValidUnicast())
                return;
 
        time_t ts = time(NULL);
        struct tm *now = localtime(&ts);
 
+   char message[1025];
 #ifdef UNICODE
        char *mbText = MBStringFromWideString(text);
        snprintf(message, 1025, "<%d>%s %2d %02d:%02d:%02d %s %s %s", (m_auditFacility << 3) + m_auditSeverity, month[now->tm_mon],
@@ -60,16 +59,11 @@ static void SendSyslogRecord(const TCHAR *text)
 #endif
        message[1024] = 0;
 
-   SOCKET hSocket = socket(AF_INET, SOCK_DGRAM, 0);
+   SOCKET hSocket = socket(m_auditServerAddr.getFamily(), SOCK_DGRAM, 0);
    if (hSocket != INVALID_SOCKET)
        {
-               struct sockaddr_in addr;
-
-               memset(&addr, 0, sizeof(struct sockaddr_in));
-               addr.sin_family = AF_INET;
-               addr.sin_addr.s_addr = m_auditServerAddr;
-               addr.sin_port = m_auditServerPort;
-
+               SockAddrBuffer addr;
+               m_auditServerAddr.fillSockAddr(&addr, m_auditServerPort);
                sendto(hSocket, message, (int)strlen(message), 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
                shutdown(hSocket, SHUT_RDWR);
                closesocket(hSocket);
@@ -97,8 +91,8 @@ void InitAuditLog()
        ConfigReadStr(_T("ExternalAuditServer"), temp, 256, _T("none"));
        if (_tcscmp(temp, _T("none")))
        {
-               m_auditServerAddr = ResolveHostName(temp);
-               m_auditServerPort = htons((WORD)ConfigReadInt(_T("ExternalAuditPort"), 514));
+               m_auditServerAddr = InetAddress::resolveHostName(temp);
+               m_auditServerPort = (WORD)ConfigReadInt(_T("ExternalAuditPort"), 514);
                m_auditFacility = ConfigReadInt(_T("ExternalAuditFacility"), 13);  // default is log audit facility
                m_auditSeverity = ConfigReadInt(_T("ExternalAuditSeverity"), SYSLOG_SEVERITY_NOTICE);
                ConfigReadStrA(_T("ExternalAuditTag"), m_auditTag, MAX_SYSLOG_TAG_LEN, "netxmsd-audit");
@@ -176,7 +170,7 @@ void NXCORE_EXPORTABLE WriteAuditLog2(const TCHAR *subsys, bool isSuccess, UINT3
        msg.setField(VID_MESSAGE, (const TCHAR *)text);
        EnumerateClientSessions(SendNewRecord, &msg);
 
-       if (m_auditServerAddr != 0)
+       if (m_auditServerAddr.isValidUnicast())
        {
                String extText;
                TCHAR buffer[256];
index ece1a95..56f91ba 100644 (file)
@@ -149,9 +149,10 @@ static int valid_cert(X509 *cert, const char *hostname)
  */
 static int cas_validate(const char *ticket, const char *service, char *outbuf, int outbuflen, char *proxies[])
 {
+   InetAddress a;
+   SockAddrBuffer sa;
    SOCKET s = INVALID_SOCKET;
    int err, b, ret, total;
-   struct sockaddr_in sa;
    SSL *ssl = NULL;
    X509 *s_cert = NULL;
    char buf[4096];
@@ -169,11 +170,13 @@ static int cas_validate(const char *ticket, const char *service, char *outbuf, i
       SET_RET_AND_GOTO_END(CAS_ERROR_CONN);
    }
 
-   memset(&sa, 0, sizeof(sa));
-   sa.sin_family = AF_INET;
-   sa.sin_addr.s_addr = ResolveHostNameA(m_host);
-   sa.sin_port = htons(m_port);
-   if (connect(s, (struct sockaddr*) &sa, sizeof(sa)) == -1)
+   a = InetAddress::resolveHostName(m_host);
+   if (!a.isValidUnicast())
+   {
+      SET_RET_AND_GOTO_END(CAS_ERROR_CONN);
+   }
+   a.fillSockAddr(&sa, m_port);
+   if (connect(s, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa)) == -1)
    {
       SET_RET_AND_GOTO_END(CAS_ERROR_CONN);
    }
index 9fd75a1..0c0693d 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2013 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -136,7 +136,7 @@ THREAD_RESULT THREAD_CALL ClientListener(void *arg)
    // Fill in local address structure
    memset(&servAddr, 0, sizeof(struct sockaddr_in));
    servAddr.sin_family = AF_INET;
-   servAddr.sin_addr.s_addr = !_tcscmp(g_szListenAddress, _T("*")) ? 0 : ResolveHostName(g_szListenAddress);
+   servAddr.sin_addr.s_addr = !_tcscmp(g_szListenAddress, _T("*")) ? 0 : htonl(InetAddress::resolveHostName(g_szListenAddress, AF_INET).getAddressV4());
    servAddr.sin_port = htons(wListenPort);
 
    // Bind socket
@@ -234,7 +234,8 @@ THREAD_RESULT THREAD_CALL ClientListenerIPv6(void *arg)
    // Fill in local address structure
    memset(&servAddr, 0, sizeof(struct sockaddr_in6));
    servAddr.sin6_family = AF_INET6;
-   //servAddr.sin6_addr.s6_addr = ResolveHostName(g_szListenAddress);
+   if (_tcscmp(g_szListenAddress, _T("*")))
+      memcpy(servAddr.sin6_addr.s6_addr, InetAddress::resolveHostName(g_szListenAddress, AF_INET6).getAddressV6(), 16);
    servAddr.sin6_port = htons(wListenPort);
 
    // Bind socket
index 601dd23..44ae117 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2014 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -136,7 +136,6 @@ static int GetSMTPResponse(SOCKET hSocket, char *pszBuffer, int *pnBufPos)
 static UINT32 SendMail(char *pszRcpt, char *pszSubject, char *pszText)
 {
    SOCKET hSocket;
-   struct sockaddr_in sa;
    char szBuffer[SMTP_BUFFER_SIZE];
    int iResp, iState = STATE_INITIAL, nBufPos = 0;
    UINT32 dwRetCode;
@@ -145,23 +144,20 @@ static UINT32 SendMail(char *pszRcpt, char *pszSubject, char *pszText)
        // get mail encoding from DB
        ConfigReadStrA(_T("MailEncoding"), szEncoding, sizeof(szEncoding) / sizeof(TCHAR), "iso-8859-1");
 
-   // Fill in address structure
-   memset(&sa, 0, sizeof(sa));
-   sa.sin_family = AF_INET;
-   sa.sin_port = htons(m_wSmtpPort);
-
    // Resolve hostname
-       sa.sin_addr.s_addr = ResolveHostName(m_szSmtpServer);
-   if ((sa.sin_addr.s_addr == INADDR_ANY) || (sa.sin_addr.s_addr == INADDR_NONE))
+       InetAddress addr = InetAddress::resolveHostName(m_szSmtpServer);
+   if (!addr.isValidUnicast())
       return SMTP_ERR_BAD_SERVER_NAME;
 
    // Create socket
-   hSocket = socket(AF_INET, SOCK_STREAM, 0);
+   hSocket = socket(addr.getFamily(), SOCK_STREAM, 0);
    if (hSocket == INVALID_SOCKET)
       return SMTP_ERR_COMM_FAILURE;
 
    // Connect to server
-   if (connect(hSocket, (struct sockaddr *)&sa, sizeof(sa)) == 0)
+   SockAddrBuffer sa;
+   addr.fillSockAddr(&sa, m_wSmtpPort);
+   if (connect(hSocket, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa)) == 0)
    {
       while((iState != STATE_FINISHED) && (iState != STATE_ERROR))
       {
index 5599067..30a3c97 100644 (file)
@@ -150,6 +150,12 @@ EPRule::EPRule(DB_RESULT hResult, int row)
        m_dwAlarmTimeoutEvent = DBGetFieldULong(hResult, row, 9);
        m_dwSituationId = DBGetFieldULong(hResult, row, 10);
    DBGetField(hResult, row, 11, m_szSituationInstance, MAX_DB_STRING);
+   m_dwNumActions = 0;
+   m_pdwActionList = NULL;
+   m_dwNumEvents = 0;
+   m_pdwEventList = NULL;
+   m_dwNumSources = 0;
+   m_pdwSourceList = NULL;
 }
 
 /**
index 15cc57a..474ba94 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2015 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -100,7 +100,7 @@ THREAD_RESULT THREAD_CALL MobileDeviceListener(void *arg)
    // Fill in local address structure
    memset(&servAddr, 0, sizeof(struct sockaddr_in));
    servAddr.sin_family = AF_INET;
-   servAddr.sin_addr.s_addr = !_tcscmp(g_szListenAddress, _T("*")) ? 0 : ResolveHostName(g_szListenAddress);
+   servAddr.sin_addr.s_addr = !_tcscmp(g_szListenAddress, _T("*")) ? 0 : htonl(InetAddress::resolveHostName(g_szListenAddress, AF_INET).getAddressV4());
    servAddr.sin_port = htons(wListenPort);
 
    // Bind socket
@@ -198,7 +198,8 @@ THREAD_RESULT THREAD_CALL MobileDeviceListenerIPv6(void *arg)
    // Fill in local address structure
    memset(&servAddr, 0, sizeof(struct sockaddr_in6));
    servAddr.sin6_family = AF_INET6;
-   //servAddr.sin6_addr.s6_addr = ResolveHostName(g_szListenAddress);
+   if (_tcscmp(g_szListenAddress, _T("*")))
+      memcpy(servAddr.sin6_addr.s6_addr, InetAddress::resolveHostName(g_szListenAddress, AF_INET6).getAddressV6(), 16);
    servAddr.sin6_port = htons(wListenPort);
 
    // Bind socket
index 464766e..b3a1670 100644 (file)
@@ -1999,32 +1999,7 @@ void Node::updatePrimaryIpAddr()
        if (m_primaryName[0] == 0)
                return;
 
-   InetAddress ipAddr = InetAddress::parse(m_primaryName);
-   if (!ipAddr.isValid() && (m_zoneId != 0))
-   {
-      // resolve address through proxy agent
-      Zone *zone = FindZoneByGUID(m_zoneId);
-      if (zone != NULL)
-      {
-         Node *proxy = (Node *)FindObjectById(zone->getAgentProxy(), OBJECT_NODE);
-         if (proxy != NULL)
-         {
-            TCHAR query[256], buffer[128];
-            _sntprintf(query, 256, _T("Net.Resolver.AddressByName(%s)"), m_primaryName);
-            if (proxy->getItemFromAgent(query, 128, buffer) == ERR_SUCCESS)
-            {
-               ipAddr = InetAddress::parse(buffer);
-            }
-         }
-      }
-   }
-
-   // Resolve address through local resolver
-   if (!ipAddr.isValid())
-   {
-      ipAddr = InetAddress::resolveHostName(m_primaryName);
-   }
-
+   InetAddress ipAddr = ResolveHostName(m_zoneId, m_primaryName);
    if (!ipAddr.equals(m_ipAddress) && (ipAddr.isValidUnicast() || !_tcscmp(m_primaryName, _T("0.0.0.0"))))
        {
                TCHAR buffer1[64], buffer2[64];
@@ -4855,7 +4830,7 @@ UINT32 Node::modifyFromMessageInternal(NXCPMessage *pRequest)
       TCHAR primaryName[MAX_DNS_NAME];
                pRequest->getFieldAsString(VID_PRIMARY_NAME, primaryName, MAX_DNS_NAME);
 
-      InetAddress ipAddr = InetAddress::resolveHostName(primaryName);
+      InetAddress ipAddr = ResolveHostName(m_zoneId, primaryName);
       if (ipAddr.isValid() && !(m_flags & NF_REMOTE_AGENT))
       {
          // Check if received IP address is one of node's interface addresses
index 6a1f0ff..f1ae1d3 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  ** NetXMS - Network Management System
- ** Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Victor Kirhenshtein
+ ** Copyright (C) 2003-2016 Victor Kirhenshtein
  **
  ** RADIUS client
  ** This code is based on uRadiusLib (C) Gary Wallis, 2006.
@@ -576,7 +576,7 @@ static int rad_build_packet(AUTH_HDR *auth, int auth_len,
 // Receive result from server
 //
 
-static int result_recv(UINT32 host, WORD udp_port, char *buffer, int length, BYTE *vector, char *secretkey)
+static int result_recv(const InetAddress& host, WORD udp_port, char *buffer, int length, BYTE *vector, char *secretkey)
 {
        AUTH_HDR *auth;
        int totallen, secretlen;
@@ -605,9 +605,8 @@ static int result_recv(UINT32 host, WORD udp_port, char *buffer, int length, BYT
                DbgPrintf(3, _T("RADIUS: Received invalid reply digest from server"));
        }
 
-       IpToStr(ntohl(host), szHostName);
-       DbgPrintf(3, _T("RADIUS: Packet from host %s code=%d, id=%d, length=%d"),
-             szHostName, auth->code, auth->id, totallen);
+       host.toString(szHostName);
+       DbgPrintf(3, _T("RADIUS: Packet from host %s code=%d, id=%d, length=%d"), szHostName, auth->code, auth->id, totallen);
        return (auth->code == PW_AUTHENTICATION_REJECT) ? 1 : 0;
 }
 
@@ -618,9 +617,6 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
 {
        AUTH_HDR *auth;
        VALUE_PAIR *req, *vp;
-       UINT32 server_ip;
-       struct sockaddr saremote;
-       struct sockaddr_in *sin;
        struct timeval          tv;
        fd_set readfds;
        socklen_t salen;
@@ -666,8 +662,8 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
        pairadd(&req, vp);
 
        // Resolve hostname.
-       server_ip = ResolveHostName(serverName);
-       if ((server_ip == INADDR_NONE) || (server_ip == INADDR_ANY))
+       InetAddress serverAddr = InetAddress::resolveHostName(serverName);
+       if (!serverAddr.isValidUnicast())
        {
                DbgPrintf(3, _T("RADIUS: cannot resolve server name \"%s\""), serverName);
                pairfree(req);
@@ -675,7 +671,7 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
        }
 
        // Open a socket.
-       sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+       sockfd = socket(serverAddr.getFamily(), SOCK_DGRAM, 0);
        if (sockfd == INVALID_SOCKET)
        {
                DbgPrintf(3, _T("RADIUS: Cannot create socket"));
@@ -683,11 +679,8 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
                return 5;
        }
 
-       sin = (struct sockaddr_in *)&saremote;
-       memset(sin, 0, sizeof (saremote));
-       sin->sin_family = AF_INET;
-       sin->sin_addr.s_addr = server_ip;
-       sin->sin_port = htons(port);
+       SockAddrBuffer sa;
+       serverAddr.fillSockAddr(&sa, port);
 
        // Build final radius packet.
        length = rad_build_packet(auth, sizeof(send_buffer),
@@ -702,7 +695,7 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
                {
                        DbgPrintf(3, _T("RADIUS: Re-sending request..."));
                }
-               sendto(sockfd, (char *)auth, length, 0, &saremote, sizeof(struct sockaddr_in));
+               sendto(sockfd, (char *)auth, length, 0, (struct sockaddr *)&sa, SA_LEN((struct sockaddr *)&sa));
 
                FD_ZERO(&readfds);
                FD_SET(sockfd, &readfds);
@@ -713,9 +706,11 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
                        continue;
                }
 
-               salen = sizeof(saremote);
-               result = recvfrom(sockfd, (char *)recv_buffer, sizeof(recv_buffer), 0, &saremote, &salen);
-               if (result >= 0)
+               SockAddrBuffer sarecv;
+               socklen_t salen = sizeof(sa);
+               result = recvfrom(sockfd, (char *)recv_buffer, sizeof(recv_buffer), 0, (struct sockaddr *)&sarecv, &salen);
+               InetAddress addrRecv = InetAddress::createFromSockaddr((struct sockaddr *)&sarecv);
+               if ((result >= 0) && addrRecv.equals(serverAddr) && (SA_PORT(&sarecv) == SA_PORT(&sa)))
                {
                        break;
                }
@@ -725,9 +720,7 @@ static int DoRadiusAuth(const char *cLogin, const char *cPasswd, bool useSeconda
 
        if (result > 0 && i < nRetries)
        {
-               result = result_recv(sin->sin_addr.s_addr, sin->sin_port,
-                               (char *)recv_buffer, result, vector,
-                               szSecret);
+               result = result_recv(serverAddr, port, (char *)recv_buffer, result, vector, szSecret);
        }
        else
        {
index e432608..d22b631 100644 (file)
@@ -4933,7 +4933,7 @@ void ClientSession::createObject(NXCPMessage *request)
                if (request->isFieldExist(VID_PRIMARY_NAME))
                {
                        request->getFieldAsString(VID_PRIMARY_NAME, nodePrimaryName, MAX_DNS_NAME);
-         ipAddr = InetAddress::resolveHostName(nodePrimaryName);
+         ipAddr = ResolveHostName(zoneId, nodePrimaryName);
                }
                else
                {
index 7d0f224..cc0a3f9 100644 (file)
@@ -268,8 +268,8 @@ static Node *FindNodeByHostname(const char *hostName)
       return NULL;
 
    Node *node = NULL;
-   UINT32 ipAddr = ntohl(ResolveHostNameA(hostName));
-       if ((ipAddr != INADDR_NONE) && (ipAddr != INADDR_ANY))
+   InetAddress ipAddr = InetAddress::resolveHostName(hostName);
+       if (ipAddr.isValidUnicast())
    {
       node = FindNodeByIP((g_flags & AF_TRAP_SOURCES_IN_ALL_ZONES) ? ALL_ZONES : 0, ipAddr);
    }
index 8a6bd2f..1efe372 100644 (file)
@@ -328,3 +328,36 @@ bool NXCORE_EXPORTABLE ExecuteQueryOnObject(DB_HANDLE hdb, UINT32 objectId, cons
    DBFreeStatement(hStmt);
    return success;
 }
+
+/**
+ * Resolve host name using zone if needed
+ */
+InetAddress NXCORE_EXPORTABLE ResolveHostName(UINT32 zoneId, const TCHAR *hostname)
+{
+   InetAddress ipAddr = InetAddress::parse(hostname);
+   if (!ipAddr.isValid() && IsZoningEnabled() && (zoneId != 0))
+   {
+      // resolve address through proxy agent
+      Zone *zone = FindZoneByGUID(zoneId);
+      if (zone != NULL)
+      {
+         Node *proxy = (Node *)FindObjectById(zone->getAgentProxy(), OBJECT_NODE);
+         if (proxy != NULL)
+         {
+            TCHAR query[256], buffer[128];
+            _sntprintf(query, 256, _T("Net.Resolver.AddressByName(%s)"), hostname);
+            if (proxy->getItemFromAgent(query, 128, buffer) == ERR_SUCCESS)
+            {
+               ipAddr = InetAddress::parse(buffer);
+            }
+         }
+      }
+   }
+
+   // Resolve address through local resolver
+   if (!ipAddr.isValid())
+   {
+      ipAddr = InetAddress::resolveHostName(hostname);
+   }
+   return ipAddr;
+}
index 3b11f4d..bd16e42 100644 (file)
@@ -991,6 +991,8 @@ void GetSysInfoStr(TCHAR *pszBuffer, int nMaxSize);
 InetAddress GetLocalIpAddr();
 TCHAR *GetLocalHostName(TCHAR *buffer, size_t bufSize);
 
+InetAddress NXCORE_EXPORTABLE ResolveHostName(UINT32 zoneId, const TCHAR *hostname);
+
 BOOL ExecCommand(TCHAR *pszCommand);
 BOOL SendMagicPacket(UINT32 dwIpAddr, BYTE *pbMacAddr, int iNumPackets);