Imported Upstream version 2.7
[ossec-hids.git] / src / headers / shared.h
index d3e019b..fe2827c 100755 (executable)
@@ -1,11 +1,12 @@
-/* @(#) $Id: shared.h,v 1.47 2009/09/17 18:47:23 dcid Exp $ */
+/* @(#) $Id: ./src/headers/shared.h, 2011/09/08 dcid Exp $
+ */
 
 /* Copyright (C) 2009 Trend Micro Inc.
  * All rights reserved.
  *
  * This program is a free software; you can redistribute it
  * and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
  * Foundation
  */
 
@@ -18,7 +19,7 @@
  *  The stack smashing protector defeats some BoF via: gcc -fstack-protector
  *  Reference: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/cpp.pdf
  */
+
 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) && (__GNUC_PATCHLEVEL__ >= 2)) || \
                           ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || \
                            (__GNUC__ >= 5))
@@ -82,6 +83,8 @@
 #include <windows.h>
 #include <winsock.h>
 #include <io.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #endif
 
 #include <time.h>
@@ -132,7 +135,13 @@ typedef uint8_t u_int8_t;
 typedef int sock2len_t;
 #endif
 
-/* For Windows (so high maintenance :)) */
+
+#ifndef WIN32
+#define CloseSocket(x) close(x)
+#endif
+
+
+/* For Windows */
 #ifdef WIN32
 typedef int uid_t;
 typedef int gid_t;
@@ -141,6 +150,7 @@ typedef int socklen_t;
 #define srandom(x) srand(x)
 #define random(x) rand(x)
 #define lstat(x,y) stat(x,y)
+#define CloseSocket(x) closesocket(x)
 void WinSetError();
 typedef unsigned short int u_int16_t;
 typedef unsigned char u_int8_t;
@@ -168,7 +178,7 @@ char *__local_name;
 /*** These functions will exit on error. No need to check return code ***/
 
 /* for calloc: x = calloc(4,sizeof(char)) -> os_calloc(4,sizeof(char),x) */
-#define os_calloc(x,y,z) (z = calloc(x,y))?(void)1:ErrorExit(MEM_ERROR, ARGV0) 
+#define os_calloc(x,y,z) (z = calloc(x,y))?(void)1:ErrorExit(MEM_ERROR, ARGV0)
 
 #define os_strdup(x,y) (y = strdup(x))?(void)1:ErrorExit(MEM_ERROR, ARGV0)
 
@@ -183,9 +193,9 @@ char *__local_name;
 #ifdef CLIENT
     #define isAgent 1
 #else
-    #define isAgent 0    
+    #define isAgent 0
 #endif
-        
+
 
 
 #include "debug_op.h"
@@ -209,6 +219,7 @@ char *__local_name;
 #include "file-queue.h"
 #include "read-agents.h"
 #include "report_op.h"
+#include "string_op.h"
 
 #include "os_xml/os_xml.h"
 #include "os_regex/os_regex.h"
@@ -217,5 +228,5 @@ char *__local_name;
 
 
 #endif /* __SHARED_H */
-                              
+                       
 /* EOF */