FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
shadow_subsystem_builtin.c
1
19#include <freerdp/config.h>
20
21#include <freerdp/server/shadow.h>
22
23typedef struct
24{
25 const char* (*name)(void);
26 pfnShadowSubsystemEntry entry;
27} RDP_SHADOW_SUBSYSTEM;
28
29extern int ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
30extern const char* ShadowSubsystemName(void);
31
32static const RDP_SHADOW_SUBSYSTEM g_Subsystems[] = {
33
34 { ShadowSubsystemName, ShadowSubsystemEntry }
35};
36
37static const size_t g_SubsystemCount = ARRAYSIZE(g_Subsystems);
38
39static pfnShadowSubsystemEntry shadow_subsystem_load_static_entry(const char* name)
40{
41 if (!name)
42 {
43 if (g_SubsystemCount > 0)
44 {
45 const RDP_SHADOW_SUBSYSTEM* cur = &g_Subsystems[0];
46 WINPR_ASSERT(cur->entry);
47
48 return cur->entry;
49 }
50
51 return NULL;
52 }
53
54 for (size_t index = 0; index < g_SubsystemCount; index++)
55 {
56 const RDP_SHADOW_SUBSYSTEM* cur = &g_Subsystems[index];
57 WINPR_ASSERT(cur->name);
58 WINPR_ASSERT(cur->entry);
59
60 if (strcmp(name, cur->name()) == 0)
61 return cur->entry;
62 }
63
64 return NULL;
65}
66
67void shadow_subsystem_set_entry_builtin(const char* name)
68{
69 pfnShadowSubsystemEntry entry = shadow_subsystem_load_static_entry(name);
70
71 if (entry)
72 shadow_subsystem_set_entry(entry);
73}