📄 ipmiif.h
字号:
handler returns an integer. It should return IPMI_EVENT_HANDLED if it handled the event, or IPMI_EVENT_NOT_HANDLED if it didn't handle the event. "Handling" the event means that is will manage the event (delete it when it is time). If no sensor handles the event, then it will be delivered to the "main" unhandled event handler for the domain. */typedef int (*ipmi_entity_hot_swap_cb)(ipmi_entity_t *ent, enum ipmi_hot_swap_states last_state, enum ipmi_hot_swap_states curr_state, void *cb_data, ipmi_event_t *event);int ipmi_entity_add_hot_swap_handler(ipmi_entity_t *ent, ipmi_entity_hot_swap_cb handler, void *cb_data);int ipmi_entity_remove_hot_swap_handler(ipmi_entity_t *ent, ipmi_entity_hot_swap_cb handler, void *cb_data);/* Get the current hot-swap state. */typedef void (*ipmi_entity_hot_swap_state_cb)(ipmi_entity_t *ent, int err, enum ipmi_hot_swap_states state, void *cb_data);int ipmi_entity_get_hot_swap_state(ipmi_entity_t *ent, ipmi_entity_hot_swap_state_cb handler, void *cb_data);/* Thses set whether the device will automatically be activated and deactivated by the hardware or OpenIPMI. Both values are get/set together. By default devices will automatically be activated/deactivated and this value is set to zero, or IPMI_TIMEOUT_NOW (upon insertion, they will transition directly to active state. Upon a removal request, it will transition directly to inactive). If this is set to IPMI_TIMEOUT_FOREVER, then the state machine will stop in the inactive/removal pending state and the user must call the activate or deactivate routines below to push it out of those states. Otherwise, the timeout is the time in nanoseconds for the operation. */int ipmi_entity_get_auto_activate_time(ipmi_entity_t *ent, ipmi_entity_time_cb handler, void *cb_data);int ipmi_entity_set_auto_activate_time(ipmi_entity_t *ent, ipmi_timeout_t auto_act, ipmi_entity_cb done, void *cb_data);int ipmi_entity_get_auto_deactivate_time(ipmi_entity_t *ent, ipmi_entity_time_cb handler, void *cb_data);int ipmi_entity_set_auto_deactivate_time(ipmi_entity_t *ent, ipmi_timeout_t auto_deact, ipmi_entity_cb done, void *cb_data);/* Cause the entity to move from INACTIVE to ACTIVATION_REQUESTED state, if possible. If the entity does not support this operation, this will return ENOSYS and you can move straight from INACTIVE to ACTIVE state by calling ipmi_entity_active. */int ipmi_entity_set_activation_requested(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data);/* Attempt to activate or deactivate an entity. Activate will cause a transition from INACTIVE to ACTIVE (but only if ipmi_entity_set_activation_requested() returns ENOSYS), or from ACTIVATION_REQUESTED to ACTIVE. Deactivate will cause a transition from DEACTIVATION_REQUESTED or ACTIVE to INACTIVE. */int ipmi_entity_activate(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data);int ipmi_entity_deactivate(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data);/* Set and get the hot-swap indicator. Note that some systems manage the hot-swap indicator themselves, the set routine will return ENOSYS if this is the case. */int ipmi_entity_get_hot_swap_indicator(ipmi_entity_t *ent, ipmi_entity_val_cb handler, void *cb_data);int ipmi_entity_set_hot_swap_indicator(ipmi_entity_t *ent, int val, ipmi_entity_cb done, void *cb_data);/* Get the current value of the hot-swap requester, if available. If not available, this will return ENOSYS. The hot-swap requester is the thing on the chassis that the operator uses to request a hot-swap of the entity (like the the ejector handle switch). */int ipmi_entity_get_hot_swap_requester(ipmi_entity_t *ent, ipmi_entity_val_cb handler, void *cb_data);/* Check the state of hot-swap for the entity. */int ipmi_entity_check_hot_swap_state(ipmi_entity_t *ent);/* Entity ID based versions of some of the above calls. */int ipmi_entity_id_get_hot_swap_state(ipmi_entity_id_t id, ipmi_entity_hot_swap_state_cb handler, void *cb_data);int ipmi_entity_id_get_auto_activate_time(ipmi_entity_id_t id, ipmi_entity_time_cb handler, void *cb_data);int ipmi_entity_id_set_auto_activate_time(ipmi_entity_id_t id, ipmi_timeout_t auto_act, ipmi_entity_cb done, void *cb_data);int ipmi_entity_id_get_auto_deactivate_time(ipmi_entity_id_t id, ipmi_entity_time_cb handler, void *cb_data);int ipmi_entity_id_set_auto_deactivate_time(ipmi_entity_id_t id, ipmi_timeout_t auto_deact, ipmi_entity_cb done, void *cb_data);int ipmi_entity_id_activate(ipmi_entity_id_t id, ipmi_entity_cb done, void *cb_data);int ipmi_entity_id_deactivate(ipmi_entity_id_t id, ipmi_entity_cb done, void *cb_data);int ipmi_entity_id_get_hot_swap_indicator(ipmi_entity_id_t id, ipmi_entity_val_cb handler, void *cb_data);int ipmi_entity_id_set_hot_swap_indicator(ipmi_entity_id_t id, int val, ipmi_entity_cb done, void *cb_data);int ipmi_entity_id_get_hot_swap_requester(ipmi_entity_id_t id, ipmi_entity_val_cb handler, void *cb_data);int ipmi_entity_id_check_hot_swap_state(ipmi_entity_id_t id);/* Handles events from the given sensor with the handler. Only one handler may be registered against a sensor, if you call this again with a new handler, the old handler will be replaced. Set the handler to NULL to disable it. The dir variable tells if the threshold is being asserted or deasserted. The high_low value tells if the value is going high or low, and the threshold value tells which threshold is being reported. The value_present field tells whether the raw or converted values are present. If the "event" field is not NULL, then the log provided is the log that caused this event to be generated; it is provided so you may delete the log from the SEL. *//* THIS CALL IS DEPRECATED. Please use the add and remove versions of this function.*/enum ipmi_value_present_e { IPMI_NO_VALUES_PRESENT, IPMI_RAW_VALUE_PRESENT, IPMI_BOTH_VALUES_PRESENT };typedef void (*ipmi_sensor_threshold_event_handler_cb)( ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, enum ipmi_thresh_e threshold, enum ipmi_event_value_dir_e high_low, enum ipmi_value_present_e value_present, unsigned int raw_value, double value, void *cb_data, ipmi_event_t *event);intipmi_sensor_threshold_set_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_threshold_event_handler_cb handler, void *cb_data);/* Handle events from a given sensor. This allows multiple handlers to be added to a sensor. Also, the handler returns an integer. It should return IPMI_EVENT_HANDLED if it handled the event, or IPMI_EVENT_NOT_HANDLED if it didn't handle the event. "Handling" the event means that is will manage the event (delete it when it is time). If no sensor handles the event, then it will be delivered to the "main" unhandled event handler for the domain. */typedef int (*ipmi_sensor_threshold_event_cb)( ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, enum ipmi_thresh_e threshold, enum ipmi_event_value_dir_e high_low, enum ipmi_value_present_e value_present, unsigned int raw_value, double value, void *cb_data, ipmi_event_t *event);int ipmi_sensor_add_threshold_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_threshold_event_cb handler, void *cb_data);int ipmi_sensor_remove_threshold_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_threshold_event_cb handler, void *cb_data);/* Register a handler for a discrete sensor. Only one handler may be registered against a sensor, if you call this again with a new handler, the old handler will be replaced. Set the handler to NULL to disable it. When an event comes in from the sensor, the callback function will be called. The "dir" variable tells if the state is being asserted or deasserted, the offset is the state that is being asserted or deasserted. If the "event" field is not NULL, then the event provided is the event that caused this event to be generated; it is provided so you may delete the event from the SEL. Note that the offset, severity, and prev_severity values will be -1 if not valid or present. *//* THIS CALL IS DEPRECATED. Please use the add and remove versions of this function.*/typedef void (*ipmi_sensor_discrete_event_handler_cb)( ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, int offset, int severity, int prev_severity, void *cb_data, ipmi_event_t *event);intipmi_sensor_discrete_set_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_discrete_event_handler_cb handler, void *cb_data);/* Register a handler to be called for incoming events on the sensor. This call allows multiple handlers to be added to a sensor. Also, the handler returns an integer. It should return IPMI_EVENT_HANDLED if it handled the event, or IPMI_EVENT_NOT_HANDLED if it didn't handle the event. "Handling" the event means that is will manage the event (delete it when it is time). If no sensor handles the event, then it will be delivered to the "main" unhandled event handler for the domain. */typedef int (*ipmi_sensor_discrete_event_cb)( ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, int offset, int severity, int prev_severity, void *cb_data, ipmi_event_t *event);int ipmi_sensor_add_discrete_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_discrete_event_cb handler, void *cb_data);int ipmi_sensor_remove_discrete_event_handler( ipmi_sensor_t *sensor, ipmi_sensor_discrete_event_cb handler, void *cb_data);/* The event state is which events are set and cleared for the given sensor. Events are enumerated for threshold events and numbered for discrete events. Use the provided functions to initialize, read, and modify an event state. */typedef struct ipmi_event_state_s ipmi_event_state_t;/* Return the size of an event state data structure, so you can allocate your own and copy them. */unsigned int ipmi_event_state_size(void);void ipmi_copy_event_state(ipmi_event_state_t *dest, ipmi_event_state_t *src);/* Routines to init, clear, set, and query values in the event state. */void ipmi_event_state_set_events_enabled(ipmi_event_state_t *events, int val);int ipmi_event_state_get_events_enabled(ipmi_event_state_t *events);void ipmi_event_state_set_scanning_enabled(ipmi_event_state_t *events,int val);int ipmi_event_state_get_scanning_enabled(ipmi_event_state_t *events);void ipmi_event_state_set_busy(ipmi_event_state_t *events, int val);int ipmi_event_state_get_busy(ipmi_event_state_t *events);void ipmi_event_state_set_enable_events(ipmi_event_state_t *events, int val);void ipmi_event_state_init(ipmi_event_state_t *events);void ipmi_threshold_event_clear(ipmi_event_state_t *events, enum ipmi_thresh_e type, enum ipmi_event_value_dir_e value_dir, enum ipmi_event_dir_e dir);void ipmi_threshold_event_set(ipmi_event_state_t *events, enum ipmi_thresh_e type, enum ipmi_event_value_dir_e value_dir, enum ipmi_event_dir_e dir);int ipmi_is_threshold_event_set(ipmi_event_state_t *events, enum ipmi_thresh_e type, enum ipmi_event_value_dir_e value_dir, enum ipmi_event_dir_e dir);void ipmi_discrete_event_clear(ipmi_event_state_t *events, int event_offset, enum ipmi_event_dir_e dir);void ipmi_discrete_event_set(ipmi_event_state_t *events, int event_offset, enum ipmi_event_dir_e dir);int ipmi_is_discrete_event_set(ipmi_event_state_t *events, int event_offset, enum ipmi_event_dir_e dir);/* A generic callback for a lot of things. */typedef void (*ipmi_sensor_done_cb)(ipmi_sensor_t *sensor,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -