2.2. OPENIPMI CONCEPTS
Random Data For certain operations, OpenIPMI needs random data.
Logging Logs that OpenIPMI uses to report information and internal problems comes through the OS Handler.
Database OpenIPMI can use an external database to hold persistent information (like SDRs) and thus avoid having to fetch them every time it starts up. This interface is not required, but can greatly reduce the startup time of OpenIPMI.
User Functions Not used by OpenIPMI, but available for the user for special things the user will need.
Standard User Functions in the OS Handler OS handlers have some standard functions pointers for the user. These are:
free os handler perform one op
Free the OS handler. Do not use the OS handler after calling this. Handle one event (a timer timeout or a file operation) and return. This takes a timeout; it will wait up to the amount of time given for the event. Continuously handle events. This function will not return.
These operations may not be available on all OS handlers, see the particular OS handler you are using for more details.
These are part of the OS handler. As an example on how to use them, the following code performs one operation, prints any error it returns, then frees the OS handler:
struct timeval tv; int rv; tv.tv_sec = 10; tv.tv_usec = 0; rv = os_hnd->perform_one_op(os_hnd, &tv); if (rv)
printf("Error handling operation: 0x%x", rv); os_hnd->free_os_handler(os_hnd);
POSIX OS Handlers
OS handlers are already defined for POSIX systems, both with and without threads. These are defined in the include file ipmi_posix.h; see that file for more details. If you are running in a threaded application, you almost certainly should use the threaded version of the OS handlers.
To allocate a POSIX OS handler, use one of the following:
o s _ h n d = i p m i _ p o s i x _ s e t u p _ o s _ h a n d l e r ( ) ;
o s _ h n d = i p m i _ p o s i x _ t h r e a d _ s e t u p _ o s _ h a n d l e r ( w a k e _ s i g ) ;
The wake_sig is a signal number that your program is not using (usually SIGUSR1, SIGUSR2, or a real- time signal). The OS handlers uses this signal to send between threads to wake them up if they need to be woken.
Freeing and handling the OS handler is done with the standard functions in the OS handler, described in section 2.2.2.