summaryrefslogtreecommitdiff
path: root/include/extension.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-09 15:02:22 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-09 15:02:22 -0700
commite220af8dc07d845efb81082f3159460406ece9ca (patch)
tree0730a4d27a0aea3e826674c237cb581b56a9dcdc /include/extension.h
parent49e349c494e0134570a158e56ba8b5b9f26b94f6 (diff)
work in progress
Diffstat (limited to 'include/extension.h')
-rw-r--r--include/extension.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/include/extension.h b/include/extension.h
index 5dabb8e..ad00593 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -11,8 +11,8 @@
* as module in a webserver) many requests are handled by the same extension
* instance.
*
- * This is a template class. You need to pass in the type of an object
- * that you use for storing request specific state information.
+ * This is a template class. You need to pass in the type of an object
+ * that you use for storing request specific state information.
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013 Copernica BV
@@ -29,6 +29,20 @@ struct _zend_module_entry;
namespace Php {
/**
+ * A couple of predefined native callback functions that can be registered.
+ * These are functions that optional accept a Request and/or Parameters object,
+ * and that either return void or a Value object.
+ */
+typedef void (*native_callback_0)();
+typedef void (*native_callback_1)(Parameters &);
+typedef void (*native_callback_2)(Request &);
+typedef void (*native_callback_3)(Request &, Parameters &);
+typedef Value (*native_callback_4)();
+typedef Value (*native_callback_5)(Parameters &);
+typedef Value (*native_callback_6)(Request &);
+typedef Value (*native_callback_7)(Request &, Parameters &);
+
+/**
* Class definition
*/
class Extension
@@ -159,6 +173,21 @@ public:
Function &add(const char *name, const Function &function);
/**
+ * Add a native function directly to the extension
+ * @param name Name of the function
+ * @param function The function to add
+ * @return Function The added function
+ */
+ Function &add(const char *name, native_callback_0 function);
+ Function &add(const char *name, native_callback_1 function);
+ Function &add(const char *name, native_callback_2 function);
+ Function &add(const char *name, native_callback_3 function);
+ Function &add(const char *name, native_callback_4 function);
+ Function &add(const char *name, native_callback_5 function);
+ Function &add(const char *name, native_callback_6 function);
+ Function &add(const char *name, native_callback_7 function);
+
+ /**
* Retrieve the module entry
*
* This is the memory address that should be exported by the get_module()