Initialize
The Initialize routine must be defined by the object to be loaded by the server.
It is used each time the server is started, including restarts, and is called each time the object is referenced in the DHCP server's configuration file.
The following is the structure of the Initialize routine:
int Initialize ( FILE *fp,
caddr_t *hObjectInstance ) ;
Where:
Item | Description |
---|---|
fp | Points to the configuration block for the loaded UserObject. The value of the pointer is NULL if no configuration block exists following the UserObject definition in the DHCP Server configuration file. |
hObjectInstance | Is set by the loaded object if the object requires private data to be returned to it through each invocation. One handle is created for each configuration instance of the loaded object. |
If the file pointer fp is not NULL, its initial value references the first line of contained data within the configuration block of the user-defined object. Parsing should continue only as far as an unmatched close brace (}), which indicates the end of the configuration block.
The Initialize routine does not require setting the hObjectInstance handle.
However, it is required that the routine return specific codes,
depending on whether the initialization succeeded or failed. The required
codes and their meanings follow:
Item | Description |
---|---|
0 (zero) | Instance is successfully initialized. The server can continue to link to each symbol. |
!= 0 (non-zero) | Instance failed to initialize. The server can free its resources and continue to load, ignoring this section of the configuration file. |