summaryrefslogtreecommitdiff
path: root/ext/msession
diff options
context:
space:
mode:
authorMark L. Woodward <mlwmohawk@php.net>2001-09-20 12:21:01 +0000
committerMark L. Woodward <mlwmohawk@php.net>2001-09-20 12:21:01 +0000
commitd1a1ef3d9b88df38827e2d508e21cdd704b1491f (patch)
treeeacabc9fdd21d80890801ef4f620c0cf81cac018 /ext/msession
parentf45555e62f578854b5862e6a3b84c0a21a053850 (diff)
downloadphp-git-d1a1ef3d9b88df38827e2d508e21cdd704b1491f.tar.gz
(Removed Makefile, added accidentally.)
Eliminated mod_msession in ext/session, and moved that code into msesion.c
Diffstat (limited to 'ext/msession')
-rw-r--r--ext/msession/Makefile16
-rw-r--r--ext/msession/msession.c84
-rw-r--r--ext/msession/reqclient.h4
3 files changed, 81 insertions, 23 deletions
diff --git a/ext/msession/Makefile b/ext/msession/Makefile
deleted file mode 100644
index 8464c95a7d..0000000000
--- a/ext/msession/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-top_srcdir = /local/projects/php/php4
-top_builddir = /local/projects/php/php4
-srcdir = /local/projects/php/php4/ext/msession
-builddir = /local/projects/php/php4/ext/msession
-VPATH = /local/projects/php/php4/ext/msession
-# $Id$
-
-LTLIBRARY_NAME = libmsession.la
-LTLIBRARY_SOURCES = msession.c
-LTLIBRARY_SHARED_NAME = msession.la
-
-LTLIBRARY_SHARED_LIBADD = $(PHOENIX_LIB)
-
-EXTRA_INCLUDES = $(PHOENIX_INCLUDE)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/msession/msession.c b/ext/msession/msession.c
index 64c3bd609d..924f48043f 100644
--- a/ext/msession/msession.c
+++ b/ext/msession/msession.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| msession 1.0 |
+----------------------------------------------------------------------+
- | Copyright (c) 2001 Mark L. Woodward (Mohawk Software) |
+ | Copyright (c) 1997-2001 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -20,10 +20,34 @@
#include "php_ini.h"
#include "php_msession.h"
#include "reqclient.h"
+#include "../session/php_session.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+// #define ERR_DEBUG
+
+#ifdef ERR_DEBUG
+#define ELOG( str ) php_log_err( str )
+#else
+#define ELOG( str )
+#endif
+
+char g_msession[]="Msession";
#if HAVE_MSESSION
+PS_FUNCS(msession);
+
+ps_module ps_mod_msession = {
+ PS_MOD(msession)
+};
+
// #define ERR_DEBUG
/* If you declare any globals in php_msession.h uncomment this:
@@ -97,6 +121,8 @@ PHP_MINIT_FUNCTION(msession)
g_conn = NULL;
g_host = g_defhost;
+ php_session_register_module(&ps_mod_msession);
+
return SUCCESS;
}
@@ -160,7 +186,7 @@ PHP_FUNCTION(confirm_msession_compiled)
g_port);
RETURN_STRINGL(string, len, 1);
}
-int PHPMsessionConnect(char *szhost, int nport)
+int PHPMsessionConnect(const char *szhost, int nport)
{
if(!g_reqb)
g_reqb = AllocateRequestBuffer(2048);
@@ -209,7 +235,7 @@ void PHPMsessionDisconnect()
}
}
-char *PHPMsessionGetData(char *session)
+char *PHPMsessionGetData(const char *session)
{
char *ret = NULL;
@@ -229,7 +255,7 @@ char *PHPMsessionGetData(char *session)
ret = safe_estrdup(g_reqb->req.datum);
return ret;
}
-int PHPMsessionSetData(char *session, char *data)
+int PHPMsessionSetData(const char *session, const char *data)
{
int ret=0;
#ifdef ERR_DEBUG
@@ -246,7 +272,7 @@ int PHPMsessionSetData(char *session, char *data)
return ret;
}
-int PHPMsessionDestroy(char *session)
+int PHPMsessionDestroy(const char *session)
{
int ret=0;
if(!g_reqb)
@@ -799,4 +825,52 @@ PHP_FUNCTION(msession_setdata)
}
}
+PS_OPEN_FUNC(msession)
+{
+ ELOG( "ps_open_msession");
+ PS_SET_MOD_DATA((void *)1); // session.c needs a non-zero here!
+ return PHPMsessionConnect(save_path, 8086) ? SUCCESS : FAILURE;
+}
+
+PS_CLOSE_FUNC(msession)
+{
+ PHPMsessionDisconnect();
+ ELOG( "ps_close_msession");
+ return SUCCESS;
+}
+
+PS_READ_FUNC(msession)
+{
+ ELOG( "ps_read_msession");
+ *val = PHPMsessionGetData(key);
+ if(*val)
+ {
+ *vallen = strlen(*val);
+ }
+ else
+ {
+ *val = emalloc(1);
+ **val=0;
+ *vallen = 0;
+ }
+ return SUCCESS;
+}
+
+PS_WRITE_FUNC(msession)
+{
+ ELOG( "ps_write_msession");
+ return (PHPMsessionSetData(key,val)) ? SUCCESS : FAILURE;
+}
+
+PS_DESTROY_FUNC(msession)
+{
+ ELOG( "ps_destroy_msession");
+ return (PHPMsessionDestroy(key)) ? SUCCESS : FAILURE;
+}
+
+PS_GC_FUNC(msession)
+{
+ ELOG( "ps_gc_msession");
+ return SUCCESS;
+}
#endif /* HAVE_MSESSION */
diff --git a/ext/msession/reqclient.h b/ext/msession/reqclient.h
index f5a9dedeef..de6c3c3881 100644
--- a/ext/msession/reqclient.h
+++ b/ext/msession/reqclient.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| msession 1.0 |
+----------------------------------------------------------------------+
- | Copyright (c) 2001 Mark L. Woodward (Mohawk Software) |
+ | Copyright (c) 1997-2001 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -82,7 +82,7 @@ void FreeRequestBuffer(REQB *req);
REQB *SizeRequestBuffer(REQB *req, unsigned int size);
REQB *StaticRequestBuffer(char *buffer, unsigned int cb);
-int FormatRequest(REQB **buffer, int stat, char *session, char *name, char *value, int param);
+int FormatRequest(REQB **buffer, int stat, const char *session, const char *name, const char *value, int param);
int FormatRequestMulti(REQB **buffer, int stat, char *session, int n, char **pairs, int param);
int DoSingleRequest(char *hostname, int port, REQB **preq);
void *OpenReqConn(char *hostname, int port);