saf-env.h File Reference


Detailed Description

ESF Manager Processing Environment.

Data structures and other definitions for the ESF Manager Processing Environment.

See also:
saf-env.c

Definition in file saf-env.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SafENV_H
#define SafESM_LCK_CHG   0
 change from shared to exclusive lock
#define SafESM_LCK_HAVE   1
 ignore if already hold lock
#define SafESM_LCK_TEST   2
 test but do not lock
#define SafESM_LCK_USE   3
 do not wait if already locked
#define SafESM_LCK_NOWAIT   3
 do not wait if already locked
#define SafESM_LCK_NONE   4
 normal processing
#define SafESM_LCK_UOW   11
 lock ends when unit of work ends
#define SafESM_LCK_TASK   12
 lock ends when task ends
#define SafESM_LCK_PROC   13
 lock ends when process ends
#define SafESM_LCK_SHR   0
 shared (read) lock
#define SafESM_LCK_EXCL   1
 exclusive (write) lock

Enumerations

enum  SafMsgLvl {
  SafMsgINFO, SafMsgWARN, SafMsgERR, SafMsgCRIT,
  SafMsgInvalid
}
 Log Message Level. More...
enum  SafLockRet {
  SafLockOK = 0, SafLockOWN = 1, SafLockHELD = 2, SafLockNHELD = 3,
  SafLockNEXIST = 4, SafLockDENY = 5, SafLockERR = 6, SafLockPARAM = 7,
  SafLockInvalid
}
 Lock Return Codes. More...

Functions

mf_uns32 SafEnvInit (struct SafInit *)
 ESF Environment Initialization.
SafRet SafShmOpen (const char *Name, size_t *Size, void **Area)
 Open named "shared" memory.
SafRet SafModLoad (const char *ModPath, struct SafPTab *(**Entry)(void))
 Load a module.
SafRet SafModUnload (const char *ModPath)
 Unload a module.
SafRet SafGetInstPath (char *Path, size_t MaxLen)
 Get product installation base path.
SafRet SafLog (int Num, enum SafMsgLvl, const char *DefaultText,...)
 Log a message.
SafRet SafLogLit (int Num, enum SafMsgLvl Level, const char *Text)
 Log a literal message.
SafRet SafAceeAlloc (const char *Name, const char *Group, struct SafACEE **AceeP, int *IsNew)
 Allocate an ACEE.
SafRet SafAceeIterate (void *Data, int(*Callback)(struct SafACEE *Acee, void *Data))
 Iterate over ACEEs.
SafLockRet SafLockEnq (const char *QName, const char *RName, int Type, int Exclusive, int Lifetime)
 Acquire a named lock (enqueue).
SafLockRet SafThrLock (const char *Name, int Exclusive)
 Acquire a named lock, if the environment is multithreaded.
SafLockRet SafShmLock (const char *Name, int Exclusive)
 Acquire a named lock, if the environment uses shared memory.
SafLockRet SafLockDeq (const char *QName, const char *RName)
 Release a named lock (dequeue).
SafLockRet SafThrUnlock (const char *Name)
 Release a named lock, if the environment is multithreaded.
SafLockRet SafShmUnlock (const char *Name)
 Release a named lock, if the environment uses shared memory.
int SafIsMT (void)
 Identify multithreaded environments.
int SafIsSharedMemory (void)
 Identify multiprocess shared-memory environments.
int SafStrcmpCI (const char *, const char *)
 Case-insensitive string comparison.
int SafStrcmpCIN (const char *, const char *, size_t)
 Case-insensitive string comparison (length-limited).
char * SafDupStr (const char *)
 Duplicate a string.
SafRet SafAllocStore (struct SafStore **StoreP)
 Create a store.
SafRet SafFreeStore (struct SafStore *Store)
 Free a store and the class and name data in it.
SafRet SafClearStore (struct SafStore *Store)
 Remove all the data from a store.
SafRet SafStoreRemove (struct SafStore *Store, const char *C, const char *N)
 Remove an entry from a store.
SafRet SafStoreIterate (struct SafStore *Store, const char *Class, SafRet(*Visitor)(const char *Class, const char *Name, void *Value, void *Data), void *Data, SafRet *VisitorErrP)
 Iterate over a store, optionally filtering for a single class.
SafRet SafStoreAdd (struct SafStore *S, const char *C, const char *N, void *P)
 Add an entry to a store.
SafRet SafStoreFind (struct SafStore *S, const char *C, const char *N, void **P)
 Retrieve an entry from a store.
SafRet SafStoreLoad (struct SafStore *Store, const char *Text)
 Load a store from structured text.
int SafVSnprintf (char *Buffer, size_t BufLen, const char *Format, va_list Args)
int SafSnprintf (char *Buffer, size_t BufLen, const char *Format,...)
SafRet SafGetEnvFunc (int(**FuncP)(), const char *Name, const char *Env)


Enumeration Type Documentation

enum SafMsgLvl

Log Message Level.

These are the level indicators for log messages passed to the SafLog() function.

Enumerator:
SafMsgINFO  Informational message.
SafMsgWARN  Warning message.
SafMsgERR  Error message.
SafMsgCRIT  Critical (fatal) error message.

Definition at line 51 of file saf-env.h.

enum SafLockRet

Lock Return Codes.

These are the return codes from the lock-management functions, SafLockEnq() and SafLockDeq().

Enumerator:
SafLockOK  Operation succeeded.
SafLockOWN  Caller already owns lock.
SafLockHELD  (Test, Use, Have) Lock is already held by another task
SafLockNHELD  (Deq, Change) Caller does not hold the lock
SafLockNEXIST  (Deq, Change) Lock does not exist
SafLockDENY  Request denied by system.
SafLockERR  Lock manager internal error.
SafLockPARAM  Invalid parameter passed by caller.

Definition at line 90 of file saf-env.h.


Function Documentation

mf_uns32 SafEnvInit ( struct SafInit Init  ) 

ESF Environment Initialization.

For internal use only.

This function is invoked by the ESF Manager Initialization routine to set the processing environment.

Parameters:
[in] Init ESF Manager initialization area (see SafInit).
Returns:
An integer value, zero for success and non-zero if initialization failed. See ESF Manager Initialization Return Codes and ESF Manager Initialization Internal Return Codes.

Definition at line 299 of file saf-env.c.

References SafInit::Environment, SafENV_CAS, SafENV_MFDS, SafENV_MTOMASK, SafENV_SOLO, SafINIT_ENV, SafINIT_INTERNAL, and SafINIT_OK.

SafRet SafShmOpen ( const char *  Name,
size_t *  Size,
void **  Area 
)

Open named "shared" memory.

Attach to an existing named memory area, or create it if it does not already exist. The area will be available to all ESF Manager and ESM Module instances in the current environment. In CAS, that means it's actually in the CAS shared memory segment; in MFDS, it's normal process-private memory.

Parameters:
[in] Name Name of the area being opened.
[in,out] Size Size of the area to create, if it does not already exist; actual size on return, if it does already exist.
[out] Area Returns a pointer to the area.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 791 of file saf-env.c.

References SafR_PARAM, and SafR_STATE.

Referenced by EsmGetSharedMem().

SafRet SafModLoad ( const char *  ModPath,
struct SafPTab *(**)(void)  Entry 
)

Load a module.

Load the named module into the process. The module should be an OS loadable object (DLL on Windows, CSO on Unix); on Windows, it is also possible to use a loadable COBOL module (int code or gnt code), but this is discouraged (because of poor error reporting by cobgetfuncaddr and other issues).

All modules loaded by ESF Manager follow the same conventions: they export an initial entry point which takes no parameters and returns a pointer to an array of function pointers. See the ESM Module Interface.

Parameters:
[in] ModPath Pathname of module to load. Searching the load path is also supported, but unwise (since this is security-sensitive). Note that the ESM Interface always passes an absolute path.
[out] Entry Pointer to function pointer which will be set to the initial entry point exported by the module.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 398 of file saf-env.c.

References Entry, Path, SafDupStr(), SafR_EXFAIL, SafR_INTERNAL, SafR_INVALID, SafR_NOTFOUND, SafR_OK, SafR_PARAM, SafR_RESOURCE, SafSTRCMP, SafThrLock(), and SafThrUnlock().

SafRet SafModUnload ( const char *  ModPath  ) 

Unload a module.

Unload the named module, if it was previously loaded by SafModLoad. The ModPath parameter must match the path passed to SafModLoad.

Parameters:
[in] ModPath Pathname of module to unload.
Returns:
Zero for success or a SafRet value for failure.
Todo:
Implement module unloading (RPI 550850).

Definition at line 606 of file saf-env.c.

References Handle, Path, SafR_EXFAIL, SafR_NOTFOUND, SafR_OK, SafR_PARAM, SafSTRCMP, SafThrLock(), and SafThrUnlock().

Referenced by SafEsmUnload().

SafRet SafGetInstPath ( char *  Path,
size_t  MaxLen 
)

Get product installation base path.

Determine the base path for the current product.

Parameters:
[out] Path Buffer for returned path, as a null-terminated string.
[in] MaxLen Maximum length of the returned path, including the terminating null.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 814 of file saf-env.c.

References SafR_EXFAIL, SafR_NOTFOUND, SafR_OK, SafR_RESOURCE, and SafR_TRUNCATED.

SafRet SafLog ( int  Num,
enum SafMsgLvl  Level,
const char *  DefaultText,
  ... 
)

Log a message.

Log a message with an environment-specific logging facility. We attempt to get message text for the current language (using the COBOL RTS NLS routines); if that fails, we use the default text supplied by the caller. (This is also convenient for developers and maintainers, who can see what message is being logged without looking up the message number.) Messages are treated as snprintf format strings, but they're scanned and only message text with whitelisted substitutions are allowed through.

NLS implementation notes: CBL_NLS_GET_MSG is used to retrieve message text on all platforms. CBL_NLS_GET_MSG will do formatting, but we don't let it; all the messages in the catalog should have percent-signs doubled to prevent CBL_NLS_GET_MSG from trying to process them. See safmgr.err for examples; that's also where new messages should be added. safmgr.err is compiled into safmgr.lng, which should go in the same directory as the ESF Manager shared object.

Parameters:
[in] Num Message number (see ESF Manager Messages and Logging)
[in] Level Message level (see SafMsgLvl)
[in] DefaultText Default message text
[in] ... Substitution parameters
Returns:
Zero for success or a SafRet value for failure.

Definition at line 1001 of file saf-env.c.

References SafR_EXFAIL, SafR_INTERNAL, SafR_OK, SafR_PARAM, SafR_STATE, snprintf, and vsnprintf.

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

SafRet SafLogLit ( int  Num,
enum SafMsgLvl  Level,
const char *  Text 
)

Log a literal message.

This is similar to SafLog(), except that it does no formatting other than prefixing the message with the prefix, number, and level indicator. (Some of that may be environmentally specific, which is why it happens here.) Also, no NLS lookup is performed.

Parameters:
[in] Num Message number, as for SafLog().
[in] Level Message level, as for SafLog().
[in] Text Formatted message text.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 1196 of file saf-env.c.

References SafR_EXFAIL, SafR_PARAM, SafR_STATE, and snprintf.

Referenced by EsmLog().

SafRet SafAceeAlloc ( const char *  Name,
const char *  Group,
struct SafACEE **  AceeP,
int *  IsNew 
)

Allocate an ACEE.

Allocate or find an ACEE structure. Every verified user has an ACEE; this function will locate the ACEE if it exists, or create one if it does not. In the CAS environment, ACEEs are shared and managed by the environment; in other environments, we fake them.

The full key for the ACEE is actually Name and Group, since users can sign in under different groups. (This has no effect under some ESMs, but others honor it.)

Parameters:
[in] Name The unique name for the ACEE, which should be the user's short name (max 8 characters).
[in] Group Optional group name (max 8 characters).
[out] AceeP The returned ACEE pointer.
[out] IsNew Optional flag for whether this ACEE was created new (or an existing one was retrieved).
Returns:
Zero for success or a SafRet value for failure.

Definition at line 1248 of file saf-env.c.

References SafR_PARAM, and SafR_STATE.

Referenced by EsmGetAcee(), and SafVerify().

SafRet SafAceeIterate ( void *  Data,
int(*)(struct SafACEE *Acee, void *Data)  Callback 
)

Iterate over ACEEs.

Iterate over all existing ACEE structures. Every verified user has an ACEE; in all-groups mode, each verified {user, signon-group} pair will have a distinct ACEE. This function calls a callback supplied by the caller for each ACEE.

Iteration ends with the last ACEE, or when the callback returns a non-zero value.

Parameters:
[in] Data Pointer to any data the caller wishes to pass to the callback. (This could be an allocated area which the callback uses to pass data back to the caller, of course.)
[in] Callback A pointer to a function/procedure that takes a pointer to an ACEE and a pointer to arbitrary data (which will be the Data parameter described above), and returning an int.
Returns:
Zero for success or a SafRet value for failure. This will be the final value returned by the callback, unless an error occurs in the iterator itself. Typically, a callback will return 0 unless it wishes to end iteration (eg because it has found and processed the only ACEE it's interested in), which it can do by returning eg SafR_END. If there are no ACEEs, the function will return SafR_NOMORE.

Definition at line 1286 of file saf-env.c.

References SafR_PARAM, and SafR_STATE.

Referenced by EsmAceeIterate().

SafLockRet SafLockEnq ( const char *  QName,
const char *  RName,
int  Type,
int  Exclusive,
int  Lifetime 
)

Acquire a named lock (enqueue).

Enqueue on a named lock object. See EsmLockEnq() for more information.

Parameters:
[in] QName Queue (class) name of lock object, a nul-terminated string (max 8 characters, no spaces)
[in] RName Resource name of lock object, a nul-terminated string (max 255 characters)
[in] Type Operation type; see Lock Operation Types
[in] Exclusive Whether lock is shared (zero) or exclusive (non-zero); see Lock Exclusivity
[in] Lifetime Lock lifetime; see Lock Lifetimes
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1314 of file saf-env.c.

References SafESM_LCK_NONE, SafESM_LCK_PROC, SafLockERR, and SafLockPARAM.

Referenced by EsmLockEnq(), SafShmLock(), and SafThrLock().

SafLockRet SafThrLock ( const char *  Name,
int  Exclusive 
)

Acquire a named lock, if the environment is multithreaded.

If MultiThreaded is set, call the real locking function; otherwise a no-op. See EsmLockEnq() for more information. QName is always "#ESFMgr"; Type is always SafESM_LCK_NONE; Lifetime is always SafESM_LCK_PROC.

Parameters:
[in] Name Resource name of lock object, a nul-terminated string (max 255 characters)
[in] Exclusive Whether lock is shared (zero) or exclusive (non-zero); see Lock Exclusivity
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1348 of file saf-env.c.

References SafESM_LCK_NONE, SafESM_LCK_PROC, and SafLockEnq().

Referenced by SafModLoad(), SafModUnload(), and safterm().

SafLockRet SafShmLock ( const char *  Name,
int  Exclusive 
)

Acquire a named lock, if the environment uses shared memory.

If SharedMemory is set, call the real locking function; otherwise a no-op. See EsmLockEnq() for more information. QName is always "#ESFMgr"; Type is always SafESM_LCK_NONE; Lifetime is always SafESM_LCK_PROC.

Parameters:
[in] Name Resource name of lock object, a nul-terminated string (max 255 characters)
[in] Exclusive Whether lock is shared (zero) or exclusive (non-zero); see Lock Exclusivity
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1378 of file saf-env.c.

References SafESM_LCK_NONE, SafESM_LCK_PROC, and SafLockEnq().

SafLockRet SafLockDeq ( const char *  QName,
const char *  RName 
)

Release a named lock (dequeue).

Dequeue on a named lock object. See EsmLockDeq() for more information.

Parameters:
[in] QName Queue (class) name of lock object, a nul-terminated string (max 8 characters, no spaces)
[in] RName Resource name of lock object, a nul-terminated string (max 255 characters)
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1407 of file saf-env.c.

References SafLockERR, and SafLockPARAM.

Referenced by EsmLockDeq(), SafShmUnlock(), and SafThrUnlock().

SafLockRet SafThrUnlock ( const char *  Name  ) 

Release a named lock, if the environment is multithreaded.

If MultiThreaded is set, call the real locking function; otherwise a no-op. See EsmLockDeq() for more information. QName is always "#ESFMgr".

Parameters:
[in] Name Resource name of lock object, a nul-terminated string (max 255 characters)
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1431 of file saf-env.c.

References SafLockDeq().

Referenced by SafModLoad(), SafModUnload(), and safterm().

SafLockRet SafShmUnlock ( const char *  Name  ) 

Release a named lock, if the environment uses shared memory.

If SharedMemory is set, call the real locking function; otherwise a no-op. See EsmLockDeq() for more information. QName is always "#ESFMgr".

Parameters:
[in] Name Resource name of lock object, a nul-terminated string (max 255 characters)
Returns:
Zero for success or a SafLockRet value for error.

Definition at line 1451 of file saf-env.c.

References SafLockDeq().

int SafIsMT ( void   ) 

Identify multithreaded environments.

Return the value of the MultiThreaded internal variable, which is non-zero if the environment is multithreaded.

Returns:
Zero for single-threaded environments, non-zero for multithreaded.

Definition at line 1468 of file saf-env.c.

Referenced by EsmSafQuery(), and SafAllocStore().

int SafIsSharedMemory ( void   ) 

Identify multiprocess shared-memory environments.

Return the value of the SharedMemory internal variable, which is non-zero if the environment has multiple processes commmunicating with shared memory.

Returns:
Zero for non-shared-memory environments, non-zero for shared-memory environments.

Definition at line 1485 of file saf-env.c.

int SafStrcmpCI ( const char *  Str1,
const char *  Str2 
)

Case-insensitive string comparison.

Like strcmp, but case-insensitive (in the current locale). Can be used with the SafSTRCMP_CI macro.

Parameters:
[in] Str1 First string to be compared.
[in] Str2 Second string to be compared.
Returns:
One of {-1,0,1}, if Str1 is less than, equal to, or greater than Str2. Null pointers compare equal to each other and less than anything else (including an empty string).

Definition at line 684 of file saf-env.c.

int SafStrcmpCIN ( const char *  Str1,
const char *  Str2,
size_t  Len 
)

Case-insensitive string comparison (length-limited).

Like strncmp, but case-insensitive (in the current locale). Can be used with the SafSTRCMP_CIN macro.

Parameters:
[in] Str1 First string to be compared.
[in] Str2 Second string to be compared.
[in] Len Maximum number of characters to compare.
Returns:
One of {-1,0,1}, if Str1 is less than, equal to, or greater than Str2. Null pointers compare equal to each other and less than anything else (including an empty string).

Definition at line 720 of file saf-env.c.

char* SafDupStr ( const char *  Str  ) 

Duplicate a string.

Attempts to duplicate a string, allocating the new area and copying the source to it. Returns null if allocation fails. A null input is treated as the empty string.

Freeing the data is the caller's responsibility.

Parameters:
[in] Str String to be copied.
Returns:
New string or null.

Definition at line 757 of file saf-env.c.

Referenced by SafModLoad(), SafStoreAdd(), and SafStoreLoad().

SafRet SafAllocStore ( struct SafStore **  StoreP  ) 

Create a store.

A factory for associative stores. The caller defines a variable of type "pointer to struct SafStore" (an opaque structure) and passes its address to SafAllocStore:

   struct SafStore *MyStore = NULL;
   SafRet Ret;
   
   Ret = SafAllocStore(&MyStore);
   if (Ret)
      // handle error...

Parameters:
[out] StoreP Pointer to a pointer to a struct SafStore which will receive the address of the newly-created store.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 610 of file saf-store.c.

References SafIsMT(), SafR_OK, SafR_PARAM, and SafR_RESOURCE.

Referenced by EsmParseConfig().

SafRet SafFreeStore ( struct SafStore *  Store  ) 

Free a store and the class and name data in it.

Free a store, including freeing the internal data structures and the class and name data. The store must not be used after this function has been called.

Parameters:
[in] Store The store to be freed.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 671 of file saf-store.c.

References SafR_OK, and SafR_PARAM.

Referenced by EsmParseConfig().

SafRet SafClearStore ( struct SafStore *  Store  ) 

Remove all the data from a store.

Free the data in a store and reset it to its pristine state without reallocating or freeing the store itself or its mutex. This allows a store to be safely cleaned out while it may be in use by other threads.

Parameters:
[in] Store The store to be cleared.
Returns:
Zero for success or a SafRet value for failure.

Definition at line 735 of file saf-store.c.

References SafR_OK, and SafR_PARAM.

SafRet SafStoreRemove ( struct SafStore *  Store,
const char *  Class,
const char *  Name 
)

Remove an entry from a store.

Parameters:
[in] Store The store
[in] Class Class of the value to be removed
[in] Name Name of the value to be removed
Returns:
Zero for success or a SafRet value for failure.

Definition at line 804 of file saf-store.c.

References SafR_PARAM.

Referenced by SafStoreLoad().

SafRet SafStoreIterate ( struct SafStore *  Store,
const char *  Class,
SafRet(*)(const char *Class, const char *Name, void *Value, void *Data)  Visitor,
void *  Data,
SafRet VisitorErrP 
)

Iterate over a store, optionally filtering for a single class.

Iterate through the given store, calling the supplied visitor function on each value. Optionally filter by class. A nonzero return from the visitor ends iteration.

Parameters:
[in] Store The store
[in] Class An optional class name to restrict the iteration to values belonging to the specified class
[in] Visitor A callback, invoked for each value
[in] Data An optional pointer which will be passed to the visitor callback
[out] VisitorErrP Returns the final error code of the visitor callback
Returns:
Zero for success or a SafRet value for failure.

Definition at line 850 of file saf-store.c.

References SafR_NOMORE, SafR_OK, SafR_PARAM, and SafSTRCMP_CI.

SafRet SafStoreAdd ( struct SafStore *  Store,
const char *  Class,
const char *  Name,
void *  Pointer 
)

Add an entry to a store.

Add an entry to a store using the given class and name. The class and name strings are duplicated (and need not be preserved by the caller). The contents of the pointer being stored are not inspected; they are the caller's responsibility. If a value with the same class and name already exists in the store, it will be silently replaced.

Parameters:
[in] Store The store
[in] Class Class to store the value under
[in] Name Name of the value
[in] Pointer Pointer to be stored
Returns:
Zero for success or a SafRet value for failure.

Definition at line 927 of file saf-store.c.

References SafDupStr(), SafR_NOTFOUND, SafR_OK, SafR_PARAM, and SafR_RESOURCE.

Referenced by SafStoreLoad().

SafRet SafStoreFind ( struct SafStore *  Store,
const char *  Class,
const char *  Name,
void **  PointerP 
)

Retrieve an entry from a store.

Locate the entry in the given store with the given class and name, and set the output PointerP parameter to its value.

Parameters:
[in] Store The store
[in] Class Class of the value to be located
[in] Name Name of the value to be located
[out] PointerP Returns the pointer value from the store
Returns:
Zero for success or a SafRet value for failure.

Definition at line 996 of file saf-store.c.

References SafR_OK, and SafR_PARAM.

Referenced by EsmQueryConfig(), and SafQueryCfg().

SafRet SafStoreLoad ( struct SafStore *  Store,
const char *  Text 
)

Load a store from structured text.

Parse a string in "ini"-format structured text format, and add entries to a store corresponding to the sections, names, and values contained in it.

The format has name=value pairs, one per line, within sections indicated by a name in square brackets on a separate line (sometimes called a "section tag"). Blank lines and lines beginning with the comment character ; are ignored, and leading and trailing whitespace is removed from names and values.

For example:

   [Section One]
   Alice=1
   Bob=2

   # A comment

   [Section Two]
   Path = /some/series/of/directories
   a list = apples bananas pears
   #This = is commented out
   true = 1=1

The store provided by the caller (which must have been initialized, but need not be empty) will be populated with entries as follows: the section name string (again, leading and trailing whitespace removed) becomes the class for each section, names are entry names, and values are copied into individually-allocated string buffers that become the values in the store entries.

Any name-value pairs that appear before the first section tag will be stored under an empty class (a class of "").

So, given the sample data above:

   struct SafStore *Config;
   extern const char *ConfigData;   // points to string shown above
   void *Bob;

   // Parse the data into the store
   SafAllocStore(&Config);
   SafStoreLoad(Config, ConfigData);

   // Get value of "Bob" in "Section One"
   SafStoreFind(Config, "section one", "Bob", &Bob);
   printf("Bob is %s\n", Bob);

Parameters:
[out] Store The store to update from the parsed text
[in] Text The ini-format text to be parsed
Returns:
Zero for success or a SafRet value for failure.

Definition at line 1096 of file saf-store.c.

References SafDupStr(), SafR_INVALID, SafR_OK, SafR_PARAM, SafR_RESOURCE, SafStoreAdd(), SafStoreRemove(), and SafSTRING.

Referenced by EsmParseConfig().