summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-10 22:50:41 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-10 22:50:41 +0000
commit09dd16b981c38cbde7573398cb50ae1cf0531ade (patch)
treec9c078d2b5e41c9c76e3e5175e66fb4b7cb002d6
parent90639721625b5da867effc7dd4adec003c1bd3b4 (diff)
Route some more stuff through socket.h and hash_map.h. Add #define protection to timer.h and remove some unneeded includes and externs from timer.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3869 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/dns.h4
-rw-r--r--include/hash_map.h4
-rw-r--r--include/inspsocket.h19
-rw-r--r--include/socket.h3
-rw-r--r--include/timer.h4
-rw-r--r--include/typedefs.h10
-rw-r--r--src/timer.cpp16
7 files changed, 19 insertions, 41 deletions
diff --git a/include/dns.h b/include/dns.h
index cdc1fd024..e907c7e2c 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -18,10 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef _DNS_H
#define _DNS_H
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <string>
+#include "socket.h"
struct dns_ip4list {
in_addr ip;
diff --git a/include/hash_map.h b/include/hash_map.h
index f74dce92a..39529634a 100644
--- a/include/hash_map.h
+++ b/include/hash_map.h
@@ -21,11 +21,15 @@
#include "inspircd_config.h"
#ifdef GCC3
+
#include <ext/hash_map>
#define nspace __gnu_cxx
+
#else
+
#include <hash_map>
#define nspace std
+
#endif
#endif
diff --git a/include/inspsocket.h b/include/inspsocket.h
index caa1490b5..c9cc70acf 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -17,27 +17,12 @@
#ifndef __INSP_SOCKET_H__
#define __INSP_SOCKET_H__
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <sstream>
#include <string>
#include <deque>
-#include "dns.h"
#include "inspircd_config.h"
-
-/* macros to the relevant system address description structs */
-#ifdef IPV6
-
-typedef struct sockaddr_in6 insp_sockaddr;
-typedef struct in6_addr insp_inaddr;
-
-#else
-
-typedef struct sockaddr_in insp_sockaddr;
-typedef struct in_addr insp_inaddr;
-
-#endif
+#include "dns.h"
+#include "socket.h"
/**
* States which a socket may be in
diff --git a/include/socket.h b/include/socket.h
index 1dd2e6827..89b5ca1a4 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -36,8 +36,9 @@
#else
-#include <windows_defs.h>
+#include <windef.h>
#include <winsock2.h>
+typedef int socklen_t;
#endif
diff --git a/include/timer.h b/include/timer.h
index 3c4fb0897..6a4c9063b 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -14,6 +14,9 @@
* ---------------------------------------------------
*/
+#ifndef INSPIRCD_TIMER_H
+#define INSPIRCD_TIMER_H
+
/** Timer class for one-second resolution timers
* InspTimer provides a facility which allows module
* developers to create one-shot timers. The timer
@@ -55,3 +58,4 @@ void TickTimers(time_t TIME);
void AddTimer(InspTimer* T);
void TickMissedTimers(time_t TIME);
+#endif
diff --git a/include/typedefs.h b/include/typedefs.h
index 1bb65bebe..cd8c82039 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -1,6 +1,9 @@
#ifndef __TYPEDEF_H__
#define __TYPEDEF_H__
+#include <string>
+#include "inspircd_config.h"
+#include "hash_map.h"
#include "users.h"
#include "channels.h"
#include "hashcomp.h"
@@ -9,13 +12,6 @@
#include "inspircd.h"
#include "modules.h"
#include "globals.h"
-#include "inspircd_config.h"
-#include <string>
-#ifdef GCC3
-#include <ext/hash_map>
-#else
-#include <hash_map>
-#endif
typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, irc::StrHashComp> chan_hash;
diff --git a/src/timer.cpp b/src/timer.cpp
index 0e7a77ad8..0c2cabbbe 100644
--- a/src/timer.cpp
+++ b/src/timer.cpp
@@ -14,24 +14,14 @@
* ---------------------------------------------------
*/
-using namespace std;
-
-#include "inspircd_config.h"
-#include <time.h>
#include <vector>
#include <map>
-#include "users.h"
-#include "ctables.h"
-#include "typedefs.h"
-#include "commands.h"
-#include "globals.h"
-#include "hashcomp.h"
+#include "inspircd_config.h"
#include "inspircd.h"
-#include "inspstring.h"
+#include "typedefs.h"
#include "helperfuncs.h"
+#include "timer.h"
-extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
extern time_t TIME;
typedef std::vector<InspTimer*> timergroup;