added basic ssl support to ircu
[ircu2.10.12-pk.git] / tools / Bounce / Bounce.h
index 5529786ba7b9ce01ca03d707c48c9cccc253192d..b35d471d353bd8630134b82835b0d1bd1658de27 100755 (executable)
@@ -1,3 +1,29 @@
+/*
+ * IRC - Internet Relay Chat, tools/Bounce/Bounce.h
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ *                    University of Oulu, Computing Center
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * 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
+ * the Free Software Foundation; either version 1, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ */
+
 #include <sys/types.h> 
 #include <sys/time.h>
 #include <sys/wait.h> 
@@ -23,7 +49,8 @@
 #include <list>
 using std::list; 
 
-
+#define DEBUG
 /*
  *  "Bounce" Class.
  */
@@ -33,12 +60,12 @@ class Connection;
 class Bounce
 {
 public:
-  list<Listener*> listenerList; // List of Listeners.
+  list<Listener*> listenerList;      // List of 'Listeners'.
   list<Connection*> connectionsList; // List of 'Connections'. 
 
-  void bindListeners(); //Binds Listening Ports.
-  void checkSockets(); // Polls all sockets.
-  void recieveNewConnection(Listener*);
+  void bindListeners(); // Binds Listening Ports.
+  void checkSockets();  // Polls all sockets.
+  void recieveNewConnection(Listener*); // Accepts connections.
 };
 
 /*
@@ -48,14 +75,14 @@ public:
 class Socket 
 {
 public:
-  int fd; 
-  int lastReadSize;
-  struct sockaddr_in address;
-  int connectTo(char*, unsigned short);
-  int write(char*, int); 
-  int write(char*); 
-  char* read();
-  Socket();
+  int fd;                               // File descriptor.
+  int lastReadSize;                     // Size of last read buffer.
+  struct sockaddr_in address;           // Socket addr_in struct.
+  int connectTo(char*, unsigned short); // Connects the socket.
+  int write(char*, int);                // Writes 'int' bytes from message.
+  int write(char*);                     // Writes strlen(message).
+  char* read();                         // Reads as much as possible into a 4k buffer.
+  Socket();                             // Constructor.
 };
 
 /*
@@ -66,18 +93,19 @@ class Bounce;
 class Listener
 {
 public:
-  int fd; 
-  int remotePort;
-  int localPort;
-  char myVhost[15];
-  char remoteServer[15];
+  int fd;                 // File descriptor.
+  int remotePort;         // Remote port from config.
+  int localPort;          // Local port for binding.
+  char myVhost[15];       // Vhost to bind locally.
+  char remoteServer[15];  // Remote server to connect to.
 
-  void beginListening();
-  Socket* handleAccept();
+  void beginListening();  // Bind listening ports.
+  Socket* handleAccept(); // Accept a new connection.
 };
 
 /*
  *  "Connection" Class.
+ *  Simply a container for a local/remote Socket pair.
  */
 
 class Connection