00001 /** @file 00002 00003 Plugin init declarations 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 #ifndef __PLUGIN_H__ 00025 #define __PLUGIN_H__ 00026 00027 #include "List.h" 00028 00029 // need to keep syncronized with TSSDKVersion 00030 // in ts/ts.h.in 00031 typedef enum 00032 { 00033 PLUGIN_SDK_VERSION_UNKNOWN = -1, 00034 PLUGIN_SDK_VERSION_2_0, 00035 PLUGIN_SDK_VERSION_3_0, 00036 PLUGIN_SDK_VERSION_4_0 00037 } PluginSDKVersion; 00038 00039 struct PluginRegInfo 00040 { 00041 PluginRegInfo(); 00042 ~PluginRegInfo(); 00043 00044 bool plugin_registered; 00045 char *plugin_path; 00046 00047 PluginSDKVersion sdk_version; 00048 char *plugin_name; 00049 char *vendor_name; 00050 char *support_email; 00051 00052 LINK(PluginRegInfo, link); 00053 }; 00054 00055 // Plugin registration vars 00056 extern DLL<PluginRegInfo> plugin_reg_list; 00057 extern PluginRegInfo *plugin_reg_current; 00058 00059 void plugin_init(void); 00060 00061 /** Abstract interface class for plugin based continuations. 00062 00063 The primary intended use of this is for logging so that continuations 00064 that generate logging messages can generate plugin local data in a 00065 generic way. 00066 00067 The core will at appropriate times dynamically cast the continuation 00068 to this class and if successful access the plugin data via these 00069 methods. 00070 00071 Plugins should mix this in to continuations for which it is useful. 00072 The default implementations return empty / invalid responses and should 00073 be overridden by the plugin. 00074 */ 00075 class PluginIdentity 00076 { 00077 public: 00078 /// Make sure destructor is virtual. 00079 virtual ~PluginIdentity() {} 00080 00081 /** Get the plugin tag. 00082 The returned string must have a lifetime at least as long as the plugin. 00083 @return A string identifying the plugin or @c NULL. 00084 */ 00085 virtual char const* getPluginTag() const { return NULL; } 00086 /** Get the plugin instance ID. 00087 A plugin can create multiple subsidiary instances. This is used as the 00088 identifier for those to distinguish the instances. 00089 */ 00090 virtual int64_t getPluginId() const { return 0; } 00091 }; 00092 00093 #endif /* __PLUGIN_H__ */