The structure that defines a component within WinGate. Instances of ComponentEntry are passed into calls to RegisterComponent
Syntax
| Code Block |
|---|
|
struct ComponentEntry
{
unsigned long dwSize; // size of this structure
WCHAR szUUID[COMPONENT_MAXNAME + 1]; // UUID of the component
WCHAR szName[COMPONENT_MAXNAME + 1]; // display name of the component
unsigned long dwComponentVersion; // version of the component for version checking modules etc
bool bPublic; // is this component public?
HostComponentHandle hHostPrivate; // context handle used by Host to associate with the component
ComponentContextHandle hComponentPrivate; // context handle used by component to associate with the Host
QueryInitInterfacesFunc QueryInitInterfaces; // OPTIONAL: query a component to see if its dependencies for initialisation are met
InitInterfacesFunc InitInterfaces; // OPTIONAL: triggers registration of interfaces, if you have any, you need this
ObtainInterfaceFunc ObtainInterface; // OPTIONAL: requests an interface
NotifyFunc Notify; // OPTIONAL: receives notifications, should be NULL if notifications not required
StartFunc Start; // OPTIONAL: start a component service.
StopFunc Stop; // OPTIONAL: stop a component service
StoreFunc Store; // OPTIONAL: Store a component configuration
LoadFunc Load; // OPTIONAL: Load a component configuration
}; |
Members
| Vardef |
|---|
| Name | dwSize |
|---|
| Type | unsigned long |
|---|
| Style | Member |
|---|
|
The size in bytes of the ComponentEntry structure. |
| Vardef |
|---|
| Name | szUUID |
|---|
| Type | WCHAR |
|---|
| Style | Member |
|---|
|
The null-terminated UUID string of the component. |
| Vardef |
|---|
| Name | szName |
|---|
| Type | WCHAR |
|---|
| Style | Member |
|---|
|
The null-terminated name of the component that's displayed to the user. |
| Vardef |
|---|
| Name | dwComponentVersion |
|---|
| Type | unsigned long |
|---|
| Style | Member |
|---|
|
The version number of the component. This value is displayed in the Modules panel inside the WinGate Management Console. |
| Vardef |
|---|
| Name | bPublic |
|---|
| Type | bool |
|---|
| Style | Member |
|---|
|
Specifies whether this component is public. Public components will notify other modules of their existence via their own ComponentEntry.Notify callback. |
| Vardef |
|---|
| Name | hHostPrivate |
|---|
| Linked | true |
|---|
| Type | HostComponentHandle |
|---|
| Style | Member |
|---|
|
|
| Vardef |
|---|
| Name | hComponentPrivate |
|---|
| Linked | true |
|---|
| Type | ComponentContextHandle |
|---|
| Style | Member |
|---|
|
Handle used by a component to associate itself with the host framework. You typically set this to the address of your own ComponentEntry. | Code Block |
|---|
static ComponentEntry myComponent;
extern "C" __declspec(dllexport) int Initialise(HostAPI* pHost, HostModuleHandle hModule, LPCWSTR szRegistryPath)
{
// other initialisation ommitted
myComponent.hComponentPrivate = &myComponent;
return wgapi_RegisterComponent(hModule, &myComponent);
} |
|
| Vardef |
|---|
| Name | QueryInitInterfaces |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | QueryInitInterfacesFunc |
|---|
| Style | Member |
|---|
|
Pointer to the function to query whether the interfaces for the component can be initialised. See Remarks |
| Vardef |
|---|
| Name | InitInterfaces |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | InitInterfacesFunc |
|---|
| Style | Member |
|---|
|
Pointer to the function that initialises the component's interfaces. This will not be called by the framework unless ComponentEntry.QueryInitInterfaces has returned true; |
| Vardef |
|---|
| Name | ObtainInterface |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | ObtainInterfaceFunc |
|---|
| Style | Member |
|---|
|
TODO: What is this? |
| Vardef |
|---|
| Name | Notify |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | NotifyFunc |
|---|
| Style | Member |
|---|
|
Pointer to the function that receives notifications from the framework. |
| Vardef |
|---|
| Name | Start |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | StartFunc |
|---|
| Style | Member |
|---|
|
Starts the component |
| Vardef |
|---|
| Name | Stop |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | StopFunc |
|---|
| Style | Member |
|---|
|
Stops the component |
| Vardef |
|---|
| Name | Store |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | StoreFunc |
|---|
| Style | Member |
|---|
|
Instructs the component that it needs to store its configuration. |
| Vardef |
|---|
| Name | Load |
|---|
| LinkedName | true |
|---|
| Linked | true |
|---|
| Type | LoadFunc |
|---|
| Style | Member |
|---|
|
Instructs the component that it needs to refresh its configuration. |
...
Before a component has its interfaces initialised by a call to InitInterfaces, QueryInitInterfaces is called to see whether it is ready. A component can use this to wait until all components it is dependent on have had their interfaces initialised first. The general flow if component interface initialisation is as follows:
Requirements
See Also
QueryInitInterfaces