safmgr.c File Reference


Detailed Description

ES ESF Manager Startup and Control.

The ESF Manager API is used to control the ESF Manager; it includes an initialization function, configuration update notification support, and so forth.

Definition in file safmgr.c.

Go to the source code of this file.

Enumerations

enum  { SafUNINITIALIZED = 0, SafRUNNING = 1, SafTERMINATED = 2 }

Functions

BOOL APIENTRY DllMain (HANDLE Inst, DWORD Reason, LPVOID Reserved)
mf_uns32 safmgr (struct SafInit *Init)
 ESF Manager Initialization.
mf_uns32 safterm (mf_uns32 What, void *Reserved)
 ESF Manager Termination.
int SafState (void)
 ESF Manager Run State.
SafRet SafQueryCfg (const char *Class, const char *Name, char **ValueP)
 Query ESF Manager Custom Configuration.
mf_uns32 SafNative32u (mf_uns32 NetValue)


Function Documentation

mf_uns32 safmgr ( struct SafInit Init  ) 

ESF Manager Initialization.

This function must be invoked before any other ESF Manager functions are used.

After successful initialization, a subsequent initialization has no effect. If initialization fails, it can be retried after the problem has been corrected.

Warning:
This function is not thread-safe. It must not be called by multiple threads until after initialization has completed successfully (at which point it will have no further effect).
Parameters:
Init A pointer to struct SafInit. On entry the following fields must be set:
  • Version Set to SafMGR_API_VER.
  • Environment Set to one of the predefined values.
  • Config Pointing to the ESF Manager configuration block.
  • ESMCnt Set to the number of configured ESM Modules.
  • ESMCfg Pointing to configuration blocks for ESM Modules.
On return, ESF Manager will have set Reason and Detail. They will be zero for success, non-zero for error. If a failure occurred in an ESM Module's initialization (see the description for SafInit::Detail), ESMCnt will be set to the index (from 0) of the ESM Module that reported the error.

Returns:
An integer value, zero for success and non-zero if initialization failed. See ESF Manager Initialization Return Codes.

Definition at line 163 of file safmgr.c.

References SafInit::Config, SafInit::ESMCfg, SafInit::ESMCnt, SafESM_MAX, SafINIT_BAD_CB, SafINIT_CFG, SafINIT_CNT, SafINIT_ESMCFG, SafINIT_NULL, SafINIT_OK, SafINIT_VER, SafMGR_API_VER, and SafInit::Version.

mf_uns32 safterm ( mf_uns32  What,
void *  Reserved 
)

ESF Manager Termination.

This function should be called when a thread or process that has used ESF is terminating. It will inform the ESM Modules (currently for process exit only), and will perform any necessary cleanup for the Manager itself, including environment-specific cleanup.

Parameters:
[in] What Indicates what is terminating; see "What" Codes for safterm()
Reserved Reserved for future use (pass a null pointer)
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 538 of file safmgr.c.

References SafEsmExit(), SafEsmUnload(), SafRaiseAuditEvent(), SafTERM_ESF, SafTERM_PROCESS, SafThrLock(), and SafThrUnlock().

int SafState ( void   ) 

ESF Manager Run State.

Returns the run state of ESF Manager (uninitialized, running, terminated).

No parameters

Returns:
An integer value:
  • 0: ESF Manager has not been initialized
  • 1: ESF Manager is running
  • 2: ESF Manager has been terminated

Definition at line 597 of file safmgr.c.

Referenced by SafAdmin(), SafAuth(), SafUpdate(), SafVerify(), and SafXauth().

SafRet SafQueryCfg ( const char *  Class,
const char *  Name,
char **  ValueP 
)

Query ESF Manager Custom Configuration.

MFDS provides a "Configuration Information" text area in each Security Manager configuration object. This area can be used to set custom configuration attributes in "ini" format, with name=value pairs grouped under section headings in square brackets.

This function can be used to query the value associated with a name in a given section.

Parameters:
[in] Class Section heading (without the brackets)
[in] Name Item name
[out] ValueP Returned pointer to value, if any
Returns:
Zero for success or a SafRet value for failure.

Definition at line 621 of file safmgr.c.

References SafStoreFind().

Referenced by SafAdmin(), and SafVerify().