Back to index

php5  5.3.10
Defines | Functions | Variables
mod_user.c File Reference
#include "php.h"
#include "php_session.h"
#include "mod_user.h"

Go to the source code of this file.

Defines

#define SESS_ZVAL_LONG(val, a)
#define SESS_ZVAL_STRING(vl, a)
#define SESS_ZVAL_STRINGN(vl, ln, a)
#define STDVARS1
#define STDVARS
#define PSF(a)   PS(mod_user_names).name.ps_##a
#define FINISH

Functions

static zval * ps_call_handler (zval *func, int argc, zval **argv TSRMLS_DC)
 PS_OPEN_FUNC (user)
 PS_CLOSE_FUNC (user)
 PS_READ_FUNC (user)
 PS_WRITE_FUNC (user)
 PS_DESTROY_FUNC (user)
 PS_GC_FUNC (user)

Variables

ps_module ps_mod_user

Define Documentation

#define FINISH
Value:
if (retval) {                                           \
              convert_to_long(retval);                  \
              ret = Z_LVAL_P(retval);                          \
              zval_ptr_dtor(&retval);                          \
       }                                                                     \
       return ret

Definition at line 76 of file mod_user.c.

#define PSF (   a)    PS(mod_user_names).name.ps_##a

Definition at line 74 of file mod_user.c.

#define SESS_ZVAL_LONG (   val,
 
)
Value:
{                                                                                          \
       MAKE_STD_ZVAL(a);                                                     \
       ZVAL_LONG(a, val);                                                    \
}

Definition at line 29 of file mod_user.c.

#define SESS_ZVAL_STRING (   vl,
 
)
Value:
{                                                                                          \
       char *__vl = vl;                                                      \
       SESS_ZVAL_STRINGN(__vl, strlen(__vl), a);        \
}

Definition at line 35 of file mod_user.c.

#define SESS_ZVAL_STRINGN (   vl,
  ln,
 
)
Value:
{                                                                                          \
       MAKE_STD_ZVAL(a);                                                     \
       ZVAL_STRINGL(a, vl, ln, 1);                                    \
}

Definition at line 41 of file mod_user.c.

#define STDVARS
Value:
STDVARS1;                                                      \
       char *mdata = PS_GET_MOD_DATA();          \
       if (!mdata) { return FAILURE; }

Definition at line 69 of file mod_user.c.

#define STDVARS1
Value:
zval *retval;                                           \
       int ret = FAILURE

Definition at line 65 of file mod_user.c.


Function Documentation

static zval* ps_call_handler ( zval *  func,
int  argc,
zval **argv  TSRMLS_DC 
) [static]

Definition at line 47 of file mod_user.c.

{
       int i;
       zval *retval = NULL;

       MAKE_STD_ZVAL(retval);
       if (call_user_function(EG(function_table), NULL, func, retval, argc, argv TSRMLS_CC) == FAILURE) {
              zval_ptr_dtor(&retval);
              retval = NULL;
       }

       for (i = 0; i < argc; i++) {
              zval_ptr_dtor(&argv[i]);
       }

       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PS_CLOSE_FUNC ( user  )

Definition at line 106 of file mod_user.c.

Here is the call graph for this function:

PS_DESTROY_FUNC ( user  )

Definition at line 151 of file mod_user.c.

{
       zval *args[1];
       STDVARS;

       SESS_ZVAL_STRING((char*)key, args[0]);

       retval = ps_call_handler(PSF(destroy), 1, args TSRMLS_CC);

       FINISH;
}

Here is the call graph for this function:

PS_GC_FUNC ( user  )

Definition at line 163 of file mod_user.c.

{
       zval *args[1];
       STDVARS;

       SESS_ZVAL_LONG(maxlifetime, args[0]);

       retval = ps_call_handler(PSF(gc), 1, args TSRMLS_CC);

       FINISH;
}

Here is the call graph for this function:

PS_OPEN_FUNC ( user  )

Definition at line 84 of file mod_user.c.

{
       zval *args[2];
       static char dummy = 0;
       STDVARS1;

       SESS_ZVAL_STRING((char*)save_path, args[0]);
       SESS_ZVAL_STRING((char*)session_name, args[1]);

       retval = ps_call_handler(PSF(open), 2, args TSRMLS_CC);
       if (retval) {
              /* This is necessary to fool the session module. Yes, it's safe to
               * use a static. Neither mod_user nor the session module itself will
               * ever touch this pointer. It could be set to 0xDEADBEEF for all the
               * difference it makes, but for the sake of paranoia it's set to some
               * valid value. */
              PS_SET_MOD_DATA(&dummy);
       }

       FINISH;
}

Here is the call graph for this function:

PS_READ_FUNC ( user  )

Definition at line 117 of file mod_user.c.

{
       zval *args[1];
       STDVARS;

       SESS_ZVAL_STRING((char*)key, args[0]);

       retval = ps_call_handler(PSF(read), 1, args TSRMLS_CC);

       if (retval) {
              if (Z_TYPE_P(retval) == IS_STRING) {
                     *val = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
                     *vallen = Z_STRLEN_P(retval);
                     ret = SUCCESS;
              }
              zval_ptr_dtor(&retval);
       }

       return ret;
}

Here is the call graph for this function:

PS_WRITE_FUNC ( user  )

Definition at line 138 of file mod_user.c.

{
       zval *args[2];
       STDVARS;

       SESS_ZVAL_STRING((char*)key, args[0]);
       SESS_ZVAL_STRINGN((char*)val, vallen, args[1]);

       retval = ps_call_handler(PSF(write), 2, args TSRMLS_CC);

       FINISH;
}

Here is the call graph for this function:


Variable Documentation

Initial value:
 {

}

Definition at line 25 of file mod_user.c.