]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/connection.h
Commented new functions
[user/henk/code/inspircd.git] / include / connection.h
index c74a494b1ce6257d5c335bd79a5f6fb217c49012..614a3146d7628bb69775d114ca55e57589c43b6a 100644 (file)
@@ -1,13 +1,25 @@
-/*
-
-*/
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *                       E-mail:
+ *                <brain@chatspike.net>
+ *               <Craig@chatspike.net>
+ *     
+ * Written by Craig Edwards, Craig McLure, and others.
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
 
 #include "inspircd_config.h"
 #include "base.h"
 #include <string>
 #include <map>
-#include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <unistd.h>
@@ -15,6 +27,7 @@
 #include <time.h>
 #include <vector>
 #include <deque>
+#include <sstream>
 
 #ifndef __CONNECTION_H__
 #define __CONNECTION_H__
@@ -24,6 +37,7 @@
 #define STATE_SYNC             2
 #define STATE_NOAUTH_INBOUND   3
 #define STATE_NOAUTH_OUTBOUND  4
+#define STATE_SERVICES         5
 
 /** Each connection has one or more of these
  * each represents ONE outbound connection to another ircd
@@ -37,7 +51,7 @@
  * connection(s) relating to the server you want information on.
  * The core and module API provide functions for this.
  */
-class ircd_connector : public classbase
+class ircd_connector : public Extensible
 {
  private:
        /** Sockaddr of the outbound ip and port
@@ -65,7 +79,13 @@ class ircd_connector : public classbase
         */
        bool SetHostAddress(char* host, int port);
 
+
  public:
+
+        /** IRCD Buffer for input characters, holds one line
+         */
+        std::string ircdbuffer;
+
  
        /** When MakeOutboundConnection is called, these public members are
         * filled with the details passed to the function, for future
@@ -88,7 +108,7 @@ class ircd_connector : public classbase
 
        /** Create an outbound connection to a listening socket
         */ 
-       bool MakeOutboundConnection(char* host, int port);
+       bool MakeOutboundConnection(char* newhost, int newport);
        
        /** Return the servername on this established connection
         */
@@ -139,25 +159,23 @@ class ircd_connector : public classbase
        
        /** Set both the host and the port in one operation for this connection
         */
-       bool SetHostAndPort(char* host, int port);
+       bool SetHostAndPort(char* newhost, int newport);
        
        /** Close the connection by calling close() on its file descriptor
         * This function call updates no other data.
         */
        void CloseConnection();
-};
-
 
-/** Class packet is deprecated.
- * This declaration is preserved here to maintain documentation only.
- */
-class packet
-{
+       void AddBuffer(std::string a);
+       bool BufferIsComplete();
+       void ClearBuffer();
+       std::string GetBuffer();
 };
 
+
 /** Please note: classes serverrec and userrec both inherit from class connection.
  */
-class connection : public classbase
+class connection : public Extensible
 {
  public:
        /** File descriptor of the connection
@@ -170,7 +188,7 @@ class connection : public classbase
        
        /** IP of connection. Reserved for future use.
         */
-       long ip;
+       char ip[32];
        
        /** Inbuf of connection. Only used for userrec
         */
@@ -228,7 +246,7 @@ class connection : public classbase
        
        /** Unused, will be removed in a future alpha/beta
         */
-       char internal_addr[1024];
+       char internal_addr[MAXBUF];
        
        /** Unused, will be removed in a future alpha/beta
         */
@@ -253,7 +271,7 @@ class connection : public classbase
        
        /** Begin an outbound mesh link to another ircd on a network you are already an authenticated member of
         */
-       bool MeshCookie(char* targethost, int port, long cookie, char* servername);
+       bool MeshCookie(char* targethost, int port, unsigned long cookie, char* servername);
        
        /** Terminate a link to 'targethost' by calling the ircd_connector::CloseConnection method.
         */