Fixed many incompatibilities with UNIX and gcc for new code
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 9 Aug 2004 10:41:17 +0000 (10:41 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 9 Aug 2004 10:41:17 +0000 (10:41 +0000)
include/nxcscpapi.h
src/agent/core/comm.cpp
src/libnetxms/Makefile.am
src/libnetxms/dload.cpp
src/libnxcl/libnxcl.h
src/server/core/Makefile.am
src/server/include/nxsrvapi.h
src/server/libnxsrv/agent.cpp

index ad26a6b..6ff0a11 100644 (file)
@@ -119,8 +119,6 @@ typedef struct
 
 class LIBNXCSCP_EXPORTABLE MsgWaitQueue
 {
-   friend void MWQThreadStarter(void *);
-
 private:
    MUTEX m_hMutex;
    CONDITION m_hStopCondition;
@@ -132,6 +130,8 @@ private:
    void Unlock(void) { MutexUnlock(m_hMutex); }
    void HousekeeperThread(void);
    void *WaitForMessageInternal(WORD wIsBinary, WORD wCode, DWORD dwId, DWORD dwTimeOut);
+   
+   static void MWQThreadStarter(void *);
 
 public:
    MsgWaitQueue();
index 9476136..bb27354 100644 (file)
@@ -189,13 +189,13 @@ void ListenerThread(void *)
             WriteLog(MSG_TOO_MANY_ERRORS, EVENTLOG_WARNING_TYPE, NULL);
             iNumErrors = 0;
          }
-         Sleep(500);
+         ThreadSleepMs(500);
       }
 
       iNumErrors = 0;     // Reset consecutive errors counter
-      DebugPrintf("Incoming connection from %s", IpToStr(servAddr.sin_addr.S_un.S_addr, szBuffer));
+      DebugPrintf("Incoming connection from %s", IpToStr(servAddr.sin_addr.S_addr, szBuffer));
 
-      if (IsValidServerAddr(servAddr.sin_addr.S_un.S_addr))
+      if (IsValidServerAddr(servAddr.sin_addr.S_addr))
       {
          g_dwAcceptedConnections++;
 
index 761aa7b..e971882 100644 (file)
@@ -1,5 +1,5 @@
 INCLUDES=-I@top_srcdir@/include
 
 lib_LTLIBRARIES = libnetxms.la
-libnetxms_la_SOURCES = hash.cpp icmp.cpp inline.cpp main.cpp md5.cpp sha1.cpp tools.cpp
+libnetxms_la_SOURCES = config.cpp dload.cpp hash.cpp icmp.cpp inline.cpp main.cpp md5.cpp sha1.cpp tools.cpp
 libnetxms_la_LDFLAGS = -version-info $(LIBNETXMS_LIBRARY_VERSION)
index b92ec1d..ce3b1f7 100644 (file)
 
 #include "libnetxms.h"
 
+#ifndef _WIN32
+#include <dlfcn.h>
+#endif
+
 
 //
 // Load DLL/shared library
index 99fc0c0..cdddc27 100644 (file)
@@ -29,7 +29,7 @@
 #ifdef _WIN32
 #include <windows.h>
 #else    /* _WIN32 */
-#include <unistd.h>
+#include <fcntl.h>
 #endif   /* _WIN32 */
 
 #include <nms_common.h>
index db4d415..6657bb8 100644 (file)
@@ -1,8 +1,8 @@
 INCLUDES=-I@top_srcdir@/include -I@top_srcdir@/src/server/include
 
 bin_PROGRAMS = netxmsd
-netxmsd_SOURCES = messages.c acl.cpp actions.cpp admin.cpp client.cpp config.cpp container.cpp datacoll.cpp db.cpp dbwrite.cpp dcitem.cpp dcithreshold.cpp debug.cpp discovery.cpp entirenet.cpp epp.cpp events.cpp evproc.cpp hk.cpp id.cpp image.cpp interface.cpp locks.cpp log.cpp main.cpp netinfo.cpp netobj.cpp node.cpp np.cpp objects.cpp session.cpp snmp.cpp status.cpp subnet.cpp syncer.cpp queue.cpp tools.cpp users.cpp watchdog.cpp winsrv.cpp srvroot.cpp
-netxmsd_LDADD = @PTHREAD_LIBS@ ../../libnetxms/libnetxms.la ../../libnxcscp/libnxcscp.la -lsnmp -lssl
+netxmsd_SOURCES = messages.c acl.cpp actions.cpp admin.cpp client.cpp config.cpp container.cpp datacoll.cpp db.cpp dbwrite.cpp dcitem.cpp dcithreshold.cpp debug.cpp discovery.cpp entirenet.cpp epp.cpp events.cpp evproc.cpp hk.cpp id.cpp image.cpp interface.cpp locks.cpp log.cpp main.cpp netinfo.cpp netobj.cpp node.cpp np.cpp objects.cpp session.cpp snmp.cpp srvroot.cpp status.cpp subnet.cpp syncer.cpp tools.cpp users.cpp watchdog.cpp winsrv.cpp
+netxmsd_LDADD = @PTHREAD_LIBS@ ../../libnetxms/libnetxms.la ../../libnxcscp/libnxcscp.la ../libnxsrv/libnxsrv.la -lsnmp -lssl
 
 messages.c: messages.mc
        $(PERL) @top_builddir@/tools/mc.pl $<
index 6a07026..3eddf91 100644 (file)
@@ -98,8 +98,6 @@ typedef struct
 
 class LIBNXSRV_EXPORTABLE AgentConnection
 {
-   friend void AgentReceiverThread(void *);
-
 private:
    DWORD m_dwAddr;
    int m_iAuthMethod;
@@ -114,6 +112,7 @@ private:
    MsgWaitQueue *m_pMsgWaitQueue;
 
    void ReceiverThread(void);
+   static void ReceiverThreadStarter(void *);
 
 protected:
    void DestroyResultData(void);
index 9eae730..d7f32c2 100644 (file)
@@ -22,6 +22,7 @@
 **/
 
 #include "libnxsrv.h"
+#include <stdarg.h>
 
 
 //
@@ -35,7 +36,7 @@
 // Receiver thread starter
 //
 
-static void AgentReceiverThread(void *pArg)
+void AgentConnection::ReceiverThreadStarter(void *pArg)
 {
    ((AgentConnection *)pArg)->ReceiverThread();
 }
@@ -206,7 +207,7 @@ BOOL AgentConnection::Connect(BOOL bVerbose)
    }
 
    // Start receiver thread
-   ThreadCreate(AgentReceiverThread, 0, this);
+   ThreadCreate(ReceiverThreadStarter, 0, this);
 
    // Authenticate itself to agent
    switch(m_iAuthMethod)