static int start(void *d){
    eml_parser_data *data=(eml_parser_data *)d;

    //Dinamyc plugin initialization
    if (cp_define_symbol(data->ctx, "es_uvigo_ei_header", data->parsers[0])==CP_OK &&
        cp_define_symbol(data->ctx, "es_uvigo_ei_body", data->parsers[1])==CP_OK &&
        cp_define_symbol(data->ctx, "es_uvigo_ei_full", data->parsers[2])==CP_OK )
       return CP_OK;
    else return CP_ERR_RESOURCE;	
}
示例#2
0
/**
 * Initializes and starts the plug-in.
 */
static int start(void *d) {
    pcre_regex_data *data=(pcre_regex_data *)d;

    //Dinamyc plugin initialization
    if (cp_define_symbol(data->ctx, "es_uvigo_ei_pcre_eval", data->funcs[0])==CP_OK &&
        cp_define_symbol(data->ctx, "es_uvigo_ei_pcre_eval_header", data->funcs[1])==CP_OK)
       return CP_OK;
    else
       return CP_ERR_RESOURCE;
}
示例#3
0
文件: symuser.c 项目: 070499/xbmc
static int start(void *d) {
	plugin_data_t *data = d;
	cp_extension_t **exts;
	
	exts = cp_get_extensions_info(data->ctx, "symuser.strings", NULL, NULL);
	if (exts != NULL && exts[0] != NULL) {
		const char *symname;
		
		symname = cp_lookup_cfg_value(exts[0]->configuration, "@string-symbol");
		if (symname != NULL) {
			data->str = cp_resolve_symbol(data->ctx, exts[0]->plugin->identifier, symname, NULL);
			if (data->str == NULL) {
				cp_log(data->ctx, CP_LOG_ERROR, "Could not resolve symbol specified by extension.");
			}
		} else {
			cp_log(data->ctx, CP_LOG_ERROR, "No string-symbol attribute present in extension.");
		} 
	} else {
		cp_log(data->ctx, CP_LOG_ERROR, "No extensions available.");
	}
	if (exts != NULL) {
		cp_release_info(data->ctx, exts);
	}
	if (data->str == NULL) {
		return CP_ERR_RUNTIME;
	}
	return cp_define_symbol(data->ctx, "used_string", (void *) data->str);
}
示例#4
0
static int start(void *d) {
	plugin_data_t *data = d;

	if ((data->str = malloc(sizeof(char) * 16)) == NULL) {
		return CP_ERR_RESOURCE;
	}
	strcpy(data->str, "Provided string");
	cp_define_symbol(data->ctx, "sp_string", data->str);
	return CP_OK;
}
static int start(void *d) {
	struct runtime_data *data = d;
	char **argv;

	data->counters->start++;
	argv = cp_get_context_args(data->ctx, NULL);
	if (argv != NULL && argv[0] != NULL) {
		if ((data->counters->context_arg_0 = strdup(argv[0])) == NULL) {
			return CP_ERR_RESOURCE;
		}
	}
	if (cp_define_symbol(data->ctx, "cbc_counters", data->counters) != CP_OK
		|| cp_register_logger(data->ctx, logger, data, CP_LOG_WARNING) != CP_OK
		|| cp_register_plistener(data->ctx, listener, data) != CP_OK
		|| cp_run_function(data->ctx, run) != CP_OK) {
		return CP_ERR_RUNTIME;
	} else {
		return CP_OK;
	}
}
示例#6
0
/**
 * Initializes and starts the plug-in.
 */
static int start(void *d) {
	classifier_t *cl = d;
	cp_context_t *ctx = cl->data;

	return cp_define_symbol(ctx, "cp_ex_cpfile_extension_classifier", cl);
}