From 827373ddaac2bea3d6d937a61760df7954bf7c39 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Mon, 6 Jul 2009 22:36:50 -0300 Subject: [PATCH] Remove no more needed files: nethook and null hook. --- Makefile.am | 3 +- nethook.c | 45 ------------------------- nethook.h | 45 ------------------------- null.c | 95 ----------------------------------------------------- null.h | 30 ----------------- 5 files changed, 1 insertion(+), 217 deletions(-) delete mode 100644 nethook.c delete mode 100644 nethook.h delete mode 100644 null.c delete mode 100644 null.h diff --git a/Makefile.am b/Makefile.am index 039dcb7..fc062f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,7 @@ bin_PROGRAMS = popproxy ppmanager -popproxy_SOURCES = popproxy.c log.c log.h nethook.c nethook.h \ +popproxy_SOURCES = popproxy.c log.c log.h \ tcp_connect.h tcp_connect.c tcp_server.c \ hcconn.c hcconn.h hcconn_internal.h hcconn_ssl.c \ - null.c null.h \ pop.c pop.h usermap.c usermap.h dist_sysconf_DATA = popproxy.conf ppmanager = ppmanager.c diff --git a/nethook.c b/nethook.c deleted file mode 100644 index 8380990..0000000 --- a/nethook.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -** Copyright (C) 2006 Thadeu Lima de Souza Cascardo -** -** 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** -*/ - -#include "nethook.h" - -void -nethook_event (HCConn* conn, HCEvent event, gpointer data) -{ - char buffer[4096]; - int r; - net_hook_t* hook; - hook = (net_hook_t*) data; - switch (event) - { - case HC_EVENT_CONNECT: - hook->connect (hook); - break; - case HC_EVENT_READ: - while ((r = hc_conn_read (conn, buffer, sizeof (buffer))) > 0) - hook->read (hook, buffer, r); - break; - case HC_EVENT_CLOSE: - hook->close (hook); - break; - default: - g_warning ("Received an unexpected client event."); - break; - } -} diff --git a/nethook.h b/nethook.h deleted file mode 100644 index b428a14..0000000 --- a/nethook.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** Copyright (C) 2006 Thadeu Lima de Souza Cascardo -** -** 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** -*/ - -#ifndef NET_HOOK_H -#define NET_HOOK_H - -#include -#include "hcconn.h" - -typedef struct _net_hook_t net_hook_t; -typedef void (*net_connect) (net_hook_t*); -typedef void (*net_close) (net_hook_t*); -typedef void (*net_write) (net_hook_t*); -typedef void (*net_read) (net_hook_t*, gchar*, size_t); - -struct _net_hook_t -{ - HCConn* conn; - net_hook_t* peer; - gboolean server; - net_connect connect; - net_close close; - net_read read; - gpointer data; -}; - -void nethook_event (HCConn*, HCEvent, gpointer); - -#endif diff --git a/null.c b/null.c deleted file mode 100644 index 9aa94de..0000000 --- a/null.c +++ /dev/null @@ -1,95 +0,0 @@ -/* -** Copyright (C) 2006 Thadeu Lima de Souza Cascardo -** Copyright (C) 2009 Thadeu Lima de Souza Cascardo -** -** 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** -*/ - -#include -#include "null.h" - -static void -null_connect (net_hook_t *hook) -{ -} - -static void -null_close (net_hook_t *hook) -{ - if (hook->peer) - { - hook->peer->peer = NULL; - hc_conn_close (hook->peer->conn); - } - hc_conn_close (hook->conn); - g_slice_free (net_hook_t, hook); -} - -static void -null_read (net_hook_t *hook, gchar *buffer, size_t len) -{ - hc_conn_write (hook->peer->conn, buffer, len); -} - -static void -null_error (net_hook_t *hook) -{ - g_message ("Error in POP3 client connection."); -} - -static net_hook_t * -null_server_hook_new (net_hook_t *client_hook, char *server, char *port) -{ - net_hook_t *hook; - int fd; - HCConn *conn; - hook = g_slice_new (net_hook_t); - hook->peer = client_hook; - hook->server = TRUE; - hook->connect = null_connect; - hook->close = null_close; - hook->read = null_read; - hook->data = NULL; - conn = hc_conn_new (NULL, NULL); - hook->conn = hc_conn_new (nethook_event, hook); - fd = hc_tcp_connect (server, port); - hc_conn_set_driver_channel (conn, fd); - hc_conn_set_driver_ssl (hook->conn, conn); - return hook; -} - -net_hook_t * -null_hook_new (HCConn *conn, char *server, char *port) -{ - net_hook_t *hook; - hook = g_slice_new (net_hook_t); - hook->conn = conn; - hook->peer = NULL; - hook->server = FALSE; - hook->connect = null_connect; - hook->close = null_close; - hook->read = null_read; - hook->data = server; - hook->peer = null_server_hook_new (hook, server, port); - hc_conn_set_callback (hook->conn, nethook_event, hook); - return hook; -} - -void -null_destroy (net_hook_t *hook) -{ - g_slice_free (net_hook_t, hook); -} diff --git a/null.h b/null.h deleted file mode 100644 index df848a8..0000000 --- a/null.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -** Copyright (C) 2006 Thadeu Lima de Souza Cascardo -** Copyright (C) 2009 Thadeu Lima de Souza Cascardo -** -** 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** -*/ - -#ifndef NULL_H -#define NULL_H - -#include "nethook.h" -#include "hcconn.h" - -net_hook_t * null_hook_new (HCConn *, char *, char *); -void null_destroy (net_hook_t *); - -#endif -- 2.20.1