Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

plugin.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  * Verball Model Storage Library, Common Information Model Library 
00004  * for integration of Intelligent Services.
00005  * Copyright (C) 2005 Nikita Vinokurov, Orgway LLC.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; 
00010  * version 2.1 of the License.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA  02110-1301  USA
00021  *
00022  * $Id: plugin.h,v 1.25 2006/12/23 20:30:24 yagel Exp $
00023  **********************************************************************/
00024 
00025 
00026 #ifndef _PLUGIN_H_
00027 #define _PLUGIN_H_
00028 
00029 #include "msint.h"
00030 #include "stmt/simplelist.h"
00031 #include "stmt/statement.h"
00032 
00033 
00034 #if defined(_WIN32) || defined(__declspec)
00035 
00036 #define PLUGIN_STORAGE_TYPE __declspec(dllexport)
00037 #else
00038 #define PLUGIN_STORAGE_TYPE extern
00039 #endif
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif /* __cplusplus */
00044 
00045 
00049 typedef struct _MSPlugin MSPlugin;
00050 typedef struct _MSInstance MSInstance;
00051 typedef struct _MSInterface MSInterface;
00052 typedef struct _StmtList StmtList;
00053 typedef struct _PluginFunc PluginFunc;
00054 
00057 typedef enum {
00061     PLUGIN_TYPE_SETRULE,
00066     PLUGIN_TYPE_GETRULE,
00072     PLUGIN_TYPE_GETGENRULE,
00077     PLUGIN_TYPE_GETFILRULE,
00079     PLUGIN_TYPE_IFUNCTION,
00081     PLUGIN_TYPE_BEFORESETRULE,
00083     PLUGIN_TYPE_AFTERSETRULE,
00085     PLUGIN_TYPE_GETPOSTRULE,
00087     PLUGIN_TYPE_AFTERRESTORERULE,
00088 
00089 } PluginFuncType;   
00090 
00091 
00093 typedef enum {
00095     PLUGIN_RESP_CONTINUE,
00097     PLUGIN_RESP_STOP,
00099     PLUGIN_RESP_BLOCK,
00100 
00101 } PluginResp;
00102 
00105 typedef struct _PluginArg {
00106 
00108     ModelStorage *msi;
00113     MSTxn *txn;
00116     const Statement *mask;
00119     Statement *stmt;
00122     Statement *result;
00127     void *private_data;
00128 
00131     void *data;
00132 
00133 } PluginArg;
00134 
00135 
00137 struct _PluginFunc {
00139     MSPlugin *plugin;
00140     PluginFuncType type; 
00141     union {
00142         int (*BeforeSet)     (PluginArg * arg, PluginResp *resp);
00143         int (*AfterSet)      (PluginArg * arg, PluginResp *resp);
00144         int (*GetGenerate)   (PluginArg * arg, PluginResp *resp);
00145         int (*GetFilter)     (PluginArg * arg, PluginResp *resp);
00146         int (*GetPost)       (PluginArg * arg, PluginResp *resp);
00147         int (*AfterRestore)  (Statement *stmt, void *private_data);
00148     };
00149     int prio; 
00150     int enabled; 
00151 };
00152 
00153 
00156 struct _MSInterface {
00157     int (*ms_set_statement)    (MSInstance *msi, Statement *s);
00158     int (*ms_get_statements)   (MSInstance *msi, Statement *mask, StmtList *result);
00159     int (*ms_get_statements_ex)(MSInstance *msi, Statement *mask, StmtList *result, struct _PluginFunc *exclude);
00160     int (*ms_set_statement_ex) (MSInstance *msi, Statement *mask, StmtList *result, struct _PluginFunc *exclude);
00161     int (*ms_txn_begin)        (MSInstance *msi);
00162     int (*ms_txn_commit)       (MSInstance *msi);
00163     int (*ms_txn_rollback)     (MSInstance *msi); 
00164 
00165 };
00166 
00167 
00173 struct _MSPlugin {
00174 
00179     int (*axioms)(Statement **axioms, void *private_data);
00180 
00182     int (*post_init)(ModelStorageEnv *env, void *private_data);
00183     
00185     int (*get_functions)(PluginFunc **funcs, int *count);
00186     
00190     int (*cleanup)( void **private_data );
00191 
00193     int (*dump)(FILE *stream, void *private_data);
00194 
00200     int (*restore)(unsigned int magic, FILE *stream, void **private_data);
00201     
00202 
00207     int prio;
00208     unsigned int magic;
00210     const char *name;
00212     const char *description;
00214     const char *vendor;
00216     const char *version;
00218     const char *id;
00219     void *private_data;
00220     int vital; 
00221     int _enabled;
00222 
00223 
00224 };
00225 
00226 
00229 PLUGIN_STORAGE_TYPE MSPlugin plug_initialize(void);
00230 
00231 
00232 #ifdef __cplusplus
00233 }
00234 #endif /* __cplusplus */
00235 
00236 #endif //_PLUGIN_H_
00237 

Generated on Wed Dec 27 16:52:17 2006 for VRB Online Server by  doxygen 1.4.4