Special IPMI Formats
IPMI uses a special format for storing strings. It allows data to be stored in four different formats. The first byte describes the type and length; the format is: bits 0-4 - The number of bytes following this byte. Note that this is not the number of characters in the string, it is the number of bytes following. The value of 11111b is reserved. bit 5 - reserved bits 6-7 - The string type. Valid values are: 00h - Unicode 01h - BCD plus 02h - 6-bit ASCII, packed 03h - 8-bit ASCII and Latin 1. In this case, a length of one is reserved. The length may be zero, or it may be from 2 to 30, but may not be 1. The values and packing are defined in the IPMI spec. TBD - add character values and packing information
OpenIPMI does most of the work of decoding the IPMI strings. Generally, to fetch a string, three functions are supported that generally look something like:
int ipmi_xxx_get_id_length(ipmi_xxx_t *obj); e n u m i p m i _ s t r _ t y p e _ e i p m i _ x x x _ g e t _ i d _ t y p e ( i p m i _ x x x _ t * o b j int ipmi_xxx_get_id(ipmi_xxx_t *obj, char *id, int length); ) ;
Fetching the type allows you to tell what it is. The type may be one of:
IPMI ASCII STR - The value is in normal ASCII and Latin 1
IPMI UNICODE STR - The value is unicode encoded.
IPMI BINARY STR - The value is raw binary data.