Added some comments and reminders in connection system.
[cascardo/rnetproxy.git] / popproxy.c
index 7f4f5a3..78403ba 100644 (file)
@@ -28,7 +28,6 @@
 #include "log.h"
 #include "nethook.h"
 #include "null.h"
-#include "ssl.h"
 #include "pop.h"
 
 #include "hcconn.h"
@@ -42,10 +41,11 @@ struct pop_address
   char *port;
 };
 
-void new_client (int fd, struct sockaddr* addr, socklen_t saddr, gpointer data)
+static void
+new_client (int fd, struct sockaddr *addr, socklen_t saddr, gpointer data)
 {
   HCConn *conn;
-  net_hook_thook;
+  net_hook_t *hook;
   struct pop_address *address = data;
   if (fd < 0)
     {
@@ -54,12 +54,13 @@ void new_client (int fd, struct sockaddr* addr, socklen_t saddr, gpointer data)
     }
   g_message ("Received connection from %s.",
              inet_ntoa (((struct sockaddr_in *) addr)->sin_addr));
-  conn = hc_conn_new (fd, NULL, NULL);
-  hook = ssl_hook_new (conn, address->server, address->port);
+  conn = hc_conn_new (NULL, NULL);
+  hc_conn_set_driver_channel (conn, fd);
+  hook = null_hook_new (conn, address->server, address->port);
   pop_hook_new (hook);
 }
 
-static gcharconfigfile;
+static gchar *configfile;
 
 static GOptionEntry opt_entries[] =
   {
@@ -68,15 +69,15 @@ static GOptionEntry opt_entries[] =
     { NULL }
   };
 
-int main (int argc, char** argv)
+int main (int argc, char **argv)
 {
 
-  GOptionContextopt_ctx;
+  GOptionContext *opt_ctx;
   GKeyFile *keyfile;
   GError *error;
   int server_fd;
-  gcharconf_address;
-  gcharport;
+  gchar *conf_address;
+  gchar *port;
   gchar *server_address;
   gchar *server_port;
   struct pop_address pop_address;
@@ -94,7 +95,7 @@ int main (int argc, char** argv)
     }
   g_option_context_free (opt_ctx);
   
-  keyfile =  g_key_file_new ();
+  keyfile = g_key_file_new ();
 
   error = NULL;
   if (g_key_file_load_from_file (keyfile, configfile,