add freeipmi source
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_CHANNEL_UTIL_H
|
||||
#define IPMI_CHANNEL_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/api/ipmi-api.h>
|
||||
|
||||
/* Get first channel found for medium type*/
|
||||
int ipmi_get_channel_number (ipmi_ctx_t ctx,
|
||||
uint8_t channel_medium_type,
|
||||
uint8_t *channel_number);
|
||||
|
||||
/* Returns all channel numbers found for medium type, return value is
|
||||
* number of channel numbers returned. If number of channel numbers
|
||||
* found exceeds channel_numbers_len, return is truncated.
|
||||
*/
|
||||
int ipmi_get_channel_numbers (ipmi_ctx_t ctx,
|
||||
uint8_t channel_medium_type,
|
||||
uint8_t *channel_numbers,
|
||||
unsigned int channel_numbers_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_CHANNEL_UTIL_H */
|
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_CIPHER_SUITE_UTIL_H
|
||||
#define IPMI_CIPHER_SUITE_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/interface/ipmi-rmcpplus-interface.h>
|
||||
|
||||
#define IPMI_CIPHER_SUITE_COMBINATION_VALID(__a, __i, __c) \
|
||||
/* Cipher Suite 0 */ \
|
||||
((((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_NONE \
|
||||
&& (__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE) \
|
||||
/* Cipher Suite 1 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 2-5 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA1_96 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40))) \
|
||||
/* Cipher Suite 6 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 7-10 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_MD5_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40))) \
|
||||
/* Cipher Suite 11-14 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_MD5_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40))) \
|
||||
/* Cipher Suite 15 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 16-19 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA256_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40))) ) ? 1 : 0)
|
||||
|
||||
#define IPMI_CIPHER_SUITE_COMBINATION_SUPPORTED(__a, __i, __c) \
|
||||
/* Cipher Suite 0 */ \
|
||||
((((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_NONE \
|
||||
&& (__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE) \
|
||||
/* Cipher Suite 1 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 2-3 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA1_96 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128))) \
|
||||
/* Cipher Suite 6 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 7-8 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_MD5_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128))) \
|
||||
/* Cipher Suite 11-12 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_MD5_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128))) \
|
||||
/* Cipher Suite 15 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_NONE \
|
||||
&& (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE)) \
|
||||
/* Cipher Suite 16-17 */ \
|
||||
|| ((__a) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256 \
|
||||
&& ((__i) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA256_128 \
|
||||
&& ((__c) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|
||||
|| (__c) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128))) ) ? 1 : 0)
|
||||
|
||||
/* To avoid gcc warnings, add +1 in comparison */
|
||||
/* achu: no macros here, cipher suite ids are numbers */
|
||||
#define IPMI_CIPHER_SUITE_ID_SUPPORTED(__id) \
|
||||
((((__id + 1) >= (0 + 1) && (__id) <= 3) \
|
||||
|| ((__id) >= 6 && (__id) <= 8) \
|
||||
|| ((__id) >= 11 && (__id) <= 12) \
|
||||
|| ((__id) >= 15 && (__id) <= 17)) ? 1 : 0)
|
||||
|
||||
int ipmi_cipher_suite_id_to_algorithms (uint8_t cipher_suite_id,
|
||||
uint8_t *authentication_algorithm,
|
||||
uint8_t *integrity_algorithm,
|
||||
uint8_t *confidentiality_algorithm);
|
||||
|
||||
int ipmi_algorithms_to_cipher_suite_id (uint8_t authentication_algorithm,
|
||||
uint8_t integrity_algorithm,
|
||||
uint8_t confidentiality_algorithm,
|
||||
uint8_t *cipher_suite_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_CIPHER_SUITE_UTIL_H */
|
58
source/freeipmi/usr/include/freeipmi/util/ipmi-dcmi-util.h
Normal file
58
source/freeipmi/usr/include/freeipmi/util/ipmi-dcmi-util.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
/*****************************************************************************\
|
||||
* Copyright (C) 2009-2015 Lawrence Livermore National Security, LLC.
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* Written by Albert Chu <chu11@llnl.gov>
|
||||
* LLNL-CODE-413270
|
||||
*
|
||||
* This file is part of Ipmi-Dcmi, tools and libraries to support the
|
||||
* data center manageability interface (DCMI). For details, see
|
||||
* http://www.llnl.gov/linux/.
|
||||
*
|
||||
* Ipmi-Dcmi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Ipmi-Dcmi is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with Ipmi-Dcmi. If not, see <http://www.gnu.org/licenses/>.
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef IPMI_DCMI_UTIL_H
|
||||
#define IPMI_DCMI_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
const char *ipmi_cmd_dcmi_str (uint8_t cmd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_DCMI_UTIL_H */
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_DEVICE_TYPES_UTIL_H
|
||||
#define IPMI_DEVICE_TYPES_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
int ipmi_device_type_modifer_message (uint8_t device_type,
|
||||
uint8_t device_modifier,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_DEVICE_TYPES_UTIL_H */
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_ENTITY_IDS_H
|
||||
#define IPMI_ENTITY_IDS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const char *ipmi_get_entity_id_string (uint8_t entity_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_ENTITY_IDS_H */
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
/*****************************************************************************\
|
||||
* Copyright (C) 2009-2015 Lawrence Livermore National Security, LLC.
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* Written by Albert Chu <chu11@llnl.gov>
|
||||
* LLNL-CODE-413270
|
||||
*
|
||||
* This file is part of Ipmi-Dcmi, tools and libraries to support the
|
||||
* data center manageability interface (DCMI). For details, see
|
||||
* http://www.llnl.gov/linux/.
|
||||
*
|
||||
* Ipmi-Dcmi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Ipmi-Dcmi is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with Ipmi-Dcmi. If not, see <http://www.gnu.org/licenses/>.
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef IPMI_ERROR_DCMI_UTIL_H
|
||||
#define IPMI_ERROR_DCMI_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ipmi_completion_code_dcmi_strerror_r (uint8_t cmd,
|
||||
uint8_t netfn,
|
||||
uint8_t comp_code,
|
||||
char *errstr,
|
||||
size_t len);
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ipmi_completion_code_dcmi_strerror_cmd_r (fiid_obj_t obj_cmd,
|
||||
uint8_t netfn,
|
||||
char *errstr,
|
||||
size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_ERROR_DCMI_UTIL_H */
|
54
source/freeipmi/usr/include/freeipmi/util/ipmi-error-util.h
Normal file
54
source/freeipmi/usr/include/freeipmi/util/ipmi-error-util.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_ERROR_UTIL_H
|
||||
#define IPMI_ERROR_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
#define IPMI_ERR_STR_MAX_LEN 2048
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ipmi_completion_code_strerror_r (uint8_t cmd,
|
||||
uint8_t netfn,
|
||||
uint8_t comp_code,
|
||||
char *errstr,
|
||||
size_t len);
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ipmi_completion_code_strerror_cmd_r (fiid_obj_t obj_cmd,
|
||||
uint8_t netfn,
|
||||
char *errstr,
|
||||
size_t len);
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ipmi_rmcpplus_status_strerror_r (uint8_t rmcpplus_status_code,
|
||||
char *errstr,
|
||||
size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_ERROR_UTIL_H */
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IPMI_IANA_ENTERPRISE_NUMBERS_UTIL_H
|
||||
#define IPMI_IANA_ENTERPRISE_NUMBERS_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* returns length written into buffer on success, -1 on error */
|
||||
/* if 0 bytes written, indicates no strings for manufacturer id
|
||||
* if -1 w/ EINVAL, indicates manufacturer id out of range
|
||||
* will handle special case known bad manufacturer ids
|
||||
*/
|
||||
int ipmi_iana_enterprise_numbers_string (uint32_t manufacturer_id,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_IANA_ENTERPRISE_NUMBERS_UTIL_H */
|
42
source/freeipmi/usr/include/freeipmi/util/ipmi-ipmb-util.h
Normal file
42
source/freeipmi/usr/include/freeipmi/util/ipmi-ipmb-util.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_IPMB_UTIL_H
|
||||
#define IPMI_IPMB_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_ipmb_check_rq_seq (fiid_obj_t obj_ipmb_msg_hdr, uint8_t rq_seq);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_ipmb_check_checksum (uint8_t rq_addr,
|
||||
fiid_obj_t obj_ipmb_msg_hdr,
|
||||
fiid_obj_t obj_cmd,
|
||||
fiid_obj_t obj_ipmb_msg_trlr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_IPMB_UTIL_H */
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_JEDEC_MANUFACTURER_IDENTIFICATION_CODE_UTIL_H
|
||||
#define IPMI_JEDEC_MANUFACTURER_IDENTIFICATION_CODE_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
char *ipmi_jedec_manufacturer_id_search (uint8_t continuation_codes_count, uint8_t id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_JEDEC_MANUFACTURER_IDENTIFICATION_CODE_UTIL_H */
|
71
source/freeipmi/usr/include/freeipmi/util/ipmi-lan-util.h
Normal file
71
source/freeipmi/usr/include/freeipmi/util/ipmi-lan-util.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_LAN_UTIL_H
|
||||
#define IPMI_LAN_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_session_sequence_number (fiid_obj_t obj_lan_session_hdr,
|
||||
uint32_t session_sequence_number);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_session_id (fiid_obj_t obj_lan_session_hdr,
|
||||
uint32_t session_id);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_session_authentication_code (fiid_obj_t obj_lan_session_hdr_rs,
|
||||
fiid_obj_t obj_lan_msg_hdr_rs,
|
||||
fiid_obj_t obj_cmd,
|
||||
fiid_obj_t obj_lan_msg_trlr_rs,
|
||||
uint8_t authentication_type,
|
||||
const void *authentication_code_data,
|
||||
unsigned int authentication_code_data_len);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_packet_session_authentication_code (const void *pkt,
|
||||
unsigned int pkt_len,
|
||||
uint8_t authentication_type,
|
||||
const void *authentication_code_data,
|
||||
unsigned int authentication_code_data_len);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_net_fn (fiid_obj_t obj_lan_msg_hdr, uint8_t net_fn);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_rq_seq (fiid_obj_t obj_lan_msg_hdr, uint8_t rq_seq);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_checksum (fiid_obj_t obj_lan_msg_hdr,
|
||||
fiid_obj_t obj_cmd,
|
||||
fiid_obj_t obj_lan_msg_trlr);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_lan_check_packet_checksum (const void *pkt, unsigned int pkt_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_LAN_UTIL_H */
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_OUTOFBAND_UTIL_H
|
||||
#define IPMI_OUTOFBAND_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_is_ipmi_1_5_packet (const void *pkt, unsigned int pkt_len);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_is_ipmi_2_0_packet (const void *pkt, unsigned int pkt_len);
|
||||
|
||||
int ipmi_check_session_sequence_number_1_5_init (uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list);
|
||||
|
||||
int ipmi_check_session_sequence_number_2_0_init (uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list);
|
||||
|
||||
/* returns 1 if sequence number in range, 0 if not, -1 on error */
|
||||
/* highest_received_sequence_number and previously_received_list updated on success */
|
||||
/* set sequence_number_window to 0 for default */
|
||||
int ipmi_check_session_sequence_number_1_5 (uint32_t session_sequence_number,
|
||||
uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list,
|
||||
unsigned int sequence_number_window);
|
||||
|
||||
/* returns 1 if sequence number in range, 0 if not, -1 on error */
|
||||
/* highest_received_sequence_number and previously_received_list updated on success */
|
||||
/* set sequence_number_window to 0 for default */
|
||||
int ipmi_check_session_sequence_number_2_0 (uint32_t session_sequence_number,
|
||||
uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list,
|
||||
unsigned int sequence_number_window);
|
||||
|
||||
/* returns 1 on supported, 0 on not-supported, -1 on error */
|
||||
/* obj_cmd must be get authentication capabilities response */
|
||||
int ipmi_check_authentication_capabilities_authentication_type (uint8_t authentication_type,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on supported, 0 on not-supported, -1 on error */
|
||||
/* username NULL == no username */
|
||||
/* password NULL == no password */
|
||||
/* obj_cmd must be get authentication capabilities response */
|
||||
/* note that length of fields unimportant, only NULL vs. non-NULL checked */
|
||||
int ipmi_check_authentication_capabilities_username (const char *username,
|
||||
const char *password,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on supported, 0 on not-supported, -1 on error */
|
||||
/* obj_cmd must be get authentication capabilities response */
|
||||
int ipmi_check_authentication_capabilities_ipmi_2_0 (fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on supported, 0 on not-supported, -1 on error */
|
||||
/* k_g NULL == no k_g */
|
||||
/* obj_cmd must be get authentication capabilities response */
|
||||
/* note that length of fields unimportant, only NULL vs. non-NULL checked */
|
||||
int ipmi_check_authentication_capabilities_k_g (const void *k_g,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on privilege level supported, 0 on not-supported, -1 on error */
|
||||
/* obj_cmd must be open session response */
|
||||
int ipmi_check_open_session_maximum_privilege (uint8_t privilege_level,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_OUTOFBAND_UTIL_H */
|
176
source/freeipmi/usr/include/freeipmi/util/ipmi-rmcpplus-util.h
Normal file
176
source/freeipmi/usr/include/freeipmi/util/ipmi-rmcpplus-util.h
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_RMCPPLUS_UTIL_H
|
||||
#define IPMI_RMCPPLUS_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* return length of data written into buffer on success, -1 on error */
|
||||
int ipmi_calculate_sik (uint8_t authentication_algorithm,
|
||||
const void *k_g,
|
||||
unsigned int k_g_len,
|
||||
const void *remote_console_random_number,
|
||||
unsigned int remote_console_random_number_len,
|
||||
const void *managed_system_random_number,
|
||||
unsigned int managed_system_random_number_len,
|
||||
uint8_t name_only_lookup,
|
||||
uint8_t requested_privilege_level,
|
||||
const char *user_name,
|
||||
unsigned int user_name_len,
|
||||
void *sik,
|
||||
unsigned int sik_len);
|
||||
|
||||
/* return length of data written into buffer on success, -1 on error */
|
||||
int ipmi_calculate_k1 (uint8_t authentication_algorithm,
|
||||
const void *sik_key,
|
||||
unsigned int sik_key_len,
|
||||
void *k1,
|
||||
unsigned int k1_len);
|
||||
|
||||
/* return length of data written into buffer on success, -1 on error */
|
||||
int ipmi_calculate_k2 (uint8_t authentication_algorithm,
|
||||
const void *sik_key,
|
||||
unsigned int sik_key_len,
|
||||
void *k2,
|
||||
unsigned int k2_len);
|
||||
|
||||
/* returns 0 on success, -1 on error.
|
||||
*
|
||||
* sik_key, integrity_key, confidentiality_key should be pointers to
|
||||
* buffers. length parameters should contains lengths of buffers.
|
||||
*
|
||||
* returned pointers and lengths reflect appropriate keys for
|
||||
* remaining rmcpplus communication.
|
||||
*/
|
||||
int ipmi_calculate_rmcpplus_session_keys (uint8_t authentication_algorithm,
|
||||
uint8_t integrity_algorithm,
|
||||
uint8_t confidentiality_algorithm,
|
||||
const void *authentication_code_data,
|
||||
unsigned int authentication_code_data_len,
|
||||
const void *k_g,
|
||||
unsigned int k_g_len,
|
||||
const void *remote_console_random_number,
|
||||
unsigned int remote_console_random_number_len,
|
||||
const void *managed_system_random_number,
|
||||
unsigned int managed_system_random_number_len,
|
||||
uint8_t name_only_lookup,
|
||||
uint8_t requested_privilege_level,
|
||||
const char *user_name,
|
||||
unsigned int user_name_len,
|
||||
void **sik_key,
|
||||
unsigned int *sik_key_len,
|
||||
void **integrity_key,
|
||||
unsigned int *integrity_key_len,
|
||||
void **confidentiality_key,
|
||||
unsigned int *confidentiality_key_len);
|
||||
|
||||
/* return length of data written into buffer on success, -1 on error */
|
||||
int ipmi_calculate_rakp_3_key_exchange_authentication_code (uint8_t authentication_algorithm,
|
||||
const void *k_uid,
|
||||
unsigned int k_uid_len,
|
||||
const void *managed_system_random_number,
|
||||
unsigned int managed_system_random_number_len,
|
||||
uint32_t remote_console_session_id,
|
||||
uint8_t name_only_lookup,
|
||||
uint8_t requested_privilege_level,
|
||||
const char *user_name,
|
||||
unsigned int user_name_len,
|
||||
void *key_exchange_authentication_code,
|
||||
unsigned int key_exchange_authentication_code_len);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_payload_pad (uint8_t confidentiality_algorithm,
|
||||
fiid_obj_t obj_rmcpplus_payload);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_integrity_pad (fiid_obj_t obj_rmcpplus_session_trlr);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_rakp_2_key_exchange_authentication_code (uint8_t authentication_algorithm,
|
||||
const void *k_uid,
|
||||
unsigned int k_uid_len,
|
||||
uint32_t remote_console_session_id,
|
||||
uint32_t managed_system_session_id,
|
||||
const void *remote_console_random_number,
|
||||
unsigned int remote_console_random_number_len,
|
||||
const void *managed_system_random_number,
|
||||
unsigned int managed_system_random_number_len,
|
||||
const void *managed_system_guid,
|
||||
unsigned int managed_system_guid_len,
|
||||
uint8_t name_only_lookup,
|
||||
uint8_t requested_privilege_level,
|
||||
const char *user_name,
|
||||
unsigned int user_name_len,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_rakp_4_integrity_check_value (uint8_t authentication_algorithm,
|
||||
const void *sik_key,
|
||||
unsigned int sik_key_len,
|
||||
const void *remote_console_random_number,
|
||||
unsigned int remote_console_random_number_len,
|
||||
uint32_t managed_system_session_id,
|
||||
const void *managed_system_guid,
|
||||
unsigned int managed_system_guid_len,
|
||||
fiid_obj_t obj_cmd);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_packet_session_authentication_code (uint8_t integrity_algorithm,
|
||||
const void *pkt,
|
||||
unsigned int pkt_len,
|
||||
const void *integrity_key,
|
||||
unsigned int integrity_key_len,
|
||||
const void *authentication_code_data,
|
||||
unsigned int authentication_code_data_len,
|
||||
fiid_obj_t obj_rmcpplus_session_trlr);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_payload_type (fiid_obj_t obj_rmcpplus_session_hdr,
|
||||
uint8_t payload_type);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_status_code (fiid_obj_t obj_cmd,
|
||||
uint8_t status_code);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_message_tag (fiid_obj_t obj_cmd,
|
||||
uint8_t message_tag);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_remote_console_session_id (fiid_obj_t obj_cmd,
|
||||
uint32_t remote_console_session_id);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcpplus_check_session_id (fiid_obj_t obj_rmcpplus_session_hdr,
|
||||
uint32_t session_id);
|
||||
|
||||
int ipmi_rmcpplus_calculate_payload_type (const void *pkt,
|
||||
unsigned int pkt_len,
|
||||
uint8_t *payload_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_RMCPPLUS_UTIL_H */
|
@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_SENSOR_AND_EVENT_CODE_TABLES_UTIL_H
|
||||
#define IPMI_SENSOR_AND_EVENT_CODE_TABLES_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define IPMI_EVENT_READING_TYPE_CODE_CLASS_THRESHOLD 0x01
|
||||
#define IPMI_EVENT_READING_TYPE_CODE_CLASS_GENERIC_DISCRETE 0x02
|
||||
#define IPMI_EVENT_READING_TYPE_CODE_CLASS_SENSOR_SPECIFIC_DISCRETE 0x03
|
||||
#define IPMI_EVENT_READING_TYPE_CODE_CLASS_OEM 0x04
|
||||
#define IPMI_EVENT_READING_TYPE_CODE_CLASS_UNKNOWN 0x05
|
||||
|
||||
#define IPMI_GET_EVENT_MESSAGES_FLAGS_DEFAULT 0x0000
|
||||
#define IPMI_GET_EVENT_MESSAGES_FLAGS_SHORT 0x0001
|
||||
#define IPMI_GET_EVENT_MESSAGES_FLAGS_INTERPRET_OEM_DATA 0x0002
|
||||
#define IPMI_GET_EVENT_MESSAGES_FLAGS_SENSOR_READING 0x0004
|
||||
#define IPMI_GET_EVENT_MESSAGES_FLAGS_IGNORE_UNRECOGNIZED_EVENTS 0x0008
|
||||
|
||||
int ipmi_event_reading_type_code_class (uint8_t event_reading_type_code);
|
||||
|
||||
int ipmi_event_message_separator (const char *separator);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
int ipmi_get_generic_event_message (uint8_t event_reading_type_code,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* this function is for sensor specific messages, sensors with event
|
||||
* reading typo codes of 0x6F */
|
||||
int ipmi_get_sensor_type_message (uint8_t sensor_type,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* identical to above but returns "short" strings when appropriate */
|
||||
int ipmi_get_generic_event_message_short (uint8_t event_reading_type_code,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* identical to above but returns "short" strings when appropriate */
|
||||
int ipmi_get_sensor_type_message_short (uint8_t sensor_type,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
int ipmi_get_event_data2_message (uint8_t sensor_type,
|
||||
unsigned int offset,
|
||||
uint8_t event_data2,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
int ipmi_get_event_data3_message (uint8_t sensor_type,
|
||||
unsigned int offset,
|
||||
uint8_t event_data2,
|
||||
uint8_t event_data3,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* this function is for OEM event reading type codes */
|
||||
int ipmi_get_oem_generic_event_message (uint32_t manufacturer_id,
|
||||
uint16_t product_id,
|
||||
uint8_t event_reading_type_code,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* this function is for sensor specific messages, sensors with event
|
||||
* reading typo codes of 0x6F */
|
||||
int ipmi_get_oem_sensor_type_message (uint32_t manufacturer_id,
|
||||
uint16_t product_id,
|
||||
uint8_t sensor_type,
|
||||
uint8_t sensor_number,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* this function is for string mappings from vendors that are specific
|
||||
* to a event reading typo code and sensor type combination. */
|
||||
int ipmi_get_oem_specific_message (uint32_t manufacturer_id,
|
||||
uint16_t product_id,
|
||||
uint8_t event_reading_type_code,
|
||||
uint8_t sensor_type,
|
||||
unsigned int offset,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
/* some vendors return values instead of event bitmasks in the
|
||||
* sensor or SEL event, this is to handle this special case
|
||||
*/
|
||||
int ipmi_get_oem_event_bitmask_message (uint32_t manufacturer_id,
|
||||
uint16_t product_id,
|
||||
uint8_t event_reading_type_code,
|
||||
uint8_t sensor_type,
|
||||
uint16_t event_bitmask,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
/* wrapper function to handle retrieval of an array of event messages.
|
||||
* The array is NULL pointer terminated.
|
||||
*
|
||||
* collectively wraps
|
||||
*
|
||||
* ipmi_get_generic_event_message()
|
||||
* ipmi_get_sensor_type_message()
|
||||
*
|
||||
* If flag IPMI_GET_EVENT_MESSAGES_FLAGS_SHORT is specified,
|
||||
* ipmi_get_generic_event_message_short() and
|
||||
* ipmi_get_sensor_type_message_short() are called respectively inplace
|
||||
* of ipmi_get_generic_event_message() and ipmi_get_sensor_type_message().
|
||||
*
|
||||
* If flag IPMI_GET_EVENT_MESSAGES_FLAGS_INTERPRET_OEM_DATA is
|
||||
* specified ipmi_get_oem_generic_event_message(),
|
||||
* ipmi_get_oem_sensor_type_message(), and
|
||||
* ipmi_get_oem_sensor_event_bitmask_message() are called respectively
|
||||
* if necessary.
|
||||
*
|
||||
* If flag IPMI_GET_EVENT_MESSAGES_FLAGS_SENSOR_READING is
|
||||
* specified ipmi_get_threshold_message() will be called for a
|
||||
* sensor_event_bitmask instead of ipmi_get_generic_event_message() if
|
||||
* it is a threshold sensor. Primarily used for event messages
|
||||
* following a get sensor reading in which threshold event bitmasks
|
||||
* are slightly different.
|
||||
*
|
||||
* If flag IPMI_GET_EVENT_MESSAGES_FLAG_IGNORE_UNRECOGNIZED_EVENTS is
|
||||
* specified ipmi_get_threshold_message() will not store event strings
|
||||
* for unrecognized events.
|
||||
*
|
||||
* If there are no event messages, and 'no_event_message_string' is
|
||||
* non-NULL, it will be placed into 'event_messages' as the lone event
|
||||
* message.
|
||||
*
|
||||
* Returns 0 on success, -1 on error. Number of messages allocated in
|
||||
* 'event_messages' is returned in 'event_messages_count'.
|
||||
*
|
||||
* User responsible for clearing memory created in 'event_messages'.
|
||||
*/
|
||||
int ipmi_get_event_messages (uint8_t event_reading_type_code,
|
||||
uint8_t sensor_type, /* ignored if not relevant for event_reading_type_code */
|
||||
uint8_t sensor_number, /* ignored if not relevant for event_reading_type_code or sensor_type */
|
||||
uint16_t event_bitmask,
|
||||
uint32_t manufacturer_id, /* ignored if INTERPRET_OEM_DATA not set */
|
||||
uint16_t product_id, /* ignored if INTERPRET_OEM_DATA not set */
|
||||
char ***event_messages,
|
||||
unsigned int *event_messages_count,
|
||||
const char *no_event_message_string,
|
||||
unsigned int flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_SENSOR_AND_EVENT_CODE_TABLES_UTIL_H */
|
92
source/freeipmi/usr/include/freeipmi/util/ipmi-sensor-util.h
Normal file
92
source/freeipmi/usr/include/freeipmi/util/ipmi-sensor-util.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_SENSOR_UTIL_H
|
||||
#define IPMI_SENSOR_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/sdr/ipmi-sdr.h>
|
||||
|
||||
/* return length of string written into buffer on success, -1 on error */
|
||||
int ipmi_get_threshold_message (uint8_t offset, char *buf, unsigned int buflen);
|
||||
|
||||
const char *ipmi_get_sensor_type_string (uint8_t sensor_type);
|
||||
|
||||
const char *ipmi_get_oem_sensor_type_string (uint8_t sensor_type,
|
||||
uint8_t event_reading_code,
|
||||
uint32_t manufacturer_id,
|
||||
uint16_t product_id);
|
||||
|
||||
/* returns length written into buffer on success, -1 on error */
|
||||
int ipmi_sensor_units_string (uint8_t sensor_units_percentage,
|
||||
uint8_t sensor_units_modifier,
|
||||
uint8_t sensor_units_rate,
|
||||
uint8_t sensor_base_unit_type,
|
||||
uint8_t sensor_modifier_unit_type,
|
||||
char *buf,
|
||||
unsigned int buflen,
|
||||
unsigned int abbreviated_units_flag);
|
||||
|
||||
/* b_exponent - sometimes documented as k1 */
|
||||
/* r_exponent - sometimes documented as k2 */
|
||||
int ipmi_sensor_decode_value (int8_t r_exponent,
|
||||
int8_t b_exponent,
|
||||
int16_t m,
|
||||
int16_t b,
|
||||
uint8_t linearization,
|
||||
uint8_t analog_data_format,
|
||||
uint8_t raw_data,
|
||||
double *value);
|
||||
|
||||
/* b_exponent - sometimes documented as k1 */
|
||||
/* r_exponent - sometimes documented as k2 */
|
||||
int ipmi_sensor_decode_raw_value (int8_t r_exponent,
|
||||
int8_t b_exponent,
|
||||
int16_t m,
|
||||
int16_t b,
|
||||
uint8_t linearization,
|
||||
uint8_t analog_data_format,
|
||||
double value,
|
||||
uint8_t *raw_data);
|
||||
|
||||
/* r_exponent - sometimes documented as k2 */
|
||||
int ipmi_sensor_decode_tolerance (int8_t r_exponent,
|
||||
int16_t m,
|
||||
uint8_t raw_data,
|
||||
uint8_t linearization,
|
||||
double *value);
|
||||
|
||||
/* accuracy returned as percentage */
|
||||
int ipmi_sensor_decode_accuracy (uint16_t accuracy_raw,
|
||||
uint8_t accuracy_exp,
|
||||
double *value);
|
||||
|
||||
/* r_exponent - sometimes documented as k2 */
|
||||
int ipmi_sensor_decode_resolution (int8_t r_exponent,
|
||||
int16_t m,
|
||||
double *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_SENSOR_UTIL_H */
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_TIMESTAMP_UTIL_H
|
||||
#define IPMI_TIMESTAMP_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define IPMI_TIMESTAMP_FLAG_DEFAULT 0x00
|
||||
/* Special string abbreviations
|
||||
* "Unspecified" will be abbreviated "Unspec."
|
||||
* "Post-Init X s" will be abbreviated to just "PostInit"
|
||||
*/
|
||||
#define IPMI_TIMESTAMP_FLAG_ABBREVIATE 0x01
|
||||
/* Assume timestamp is UTC instead of localtime, convert to localtime.
|
||||
*/
|
||||
#define IPMI_TIMESTAMP_FLAG_UTC_TO_LOCALTIME 0x02
|
||||
/* Assume timestamp is localtime, convert to UTC
|
||||
*/
|
||||
#define IPMI_TIMESTAMP_FLAG_LOCALTIME_TO_UTC 0x04
|
||||
|
||||
#define IPMI_UTC_OFFSET_SECONDS_MIN -86400
|
||||
#define IPMI_UTC_OFFSET_SECONDS_MAX 86400
|
||||
|
||||
#define IPMI_UTC_OFFSET_VALID(__val) \
|
||||
(((__val) >= IPMI_UTC_OFFSET_SECONDS_MIN \
|
||||
&& (__val) <= IPMI_UTC_OFFSET_SECONDS_MAX) ? 1 : 0)
|
||||
|
||||
/* Handles special case timestamps in IPMI and timestamp
|
||||
* conversations. Special case timestamps most notably unspecified
|
||||
* timestamps and timestamps in the range of initialization of the
|
||||
* BMC. In those respective cases, an appropriate string will written
|
||||
* into the buffer instead of the actual time/date.
|
||||
*/
|
||||
|
||||
/* format uses format from strftime(), pass NULL for default one */
|
||||
int ipmi_timestamp_string (uint32_t timestamp,
|
||||
int utc_offset,
|
||||
unsigned int flags,
|
||||
const char *format,
|
||||
char *buf,
|
||||
unsigned int buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_TIMESTAMP_UTIL_H */
|
81
source/freeipmi/usr/include/freeipmi/util/ipmi-util.h
Normal file
81
source/freeipmi/usr/include/freeipmi/util/ipmi-util.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IPMI_UTIL_H
|
||||
#define IPMI_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
uint8_t ipmi_checksum (const void *buf, unsigned int buflen);
|
||||
|
||||
/* Call first time w/ checksum_initial 0, pass in result for subsequent calls */
|
||||
uint8_t ipmi_checksum_incremental (const void *buf, unsigned int buflen, uint8_t checksum_initial);
|
||||
/* Can pass NULL/0 for final buf/buflen */
|
||||
uint8_t ipmi_checksum_final (const void *buf, unsigned int buflen, uint8_t checksum_initial);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_check_cmd (fiid_obj_t obj_cmd, uint8_t cmd);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_check_completion_code (fiid_obj_t obj_cmd, uint8_t completion_code);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_check_completion_code_success (fiid_obj_t obj_cmd);
|
||||
|
||||
int ipmi_get_random (void *buf, unsigned int buflen);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_is_ipmi_1_5_packet (const void *pkt, unsigned int pkt_len);
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_is_ipmi_2_0_packet (const void *pkt, unsigned int pkt_len);
|
||||
|
||||
int ipmi_check_session_sequence_number_1_5_init (uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list);
|
||||
|
||||
int ipmi_check_session_sequence_number_2_0_init (uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list);
|
||||
|
||||
/* returns 1 if sequence number in range, 0 if not, -1 on error */
|
||||
/* highest_received_sequence_number and previously_received_list updated on success */
|
||||
/* set sequence_number_window to 0 for default */
|
||||
int ipmi_check_session_sequence_number_1_5 (uint32_t session_sequence_number,
|
||||
uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list,
|
||||
unsigned int sequence_number_window);
|
||||
|
||||
/* returns 1 if sequence number in range, 0 if not, -1 on error */
|
||||
/* highest_received_sequence_number and previously_received_list updated on success */
|
||||
/* set sequence_number_window to 0 for default */
|
||||
int ipmi_check_session_sequence_number_2_0 (uint32_t session_sequence_number,
|
||||
uint32_t *highest_received_sequence_number,
|
||||
uint32_t *previously_received_list,
|
||||
unsigned int sequence_number_window);
|
||||
|
||||
const char *ipmi_cmd_str (uint8_t net_fn, uint8_t cmd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_UTIL_H */
|
37
source/freeipmi/usr/include/freeipmi/util/rmcp-util.h
Normal file
37
source/freeipmi/usr/include/freeipmi/util/rmcp-util.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2015 FreeIPMI Core Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RMCP_UTIL_H
|
||||
#define RMCP_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freeipmi/fiid/fiid.h>
|
||||
|
||||
/* returns 1 on pass, 0 on fail, -1 on error */
|
||||
int ipmi_rmcp_check_message_tag (fiid_obj_t pong, uint8_t message_tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RMCP_UTIL_H */
|
Reference in New Issue
Block a user