Esempio n. 1
0
void *start_validator_nofree(char *name, void *handle, webs_t wp, char *value, struct variable *v)
{
	// lcdmessaged("Starting Service",name);
	cprintf("start_service_nofree %s\n", name);
	char service[64];
	int nohandle = 0;

	if (!handle) {
		handle = load_service(name);
		nohandle = 1;
	}
	if (handle == NULL) {
		return NULL;
	}
	void (*fptr) (webs_t wp, char *value, struct variable * v);

	sprintf(service, "%s", name);
	if (nohandle) {
		if (initWeb(handle) != 0) {
			return handle;
		}
	}
	cprintf("resolving %s\n", service);
	fptr = (void (*)(webs_t wp, char *value, struct variable * v))
	    dlsym(handle, service);
	cprintf("found. pointer is %p\n", fptr);
	if (fptr)
		(*fptr) (wp, value, v);
	else if (nvram_match("console_debug", "1"))
		fprintf(stderr, "function %s not found \n", service);
	cprintf("start_sevice_nofree done()\n");
	return handle;
}
Esempio n. 2
0
void start_gozila(char *name, webs_t wp)
{
	// lcdmessaged("Starting Service",name);
	cprintf("start_gozila %s\n", name);
	char service[64];
	int init = 0;
	if (!s_service) {
		init = 1;
		s_service = load_service(name);
	}
	if (s_service == NULL) {
		return;
	}
	if (init) {
		if (initWeb(s_service) != 0) {
			return;
		}
	}

	int (*fptr) (webs_t wp);

	sprintf(service, "%s", name);
	cprintf("resolving %s\n", service);
	fptr = (int (*)(webs_t wp))dlsym(s_service, service);
	if (fptr)
		(*fptr) (wp);
	else if (nvram_match("console_debug", "1"))
		fprintf(stderr, "function %s not found \n", service);
#ifndef MEMLEAK_OVERRIDE
	dlclose(s_service);
	s_service = NULL;
#endif
	cprintf("start_sevice done()\n");
}
Esempio n. 3
0
void *call_ej(char *name, void *handle, webs_t wp, int argc, char_t ** argv)
{

	if (nvram_match("console_debug", "1")) {
		fprintf(stderr, "call_ej %s\n", name);
		int i = 0;
		for (i = 0; i < argc; i++)
			fprintf(stderr, "argument %s\n", argv[i]);
	}
	char service[64];
	int nohandle = 0;

	{
		memdebug_enter();
		if (!handle) {
			cprintf("load visual_service\n");
			handle = load_visual_service(name);
			nohandle = 1;
		}
		memdebug_leave_info("loadviz");
	}
	if (handle == NULL) {
		cprintf("handle null\n");
		return NULL;
	}
	cprintf("pointer init\n");
	void (*fptr) (webs_t wp, int argc, char_t ** argv);

	sprintf(service, "ej_%s", name);
	{
		memdebug_enter();
		if (nohandle) {
			cprintf("init web\n");
			if (initWeb(handle) != 0) {
				return handle;
			}
		}
		memdebug_leave_info("initweb");
	}
	cprintf("resolving %s\n", service);
	fptr = (void (*)(webs_t wp, int argc, char_t ** argv))dlsym(handle,
								    service);
	cprintf("found. pointer is %p\n", fptr);
	{
		memdebug_enter();
		if (fptr)
			(*fptr) (wp, argc, argv);
		else if (nvram_match("console_debug", "1"))
			fprintf(stderr, "function %s not found \n", service);
		memdebug_leave_info(service);
	}
	cprintf("start_sevice_nofree done()\n");
	return handle;

}
Esempio n. 4
0
int start_validator(char *name, webs_t wp, char *value, struct variable *v)
{
	// lcdmessaged("Starting Service",name);
	cprintf("start_validator %s\n", name);
	char service[64];
	int init = 0;
	if (!s_service) {
		s_service = load_service(name);
		init = 1;
	}
	if (s_service == NULL) {
		return FALSE;
	}
	if (init) {
		if (initWeb(s_service) != 0) {
			return FALSE;
		}
	}
	int ret = FALSE;

	int (*fptr) (webs_t wp, char *value, struct variable * v);

	sprintf(service, "%s", name);
	cprintf("resolving %s\n", service);
	fptr = (int (*)(webs_t wp, char *value, struct variable * v))
	    dlsym(s_service, service);
	if (fptr)
		ret = (*fptr) (wp, value, v);
	else if (nvram_match("console_debug", "1"))
		fprintf(stderr, "function %s not found \n", service);
#ifndef MEMLEAK_OVERRIDE
	dlclose(s_service);
	s_service = NULL;
#endif

	cprintf("start_sevice done()\n");
	return ret;
}