]> granicus.if.org Git - php/commitdiff
(Removed Makefile, added accidentally.)
authorMark L. Woodward <mlwmohawk@php.net>
Thu, 20 Sep 2001 12:21:01 +0000 (12:21 +0000)
committerMark L. Woodward <mlwmohawk@php.net>
Thu, 20 Sep 2001 12:21:01 +0000 (12:21 +0000)
Eliminated mod_msession in ext/session, and moved that code into msesion.c

ext/msession/Makefile [deleted file]
ext/msession/msession.c
ext/msession/reqclient.h

diff --git a/ext/msession/Makefile b/ext/msession/Makefile
deleted file mode 100644 (file)
index 8464c95..0000000
+++ /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
index 64c3bd609d576bdfa2a9d0607d8150792128e995..924f48043fc693fd5c4564c1a08ed344a3a6487b 100644 (file)
@@ -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        |
 #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 */
index f5a9dedeef0f81b03b6a0c6caccdf523dfb3140d..de6c3c3881c57f519b8fb5cdacfe939e75e8d909 100644 (file)
@@ -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);