Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
zend_extensions.h File Reference
#include "zend_compile.h"
#include "zend_build.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _zend_extension_version_info
struct  _zend_extension

Defines

#define ZEND_EXTENSION_API_NO   220090626
#define ZEND_EXTENSION_BUILD_ID   "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
#define ZEND_EXTMSG_NEW_EXTENSION   1
#define ZEND_EXTENSION()   ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID }
#define STANDARD_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
#define COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
#define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1

Typedefs

typedef struct
_zend_extension_version_info 
zend_extension_version_info
typedef struct _zend_extension
typedef int(* startup_func_t )(zend_extension *extension)
typedef void(* shutdown_func_t )(zend_extension *extension)
typedef void(* activate_func_t )(void)
typedef void(* deactivate_func_t )(void)
typedef void(* message_handler_func_t )(int message, void *arg)
typedef void(* op_array_handler_func_t )(zend_op_array *op_array)
typedef void(* statement_handler_func_t )(zend_op_array *op_array)
typedef void(* fcall_begin_handler_func_t )(zend_op_array *op_array)
typedef void(* fcall_end_handler_func_t )(zend_op_array *op_array)
typedef void(* op_array_ctor_func_t )(zend_op_array *op_array)
typedef void(* op_array_dtor_func_t )(zend_op_array *op_array)

Functions

ZEND_API int zend_get_resource_handle (zend_extension *extension)
ZEND_API void zend_extension_dispatch_message (int message, void *arg)
void zend_extension_dtor (zend_extension *extension)
void zend_append_version_info (const zend_extension *extension)
int zend_startup_extensions_mechanism (void)
int zend_startup_extensions (void)
void zend_shutdown_extensions (TSRMLS_D)
ZEND_API int zend_load_extension (const char *path)
ZEND_API int zend_register_extension (zend_extension *new_extension, DL_HANDLE handle)
ZEND_API zend_extension * zend_get_extension (const char *extension_name)

Variables

ZEND_API zend_llist zend_extensions

Class Documentation

struct _zend_extension_version_info

Definition at line 33 of file zend_extensions.h.

Class Members
char * build_id
int zend_extension_api_no

Define Documentation

Definition at line 108 of file zend_extensions.h.

Definition at line 107 of file zend_extensions.h.

Definition at line 106 of file zend_extensions.h.

#define ZEND_EXTENSION ( )    ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID }

Definition at line 103 of file zend_extensions.h.

#define ZEND_EXTENSION_API_NO   220090626

Definition at line 31 of file zend_extensions.h.

Definition at line 38 of file zend_extensions.h.

#define ZEND_EXTMSG_NEW_EXTENSION   1

Definition at line 100 of file zend_extensions.h.


Typedef Documentation

typedef struct _zend_extension

Definition at line 40 of file zend_extensions.h.

typedef void(* activate_func_t)(void)

Definition at line 45 of file zend_extensions.h.

typedef void(* deactivate_func_t)(void)

Definition at line 46 of file zend_extensions.h.

typedef void(* fcall_begin_handler_func_t)(zend_op_array *op_array)

Definition at line 53 of file zend_extensions.h.

typedef void(* fcall_end_handler_func_t)(zend_op_array *op_array)

Definition at line 54 of file zend_extensions.h.

typedef void(* message_handler_func_t)(int message, void *arg)

Definition at line 48 of file zend_extensions.h.

typedef void(* op_array_ctor_func_t)(zend_op_array *op_array)

Definition at line 56 of file zend_extensions.h.

typedef void(* op_array_dtor_func_t)(zend_op_array *op_array)

Definition at line 57 of file zend_extensions.h.

typedef void(* op_array_handler_func_t)(zend_op_array *op_array)

Definition at line 50 of file zend_extensions.h.

typedef void(* shutdown_func_t)(zend_extension *extension)

Definition at line 44 of file zend_extensions.h.

typedef int(* startup_func_t)(zend_extension *extension)

Definition at line 43 of file zend_extensions.h.

typedef void(* statement_handler_func_t)(zend_op_array *op_array)

Definition at line 52 of file zend_extensions.h.


Function Documentation

void zend_append_version_info ( const zend_extension *  extension)

Definition at line 819 of file zend.c.

{
       char *new_info;
       uint new_info_length;

       new_info_length = sizeof("    with  v, , by \n")
                                          + strlen(extension->name)
                                          + strlen(extension->version)
                                          + strlen(extension->copyright)
                                          + strlen(extension->author);

       new_info = (char *) malloc(new_info_length + 1);

       snprintf(new_info, new_info_length, "    with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);

       zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1);
       strncat(zend_version_info, new_info, new_info_length);
       zend_version_info_length += new_info_length;
       free(new_info);
}

Here is the caller graph for this function:

ZEND_API void zend_extension_dispatch_message ( int  message,
void *  arg 
)

Definition at line 211 of file zend_extensions.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void zend_extension_dtor ( zend_extension *  extension)

Definition at line 187 of file zend_extensions.c.

{
#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
       if (extension->handle) {
              DL_UNLOAD(extension->handle);
       }
#endif
}

Here is the caller graph for this function:

ZEND_API zend_extension* zend_get_extension ( const char *  extension_name)

Definition at line 230 of file zend_extensions.c.

{
       zend_llist_element *element;

       for (element = zend_extensions.head; element; element = element->next) {
              zend_extension *extension = (zend_extension *) element->data;

              if (!strcmp(extension->name, extension_name)) {
                     return extension;
              }
       }
       return NULL;
}
ZEND_API int zend_get_resource_handle ( zend_extension *  extension)

Definition at line 219 of file zend_extensions.c.

{
       if (last_resource_number<ZEND_MAX_RESERVED_RESOURCES) {
              extension->resource_number = last_resource_number;
              return last_resource_number++;
       } else {
              return -1;
       }
}
ZEND_API int zend_load_extension ( const char *  path)

Definition at line 27 of file zend_extensions.c.

{
#if ZEND_EXTENSIONS_SUPPORT
       DL_HANDLE handle;
       zend_extension *new_extension;
       zend_extension_version_info *extension_version_info;

       handle = DL_LOAD(path);
       if (!handle) {
#ifndef ZEND_WIN32
              fprintf(stderr, "Failed loading %s:  %s\n", path, DL_ERROR());
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
              fflush(stderr);
#endif
#else
              fprintf(stderr, "Failed loading %s\n", path);
#endif
              return FAILURE;
       }

       extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
       if (!extension_version_info) {
              extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "_extension_version_info");
       }
       new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
       if (!new_extension) {
              new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "_zend_extension_entry");
       }
       if (!extension_version_info || !new_extension) {
              fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
              fflush(stderr);
#endif
              DL_UNLOAD(handle);
              return FAILURE;
       }


       /* allow extension to proclaim compatibility with any Zend version */
       if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
              if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
                     fprintf(stderr, "%s requires Zend Engine API version %d.\n"
                                   "The Zend Engine API version %d which is installed, is outdated.\n\n",
                                   new_extension->name,
                                   extension_version_info->zend_extension_api_no,
                                   ZEND_EXTENSION_API_NO);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
                     fflush(stderr);
#endif
                     DL_UNLOAD(handle);
                     return FAILURE;
              } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
                     fprintf(stderr, "%s requires Zend Engine API version %d.\n"
                                   "The Zend Engine API version %d which is installed, is newer.\n"
                                   "Contact %s at %s for a later version of %s.\n\n",
                                   new_extension->name,
                                   extension_version_info->zend_extension_api_no,
                                   ZEND_EXTENSION_API_NO,
                                   new_extension->author,
                                   new_extension->URL,
                                   new_extension->name);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
                     fflush(stderr);
#endif
                     DL_UNLOAD(handle);
                     return FAILURE;
              }
       } else if (strcmp(ZEND_EXTENSION_BUILD_ID, extension_version_info->build_id) &&
                  (!new_extension->build_id_check || new_extension->build_id_check(ZEND_EXTENSION_BUILD_ID) != SUCCESS)) {
              fprintf(stderr, "Cannot load %s - it was built with configuration %s, whereas running engine is %s\n",
                                   new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
              fflush(stderr);
#endif
              DL_UNLOAD(handle);
              return FAILURE;
       }

       return zend_register_extension(new_extension, handle);
#else
       fprintf(stderr, "Extensions are not supported on this platform.\n");
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
       fflush(stderr);
#endif
       return FAILURE;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zend_register_extension ( zend_extension *  new_extension,
DL_HANDLE  handle 
)

Definition at line 122 of file zend_extensions.c.

{
#if ZEND_EXTENSIONS_SUPPORT
       zend_extension extension;

       extension = *new_extension;
       extension.handle = handle;

       zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);

       zend_llist_add_element(&zend_extensions, &extension);

       /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
#endif

       return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 180 of file zend_extensions.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 173 of file zend_extensions.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file zend_extensions.c.

{
       /* Startup extensions mechanism */
       zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
       last_resource_number = 0;
       return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 24 of file zend_extensions.c.