[idms-dbma-devel]: COMMIT - r110 - in branches/nonblocking_io: include lib modules/mpm modules/mpm/c
Status: Pre-Alpha
Brought to you by:
nkukard
|
From: <sv...@li...> - 2005-09-22 12:31:37
|
Author: nkukard
Date: 2005-09-22 12:27:57 +0000 (Thu, 22 Sep 2005)
New Revision: 110
Modified:
branches/nonblocking_io/include/mpm.h
branches/nonblocking_io/lib/mailstore.c
branches/nonblocking_io/modules/mpm/c10k/c10k.c
branches/nonblocking_io/modules/mpm/mpm.c
branches/nonblocking_io/modules/protocols/Makefile.am
branches/nonblocking_io/modules/protocols/Makefile.in
branches/nonblocking_io/modules/protocols/pop3/command_lexer.h
branches/nonblocking_io/modules/protocols/pop3/command_parser.y
branches/nonblocking_io/modules/protocols/pop3/pop3.c
branches/nonblocking_io/modules/protocols/pop3/pop3.h
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_capa.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_dele.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_list.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_noop.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_pass.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_quit.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_retr.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_rset.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_stat.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_top.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_uidl.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_user.c
branches/nonblocking_io/modules/protocols/pop3/pop3_cmds.h
Log:
* Intermediate update
Modified: branches/nonblocking_io/include/mpm.h
===================================================================
--- branches/nonblocking_io/include/mpm.h 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/include/mpm.h 2005-09-22 12:27:57 UTC (rev 110)
@@ -92,7 +92,7 @@
struct mpm_module_t
{
char *name;
- void *funcs;
+ struct mpm_funcs_t *funcs;
};
Modified: branches/nonblocking_io/lib/mailstore.c
===================================================================
--- branches/nonblocking_io/lib/mailstore.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/lib/mailstore.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -22,9 +22,10 @@
*
*/
+#include "debug.h"
+#include "mailstore.h"
#include "misc.h"
#include "modules.h"
-#include "debug.h"
#include "string.h"
@@ -69,12 +70,14 @@
}
/* Check if we were found a module that can handle the mailstore */
+// NIO
+#if 0
if (storageCmds->canOpen(mailstore))
{
result = storageCmds;
break;
}
-
+#endif
item = g_list_next(item);
}
Modified: branches/nonblocking_io/modules/mpm/c10k/c10k.c
===================================================================
--- branches/nonblocking_io/modules/mpm/c10k/c10k.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/mpm/c10k/c10k.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -24,12 +24,21 @@
#include <errno.h>
+#include <glib.h>
+#include <netdb.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
#include "debug.h"
#include "mpm.h"
+/* List of servers we use */
+static GList *serverList = NULL;
+
+
+
/* Function to create a connection that will be passed down to the protocol handler */
static struct client_connection_t* createConnection(struct socket_data_t *socketData, int sockfd, char* remoteHost)
{
@@ -63,7 +72,7 @@
free(connection);
}
-
+#if 0
/* Start off connection */
static int handleClient(struct client_connection_t *connection)
{
@@ -83,8 +92,8 @@
return 0;
}
+#endif
-
static int c10k_linkProtocol(struct protocol_module_t *module, char *bindTo, int maxConns)
{
struct socket_data_t *socketData;
@@ -108,7 +117,7 @@
break;
case 2:
- D_PRINT(D_NOTICE,"Override listen port for %s to %i",module->name,module->listenPort);
+ D_PRINT(D_NOTICE,"Override listen port for %s to %i",module->name,socketData->listenPort);
break;
default:
@@ -175,9 +184,9 @@
/* Create socket... */
// Create the socket
- if ((sock=socket(PF_INET,SOCK_STREAM,0))< 0)
+ if ((sock = socket(PF_INET,SOCK_STREAM,0)) < 0)
{
- D_PRINT(D_FATAL,strerror(errno));
+ D_PRINT(D_FATAL,"Failed to create socket: %s",strerror(errno));
return D_FATAL;
}
// Set socket options
@@ -189,7 +198,7 @@
// Bind
if (bind(sock,(struct sockaddr*)&myaddr,(socklen_t) sizeof(myaddr))<0)
{
- D_PRINT(D_FATAL,"Error binding: %s",sys_errlist[errno]);
+ D_PRINT(D_FATAL,"Error binding: %s",strerror(errno));
return D_FATAL;
}
@@ -279,7 +288,7 @@
return D_FATAL;
}
/* Pass connection onto worker threads */
- handleClient(clientConnection);
+// handleClient(clientConnection);
}
/* Check next socket */
item = g_list_next(item);
Modified: branches/nonblocking_io/modules/mpm/mpm.c
===================================================================
--- branches/nonblocking_io/modules/mpm/mpm.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/mpm/mpm.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -132,7 +132,7 @@
}
/* Link protocol into MPM */
- mpm->linkProtocol(module,bindTo,maxConns);
+ mpm->funcs->linkProtocol(module,bindTo,maxConns);
return 0;
Modified: branches/nonblocking_io/modules/protocols/Makefile.am
===================================================================
--- branches/nonblocking_io/modules/protocols/Makefile.am 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/Makefile.am 2005-09-22 12:27:57 UTC (rev 110)
@@ -1 +1 @@
-SUBDIRS=imap4 pop3 smtp
+SUBDIRS=pop3
Modified: branches/nonblocking_io/modules/protocols/Makefile.in
===================================================================
--- branches/nonblocking_io/modules/protocols/Makefile.in 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/Makefile.in 2005-09-22 12:27:57 UTC (rev 110)
@@ -167,7 +167,7 @@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-SUBDIRS = imap4 pop3 smtp
+SUBDIRS = pop3
all: all-recursive
.SUFFIXES:
Modified: branches/nonblocking_io/modules/protocols/pop3/command_lexer.h
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/command_lexer.h 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/command_lexer.h 2005-09-22 12:27:57 UTC (rev 110)
@@ -67,7 +67,7 @@
/* Free command structure */
void freeCommandStruct(struct pop3_command_t *cmd);
/* Parse the SMTP command */
-int parseCommand(struct clientConnection_t *connection, char *str, struct pop3_command_t *cmd);
+int parseCommand(struct client_connection_t *connection, char *str, struct pop3_command_t *cmd);
Modified: branches/nonblocking_io/modules/protocols/pop3/command_parser.y
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/command_parser.y 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/command_parser.y 2005-09-22 12:27:57 UTC (rev 110)
@@ -205,7 +205,7 @@
}
/* Parse the POP3 command */
-int parseCommand(struct clientConnection_t *connection, char *str, struct pop3_command_t *cmd)
+int parseCommand(struct client_connection_t *connection, char *str, struct pop3_command_t *cmd)
{
struct command_scanner_t *scanner = malloc(sizeof(struct command_scanner_t));
int errID;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -33,19 +33,19 @@
#include <stdio.h>
#include <string.h>
#include "debug.h"
+#include "networkio.h"
#include "misc.h"
#include "mailstore.h"
#include "protocols.h"
-#include "socklib.h"
#include "pop3.h"
#include "pop3_cmds.h"
#include "command_lexer.h"
/* Some proto's we need */
-static int pop3_user_input(struct clientConnection_t *connection);
-static int pop3_cmd(struct clientConnection_t *connection);
-static int pop3_close(struct clientConnection_t *connection);
+static int pop3_user_input(struct client_connection_t *connection);
+static int pop3_cmd(struct client_connection_t *connection);
+static int pop3_close(struct client_connection_t *connection);
/* Static command type used below */
@@ -88,8 +88,9 @@
/* Startup function */
-static int pop3_startup(struct clientConnection_t *connection)
+static int pop3_startup(void *connectionData)
{
+ struct client_connection_t *connection = (struct client_connection_t *) connectionData;
struct pop3_data_t *data = malloc(sizeof(struct pop3_data_t));
@@ -133,7 +134,7 @@
/* Function to process user input */
-static int pop3_user_input(struct clientConnection_t *connection)
+static int pop3_user_input(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
@@ -148,7 +149,7 @@
/* Function to process user input */
-static int pop3_cmd(struct clientConnection_t *connection)
+static int pop3_cmd(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
int err;
@@ -228,7 +229,7 @@
/* Connection close function */
-static int pop3_close(struct clientConnection_t *connection)
+static int pop3_close(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
@@ -246,8 +247,9 @@
/* Main pop3 protocol handler */
-static int pop3_handler(struct clientConnection_t *connection)
+static int pop3_handler(void *connectionData)
{
+ struct client_connection_t *connection = (struct client_connection_t *) connectionData;
struct pop3_data_t *data = connection->data;
struct pop3_static_cmd_t *cmd = (struct pop3_static_cmd_t *) pop3_commands;
int ioState;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3.h
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3.h 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3.h 2005-09-22 12:27:57 UTC (rev 110)
@@ -33,9 +33,11 @@
#define POP3_H
#include "config.h"
+
#include <glib.h>
+
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
#define POP3_VERSION "0.0.1"
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_capa.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_capa.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_capa.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,7 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
/* List of POP3 capabilities */
@@ -76,7 +76,7 @@
/* CAPA continuation */
-int pop3_cmd_capa_cont(struct clientConnection_t *connection)
+int pop3_cmd_capa_cont(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
struct pop3_cmd_capa_t *cmdState;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_dele.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_dele.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_dele.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* DELE - RFC1939 page 8 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_list.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_list.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_list.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* LIST state */
@@ -121,7 +122,7 @@
/* LIST continuation */
-int pop3_cmd_list_cont(struct clientConnection_t *connection)
+int pop3_cmd_list_cont(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
struct pop3_cmd_list_t *cmdState;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_noop.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_noop.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_noop.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,7 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
/* NOOP - RFC1939 page 9 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_pass.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_pass.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_pass.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -28,13 +28,15 @@
#include "debug.h"
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
/* Callback from AUTH stuff */
static void pop3_auth_callback(AUTH_CALLBACK_PARAMS)
{
+// NIO
+#if 0
struct pop3_data_t *data = authInfo->client->data;
@@ -97,6 +99,7 @@
storage_msg_stats(data->msgList,STORE_ATTR_COUNT,STORE_MSG_ALL));
#endif
}
+#endif
}
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_quit.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_quit.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_quit.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,7 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
/* QUIT - RFC1939 section 4 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_retr.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_retr.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_retr.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* RETR state stuff */
@@ -88,7 +89,9 @@
}
cmdState = malloc(sizeof(struct pop3_cmd_retr_t));
- /* Open message */
+ /* Open message */
+// NIO
+#if 0
if ((cmdState->msgHandle = connection->storageCmds->msgOpen(data->mailboxHandle,message)))
{
snprintf(data->tmpBuf,data->tmpBufSize,"+OK %u octets"EOL,message->size);
@@ -107,6 +110,7 @@
free(cmdState);
goto end;
}
+#endif
}
else
snprintf(data->tmpBuf,data->tmpBufSize,
@@ -122,7 +126,7 @@
}
/* RETR continuation */
-int pop3_cmd_retr_cont(struct clientConnection_t *connection)
+int pop3_cmd_retr_cont(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
struct pop3_cmd_retr_t *cmdState;
@@ -138,7 +142,10 @@
D_PRINT(D_DEBUG,"Entering retr_cont");
+// NIO
+#if 0
res = connection->storageCmds->msgRead(cmdState->msgHandle,data->tmpBuf,data->tmpBufSize);
+#endif
/* If the entire message was retrieved mark it seen */
if (res == 0)
{
@@ -151,8 +158,11 @@
{
D_PRINT(D_DEBUG,"end of file");
+// NIO
+#if 0
connection->storageCmds->msgClose(cmdState->msgHandle);
-
+#endif
+
free(cmdState);
data->cmdHandle = NULL;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_rset.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_rset.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_rset.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* RSET - RFC1939 page 9 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_stat.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_stat.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_stat.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* STAT - RFC1939 page 6 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_top.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_top.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_top.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* TOP state stuff */
@@ -99,6 +100,8 @@
cmdState = malloc(sizeof(struct pop3_cmd_top_t));
/* Open message */
+// NIO
+#if 0
if ((cmdState->msgHandle = connection->storageCmds->msgOpen(data->mailboxHandle,message)))
{
snprintf(data->tmpBuf,data->tmpBufSize,"+OK Top of message follows"EOL);
@@ -116,7 +119,7 @@
free(cmdState);
goto end;
}
-
+#endif
}
else
snprintf(data->tmpBuf,data->tmpBufSize,
@@ -133,7 +136,7 @@
/* TOP continuation */
-int pop3_cmd_top_cont(struct clientConnection_t *connection)
+int pop3_cmd_top_cont(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
struct pop3_cmd_top_t *cmdState;
@@ -148,8 +151,10 @@
}
D_PRINT(D_DEBUG,"Entering top_cont");
-
+// NIO
+#if 0
res = connection->storageCmds->msgRead(cmdState->msgHandle,data->tmpBuf,data->tmpBufSize);
+#endif
/* If we got data, Number of lines left will decrease */
if (res > 0)
cmdState->lines--;
@@ -162,8 +167,10 @@
/* Handle other results */
if (res < 1 || cmdState->lines < 0)
{
+// NIO
+#if 0
connection->storageCmds->msgClose(cmdState->msgHandle);
-
+#endif
free(cmdState);
data->cmdHandle = NULL;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_uidl.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_uidl.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_uidl.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,8 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "mailstore.h"
+#include "networkio.h"
/* UIDL state stuff */
@@ -113,7 +114,7 @@
/* UIDL continuation */
-int pop3_cmd_uidl_cont(struct clientConnection_t *connection)
+int pop3_cmd_uidl_cont(struct client_connection_t *connection)
{
struct pop3_data_t *data = connection->data;
struct pop3_cmd_uidl_t *cmdState;
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_user.c
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_user.c 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmd_user.c 2005-09-22 12:27:57 UTC (rev 110)
@@ -26,7 +26,7 @@
#include <string.h>
#include "debug.h"
#include "pop3_cmds.h"
-#include "socklib.h"
+#include "networkio.h"
/* USER - RFC1939 page 5 */
Modified: branches/nonblocking_io/modules/protocols/pop3/pop3_cmds.h
===================================================================
--- branches/nonblocking_io/modules/protocols/pop3/pop3_cmds.h 2005-09-22 05:37:44 UTC (rev 109)
+++ branches/nonblocking_io/modules/protocols/pop3/pop3_cmds.h 2005-09-22 12:27:57 UTC (rev 110)
@@ -27,7 +27,7 @@
#define POP3_CMDS_H
#include "pop3.h"
-#include "socklib.h"
+#include "networkio.h"
@@ -70,8 +70,8 @@
#define POP3_ERROR_NONE 0
/* POP3 Command parameter definition */
-#define POP3_CMD_PARAMS struct clientConnection_t *connection, struct pop3_command_t *cmdStruct
-#define POP3_CMD_CONT_PARAMS struct clientConnection_t *connection
+#define POP3_CMD_PARAMS struct client_connection_t *connection, struct pop3_command_t *cmdStruct
+#define POP3_CMD_CONT_PARAMS struct client_connection_t *connection
#define POP3_CMD_INIT_PARAMS
/* Macros to make it easy to declare commands */
#define POP3_CMD(xxx) \
|