gwenhywfar 5.14.1
plugin.c
Go to the documentation of this file.
1/***************************************************************************
2 begin : Thu Apr 03 2003
3 copyright : (C) 2003 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 * *
23 ***************************************************************************/
24
25#ifdef HAVE_CONFIG_H
26# include <config.h>
27#endif
28
29#include "plugin_p.h"
30#include <gwenhywfar/debug.h>
31
32#include <ctype.h>
33
34#ifdef OS_WIN32
35# include <windows.h>
36#endif
37
38static GWEN_PLUGIN_MANAGER_LIST *gwen_plugin_manager__list=0;
39
40
45
46
47static void _setLibLoader(GWEN_PLUGIN *p, GWEN_LIBLOADER *ll);
49static GWEN_PLUGIN *_createPluginFromLibloader(GWEN_PLUGIN_MANAGER *pm, GWEN_LIBLOADER *libLoader, const char *modname);
50static GWEN_LIBLOADER *_searchAndLoadModule(GWEN_PLUGIN_MANAGER *pm, const char *modname);
54 const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlFromPluginList);
56/*static void _dumpDescriptorList(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl, const char *text);*/
57
58
59
60
62{
63 gwen_plugin_manager__list=GWEN_PluginManager_List_new();
64 return 0;
65}
66
67
68
70{
71 GWEN_PluginManager_List_free(gwen_plugin_manager__list);
72 return 0;
73}
74
75
76
77GWEN_PLUGIN *GWEN_Plugin_new(GWEN_PLUGIN_MANAGER *pm, const char *name, const char *fileName)
78{
79 GWEN_PLUGIN *p;
80
81 assert(pm);
82 assert(name);
84 DBG_MEM_INC("GWEN_PLUGIN", 0);
85 p->refCount=1;
88 p->manager=pm;
89 p->name=strdup(name);
90 if (fileName)
91 p->fileName=strdup(fileName);
92
93 return p;
94}
95
96
97
99{
100 if (p) {
101 DBG_MEM_DEC("GWEN_PLUGIN");
102 assert(p->refCount);
103 if (--(p->refCount)==0) {
105 GWEN_PluginDescription_free(p->pluginDescription);
106 free(p->name);
107 free(p->fileName);
108 if (p->libLoader) {
109 GWEN_LibLoader_CloseLibrary(p->libLoader);
110 GWEN_LibLoader_free(p->libLoader);
111 }
114 } /* if refCount reaches zero */
115 } /* if p */
116}
117
118
119
121{
122 assert(p);
123 assert(p->refCount);
124 DBG_MEM_INC("GWEN_PLUGIN", 1);
125 p->refCount++;
126}
127
128
129
131{
132 assert(p);
133 return p->manager;
134}
135
136
137
138const char *GWEN_Plugin_GetName(const GWEN_PLUGIN *p)
139{
140 assert(p);
141 return p->name;
142}
143
144
145
147{
148 assert(p);
149 return p->fileName;
150}
151
152
153
155{
156 assert(p);
157 return p->libLoader;
158}
159
160
161
163{
164 assert(p);
165 p->libLoader=ll;
166}
167
168
169
171{
172 assert(p);
173 return p->pluginDescription;
174}
175
176
177
179{
180 assert(p);
181 if (p->pluginDescription)
182 GWEN_PluginDescription_free(p->pluginDescription);
183 p->pluginDescription=pd;
184}
185
186
187
188
189
190
191
192GWEN_PLUGIN_MANAGER *GWEN_PluginManager_new(const char *name, const char *destLib)
193{
195
196 assert(name);
197 assert(destLib);
199 DBG_MEM_INC("GWEN_PLUGIN_MANAGER", 0);
202 pm->name=strdup(name);
203 pm->destLib=strdup(destLib);
204 pm->plugins=GWEN_Plugin_List_new();
205
206 return pm;
207}
208
209
210
212{
213 if (pm) {
214 DBG_MEM_DEC("GWEN_PLUGIN_MANAGER");
215 GWEN_Plugin_List_free(pm->plugins);
217 free(pm->destLib);
218 free(pm->name);
221 }
222}
223
224
225
227{
228 assert(pm);
229 return pm->name;
230}
231
232
233
234int GWEN_PluginManager_AddPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
235{
236 assert(pm);
237 return GWEN_PathManager_AddPath(callingLib, pm->destLib, pm->name, s);
238}
239
240
241
242int GWEN_PluginManager_AddRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s, GWEN_PATHMANAGER_RELMODE rm)
243{
244 assert(pm);
245 return GWEN_PathManager_AddRelPath(callingLib, pm->destLib, pm->name, s, rm);
246}
247
248
249
250int GWEN_PluginManager_InsertPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
251{
252 assert(pm);
253 return GWEN_PathManager_InsertPath(callingLib, pm->destLib, pm->name, s);
254}
255
256
257
258int GWEN_PluginManager_InsertRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *relpath, GWEN_PATHMANAGER_RELMODE rm)
259{
260 assert(pm);
261 return GWEN_PathManager_InsertRelPath(callingLib, pm->destLib, pm->name, relpath, rm);
262}
263
264
265
266int GWEN_PluginManager_RemovePath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
267{
268 assert(pm);
269 return GWEN_PathManager_RemovePath(callingLib, pm->destLib, pm->name, s);
270}
271
272
273
274#ifdef OS_WIN32
276 const char *callingLib,
277 const char *keypath,
278 const char *varname)
279{
280 HKEY hkey;
281 TCHAR nbuffer[MAX_PATH];
282 BYTE vbuffer[MAX_PATH];
283 DWORD nsize;
284 DWORD vsize;
285 DWORD typ;
286 int i;
287
288 assert(pm);
289
290 snprintf(nbuffer, sizeof(nbuffer), keypath);
291
292 /* open the key */
293 if (RegOpenKey(HKEY_LOCAL_MACHINE, nbuffer, &hkey)) {
294 DBG_INFO(GWEN_LOGDOMAIN, "RegOpenKey %s failed.", keypath);
295 return 1;
296 }
297
298 /* find the variablename */
299 for (i=0;; i++) {
300 nsize=sizeof(nbuffer);
301 vsize=sizeof(vbuffer);
302 if (ERROR_SUCCESS!=RegEnumValue(hkey,
303 i, /* index */
304 nbuffer,
305 &nsize,
306 0, /* reserved */
307 &typ,
308 vbuffer,
309 &vsize))
310 break;
311 if (strcasecmp(nbuffer, varname)==0 && typ==REG_SZ) {
312 /* variable found */
313 RegCloseKey(hkey);
314 return GWEN_PathManager_AddPath(callingLib,
315 pm->destLib,
316 pm->name,
317 (char *)vbuffer);
318 }
319 } /* for */
320
321 RegCloseKey(hkey);
322 DBG_INFO(GWEN_LOGDOMAIN, "In RegKey \"%s\" the variable \"%s\" does not exist", keypath, varname);
323 return 1;
324
325}
326
327#else /* OS_WIN32 */
328
330 GWEN_UNUSED const char *callingLib,
331 GWEN_UNUSED const char *keypath,
332 GWEN_UNUSED const char *varname)
333{
334 return 0;
335}
336#endif /* OS_WIN32 */
337
338
339
341{
342 GWEN_LIBLOADER *libLoader;
343 GWEN_PLUGIN *plugin;
344
345 libLoader=_searchAndLoadModule(pm, modname);
346 if (libLoader==NULL) {
347 DBG_INFO(GWEN_LOGDOMAIN, "No suitable module found for %s/%s", pm->name, modname);
348 return NULL;
349 }
350
351 plugin=_createPluginFromLibloader(pm, libLoader, modname);
352 if (plugin==NULL) {
353 DBG_INFO(GWEN_LOGDOMAIN, "Could not create plugin from module");
355 GWEN_LibLoader_free(libLoader);
356 return NULL;
357 }
358
359 _setLibLoader(plugin, libLoader);
360 return plugin;
361}
362
363
364
366{
367 GWEN_LIBLOADER *libLoader;
368 GWEN_BUFFER *nbuf;
369 const char *s;
370 GWEN_STRINGLIST *pathList;
372
373 assert(pm);
374 libLoader=GWEN_LibLoader_new();
375 pathList=GWEN_PathManager_GetPaths(pm->destLib, pm->name);
376 if (pathList==NULL) {
377 DBG_ERROR(GWEN_LOGDOMAIN, "No paths for plugins (%s)", pm->name);
378 GWEN_LibLoader_free(libLoader);
379 return NULL;
380 }
381 nbuf=GWEN_Buffer_new(0, 128, 0, 1);
382 s=modname;
383 while (*s)
384 GWEN_Buffer_AppendByte(nbuf, tolower(*(s++)));
385 se=GWEN_StringList_FirstEntry(pathList);
386
387 while (se) {
388 const char *fname;
389
391 assert(fname);
392 if (GWEN_LibLoader_OpenLibraryWithPath(libLoader, fname, GWEN_Buffer_GetStart(nbuf))==0)
393 break;
394 else {
395 DBG_DEBUG(GWEN_LOGDOMAIN, "Could not load plugin \"%s\" from \"%s\"", modname, fname);
396 }
398 } /* while */
399 if (!se) {
400 DBG_ERROR(GWEN_LOGDOMAIN, "Plugin \"%s\" not found.", modname);
401 GWEN_Buffer_free(nbuf);
402 GWEN_StringList_free(pathList);
403 GWEN_LibLoader_free(libLoader);
404 return NULL;
405 }
406 GWEN_Buffer_free(nbuf);
407 GWEN_StringList_free(pathList);
408
409 return libLoader;
410}
411
412
413
415{
416 GWEN_BUFFER *nbuf;
417 const char *s;
418 int err;
419 GWEN_PLUGIN *plugin;
421 void *p;
422
423 /* create name of init function */
424 nbuf=GWEN_Buffer_new(0, 128, 0, 1);
425 s=pm->name;
426 while (*s)
427 GWEN_Buffer_AppendByte(nbuf, tolower(*(s++)));
428 GWEN_Buffer_AppendByte(nbuf, '_');
429 s=modname;
430 while (*s)
431 GWEN_Buffer_AppendByte(nbuf, tolower(*(s++)));
432 GWEN_Buffer_AppendString(nbuf, "_factory");
433
434 /* resolve name of factory function */
435 err=GWEN_LibLoader_Resolve(libLoader, GWEN_Buffer_GetStart(nbuf), &p);
436 if (err) {
438 GWEN_Buffer_free(nbuf);
439 return NULL;
440 }
441 GWEN_Buffer_free(nbuf);
442
444 assert(fn);
445 plugin=fn(pm, modname, "");
446 if (!plugin) {
447 DBG_ERROR(GWEN_LOGDOMAIN, "Error in plugin: No plugin created for %s/%s", pm->name, modname);
448 return NULL;
449 }
450 else {
452
455 GWEN_PluginDescription_SetType(pd, pm->name);
457 }
458
459 return plugin;
460}
461
462
463
464GWEN_PLUGIN *GWEN_PluginManager_LoadPluginFile(GWEN_PLUGIN_MANAGER *pm, const char *modname, const char *fname)
465{
466 GWEN_LIBLOADER *ll;
467 GWEN_PLUGIN *plugin;
469 void *p;
470 GWEN_BUFFER *nbuf;
471 const char *s;
472 int err;
473
475 if (GWEN_LibLoader_OpenLibrary(ll, fname)) {
477 "Could not load plugin \"%s\" (%s)", modname, fname);
479 return 0;
480 }
481
482 /* create name of init function */
483 nbuf=GWEN_Buffer_new(0, 128, 0, 1);
484 s=pm->name;
485 while (*s)
486 GWEN_Buffer_AppendByte(nbuf, tolower(*(s++)));
487 GWEN_Buffer_AppendByte(nbuf, '_');
488 s=modname;
489 while (*s)
490 GWEN_Buffer_AppendByte(nbuf, tolower(*(s++)));
491 GWEN_Buffer_AppendString(nbuf, "_factory");
492
493 /* resolve name of factory function */
495 if (err) {
497 GWEN_Buffer_free(nbuf);
500 return 0;
501 }
502 GWEN_Buffer_free(nbuf);
503
505 assert(fn);
506 plugin=fn(pm, modname, fname);
507 if (!plugin) {
508 DBG_INFO(GWEN_LOGDOMAIN, "Error in plugin: No plugin created");
511 return 0;
512 }
513
514 /* store libloader */
515 _setLibLoader(plugin, ll);
516
517 return plugin;
518}
519
520
521
523{
524 GWEN_PLUGIN *p;
525
527 if (p) {
528 DBG_INFO(GWEN_LOGDOMAIN, "Returning plugin \"%s\" from internal list", s);
529 return p;
530 }
531
532 DBG_INFO(GWEN_LOGDOMAIN, "Trying to load plugin \"%s\"", s);
534 if (p) {
535 GWEN_Plugin_List_Add(p, pm->plugins);
536 DBG_INFO(GWEN_LOGDOMAIN, "Plugin \"%s\" loaded and added to internal list", s);
537 return p;
538 }
539 DBG_INFO(GWEN_LOGDOMAIN, "Plugin \"%s\" not found", s);
540 return 0;
541}
542
543
544
546{
548
549 pm=GWEN_PluginManager_List_First(gwen_plugin_manager__list);
550 while (pm) {
551 if (strcasecmp(pm->name, s)==0)
552 break;
553 pm=GWEN_PluginManager_List_Next(pm);
554 }
555
556 return pm;
557}
558
559
560
562{
564 int rv;
565
567 assert(pm);
569 if (tpm) {
571 "Plugin type \"%s\" already registered",
572 pm->name);
573 return -1;
574 }
575
576 rv=GWEN_PathManager_DefinePath(pm->destLib, pm->name);
577 if (rv) {
578 DBG_INFO(GWEN_LOGDOMAIN, "Could not define path for plugin [%s:%s]",
579 pm->destLib, pm->name);
580 return rv;
581 }
582
583 GWEN_PluginManager_List_Add(pm, gwen_plugin_manager__list);
585 "Plugin type \"%s\" registered",
586 pm->name);
587 return 0;
588}
589
590
591
593{
595 int rv;
596
598 assert(pm);
600 if (!tpm) {
602 "Plugin type \"%s\" not registered",
603 pm->name);
604 return -1;
605 }
606
607 rv=GWEN_PathManager_UndefinePath(pm->destLib, pm->name);
608 if (rv) {
609 DBG_INFO(GWEN_LOGDOMAIN, "Could not undefine path for plugin [%s:%s]",
610 pm->destLib, pm->name);
611 return rv;
612 }
613
614 GWEN_PluginManager_List_Del(pm);
616 "Plugin type \"%s\" unregistered",
617 pm->name);
618 return 0;
619}
620
621
622
624{
626 GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlFromPluginList;
627
628 pdlFromPluginList=_getPluginDescrsFromPluginList(pm);
629 pdlLoaded=_loadPluginDescrs(pm);
630
631 if (pdlFromPluginList && pdlLoaded){
633
634 pdlOut=_combinedPluginDescrList(pdlLoaded, pdlFromPluginList);
635 GWEN_PluginDescription_List2_freeAll(pdlFromPluginList);
637 return pdlOut;
638 }
639 else if (pdlFromPluginList) {
640 return pdlFromPluginList;
641 }
642 else
643 return pdlLoaded;
644}
645
646
647
649{
650 assert(pm);
651 return GWEN_PathManager_GetPaths(pm->destLib, pm->name);
652}
653
654
655
657{
659
661 if (pdl) {
663
664 pd=_findPluginDescrByNameInList2(pdl, modName);
665 if (pd) {
668 return pd;
669 }
671 }
672 return NULL;
673}
674
675
676
678{
679 const char *modname;
680
681 modname=GWEN_Plugin_GetName(p);
682 if (modname && *modname) {
683 const GWEN_PLUGIN_DESCRIPTION *pdInPlugin;
684
686 if (pdInPlugin==NULL) {
688
689 DBG_INFO(GWEN_LOGDOMAIN, "No plugin description for \"%s\", creating one", modname);
692 GWEN_PluginDescription_SetType(pd, pm->name);
694 }
695 DBG_INFO(GWEN_LOGDOMAIN, "Adding plugin [%s] of type [%s]", modname, pm->name);
696 GWEN_Plugin_List_Add(p, pm->plugins);
697 }
698 else {
699 DBG_ERROR(GWEN_LOGDOMAIN, "Plugin to add has no name (type %s), not adding", pm->name);
700 }
701}
702
703
704
706{
707 GWEN_PLUGIN *p;
708
709 assert(pm);
710 p=GWEN_Plugin_List_First(pm->plugins);
711 while (p) {
712 if (strcasecmp(p->name, s)==0)
713 break;
714 p=GWEN_Plugin_List_Next(p);
715 }
716
717 return p;
718}
719
720
722{
723 GWEN_PLUGIN *p;
724
725 assert(pm);
726 p=GWEN_Plugin_List_First(pm->plugins);
727 if (p) {
729
731 while (p) {
732 const GWEN_PLUGIN_DESCRIPTION *pd;
733
735 if (pd)
737 p=GWEN_Plugin_List_Next(p);
738 } /* while(p) */
739
742 return NULL;
743 }
744
745 return pdl;
746 }
747
748 return NULL;
749}
750
751
752
754{
756 GWEN_STRINGLIST *sl;
758
759 sl=GWEN_PathManager_GetPaths(pm->destLib, pm->name);
760 if (sl==NULL) {
761 DBG_ERROR(GWEN_LOGDOMAIN, "No paths for plugins (%s)", pm->name);
762 return NULL;
763 }
765 if (!se) {
766 DBG_ERROR(GWEN_LOGDOMAIN, "No paths given");
768 return 0;
769 }
770
772 while (se) {
773 int rv;
774 const char *path;
775
777 assert(path);
778 rv=GWEN_LoadPluginDescrsByType(path, pm->name, pl);
779 if (rv) {
780 DBG_INFO(GWEN_LOGDOMAIN, "Error loading plugin description in \"%s\"", path);
781 }
783 } /* while */
784
788 return 0;
789 }
790
792 return pl;
793}
794
795
796
798 const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlFromPluginList)
799{
802
804
805 /* first add entries from loaded list (more details in those entries) */
807 if (iter) {
809
811 while(pd) {
815 }
816
818 }
819
820 /* only add those entries from pluginList which are not already in the output list */
821 iter=GWEN_PluginDescription_List2_First(pdlFromPluginList);
822 if (iter) {
824
826 while(pd) {
827 const char *name;
828
830 if (name && *name && NULL==_findPluginDescrByNameInList2(pdlOut, name)) {
833 }
835 }
836
838 }
839
842 return NULL;
843 }
844
845 return pdlOut;
846}
847
848
849
851{
854
856 if (iter) {
857
859 while(pd) {
860 const char *nameInList;
861
862 nameInList=GWEN_PluginDescription_GetName(pd);
863 if (nameInList && *nameInList && strcasecmp(nameInList, name)==0)
864 break;
866 }
867
869 }
870
871 return pd;
872}
873
874
875
876#if 0
877void _dumpDescriptorList(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl, const char *text)
878{
879 fprintf(stderr, "Descriptor List: %s\n", text?text:"");
880 if (pdl) {
882
884 if (iter) {
886
888 while(pd) {
889 const char *name;
890
892 fprintf(stderr, "- %s\n", name?name:"<empty>");
894 }
895
897 }
898 }
899 else {
900 fprintf(stderr, "- <empty list>\n");
901 }
902}
903#endif
904
905
906
#define NULL
Definition binreloc.c:300
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition buffer.c:42
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition buffer.c:89
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
Definition buffer.c:992
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition buffer.c:235
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
Definition buffer.c:393
#define DBG_MEM_INC(o, attach)
Definition debug.h:87
#define DBG_INFO_ERR(dbg_logger, dbg_err)
Definition debug.h:196
#define DBG_INFO(dbg_logger, format,...)
Definition debug.h:181
#define DBG_ERROR(dbg_logger, format,...)
Definition debug.h:97
#define DBG_ERROR_ERR(dbg_logger, dbg_err)
Definition debug.h:113
#define DBG_MEM_DEC(o)
Definition debug.h:88
#define DBG_DEBUG(dbg_logger, format,...)
Definition debug.h:214
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
#define GWEN_UNUSED
#define GWEN_INHERIT_FUNCTIONS(t)
Definition inherit.h:163
#define GWEN_INHERIT_INIT(t, element)
Definition inherit.h:223
#define GWEN_INHERIT_FINI(t, element)
Definition inherit.h:238
GWENHYWFAR_API int GWEN_LibLoader_OpenLibraryWithPath(GWEN_LIBLOADER *h, const char *path, const char *name)
GWENHYWFAR_API GWEN_LIBLOADER * GWEN_LibLoader_new(void)
GWENHYWFAR_API int GWEN_LibLoader_OpenLibrary(GWEN_LIBLOADER *h, const char *name)
GWENHYWFAR_API int GWEN_LibLoader_CloseLibrary(GWEN_LIBLOADER *h)
GWENHYWFAR_API int GWEN_LibLoader_Resolve(GWEN_LIBLOADER *h, const char *name, void **p)
GWENHYWFAR_API void GWEN_LibLoader_free(GWEN_LIBLOADER *h)
struct GWEN_LIBLOADER GWEN_LIBLOADER
Definition libloader.h:60
#define GWEN_LIST_FINI(t, element)
Definition list1.h:475
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition list1.h:367
#define GWEN_LIST_INIT(t, element)
Definition list1.h:466
struct GWEN_PLUGIN_DESCRIPTION_LIST2 GWEN_PLUGIN_DESCRIPTION_LIST2
Definition listdoc.h:6538
unsigned int GWEN_PluginDescription_List2_GetSize(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_List2Iterator_Data(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_List2Iterator_Next(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR * GWEN_PluginDescription_List2_First(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
void GWEN_PluginDescription_List2_PushBack(GWEN_PLUGIN_DESCRIPTION_LIST2 *l, GWEN_PLUGIN_DESCRIPTION *p)
struct GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR
Definition listdoc.h:6543
void GWEN_PluginDescription_List2Iterator_free(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
void GWEN_PluginDescription_List2_free(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
GWEN_PLUGIN_DESCRIPTION_LIST2 * GWEN_PluginDescription_List2_new()
#define GWEN_LOGDOMAIN
Definition logger.h:32
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55
int GWEN_PathManager_AddRelPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue, GWEN_PATHMANAGER_RELMODE rm)
int GWEN_PathManager_InsertPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
GWEN_STRINGLIST * GWEN_PathManager_GetPaths(const char *destLib, const char *pathName)
int GWEN_PathManager_RemovePath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
int GWEN_PathManager_UndefinePath(const char *destLib, const char *pathName)
Definition pathmanager.c:96
int GWEN_PathManager_AddPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
int GWEN_PathManager_InsertRelPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue, GWEN_PATHMANAGER_RELMODE rm)
int GWEN_PathManager_DefinePath(const char *destLib, const char *pathName)
Definition pathmanager.c:71
GWEN_PATHMANAGER_RELMODE
Definition pathmanager.h:38
int GWEN_Plugin_ModuleFini(void)
Definition plugin.c:69
GWEN_PLUGIN_MANAGER * GWEN_PluginManager_new(const char *name, const char *destLib)
Definition plugin.c:192
GWEN_PLUGIN_DESCRIPTION_LIST2 * GWEN_PluginManager_GetPluginDescrs(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:623
const char * GWEN_PluginManager_GetName(const GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:226
int GWEN_PluginManager_RemovePath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
Definition plugin.c:266
GWEN_LIBLOADER * GWEN_Plugin_GetLibLoader(const GWEN_PLUGIN *p)
Definition plugin.c:154
void GWEN_PluginManager_AddPlugin(GWEN_PLUGIN_MANAGER *pm, GWEN_PLUGIN *p)
Definition plugin.c:677
GWEN_PLUGIN * GWEN_PluginManager_LoadPluginFile(GWEN_PLUGIN_MANAGER *pm, const char *modname, const char *fname)
Definition plugin.c:464
static GWEN_LIBLOADER * _searchAndLoadModule(GWEN_PLUGIN_MANAGER *pm, const char *modname)
Definition plugin.c:365
int GWEN_PluginManager_AddPathFromWinReg(GWEN_UNUSED GWEN_PLUGIN_MANAGER *pm, GWEN_UNUSED const char *callingLib, GWEN_UNUSED const char *keypath, GWEN_UNUSED const char *varname)
Definition plugin.c:329
void GWEN_PluginManager_free(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:211
int GWEN_PluginManager_AddPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
Definition plugin.c:234
int GWEN_PluginManager_InsertPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
Definition plugin.c:250
GWEN_PLUGIN_MANAGER * GWEN_PluginManager_FindPluginManager(const char *s)
Definition plugin.c:545
int GWEN_PluginManager_Unregister(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:592
int GWEN_Plugin_ModuleInit(void)
Definition plugin.c:61
GWEN_PLUGIN * GWEN_PluginManager_GetPlugin(GWEN_PLUGIN_MANAGER *pm, const char *s)
Definition plugin.c:522
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _loadPluginDescrs(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:753
const GWEN_PLUGIN_DESCRIPTION * GWEN_Plugin_GetPluginDescription(const GWEN_PLUGIN *p)
Definition plugin.c:170
static void _setLibLoader(GWEN_PLUGIN *p, GWEN_LIBLOADER *ll)
Definition plugin.c:162
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _combinedPluginDescrList(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlLoaded, const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlFromPluginList)
Definition plugin.c:797
static GWEN_PLUGIN * _createPluginFromLibloader(GWEN_PLUGIN_MANAGER *pm, GWEN_LIBLOADER *libLoader, const char *modname)
Definition plugin.c:414
GWEN_PLUGIN_MANAGER * GWEN_Plugin_GetManager(const GWEN_PLUGIN *p)
Definition plugin.c:130
static GWEN_PLUGIN * _findPluginInListByName(GWEN_PLUGIN_MANAGER *pm, const char *s)
Definition plugin.c:705
static GWEN_PLUGIN_MANAGER_LIST * gwen_plugin_manager__list
Definition plugin.c:38
int GWEN_PluginManager_InsertRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *relpath, GWEN_PATHMANAGER_RELMODE rm)
Definition plugin.c:258
void GWEN_Plugin_Attach(GWEN_PLUGIN *p)
Definition plugin.c:120
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _getPluginDescrsFromPluginList(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:721
GWEN_PLUGIN * GWEN_Plugin_new(GWEN_PLUGIN_MANAGER *pm, const char *name, const char *fileName)
Definition plugin.c:77
void GWEN_Plugin_free(GWEN_PLUGIN *p)
Definition plugin.c:98
const char * GWEN_Plugin_GetName(const GWEN_PLUGIN *p)
Definition plugin.c:138
const char * GWEN_Plugin_GetFileName(const GWEN_PLUGIN *p)
Definition plugin.c:146
GWEN_STRINGLIST * GWEN_PluginManager_GetPaths(const GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:648
int GWEN_PluginManager_Register(GWEN_PLUGIN_MANAGER *pm)
Definition plugin.c:561
void GWEN_Plugin_SetPluginDescription(GWEN_PLUGIN *p, GWEN_PLUGIN_DESCRIPTION *pd)
Definition plugin.c:178
int GWEN_PluginManager_AddRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s, GWEN_PATHMANAGER_RELMODE rm)
Definition plugin.c:242
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginManager_GetPluginDescr(GWEN_PLUGIN_MANAGER *pm, const char *modName)
Definition plugin.c:656
static GWEN_PLUGIN_DESCRIPTION * _findPluginDescrByNameInList2(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl, const char *name)
Definition plugin.c:850
GWEN_PLUGIN * GWEN_PluginManager_LoadPlugin(GWEN_PLUGIN_MANAGER *pm, const char *modname)
Definition plugin.c:340
struct GWEN_PLUGIN_MANAGER GWEN_PLUGIN_MANAGER
Definition plugin.h:37
GWEN_PLUGIN *(* GWEN_PLUGIN_FACTORYFN)(GWEN_PLUGIN_MANAGER *pm, const char *name, const char *fileName)
Definition plugin.h:59
struct GWEN_PLUGIN GWEN_PLUGIN
Definition plugin.h:36
void GWEN_PluginDescription_SetName(GWEN_PLUGIN_DESCRIPTION *pd, const char *s)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_new(void)
Definition plugindescr.c:55
void GWEN_PluginDescription_List2_freeAll(GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl)
void GWEN_PluginDescription_free(GWEN_PLUGIN_DESCRIPTION *pd)
void GWEN_PluginDescription_Attach(GWEN_PLUGIN_DESCRIPTION *pd)
void GWEN_PluginDescription_SetType(GWEN_PLUGIN_DESCRIPTION *pd, const char *s)
int GWEN_LoadPluginDescrsByType(const char *folder, const char *pluginType, GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl)
const char * GWEN_PluginDescription_GetName(const GWEN_PLUGIN_DESCRIPTION *pd)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_dup(const GWEN_PLUGIN_DESCRIPTION *pd)
struct GWEN_PLUGIN_DESCRIPTION GWEN_PLUGIN_DESCRIPTION
Definition plugindescr.h:38
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
Definition stringlist.c:62
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
Definition stringlist.c:406
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
Definition stringlist.c:398
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
Definition stringlist.c:390
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
Definition stringlist.h:53
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
Definition stringlist.h:56
#define MAX_PATH
Definition testlib.c:128