summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-01 23:03:55 +0300
committerAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-21 17:30:26 +0300
commit0b6abe8cd97e9cdfd56ef6a4154bfd87775bb4bb (patch)
tree471c11515c92d64567943e5a47793413f68b3084 /include
parentf43a78bfc347f437abaf740371886b80f3e249da (diff)
downloadipmitool-0b6abe8cd97e9cdfd56ef6a4154bfd87775bb4bb.tar.gz
mc: guid: Fix timestamp decoding
Before this commit the 'Timestamp' line was always printed for all versions of GUID, even for non-time-based ones. Plus, only the time_low field was used, and it was used as if it contained seconds since UNIX Epoch, which it didn't. In fact this field along with other time_* fields constitute a single 60-bit value representing the count of 100ns intervals since adoption of Gregorial calendar (00:00:00.00 15 Oct 1582). For non-time-based versions of GUID, the time_* fields do not represent any time at all. So, after this commit, the timestamp will be properly decoded for time-based GUID version 1 only. For other versions the 'Timestamp' line will not be displayed. A line showing the GUID version will be added to the output. Partially resolves ipmitool/ipmitool#25 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Diffstat (limited to 'include')
-rw-r--r--include/ipmitool/ipmi_mc.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/ipmitool/ipmi_mc.h b/include/ipmitool/ipmi_mc.h
index 38b67eb..a5e5cb2 100644
--- a/include/ipmitool/ipmi_mc.h
+++ b/include/ipmitool/ipmi_mc.h
@@ -110,6 +110,25 @@ typedef enum {
#define GUID_NODE_SZ 6
+#define GUID_VER_MASK 0x0F
+#define GUID_VER_SHIFT 12
+#define GUID_VERSION(t_hi) (((t_hi) >> GUID_VER_SHIFT) & GUID_VER_MASK)
+#define GUID_TIME_HI(t_hi) ((t_hi) & ~(GUID_VER_MASK << GUID_VER_SHIFT))
+
+typedef enum {
+ GUID_VERSION_UNKNOWN = 0, /* Not valid according to any specification */
+
+ /* The following are according to IPMI/SMBIOS/RFC4122 */
+ GUID_VERSION_TIME, /* Time-based, recommended for IPMI */
+ GUID_VERSION_DCE, /* DCE Security with POSIX UIDs, not for IPMI */
+ GUID_VERSION_MD5, /* Name-based, using MD5 */
+ GUID_VERSION_RND, /* Randomly generated */
+ GUID_VERSION_SHA1, /* Name-based, using SHA-1 */
+
+ GUID_VERSION_MAX = GUID_VERSION_SHA1, /* The maximum supported version */
+ GUID_VERSION_COUNT /* The number of supported versions */
+} guid_version_t;
+
/* The structure follows IPMI v2.0, rev 1.1
* See section 20.8 */
#ifdef HAVE_PRAGMA_PACK