本文整理汇总了C++中PluginInfo::pluginFlowConf方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::pluginFlowConf方法的具体用法?C++ PluginInfo::pluginFlowConf怎么用?C++ PluginInfo::pluginFlowConf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInfo
的用法示例。
在下文中一共展示了PluginInfo::pluginFlowConf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPlugin
static void loadPlugin(char *dirName, char *pluginName) {
char pluginPath[256];
PluginInfo* pluginInfo;
#ifndef MAKE_STATIC_PLUGINS
#ifndef WIN32
void *pluginPtr = NULL;
void *pluginEntryFctnPtr;
PluginInfo* (*pluginJumpFunc)(void);
#endif
#endif
int i;
snprintf(pluginPath, sizeof(pluginPath), "%s/%s", dirName != NULL ? dirName : ".", pluginName);
#ifndef MAKE_STATIC_PLUGINS
pluginPtr = (void*)dlopen(pluginPath, RTLD_NOW /* RTLD_LAZY */); /* Load the library */
if(pluginPtr == NULL) {
traceEvent(TRACE_WARNING, "Unable to load plugin '%s'", pluginPath);
traceEvent(TRACE_WARNING, "Message is '%s'", dlerror());
return;
} else
traceEvent(TRACE_INFO, "Loaded '%s'", pluginPath);
pluginEntryFctnPtr = (void*)dlsym(pluginPtr, "PluginEntryFctn");
if(pluginEntryFctnPtr == NULL) {
#ifdef WIN32
traceEvent(TRACE_WARNING, "Unable to locate plugin '%s' entry function [%li]",
pluginPath, GetLastError());
#else
traceEvent(TRACE_WARNING, "Unable to locate plugin '%s' entry function [%s]",
pluginPath, dlerror());
#endif /* WIN32 */
return;
}
pluginJumpFunc = (PluginInfo*(*)(void))pluginEntryFctnPtr;
pluginInfo = pluginJumpFunc();
#else /* MAKE_STATIC_PLUGINS */
if(strcmp(pluginName, "sipPlugin") == 0)
pluginInfo = sipPluginEntryFctn();
else if(strcmp(pluginName, "rtpPlugin") == 0)
pluginInfo = rtpPluginEntryFctn();
else if(strcmp(pluginName, "dumpPlugin") == 0)
pluginInfo = dumpPluginEntryFctn();
else if(strcmp(pluginName, "httpPlugin") == 0)
pluginInfo = httpPluginEntryFctn();
else if(strcmp(pluginName, "smtpPlugin") == 0)
pluginInfo = smtpPluginEntryFctn();
else if(strcmp(pluginName, "dbPlugin") == 0)
pluginInfo = dbPluginEntryFctn();
else if(strcmp(pluginName, "bgpPlugin") == 0)
pluginInfo = bgpPluginEntryFctn();
else if(strcmp(pluginName, "mysqlPlugin") == 0)
pluginInfo = mysqlPluginEntryFctn();
#ifdef WIN32
else if(strcmp(pluginName, "processPlugin") == 0)
pluginInfo = processPluginEntryFctn();
#endif
else {
pluginInfo = NULL;
traceEvent(TRACE_WARNING, "Missing entrypoint for plugin '%s'", pluginName);
}
#endif /* MAKE_STATIC_PLUGINS */
if(pluginInfo != NULL) {
if(strcmp(pluginInfo->nprobe_revision, nprobe_revision)) {
traceEvent(TRACE_WARNING, "Plugin %s (%s/%s) version mismatch [loaded=%s][expected=%s]: discarded",
pluginInfo->name, dirName, pluginName,
pluginInfo->nprobe_revision, nprobe_revision);
return;
}
if(plugin_sanity_check(pluginInfo->name, pluginInfo->pluginFlowConf(),
"standard templates", ver9_templates) == -1) {
traceEvent(TRACE_WARNING, "Plugin %s/%s will be ignored", dirName, pluginName);
} else {
int rc = 0;
for(i=0; i<num_plugins; i++) {
rc = plugin_sanity_check(pluginInfo->name, pluginInfo->pluginFlowConf(),
all_plugins[i]->name, all_plugins[i]->pluginFlowConf());
if(rc != 0) break;
}
if(rc == 0) {
if(pluginInfo != NULL)
all_plugins[num_plugins++] = pluginInfo; /* FIX : add PluginInfo to the list */
} else {
traceEvent(TRACE_WARNING, "Plugin %s/%s will be ignored", dirName, pluginName);
}
}
}
}