mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
use uint{8,16,32}_t instead of "unsigned {char,short,int|long}"
This commit is contained in:
parent
9c848916cc
commit
014040610f
@ -42,17 +42,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
struct valstr {
|
||||
unsigned short val;
|
||||
uint16_t val;
|
||||
const char * str;
|
||||
};
|
||||
const char * val2str(unsigned short val, const struct valstr * vs);
|
||||
unsigned short str2val(const char * str, const struct valstr * vs);
|
||||
const char * val2str(uint16_t val, const struct valstr * vs);
|
||||
uint16_t str2val(const char * str, const struct valstr * vs);
|
||||
|
||||
unsigned short buf2short(unsigned char * buf);
|
||||
uint32_t buf2long(unsigned char * buf);
|
||||
const char * buf2str(unsigned char * buf, int len);
|
||||
void printbuf(const unsigned char * buf, int len, const char * desc);
|
||||
unsigned char ipmi_csum(unsigned char * d, int s);
|
||||
uint16_t buf2short(uint8_t * buf);
|
||||
uint32_t buf2long(uint8_t * buf);
|
||||
const char * buf2str(uint8_t * buf, int len);
|
||||
void printbuf(const uint8_t * buf, int len, const char * desc);
|
||||
uint8_t ipmi_csum(uint8_t * d, int s);
|
||||
FILE * ipmi_open_file(const char * file, int rw);
|
||||
|
||||
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
|
||||
|
@ -62,11 +62,11 @@ extern int csv_output;
|
||||
|
||||
struct ipmi_rq {
|
||||
struct {
|
||||
unsigned char netfn;
|
||||
unsigned char cmd;
|
||||
unsigned char target_cmd;
|
||||
unsigned short data_len;
|
||||
unsigned char *data;
|
||||
uint8_t netfn;
|
||||
uint8_t cmd;
|
||||
uint8_t target_cmd;
|
||||
uint16_t data_len;
|
||||
uint8_t *data;
|
||||
} msg;
|
||||
};
|
||||
|
||||
@ -76,59 +76,59 @@ struct ipmi_rq {
|
||||
* is for payload_type to be IPMI_PAYLOAD_TYPE_IPMI.
|
||||
*/
|
||||
struct ipmi_v2_payload {
|
||||
unsigned short payload_length;
|
||||
unsigned char payload_type;
|
||||
uint16_t payload_length;
|
||||
uint8_t payload_type;
|
||||
|
||||
union {
|
||||
|
||||
struct {
|
||||
unsigned char rq_seq;
|
||||
uint8_t rq_seq;
|
||||
struct ipmi_rq * request;
|
||||
} ipmi_request;
|
||||
|
||||
struct {
|
||||
unsigned char rs_seq;
|
||||
uint8_t rs_seq;
|
||||
struct ipmi_rs * response;
|
||||
} ipmi_response;
|
||||
|
||||
/* Only used internally by the lanplus interface */
|
||||
struct {
|
||||
unsigned char * request;
|
||||
uint8_t * request;
|
||||
} open_session_request;
|
||||
|
||||
/* Only used internally by the lanplus interface */
|
||||
struct {
|
||||
unsigned char * message;
|
||||
uint8_t * message;
|
||||
} rakp_1_message;
|
||||
|
||||
/* Only used internally by the lanplus interface */
|
||||
struct {
|
||||
unsigned char * message;
|
||||
uint8_t * message;
|
||||
} rakp_2_message;
|
||||
|
||||
/* Only used internally by the lanplus interface */
|
||||
struct {
|
||||
unsigned char * message;
|
||||
uint8_t * message;
|
||||
} rakp_3_message;
|
||||
|
||||
/* Only used internally by the lanplus interface */
|
||||
struct {
|
||||
unsigned char * message;
|
||||
uint8_t * message;
|
||||
} rakp_4_message;
|
||||
|
||||
struct {
|
||||
unsigned char data[IPMI_BUF_SIZE];
|
||||
unsigned short character_count;
|
||||
unsigned char packet_sequence_number;
|
||||
unsigned char acked_packet_number;
|
||||
unsigned char accepted_character_count;
|
||||
unsigned char is_nack; /* bool */
|
||||
unsigned char assert_ring_wor; /* bool */
|
||||
unsigned char generate_break; /* bool */
|
||||
unsigned char deassert_cts; /* bool */
|
||||
unsigned char deassert_dcd_dsr; /* bool */
|
||||
unsigned char flush_inbound; /* bool */
|
||||
unsigned char flush_outbound; /* bool */
|
||||
uint8_t data[IPMI_BUF_SIZE];
|
||||
uint16_t character_count;
|
||||
uint8_t packet_sequence_number;
|
||||
uint8_t acked_packet_number;
|
||||
uint8_t accepted_character_count;
|
||||
uint8_t is_nack; /* bool */
|
||||
uint8_t assert_ring_wor; /* bool */
|
||||
uint8_t generate_break; /* bool */
|
||||
uint8_t deassert_cts; /* bool */
|
||||
uint8_t deassert_dcd_dsr; /* bool */
|
||||
uint8_t flush_inbound; /* bool */
|
||||
uint8_t flush_outbound; /* bool */
|
||||
} sol_packet;
|
||||
|
||||
} payload;
|
||||
@ -139,8 +139,8 @@ struct ipmi_v2_payload {
|
||||
struct ipmi_rq_entry {
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_intf * intf;
|
||||
unsigned char rq_seq;
|
||||
unsigned char * msg_data;
|
||||
uint8_t rq_seq;
|
||||
uint8_t * msg_data;
|
||||
int msg_len;
|
||||
struct ipmi_rq_entry * next;
|
||||
};
|
||||
@ -149,8 +149,8 @@ struct ipmi_rq_entry {
|
||||
|
||||
|
||||
struct ipmi_rs {
|
||||
unsigned char ccode;
|
||||
unsigned char data[IPMI_BUF_SIZE];
|
||||
uint8_t ccode;
|
||||
uint8_t data[IPMI_BUF_SIZE];
|
||||
|
||||
/*
|
||||
* Looks like this is the length of the entire packet, including the RMCP
|
||||
@ -159,23 +159,23 @@ struct ipmi_rs {
|
||||
int data_len;
|
||||
|
||||
struct {
|
||||
unsigned char netfn;
|
||||
unsigned char cmd;
|
||||
unsigned char seq;
|
||||
unsigned char lun;
|
||||
uint8_t netfn;
|
||||
uint8_t cmd;
|
||||
uint8_t seq;
|
||||
uint8_t lun;
|
||||
} msg;
|
||||
|
||||
struct {
|
||||
unsigned char authtype;
|
||||
uint8_t authtype;
|
||||
uint32_t seq;
|
||||
uint32_t id;
|
||||
unsigned char bEncrypted; /* IPMI v2 only */
|
||||
unsigned char bAuthenticated; /* IPMI v2 only */
|
||||
unsigned char payloadtype; /* IPMI v2 only */
|
||||
uint8_t bEncrypted; /* IPMI v2 only */
|
||||
uint8_t bAuthenticated; /* IPMI v2 only */
|
||||
uint8_t payloadtype; /* IPMI v2 only */
|
||||
/* This is the total length of the payload or
|
||||
IPMI message. IPMI v2.0 requires this to
|
||||
be 2 bytes. Not really used for much. */
|
||||
unsigned short msglen;
|
||||
uint16_t msglen;
|
||||
} session;
|
||||
|
||||
|
||||
@ -184,47 +184,47 @@ struct ipmi_rs {
|
||||
*/
|
||||
union {
|
||||
struct {
|
||||
unsigned char rq_addr;
|
||||
unsigned char netfn;
|
||||
unsigned char rq_lun;
|
||||
unsigned char rs_addr;
|
||||
unsigned char rq_seq;
|
||||
unsigned char rs_lun;
|
||||
unsigned char cmd;
|
||||
uint8_t rq_addr;
|
||||
uint8_t netfn;
|
||||
uint8_t rq_lun;
|
||||
uint8_t rs_addr;
|
||||
uint8_t rq_seq;
|
||||
uint8_t rs_lun;
|
||||
uint8_t cmd;
|
||||
} ipmi_response;
|
||||
struct {
|
||||
unsigned char message_tag;
|
||||
unsigned char rakp_return_code;
|
||||
unsigned char max_priv_level;
|
||||
unsigned int console_id;
|
||||
unsigned int bmc_id;
|
||||
unsigned char auth_alg;
|
||||
unsigned char integrity_alg;
|
||||
unsigned char crypt_alg;
|
||||
uint8_t message_tag;
|
||||
uint8_t rakp_return_code;
|
||||
uint8_t max_priv_level;
|
||||
uint32_t console_id;
|
||||
uint32_t bmc_id;
|
||||
uint8_t auth_alg;
|
||||
uint8_t integrity_alg;
|
||||
uint8_t crypt_alg;
|
||||
} open_session_response;
|
||||
struct {
|
||||
unsigned char message_tag;
|
||||
unsigned char rakp_return_code;
|
||||
unsigned int console_id;
|
||||
unsigned char bmc_rand[16]; /* Random number generated by the BMC */
|
||||
unsigned char bmc_guid[16];
|
||||
unsigned char key_exchange_auth_code[20];
|
||||
uint8_t message_tag;
|
||||
uint8_t rakp_return_code;
|
||||
uint32_t console_id;
|
||||
uint8_t bmc_rand[16]; /* Random number generated by the BMC */
|
||||
uint8_t bmc_guid[16];
|
||||
uint8_t key_exchange_auth_code[20];
|
||||
} rakp2_message;
|
||||
struct {
|
||||
unsigned char message_tag;
|
||||
unsigned char rakp_return_code;
|
||||
unsigned int console_id;
|
||||
unsigned char integrity_check_value[20];
|
||||
uint8_t message_tag;
|
||||
uint8_t rakp_return_code;
|
||||
uint32_t console_id;
|
||||
uint8_t integrity_check_value[20];
|
||||
} rakp4_message;
|
||||
struct {
|
||||
unsigned char packet_sequence_number;
|
||||
unsigned char acked_packet_number;
|
||||
unsigned char accepted_character_count;
|
||||
unsigned char is_nack; /* bool */
|
||||
unsigned char transfer_unavailable; /* bool */
|
||||
unsigned char sol_inactive; /* bool */
|
||||
unsigned char transmit_overrun; /* bool */
|
||||
unsigned char break_detected; /* bool */
|
||||
uint8_t packet_sequence_number;
|
||||
uint8_t acked_packet_number;
|
||||
uint8_t accepted_character_count;
|
||||
uint8_t is_nack; /* bool */
|
||||
uint8_t transfer_unavailable; /* bool */
|
||||
uint8_t sol_inactive; /* bool */
|
||||
uint8_t transmit_overrun; /* bool */
|
||||
uint8_t break_detected; /* bool */
|
||||
} sol_packet;
|
||||
|
||||
} payload;
|
||||
|
@ -57,44 +57,44 @@
|
||||
* From table 22-15 of the IPMI v2.0 spec
|
||||
*/
|
||||
struct get_channel_auth_cap_rsp {
|
||||
unsigned char channel_number;
|
||||
uint8_t channel_number;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
|
||||
uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
|
||||
uint8_t __reserved1 : 1;
|
||||
uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
|
||||
#else
|
||||
unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */
|
||||
uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
|
||||
uint8_t __reserved1 : 1;
|
||||
uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char kg_status : 1; /* two-key login status */
|
||||
unsigned char per_message_auth : 1; /* per-message authentication status */
|
||||
unsigned char user_level_auth : 1; /* user-level authentication status */
|
||||
unsigned char non_null_usernames : 1; /* one or more non-null users exist */
|
||||
unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */
|
||||
unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t kg_status : 1; /* two-key login status */
|
||||
uint8_t per_message_auth : 1; /* per-message authentication status */
|
||||
uint8_t user_level_auth : 1; /* user-level authentication status */
|
||||
uint8_t non_null_usernames : 1; /* one or more non-null users exist */
|
||||
uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
|
||||
uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
|
||||
#else
|
||||
unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */
|
||||
unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */
|
||||
unsigned char non_null_usernames : 1; /* one or more non-null users exist */
|
||||
unsigned char user_level_auth : 1; /* user-level authentication status */
|
||||
unsigned char per_message_auth : 1; /* per-message authentication status */
|
||||
unsigned char kg_status : 1; /* two-key login status */
|
||||
unsigned char __reserved2 : 2;
|
||||
uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
|
||||
uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
|
||||
uint8_t non_null_usernames : 1; /* one or more non-null users exist */
|
||||
uint8_t user_level_auth : 1; /* user-level authentication status */
|
||||
uint8_t per_message_auth : 1; /* per-message authentication status */
|
||||
uint8_t kg_status : 1; /* two-key login status */
|
||||
uint8_t __reserved2 : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 6;
|
||||
unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
|
||||
unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
|
||||
uint8_t __reserved3 : 6;
|
||||
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
|
||||
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
|
||||
#else
|
||||
unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
|
||||
unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
|
||||
unsigned char __reserved3 : 6;
|
||||
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
|
||||
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
|
||||
uint8_t __reserved3 : 6;
|
||||
#endif
|
||||
unsigned char oem_id[3]; /* IANA enterprise number for auth type */
|
||||
unsigned char oem_aux_data; /* Additional OEM specific data for oem auths */
|
||||
uint8_t oem_id[3]; /* IANA enterprise number for auth type */
|
||||
uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -105,35 +105,35 @@ struct get_channel_auth_cap_rsp {
|
||||
*/
|
||||
struct get_channel_info_rsp {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved1 : 4;
|
||||
unsigned char channel_number : 4; /* channel number */
|
||||
uint8_t __reserved1 : 4;
|
||||
uint8_t channel_number : 4; /* channel number */
|
||||
#else
|
||||
unsigned char channel_number : 4; /* channel number */
|
||||
unsigned char __reserved1 : 4;
|
||||
uint8_t channel_number : 4; /* channel number */
|
||||
uint8_t __reserved1 : 4;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 1;
|
||||
unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */
|
||||
uint8_t __reserved2 : 1;
|
||||
uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */
|
||||
#else
|
||||
unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */
|
||||
unsigned char __reserved2 : 1;
|
||||
uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */
|
||||
uint8_t __reserved2 : 1;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 3;
|
||||
unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */
|
||||
uint8_t __reserved3 : 3;
|
||||
uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */
|
||||
#else
|
||||
unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */
|
||||
unsigned char __reserved3 : 3;
|
||||
uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */
|
||||
uint8_t __reserved3 : 3;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char session_support : 2; /* Description of session support */
|
||||
unsigned char active_sessions : 6; /* Count of active sessions */
|
||||
uint8_t session_support : 2; /* Description of session support */
|
||||
uint8_t active_sessions : 6; /* Count of active sessions */
|
||||
#else
|
||||
unsigned char active_sessions : 6; /* Count of active sessions */
|
||||
unsigned char session_support : 2; /* Description of session support */
|
||||
uint8_t active_sessions : 6; /* Count of active sessions */
|
||||
uint8_t session_support : 2; /* Description of session support */
|
||||
#endif
|
||||
unsigned char vendor_id[3]; /* For OEM that specified the protocol */
|
||||
unsigned char aux_info[2]; /* Not used*/
|
||||
uint8_t vendor_id[3]; /* For OEM that specified the protocol */
|
||||
uint8_t aux_info[2]; /* Not used*/
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -144,88 +144,88 @@ struct get_channel_info_rsp {
|
||||
*/
|
||||
struct get_channel_access_rsp {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char alerting : 1;
|
||||
unsigned char per_message_auth : 1;
|
||||
unsigned char user_level_auth : 1;
|
||||
unsigned char access_mode : 3;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t alerting : 1;
|
||||
uint8_t per_message_auth : 1;
|
||||
uint8_t user_level_auth : 1;
|
||||
uint8_t access_mode : 3;
|
||||
#else
|
||||
unsigned char access_mode : 3;
|
||||
unsigned char user_level_auth : 1;
|
||||
unsigned char per_message_auth : 1;
|
||||
unsigned char alerting : 1;
|
||||
unsigned char __reserved1 : 2;
|
||||
uint8_t access_mode : 3;
|
||||
uint8_t user_level_auth : 1;
|
||||
uint8_t per_message_auth : 1;
|
||||
uint8_t alerting : 1;
|
||||
uint8_t __reserved1 : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 4;
|
||||
unsigned char channel_priv_limit : 4; /* Channel privilege level limit */
|
||||
uint8_t __reserved2 : 4;
|
||||
uint8_t channel_priv_limit : 4; /* Channel privilege level limit */
|
||||
#else
|
||||
unsigned char channel_priv_limit : 4; /* Channel privilege level limit */
|
||||
unsigned char __reserved2 : 4;
|
||||
uint8_t channel_priv_limit : 4; /* Channel privilege level limit */
|
||||
uint8_t __reserved2 : 4;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct get_user_access_rsp {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char max_user_ids : 6;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char enabled_user_ids : 6;
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char fixed_user_ids : 6;
|
||||
unsigned char __reserved4 : 1;
|
||||
unsigned char callin_callback : 1;
|
||||
unsigned char link_auth : 1;
|
||||
unsigned char ipmi_messaging : 1;
|
||||
unsigned char privilege_limit : 4;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t max_user_ids : 6;
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t enabled_user_ids : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
uint8_t fixed_user_ids : 6;
|
||||
uint8_t __reserved4 : 1;
|
||||
uint8_t callin_callback : 1;
|
||||
uint8_t link_auth : 1;
|
||||
uint8_t ipmi_messaging : 1;
|
||||
uint8_t privilege_limit : 4;
|
||||
#else
|
||||
unsigned char max_user_ids : 6;
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char enabled_user_ids : 6;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char fixed_user_ids : 6;
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char privilege_limit : 4;
|
||||
unsigned char ipmi_messaging : 1;
|
||||
unsigned char link_auth : 1;
|
||||
unsigned char callin_callback : 1;
|
||||
unsigned char __reserved4 : 1;
|
||||
uint8_t max_user_ids : 6;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t enabled_user_ids : 6;
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t fixed_user_ids : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
uint8_t privilege_limit : 4;
|
||||
uint8_t ipmi_messaging : 1;
|
||||
uint8_t link_auth : 1;
|
||||
uint8_t callin_callback : 1;
|
||||
uint8_t __reserved4 : 1;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct set_user_access_data {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char change_bits : 1;
|
||||
unsigned char callin_callback : 1;
|
||||
unsigned char link_auth : 1;
|
||||
unsigned char ipmi_messaging : 1;
|
||||
unsigned char channel : 4;
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char user_id : 6;
|
||||
unsigned char __reserved2 : 4;
|
||||
unsigned char privilege_limit : 4;
|
||||
unsigned char __reserved3 : 4;
|
||||
unsigned char session_limit : 4;
|
||||
uint8_t change_bits : 1;
|
||||
uint8_t callin_callback : 1;
|
||||
uint8_t link_auth : 1;
|
||||
uint8_t ipmi_messaging : 1;
|
||||
uint8_t channel : 4;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t user_id : 6;
|
||||
uint8_t __reserved2 : 4;
|
||||
uint8_t privilege_limit : 4;
|
||||
uint8_t __reserved3 : 4;
|
||||
uint8_t session_limit : 4;
|
||||
#else
|
||||
unsigned char channel : 4;
|
||||
unsigned char ipmi_messaging : 1;
|
||||
unsigned char link_auth : 1;
|
||||
unsigned char callin_callback : 1;
|
||||
unsigned char change_bits : 1;
|
||||
unsigned char user_id : 6;
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char privilege_limit : 4;
|
||||
unsigned char __reserved2 : 4;
|
||||
unsigned char session_limit : 4;
|
||||
unsigned char __reserved3 : 4;
|
||||
uint8_t channel : 4;
|
||||
uint8_t ipmi_messaging : 1;
|
||||
uint8_t link_auth : 1;
|
||||
uint8_t callin_callback : 1;
|
||||
uint8_t change_bits : 1;
|
||||
uint8_t user_id : 6;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t privilege_limit : 4;
|
||||
uint8_t __reserved2 : 4;
|
||||
uint8_t session_limit : 4;
|
||||
uint8_t __reserved3 : 4;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
unsigned char ipmi_get_channel_medium(struct ipmi_intf * intf, unsigned char channel);
|
||||
unsigned char ipmi_current_channel_medium(struct ipmi_intf * intf);
|
||||
uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel);
|
||||
uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf);
|
||||
int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, unsigned char channel, unsigned char priv);
|
||||
int ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv);
|
||||
int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
|
||||
|
||||
#endif /*IPMI_CHANNEL_H*/
|
||||
|
@ -38,13 +38,13 @@
|
||||
#define IPMI_ENTITY_H
|
||||
|
||||
struct entity_id {
|
||||
unsigned char id; /* physical entity id */
|
||||
uint8_t id; /* physical entity id */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
unsigned char instance : 7; /* instance number */
|
||||
uint8_t logical : 1; /* physical/logical */
|
||||
uint8_t instance : 7; /* instance number */
|
||||
#else
|
||||
unsigned char instance : 7; /* instance number */
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
uint8_t instance : 7; /* instance number */
|
||||
uint8_t logical : 1; /* physical/logical */
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -65,35 +65,35 @@ enum {
|
||||
};
|
||||
|
||||
struct fru_info {
|
||||
unsigned short size;
|
||||
unsigned char access : 1;
|
||||
uint16_t size;
|
||||
uint8_t access : 1;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_header {
|
||||
unsigned char version;
|
||||
uint8_t version;
|
||||
struct {
|
||||
unsigned char internal;
|
||||
unsigned char chassis;
|
||||
unsigned char board;
|
||||
unsigned char product;
|
||||
unsigned char multi;
|
||||
uint8_t internal;
|
||||
uint8_t chassis;
|
||||
uint8_t board;
|
||||
uint8_t product;
|
||||
uint8_t multi;
|
||||
} offset;
|
||||
unsigned char pad;
|
||||
unsigned char checksum;
|
||||
uint8_t pad;
|
||||
uint8_t checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_area_chassis {
|
||||
unsigned char area_ver;
|
||||
unsigned char type;
|
||||
unsigned short area_len;
|
||||
uint8_t area_ver;
|
||||
uint8_t type;
|
||||
uint16_t area_len;
|
||||
char * part;
|
||||
char * serial;
|
||||
};
|
||||
|
||||
struct fru_area_board {
|
||||
unsigned char area_ver;
|
||||
unsigned char lang;
|
||||
unsigned short area_len;
|
||||
uint8_t area_ver;
|
||||
uint8_t lang;
|
||||
uint16_t area_len;
|
||||
uint32_t mfg_date_time;
|
||||
char * mfg;
|
||||
char * prod;
|
||||
@ -103,9 +103,9 @@ struct fru_area_board {
|
||||
};
|
||||
|
||||
struct fru_area_product {
|
||||
unsigned char area_ver;
|
||||
unsigned char lang;
|
||||
unsigned short area_len;
|
||||
uint8_t area_ver;
|
||||
uint8_t lang;
|
||||
uint16_t area_len;
|
||||
char * mfg;
|
||||
char * name;
|
||||
char * part;
|
||||
@ -122,55 +122,55 @@ struct fru_multirec_header {
|
||||
#define FRU_RECORD_TYPE_MANAGEMENT_ACCESS 0x03
|
||||
#define FRU_RECORD_TYPE_BASE_COMPATIBILITY 0x04
|
||||
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
|
||||
unsigned char type;
|
||||
unsigned char format;
|
||||
unsigned char len;
|
||||
unsigned char record_checksum;
|
||||
unsigned char header_checksum;
|
||||
uint8_t type;
|
||||
uint8_t format;
|
||||
uint8_t len;
|
||||
uint8_t record_checksum;
|
||||
uint8_t header_checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_multirec_powersupply {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned short capacity;
|
||||
uint16_t capacity;
|
||||
#else
|
||||
unsigned short capacity : 12;
|
||||
unsigned short __reserved1 : 4;
|
||||
uint16_t capacity : 12;
|
||||
uint16_t __reserved1 : 4;
|
||||
#endif
|
||||
unsigned short peak_va;
|
||||
unsigned char inrush_current;
|
||||
unsigned char inrush_interval;
|
||||
unsigned short lowend_input1;
|
||||
unsigned short highend_input1;
|
||||
unsigned short lowend_input2;
|
||||
unsigned short highend_input2;
|
||||
unsigned char lowend_freq;
|
||||
unsigned char highend_freq;
|
||||
unsigned char dropout_tolerance;
|
||||
uint16_t peak_va;
|
||||
uint8_t inrush_current;
|
||||
uint8_t inrush_interval;
|
||||
uint16_t lowend_input1;
|
||||
uint16_t highend_input1;
|
||||
uint16_t lowend_input2;
|
||||
uint16_t highend_input2;
|
||||
uint8_t lowend_freq;
|
||||
uint8_t highend_freq;
|
||||
uint8_t dropout_tolerance;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 3;
|
||||
unsigned char tach : 1;
|
||||
unsigned char hotswap : 1;
|
||||
unsigned char autoswitch : 1;
|
||||
unsigned char pfc : 1;
|
||||
unsigned char predictive_fail : 1;
|
||||
uint8_t __reserved2 : 3;
|
||||
uint8_t tach : 1;
|
||||
uint8_t hotswap : 1;
|
||||
uint8_t autoswitch : 1;
|
||||
uint8_t pfc : 1;
|
||||
uint8_t predictive_fail : 1;
|
||||
#else
|
||||
unsigned char predictive_fail : 1;
|
||||
unsigned char pfc : 1;
|
||||
unsigned char autoswitch : 1;
|
||||
unsigned char hotswap : 1;
|
||||
unsigned char tach : 1;
|
||||
unsigned char __reserved2 : 3;
|
||||
uint8_t predictive_fail : 1;
|
||||
uint8_t pfc : 1;
|
||||
uint8_t autoswitch : 1;
|
||||
uint8_t hotswap : 1;
|
||||
uint8_t tach : 1;
|
||||
uint8_t __reserved2 : 3;
|
||||
#endif
|
||||
unsigned short peak_cap_ht;
|
||||
uint16_t peak_cap_ht;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char combined_voltage1 : 4;
|
||||
unsigned char combined_voltage2 : 4;
|
||||
uint8_t combined_voltage1 : 4;
|
||||
uint8_t combined_voltage2 : 4;
|
||||
#else
|
||||
unsigned char combined_voltage2 : 4;
|
||||
unsigned char combined_voltage1 : 4;
|
||||
uint8_t combined_voltage2 : 4;
|
||||
uint8_t combined_voltage1 : 4;
|
||||
#endif
|
||||
unsigned short combined_capacity;
|
||||
unsigned char rps_threshold;
|
||||
uint16_t combined_capacity;
|
||||
uint8_t rps_threshold;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static const char * combined_voltage_desc[] __attribute__((unused)) = {
|
||||
@ -179,36 +179,36 @@ static const char * combined_voltage_desc[] __attribute__((unused)) = {
|
||||
|
||||
struct fru_multirec_dcoutput {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char standby : 1;
|
||||
unsigned char __reserved : 3;
|
||||
unsigned char output_number : 4;
|
||||
uint8_t standby : 1;
|
||||
uint8_t __reserved : 3;
|
||||
uint8_t output_number : 4;
|
||||
#else
|
||||
unsigned char output_number : 4;
|
||||
unsigned char __reserved : 3;
|
||||
unsigned char standby : 1;
|
||||
uint8_t output_number : 4;
|
||||
uint8_t __reserved : 3;
|
||||
uint8_t standby : 1;
|
||||
#endif
|
||||
short nominal_voltage;
|
||||
short max_neg_dev;
|
||||
short max_pos_dev;
|
||||
unsigned short ripple_and_noise;
|
||||
unsigned short min_current;
|
||||
unsigned short max_current;
|
||||
uint16_t ripple_and_noise;
|
||||
uint16_t min_current;
|
||||
uint16_t max_current;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_multirec_dcload {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 4;
|
||||
unsigned char output_number : 4;
|
||||
uint8_t __reserved : 4;
|
||||
uint8_t output_number : 4;
|
||||
#else
|
||||
unsigned char output_number : 4;
|
||||
unsigned char __reserved : 4;
|
||||
uint8_t output_number : 4;
|
||||
uint8_t __reserved : 4;
|
||||
#endif
|
||||
short nominal_voltage;
|
||||
short min_voltage;
|
||||
short max_voltage;
|
||||
unsigned short ripple_and_noise;
|
||||
unsigned short min_current;
|
||||
unsigned short max_current;
|
||||
uint16_t ripple_and_noise;
|
||||
uint16_t min_current;
|
||||
uint16_t max_current;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static const char * chassis_type_desc[] __attribute__((unused)) = {
|
||||
|
@ -66,21 +66,21 @@ enum LANPLUS_SESSION_STATE {
|
||||
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
|
||||
|
||||
struct ipmi_session {
|
||||
unsigned char hostname[64];
|
||||
unsigned char username[16];
|
||||
unsigned char authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
|
||||
unsigned char challenge[16];
|
||||
unsigned char authtype;
|
||||
unsigned char authtype_set;
|
||||
uint8_t hostname[64];
|
||||
uint8_t username[16];
|
||||
uint8_t authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
|
||||
uint8_t challenge[16];
|
||||
uint8_t authtype;
|
||||
uint8_t authtype_set;
|
||||
#define IPMI_AUTHSTATUS_PER_MSG_DISABLED 0x10
|
||||
#define IPMI_AUTHSTATUS_PER_USER_DISABLED 0x08
|
||||
#define IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED 0x04
|
||||
#define IPMI_AUTHSTATUS_NULL_USERS_ENABLED 0x02
|
||||
#define IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED 0x01
|
||||
unsigned char authstatus;
|
||||
unsigned char authextra;
|
||||
unsigned char privlvl;
|
||||
unsigned char authspecial; /* special auth flag */
|
||||
uint8_t authstatus;
|
||||
uint8_t authextra;
|
||||
uint8_t privlvl;
|
||||
uint8_t authspecial; /* special auth flag */
|
||||
int password;
|
||||
int port;
|
||||
int active;
|
||||
@ -100,10 +100,10 @@ struct ipmi_session {
|
||||
enum LANPLUS_SESSION_STATE session_state;
|
||||
|
||||
/* These are the algorithms agreed upon for the session */
|
||||
unsigned char auth_alg;
|
||||
unsigned char integrity_alg;
|
||||
unsigned char crypt_alg;
|
||||
unsigned char max_priv_level;
|
||||
uint8_t auth_alg;
|
||||
uint8_t integrity_alg;
|
||||
uint8_t crypt_alg;
|
||||
uint8_t max_priv_level;
|
||||
|
||||
uint32_t console_id;
|
||||
uint32_t bmc_id;
|
||||
@ -113,18 +113,18 @@ struct ipmi_session {
|
||||
*/
|
||||
|
||||
/* Random number generated byt the console */
|
||||
unsigned char console_rand[16];
|
||||
uint8_t console_rand[16];
|
||||
/* Random number generated by the BMC */
|
||||
unsigned char bmc_rand[16];
|
||||
uint8_t bmc_rand[16];
|
||||
|
||||
unsigned char bmc_guid[16];
|
||||
unsigned char requested_role; /* As sent in the RAKP 1 message */
|
||||
unsigned char rakp2_return_code;
|
||||
uint8_t bmc_guid[16];
|
||||
uint8_t requested_role; /* As sent in the RAKP 1 message */
|
||||
uint8_t rakp2_return_code;
|
||||
|
||||
unsigned char sik[IPMI_SIK_BUFFER_SIZE]; /* Session integrity key */
|
||||
unsigned char kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */
|
||||
unsigned char k1[20]; /* Used for Integrity checking? */
|
||||
unsigned char k2[20]; /* First 16 bytes used for AES */
|
||||
uint8_t sik[IPMI_SIK_BUFFER_SIZE]; /* Session integrity key */
|
||||
uint8_t kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */
|
||||
uint8_t k1[20]; /* Used for Integrity checking? */
|
||||
uint8_t k2[20]; /* First 16 bytes used for AES */
|
||||
} v2_data;
|
||||
|
||||
|
||||
@ -135,11 +135,11 @@ struct ipmi_session {
|
||||
uint16_t max_inbound_payload_size;
|
||||
uint16_t max_outbound_payload_size;
|
||||
uint16_t port;
|
||||
unsigned char sequence_number;
|
||||
uint8_t sequence_number;
|
||||
|
||||
/* This data describes the last SOL packet */
|
||||
unsigned char last_received_sequence_number;
|
||||
unsigned char last_received_byte_count;
|
||||
uint8_t last_received_sequence_number;
|
||||
uint8_t last_received_byte_count;
|
||||
void (*sol_input_handler)(struct ipmi_rs * rsp);
|
||||
} sol_data;
|
||||
};
|
||||
@ -154,8 +154,8 @@ struct ipmi_intf {
|
||||
int thump;
|
||||
|
||||
struct ipmi_session * session;
|
||||
unsigned int my_addr;
|
||||
unsigned int target_addr;
|
||||
uint32_t my_addr;
|
||||
uint32_t target_addr;
|
||||
|
||||
int (*setup)(struct ipmi_intf * intf);
|
||||
int (*open)(struct ipmi_intf * intf);
|
||||
@ -173,9 +173,9 @@ void ipmi_intf_print(void);
|
||||
void ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname);
|
||||
void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username);
|
||||
void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password);
|
||||
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, unsigned char privlvl);
|
||||
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl);
|
||||
void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port);
|
||||
void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, unsigned char authtype);
|
||||
void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype);
|
||||
void ipmi_cleanup(struct ipmi_intf * intf);
|
||||
|
||||
#endif /* IPMI_INTF_H */
|
||||
|
@ -82,7 +82,7 @@ static struct lan_param {
|
||||
int cmd;
|
||||
int size;
|
||||
char desc[24];
|
||||
unsigned char * data;
|
||||
uint8_t * data;
|
||||
int data_len;
|
||||
} ipmi_lan_params[] __attribute__((unused)) = {
|
||||
{ IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" },
|
||||
|
@ -53,15 +53,15 @@ int ipmi_mc_main(struct ipmi_intf *, int, char **);
|
||||
* The following really apply to any IPM device, not just BMCs...
|
||||
*/
|
||||
struct ipm_devid_rsp {
|
||||
unsigned char device_id;
|
||||
unsigned char device_revision;
|
||||
unsigned char fw_rev1;
|
||||
unsigned char fw_rev2;
|
||||
unsigned char ipmi_version;
|
||||
unsigned char adtl_device_support;
|
||||
unsigned char manufacturer_id[3];
|
||||
unsigned char product_id[2];
|
||||
unsigned char aux_fw_rev[4];
|
||||
uint8_t device_id;
|
||||
uint8_t device_revision;
|
||||
uint8_t fw_rev1;
|
||||
uint8_t fw_rev2;
|
||||
uint8_t ipmi_version;
|
||||
uint8_t adtl_device_support;
|
||||
uint8_t manufacturer_id[3];
|
||||
uint8_t product_id[2];
|
||||
uint8_t aux_fw_rev[4];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */
|
||||
|
@ -48,25 +48,25 @@
|
||||
#include <ipmitool/ipmi_entity.h>
|
||||
|
||||
int ipmi_sdr_main(struct ipmi_intf *, int, char **);
|
||||
int utos(unsigned val, unsigned bits);
|
||||
int32_t utos(uint32_t val, int bits);
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
# define __TO_TOL(mtol) (unsigned short)(mtol & 0x3f)
|
||||
# define __TO_M(mtol) (signed short)(utos((((mtol & 0xff00) >> 8) | ((mtol & 0xc0) << 2)), 10))
|
||||
# define __TO_B(bacc) (signed int)(utos((((bacc & 0xff000000) >> 24) | ((bacc & 0xc00000) >> 14)), 10))
|
||||
# define __TO_ACC(bacc) (unsigned int)(((bacc & 0x3f0000) >> 16) | ((bacc & 0xf000) >> 6))
|
||||
# define __TO_ACC_EXP(bacc) (unsigned int)((bacc & 0xc00) >> 10)
|
||||
# define __TO_R_EXP(bacc) (signed int)(utos(((bacc & 0xf0) >> 4), 4))
|
||||
# define __TO_B_EXP(bacc) (signed int)(utos((bacc & 0xf), 4))
|
||||
# define __TO_TOL(mtol) (uint16_t)(mtol & 0x3f)
|
||||
# define __TO_M(mtol) (int16_t)(utos((((mtol & 0xff00) >> 8) | ((mtol & 0xc0) << 2)), 10))
|
||||
# define __TO_B(bacc) (int32_t)(utos((((bacc & 0xff000000) >> 24) | ((bacc & 0xc00000) >> 14)), 10))
|
||||
# define __TO_ACC(bacc) (uint32_t)(((bacc & 0x3f0000) >> 16) | ((bacc & 0xf000) >> 6))
|
||||
# define __TO_ACC_EXP(bacc) (uint32_t)((bacc & 0xc00) >> 10)
|
||||
# define __TO_R_EXP(bacc) (int32_t)(utos(((bacc & 0xf0) >> 4), 4))
|
||||
# define __TO_B_EXP(bacc) (int32_t)(utos((bacc & 0xf), 4))
|
||||
#else
|
||||
# define __TO_TOL(mtol) (unsigned short)(BSWAP_16(mtol) & 0x3f)
|
||||
# define __TO_M(mtol) (signed short)(utos((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10))
|
||||
# define __TO_B(bacc) (signed int)(utos((((BSWAP_32(bacc) & 0xff000000) >> 24) | \
|
||||
# define __TO_TOL(mtol) (uint16_t)(BSWAP_16(mtol) & 0x3f)
|
||||
# define __TO_M(mtol) (int16_t)(utos((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10))
|
||||
# define __TO_B(bacc) (int32_t)(utos((((BSWAP_32(bacc) & 0xff000000) >> 24) | \
|
||||
((BSWAP_32(bacc) & 0xc00000) >> 14)), 10))
|
||||
# define __TO_ACC(bacc) (unsigned int)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6))
|
||||
# define __TO_ACC_EXP(bacc) (unsigned int)((BSWAP_32(bacc) & 0xc00) >> 10)
|
||||
# define __TO_R_EXP(bacc) (signed int)(utos(((BSWAP_32(bacc) & 0xf0) >> 4), 4))
|
||||
# define __TO_B_EXP(bacc) (signed int)(utos((BSWAP_32(bacc) & 0xf), 4))
|
||||
# define __TO_ACC(bacc) (uint32_t)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6))
|
||||
# define __TO_ACC_EXP(bacc) (uint32_t)((BSWAP_32(bacc) & 0xc00) >> 10)
|
||||
# define __TO_R_EXP(bacc) (int32_t)(utos(((BSWAP_32(bacc) & 0xf0) >> 4), 4))
|
||||
# define __TO_B_EXP(bacc) (int32_t)(utos((BSWAP_32(bacc) & 0xf), 4))
|
||||
#endif
|
||||
|
||||
#define GET_SDR_REPO_INFO 0x20
|
||||
@ -80,32 +80,32 @@ int utos(unsigned val, unsigned bits);
|
||||
#define SDR_SENSOR_STAT_HI_NR (1<<5)
|
||||
|
||||
struct sdr_repo_info_rs {
|
||||
unsigned char version; /* SDR version (51h) */
|
||||
unsigned short count; /* number of records */
|
||||
unsigned short free; /* free space in SDR */
|
||||
uint8_t version; /* SDR version (51h) */
|
||||
uint16_t count; /* number of records */
|
||||
uint16_t free; /* free space in SDR */
|
||||
uint32_t add_stamp; /* last add timestamp */
|
||||
uint32_t erase_stamp; /* last del timestamp */
|
||||
unsigned char op_support; /* supported operations */
|
||||
uint8_t op_support; /* supported operations */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GET_SDR_RESERVE_REPO 0x22
|
||||
struct sdr_reserve_repo_rs {
|
||||
unsigned short reserve_id; /* reservation ID */
|
||||
uint16_t reserve_id; /* reservation ID */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GET_SDR 0x23
|
||||
struct sdr_get_rq {
|
||||
unsigned short reserve_id; /* reservation ID */
|
||||
unsigned short id; /* record ID */
|
||||
unsigned char offset; /* offset into SDR */
|
||||
uint16_t reserve_id; /* reservation ID */
|
||||
uint16_t id; /* record ID */
|
||||
uint8_t offset; /* offset into SDR */
|
||||
#define GET_SDR_ENTIRE_RECORD 0xff
|
||||
unsigned char length; /* length to read */
|
||||
uint8_t length; /* length to read */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_get_rs {
|
||||
unsigned short next; /* next record id */
|
||||
unsigned short id; /* record ID */
|
||||
unsigned char version; /* SDR version (51h) */
|
||||
uint16_t next; /* next record id */
|
||||
uint16_t id; /* record ID */
|
||||
uint8_t version; /* SDR version (51h) */
|
||||
#define SDR_RECORD_TYPE_FULL_SENSOR 0x01
|
||||
#define SDR_RECORD_TYPE_COMPACT_SENSOR 0x02
|
||||
#define SDR_RECORD_TYPE_EVENTONLY_SENSOR 0x03
|
||||
@ -117,23 +117,23 @@ struct sdr_get_rs {
|
||||
#define SDR_RECORD_TYPE_MC_CONFIRMATION 0x13
|
||||
#define SDR_RECORD_TYPE_BMC_MSG_CHANNEL_INFO 0x14
|
||||
#define SDR_RECORD_TYPE_OEM 0xc0
|
||||
unsigned char type; /* record type */
|
||||
unsigned char length; /* remaining record bytes */
|
||||
uint8_t type; /* record type */
|
||||
uint8_t length; /* remaining record bytes */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_compact_sensor {
|
||||
struct {
|
||||
unsigned char owner_id;
|
||||
uint8_t owner_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
uint8_t channel : 4; /* channel number */
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char channel : 4; /* channel number */
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t channel : 4; /* channel number */
|
||||
#endif
|
||||
unsigned char sensor_num; /* unique sensor number */
|
||||
uint8_t sensor_num; /* unique sensor number */
|
||||
} keys;
|
||||
|
||||
struct entity_id entity;
|
||||
@ -141,168 +141,168 @@ struct sdr_record_compact_sensor {
|
||||
struct {
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char sensor_scan : 1;
|
||||
uint8_t __reserved : 1;
|
||||
uint8_t scanning : 1;
|
||||
uint8_t events : 1;
|
||||
uint8_t thresholds : 1;
|
||||
uint8_t hysteresis : 1;
|
||||
uint8_t type : 1;
|
||||
uint8_t event_gen : 1;
|
||||
uint8_t sensor_scan : 1;
|
||||
#else
|
||||
unsigned char sensor_scan : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char __reserved : 1;
|
||||
uint8_t sensor_scan : 1;
|
||||
uint8_t event_gen : 1;
|
||||
uint8_t type : 1;
|
||||
uint8_t hysteresis : 1;
|
||||
uint8_t thresholds : 1;
|
||||
uint8_t events : 1;
|
||||
uint8_t scanning : 1;
|
||||
uint8_t __reserved : 1;
|
||||
#endif
|
||||
} init;
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char ignore : 1;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char event_msg : 2;
|
||||
uint8_t ignore : 1;
|
||||
uint8_t rearm : 1;
|
||||
uint8_t hysteresis : 2;
|
||||
uint8_t threshold : 2;
|
||||
uint8_t event_msg : 2;
|
||||
#else
|
||||
unsigned char event_msg : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char ignore : 1;
|
||||
uint8_t event_msg : 2;
|
||||
uint8_t threshold : 2;
|
||||
uint8_t hysteresis : 2;
|
||||
uint8_t rearm : 1;
|
||||
uint8_t ignore : 1;
|
||||
#endif
|
||||
} capabilities;
|
||||
unsigned char type; /* sensor type */
|
||||
uint8_t type; /* sensor type */
|
||||
} sensor;
|
||||
|
||||
unsigned char event_type; /* event/reading type code */
|
||||
uint8_t event_type; /* event/reading type code */
|
||||
|
||||
union {
|
||||
struct {
|
||||
unsigned short assert_event; /* assertion event mask */
|
||||
unsigned short deassert_event; /* de-assertion event mask */
|
||||
unsigned short read; /* discrete reaading mask */
|
||||
uint16_t assert_event; /* assertion event mask */
|
||||
uint16_t deassert_event; /* de-assertion event mask */
|
||||
uint16_t read; /* discrete reaading mask */
|
||||
} discrete;
|
||||
struct {
|
||||
unsigned short lower; /* lower threshold reading mask */
|
||||
unsigned short upper; /* upper threshold reading mask */
|
||||
unsigned char set; /* settable threshold mask */
|
||||
unsigned char read; /* readable threshold mask */
|
||||
uint16_t lower; /* lower threshold reading mask */
|
||||
uint16_t upper; /* upper threshold reading mask */
|
||||
uint8_t set; /* settable threshold mask */
|
||||
uint8_t read; /* readable threshold mask */
|
||||
} threshold;
|
||||
} mask;
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char analog : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char pct : 1;
|
||||
uint8_t analog : 2;
|
||||
uint8_t rate : 3;
|
||||
uint8_t modifier : 2;
|
||||
uint8_t pct : 1;
|
||||
#else
|
||||
unsigned char pct : 1;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char analog : 2;
|
||||
uint8_t pct : 1;
|
||||
uint8_t modifier : 2;
|
||||
uint8_t rate : 3;
|
||||
uint8_t analog : 2;
|
||||
#endif
|
||||
struct {
|
||||
unsigned char base;
|
||||
unsigned char modifier;
|
||||
uint8_t base;
|
||||
uint8_t modifier;
|
||||
} type;
|
||||
} unit;
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char count : 4;
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t mod_type : 2;
|
||||
uint8_t count : 4;
|
||||
#else
|
||||
unsigned char count : 4;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char __reserved : 2;
|
||||
uint8_t count : 4;
|
||||
uint8_t mod_type : 2;
|
||||
uint8_t __reserved : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char entity_inst : 1;
|
||||
unsigned char mod_offset : 7;
|
||||
uint8_t entity_inst : 1;
|
||||
uint8_t mod_offset : 7;
|
||||
#else
|
||||
unsigned char mod_offset : 7;
|
||||
unsigned char entity_inst : 1;
|
||||
uint8_t mod_offset : 7;
|
||||
uint8_t entity_inst : 1;
|
||||
#endif
|
||||
} share;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
unsigned char positive;
|
||||
unsigned char negative;
|
||||
uint8_t positive;
|
||||
uint8_t negative;
|
||||
} hysteresis;
|
||||
} threshold;
|
||||
|
||||
unsigned char __reserved[3];
|
||||
unsigned char oem; /* reserved for OEM use */
|
||||
unsigned char id_code; /* sensor ID string type/length code */
|
||||
unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
uint8_t __reserved[3];
|
||||
uint8_t oem; /* reserved for OEM use */
|
||||
uint8_t id_code; /* sensor ID string type/length code */
|
||||
uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_eventonly_sensor {
|
||||
struct {
|
||||
unsigned char owner_id;
|
||||
uint8_t owner_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char fru_owner : 2; /* fru device owner lun */
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
uint8_t channel : 4; /* channel number */
|
||||
uint8_t fru_owner : 2; /* fru device owner lun */
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char fru_owner : 2; /* fru device owner lun */
|
||||
unsigned char channel : 4; /* channel number */
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
uint8_t fru_owner : 2; /* fru device owner lun */
|
||||
uint8_t channel : 4; /* channel number */
|
||||
#endif
|
||||
unsigned char sensor_num; /* unique sensor number */
|
||||
uint8_t sensor_num; /* unique sensor number */
|
||||
} keys;
|
||||
|
||||
struct entity_id entity;
|
||||
|
||||
unsigned char sensor_type; /* sensor type */
|
||||
unsigned char event_type; /* event/reading type code */
|
||||
uint8_t sensor_type; /* sensor type */
|
||||
uint8_t event_type; /* event/reading type code */
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char count : 4;
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t mod_type : 2;
|
||||
uint8_t count : 4;
|
||||
#else
|
||||
unsigned char count : 4;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char __reserved : 2;
|
||||
uint8_t count : 4;
|
||||
uint8_t mod_type : 2;
|
||||
uint8_t __reserved : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char entity_inst : 1;
|
||||
unsigned char mod_offset : 7;
|
||||
uint8_t entity_inst : 1;
|
||||
uint8_t mod_offset : 7;
|
||||
#else
|
||||
unsigned char mod_offset : 7;
|
||||
unsigned char entity_inst : 1;
|
||||
uint8_t mod_offset : 7;
|
||||
uint8_t entity_inst : 1;
|
||||
#endif
|
||||
} share;
|
||||
|
||||
unsigned char __reserved;
|
||||
unsigned char oem; /* reserved for OEM use */
|
||||
unsigned char id_code; /* sensor ID string type/length code */
|
||||
unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
uint8_t __reserved;
|
||||
uint8_t oem; /* reserved for OEM use */
|
||||
uint8_t id_code; /* sensor ID string type/length code */
|
||||
uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_full_sensor {
|
||||
struct {
|
||||
unsigned char owner_id;
|
||||
uint8_t owner_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
uint8_t channel : 4; /* channel number */
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char channel : 4; /* channel number */
|
||||
uint8_t lun : 2; /* sensor owner lun */
|
||||
uint8_t __reserved : 2;
|
||||
uint8_t channel : 4; /* channel number */
|
||||
#endif
|
||||
unsigned char sensor_num; /* unique sensor number */
|
||||
uint8_t sensor_num; /* unique sensor number */
|
||||
} keys;
|
||||
|
||||
struct entity_id entity;
|
||||
@ -310,181 +310,181 @@ struct sdr_record_full_sensor {
|
||||
struct {
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char sensor_scan : 1;
|
||||
uint8_t __reserved : 1;
|
||||
uint8_t scanning : 1;
|
||||
uint8_t events : 1;
|
||||
uint8_t thresholds : 1;
|
||||
uint8_t hysteresis : 1;
|
||||
uint8_t type : 1;
|
||||
uint8_t event_gen : 1;
|
||||
uint8_t sensor_scan : 1;
|
||||
#else
|
||||
unsigned char sensor_scan : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char __reserved : 1;
|
||||
uint8_t sensor_scan : 1;
|
||||
uint8_t event_gen : 1;
|
||||
uint8_t type : 1;
|
||||
uint8_t hysteresis : 1;
|
||||
uint8_t thresholds : 1;
|
||||
uint8_t events : 1;
|
||||
uint8_t scanning : 1;
|
||||
uint8_t __reserved : 1;
|
||||
#endif
|
||||
} init;
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char ignore : 1;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char event_msg : 2;
|
||||
uint8_t ignore : 1;
|
||||
uint8_t rearm : 1;
|
||||
uint8_t hysteresis : 2;
|
||||
uint8_t threshold : 2;
|
||||
uint8_t event_msg : 2;
|
||||
#else
|
||||
unsigned char event_msg : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char ignore : 1;
|
||||
uint8_t event_msg : 2;
|
||||
uint8_t threshold : 2;
|
||||
uint8_t hysteresis : 2;
|
||||
uint8_t rearm : 1;
|
||||
uint8_t ignore : 1;
|
||||
#endif
|
||||
} capabilities;
|
||||
unsigned char type;
|
||||
uint8_t type;
|
||||
} sensor;
|
||||
|
||||
unsigned char event_type; /* event/reading type code */
|
||||
uint8_t event_type; /* event/reading type code */
|
||||
|
||||
union {
|
||||
struct {
|
||||
unsigned short assert_event; /* assertion event mask */
|
||||
unsigned short deassert_event; /* de-assertion event mask */
|
||||
unsigned short read; /* discrete reaading mask */
|
||||
uint16_t assert_event; /* assertion event mask */
|
||||
uint16_t deassert_event; /* de-assertion event mask */
|
||||
uint16_t read; /* discrete reaading mask */
|
||||
} discrete;
|
||||
struct {
|
||||
unsigned short lower; /* lower threshold reading mask */
|
||||
unsigned short upper; /* upper threshold reading mask */
|
||||
unsigned char set; /* settable threshold mask */
|
||||
unsigned char read; /* readable threshold mask */
|
||||
uint16_t lower; /* lower threshold reading mask */
|
||||
uint16_t upper; /* upper threshold reading mask */
|
||||
uint8_t set; /* settable threshold mask */
|
||||
uint8_t read; /* readable threshold mask */
|
||||
} threshold;
|
||||
} mask;
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char analog : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char pct : 1;
|
||||
uint8_t analog : 2;
|
||||
uint8_t rate : 3;
|
||||
uint8_t modifier : 2;
|
||||
uint8_t pct : 1;
|
||||
#else
|
||||
unsigned char pct : 1;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char analog : 2;
|
||||
uint8_t pct : 1;
|
||||
uint8_t modifier : 2;
|
||||
uint8_t rate : 3;
|
||||
uint8_t analog : 2;
|
||||
#endif
|
||||
struct {
|
||||
unsigned char base;
|
||||
unsigned char modifier;
|
||||
uint8_t base;
|
||||
uint8_t modifier;
|
||||
} type;
|
||||
} unit;
|
||||
|
||||
unsigned char linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */
|
||||
unsigned short mtol; /* M, tolerance */
|
||||
uint8_t linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */
|
||||
uint16_t mtol; /* M, tolerance */
|
||||
uint32_t bacc; /* accuracy, B, Bexp, Rexp */
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 5;
|
||||
unsigned char normal_min : 1; /* normal min field specified */
|
||||
unsigned char normal_max : 1; /* normal max field specified */
|
||||
unsigned char nominal_read : 1; /* nominal reading field specified */
|
||||
uint8_t __reserved : 5;
|
||||
uint8_t normal_min : 1; /* normal min field specified */
|
||||
uint8_t normal_max : 1; /* normal max field specified */
|
||||
uint8_t nominal_read : 1; /* nominal reading field specified */
|
||||
#else
|
||||
unsigned char nominal_read : 1; /* nominal reading field specified */
|
||||
unsigned char normal_max : 1; /* normal max field specified */
|
||||
unsigned char normal_min : 1; /* normal min field specified */
|
||||
unsigned char __reserved : 5;
|
||||
uint8_t nominal_read : 1; /* nominal reading field specified */
|
||||
uint8_t normal_max : 1; /* normal max field specified */
|
||||
uint8_t normal_min : 1; /* normal min field specified */
|
||||
uint8_t __reserved : 5;
|
||||
#endif
|
||||
} analog_flag;
|
||||
|
||||
unsigned char nominal_read; /* nominal reading, raw value */
|
||||
unsigned char normal_max; /* normal maximum, raw value */
|
||||
unsigned char normal_min; /* normal minimum, raw value */
|
||||
unsigned char sensor_max; /* sensor maximum, raw value */
|
||||
unsigned char sensor_min; /* sensor minimum, raw value */
|
||||
uint8_t nominal_read; /* nominal reading, raw value */
|
||||
uint8_t normal_max; /* normal maximum, raw value */
|
||||
uint8_t normal_min; /* normal minimum, raw value */
|
||||
uint8_t sensor_max; /* sensor maximum, raw value */
|
||||
uint8_t sensor_min; /* sensor minimum, raw value */
|
||||
|
||||
struct {
|
||||
struct {
|
||||
unsigned char non_recover;
|
||||
unsigned char critical;
|
||||
unsigned char non_critical;
|
||||
uint8_t non_recover;
|
||||
uint8_t critical;
|
||||
uint8_t non_critical;
|
||||
} upper;
|
||||
struct {
|
||||
unsigned char non_recover;
|
||||
unsigned char critical;
|
||||
unsigned char non_critical;
|
||||
uint8_t non_recover;
|
||||
uint8_t critical;
|
||||
uint8_t non_critical;
|
||||
} lower;
|
||||
struct {
|
||||
unsigned char positive;
|
||||
unsigned char negative;
|
||||
uint8_t positive;
|
||||
uint8_t negative;
|
||||
} hysteresis;
|
||||
} threshold;
|
||||
unsigned char __reserved[2];
|
||||
unsigned char oem; /* reserved for OEM use */
|
||||
unsigned char id_code; /* sensor ID string type/length code */
|
||||
unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
uint8_t __reserved[2];
|
||||
uint8_t oem; /* reserved for OEM use */
|
||||
uint8_t id_code; /* sensor ID string type/length code */
|
||||
uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_mc_locator {
|
||||
unsigned char dev_slave_addr;
|
||||
uint8_t dev_slave_addr;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 4;
|
||||
unsigned char channel_num : 4;
|
||||
uint8_t __reserved2 : 4;
|
||||
uint8_t channel_num : 4;
|
||||
#else
|
||||
unsigned char channel_num : 4;
|
||||
unsigned char __reserved2 : 4;
|
||||
uint8_t channel_num : 4;
|
||||
uint8_t __reserved2 : 4;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char pwr_state_notif : 3;
|
||||
unsigned char __reserved3 : 1;
|
||||
unsigned char global_init : 4;
|
||||
uint8_t pwr_state_notif : 3;
|
||||
uint8_t __reserved3 : 1;
|
||||
uint8_t global_init : 4;
|
||||
#else
|
||||
unsigned char global_init : 4;
|
||||
unsigned char __reserved3 : 1;
|
||||
unsigned char pwr_state_notif : 3;
|
||||
uint8_t global_init : 4;
|
||||
uint8_t __reserved3 : 1;
|
||||
uint8_t pwr_state_notif : 3;
|
||||
#endif
|
||||
unsigned char dev_support;
|
||||
unsigned char __reserved4[3];
|
||||
uint8_t dev_support;
|
||||
uint8_t __reserved4[3];
|
||||
struct entity_id entity;
|
||||
unsigned char oem;
|
||||
unsigned char id_code;
|
||||
unsigned char id_string[16];
|
||||
uint8_t oem;
|
||||
uint8_t id_code;
|
||||
uint8_t id_string[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_fru_locator {
|
||||
unsigned char dev_slave_addr;
|
||||
unsigned char device_id;
|
||||
uint8_t dev_slave_addr;
|
||||
uint8_t device_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char bus : 3;
|
||||
unsigned char lun : 2;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char logical : 1;
|
||||
uint8_t bus : 3;
|
||||
uint8_t lun : 2;
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t logical : 1;
|
||||
#else
|
||||
unsigned char logical : 1;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char lun : 2;
|
||||
unsigned char bus : 3;
|
||||
uint8_t logical : 1;
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t lun : 2;
|
||||
uint8_t bus : 3;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 4;
|
||||
unsigned char channel_num : 4;
|
||||
uint8_t __reserved3 : 4;
|
||||
uint8_t channel_num : 4;
|
||||
#else
|
||||
unsigned char channel_num : 4;
|
||||
unsigned char __reserved3 : 4;
|
||||
uint8_t channel_num : 4;
|
||||
uint8_t __reserved3 : 4;
|
||||
#endif
|
||||
unsigned char __reserved4;
|
||||
unsigned char dev_type;
|
||||
unsigned char dev_type_modifier;
|
||||
uint8_t __reserved4;
|
||||
uint8_t dev_type;
|
||||
uint8_t dev_type_modifier;
|
||||
struct entity_id entity;
|
||||
unsigned char oem;
|
||||
unsigned char id_code;
|
||||
unsigned char id_string[16];
|
||||
uint8_t oem;
|
||||
uint8_t id_code;
|
||||
uint8_t id_string[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_oem {
|
||||
unsigned char * data;
|
||||
uint8_t * data;
|
||||
int data_len;
|
||||
};
|
||||
|
||||
@ -493,28 +493,28 @@ struct sdr_record_oem {
|
||||
* From table 33-3 of the IPMI v2.0 spec
|
||||
*/
|
||||
struct get_sdr_repository_info_rsp {
|
||||
unsigned char sdr_version;
|
||||
unsigned char record_count_lsb;
|
||||
unsigned char record_count_msb;
|
||||
unsigned char free_space[2];
|
||||
unsigned char most_recent_addition_timestamp[4];
|
||||
unsigned char most_recent_erase_timestamp[4];
|
||||
uint8_t sdr_version;
|
||||
uint8_t record_count_lsb;
|
||||
uint8_t record_count_msb;
|
||||
uint8_t free_space[2];
|
||||
uint8_t most_recent_addition_timestamp[4];
|
||||
uint8_t most_recent_erase_timestamp[4];
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char overflow_flag : 1;
|
||||
unsigned char modal_update_support : 2;
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char delete_sdr_supported : 1;
|
||||
unsigned char partial_add_sdr_supported : 1;
|
||||
unsigned char reserve_sdr_repository_supported : 1;
|
||||
unsigned char get_sdr_repository_allo_info_supported : 1;
|
||||
uint8_t overflow_flag : 1;
|
||||
uint8_t modal_update_support : 2;
|
||||
uint8_t __reserved1 : 1;
|
||||
uint8_t delete_sdr_supported : 1;
|
||||
uint8_t partial_add_sdr_supported : 1;
|
||||
uint8_t reserve_sdr_repository_supported : 1;
|
||||
uint8_t get_sdr_repository_allo_info_supported : 1;
|
||||
#else
|
||||
unsigned char get_sdr_repository_allo_info_supported : 1;
|
||||
unsigned char reserve_sdr_repository_supported : 1;
|
||||
unsigned char partial_add_sdr_supported : 1;
|
||||
unsigned char delete_sdr_supported : 1;
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char modal_update_support : 2;
|
||||
unsigned char overflow_flag : 1;
|
||||
uint8_t get_sdr_repository_allo_info_supported : 1;
|
||||
uint8_t reserve_sdr_repository_supported : 1;
|
||||
uint8_t partial_add_sdr_supported : 1;
|
||||
uint8_t delete_sdr_supported : 1;
|
||||
uint8_t __reserved1 : 1;
|
||||
uint8_t modal_update_support : 2;
|
||||
uint8_t overflow_flag : 1;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
@ -523,14 +523,14 @@ struct get_sdr_repository_info_rsp {
|
||||
|
||||
struct ipmi_sdr_iterator
|
||||
{
|
||||
unsigned short reservation;
|
||||
uint16_t reservation;
|
||||
int total;
|
||||
int next;
|
||||
};
|
||||
|
||||
struct sdr_record_list {
|
||||
unsigned short id;
|
||||
unsigned char type;
|
||||
uint16_t id;
|
||||
uint8_t type;
|
||||
struct sdr_record_list * next;
|
||||
union {
|
||||
struct sdr_record_full_sensor * full;
|
||||
@ -587,16 +587,16 @@ static const char * sensor_type_desc[] __attribute__((unused)) = {
|
||||
|
||||
struct ipmi_sdr_iterator * ipmi_sdr_start(struct ipmi_intf * intf);
|
||||
struct sdr_get_rs * ipmi_sdr_get_next_header(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
||||
unsigned char * ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header, struct ipmi_sdr_iterator * i);
|
||||
uint8_t * ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header, struct ipmi_sdr_iterator * i);
|
||||
void ipmi_sdr_end(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
||||
int ipmi_sdr_print_sdr(struct ipmi_intf * intf, unsigned char type);
|
||||
int ipmi_sdr_print_rawentry(struct ipmi_intf * intf, unsigned char type, unsigned char * raw, int len);
|
||||
int ipmi_sdr_print_sdr(struct ipmi_intf * intf, uint8_t type);
|
||||
int ipmi_sdr_print_rawentry(struct ipmi_intf * intf, uint8_t type, uint8_t * raw, int len);
|
||||
int ipmi_sdr_print_listentry(struct ipmi_intf * intf, struct sdr_record_list * entry);
|
||||
const char * ipmi_sdr_get_status(unsigned char stat);
|
||||
float sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, unsigned char val);
|
||||
unsigned char sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor, float val);
|
||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor);
|
||||
const char * ipmi_sdr_get_sensor_type_desc(const unsigned char type);
|
||||
const char * ipmi_sdr_get_status(uint8_t stat);
|
||||
float sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, uint8_t val);
|
||||
uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor, float val);
|
||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, uint8_t sensor);
|
||||
const char * ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
||||
|
||||
int ipmi_sdr_print_sensor_full(struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor);
|
||||
int ipmi_sdr_print_sensor_compact(struct ipmi_intf * intf, struct sdr_record_compact_sensor * sensor);
|
||||
@ -605,10 +605,10 @@ int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf * intf, struct sdr_record
|
||||
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf * intf, struct sdr_record_mc_locator * mc);
|
||||
|
||||
struct sdr_record_list * ipmi_sdr_find_sdr_byentity(struct ipmi_intf * intf, struct entity_id * entity);
|
||||
struct sdr_record_list * ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, unsigned char num, unsigned char type);
|
||||
struct sdr_record_list * ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, uint8_t num, uint8_t type);
|
||||
struct sdr_record_list * ipmi_sdr_find_sdr_byid(struct ipmi_intf * intf, char * id);
|
||||
void ipmi_sdr_list_empty(struct ipmi_intf * intf);
|
||||
int ipmi_sdr_print_info(struct ipmi_intf * intf);
|
||||
void ipmi_sdr_print_discrete_state(unsigned char sensor_type, unsigned char event_type, unsigned char state);
|
||||
void ipmi_sdr_print_discrete_state(uint8_t sensor_type, uint8_t event_type, uint8_t state);
|
||||
|
||||
#endif /* IPMI_SDR_H */
|
||||
|
@ -61,50 +61,50 @@ enum {
|
||||
};
|
||||
|
||||
struct sel_get_rq {
|
||||
unsigned short reserve_id;
|
||||
unsigned short record_id;
|
||||
unsigned char offset;
|
||||
unsigned char length;
|
||||
uint16_t reserve_id;
|
||||
uint16_t record_id;
|
||||
uint8_t offset;
|
||||
uint8_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_event_record {
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
uint16_t record_id;
|
||||
uint8_t record_type;
|
||||
uint32_t timestamp;
|
||||
unsigned short gen_id;
|
||||
unsigned char evm_rev;
|
||||
unsigned char sensor_type;
|
||||
unsigned char sensor_num;
|
||||
unsigned char event_type : 7;
|
||||
unsigned char event_dir : 1;
|
||||
uint16_t gen_id;
|
||||
uint8_t evm_rev;
|
||||
uint8_t sensor_type;
|
||||
uint8_t sensor_num;
|
||||
uint8_t event_type : 7;
|
||||
uint8_t event_dir : 1;
|
||||
#define DATA_BYTE2_SPECIFIED_MASK 0xc0 /* event_data[0] bit mask */
|
||||
#define DATA_BYTE3_SPECIFIED_MASK 0x30 /* event_data[0] bit mask */
|
||||
#define EVENT_OFFSET_MASK 0x0f /* event_data[0] bit mask */
|
||||
unsigned char event_data[3];
|
||||
uint8_t event_data[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_ts {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
uint16_t next_id;
|
||||
uint16_t record_id;
|
||||
uint8_t record_type;
|
||||
uint32_t timestamp;
|
||||
unsigned char mfg_id[3];
|
||||
unsigned char oem_defined[6];
|
||||
uint8_t mfg_id[3];
|
||||
uint8_t oem_defined[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_nots {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned char oem_defined[13];
|
||||
uint16_t next_id;
|
||||
uint16_t record_id;
|
||||
uint8_t record_type;
|
||||
uint8_t oem_defined[13];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ipmi_event_sensor_types {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
uint8_t code;
|
||||
uint8_t offset;
|
||||
#define ALL_OFFSETS_SPECIFIED 0xff
|
||||
unsigned char data;
|
||||
unsigned char class;
|
||||
uint8_t data;
|
||||
uint8_t class;
|
||||
const char * type;
|
||||
const char * desc;
|
||||
};
|
||||
@ -383,6 +383,6 @@ int ipmi_sel_main(struct ipmi_intf *, int, char **);
|
||||
void ipmi_sel_print_std_entry(struct sel_event_record * evt);
|
||||
void ipmi_sel_print_std_entry_verbose(struct sel_event_record * evt);
|
||||
void ipmi_get_event_desc(struct sel_event_record * rec, char ** desc);
|
||||
const char * ipmi_sel_get_sensor_type(unsigned char code);
|
||||
const char * ipmi_sel_get_sensor_type(uint8_t code);
|
||||
|
||||
#endif /* IPMI_SEL_H */
|
||||
|
@ -77,14 +77,14 @@
|
||||
#define STATE_14_ASSERTED 0x40
|
||||
|
||||
struct sensor_set_thresh_rq {
|
||||
unsigned char sensor_num; /* sensor # */
|
||||
unsigned char set_mask; /* threshold setting mask */
|
||||
unsigned char lower_non_crit; /* new lower non critical threshold*/
|
||||
unsigned char lower_crit; /* new lower critical threshold*/
|
||||
unsigned char lower_non_recov; /* new lower non recoverable threshold*/
|
||||
unsigned char upper_non_crit; /* new upper non critical threshold*/
|
||||
unsigned char upper_crit; /* new upper critical threshold*/
|
||||
unsigned char upper_non_recov; /* new upper non recoverable threshold*/
|
||||
uint8_t sensor_num; /* sensor # */
|
||||
uint8_t set_mask; /* threshold setting mask */
|
||||
uint8_t lower_non_crit; /* new lower non critical threshold*/
|
||||
uint8_t lower_crit; /* new lower critical threshold*/
|
||||
uint8_t lower_non_recov; /* new lower non recoverable threshold*/
|
||||
uint8_t upper_non_crit; /* new upper non critical threshold*/
|
||||
uint8_t upper_crit; /* new upper critical threshold*/
|
||||
uint8_t upper_non_recov; /* new upper non recoverable threshold*/
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
|
@ -49,46 +49,46 @@
|
||||
*/
|
||||
struct get_session_info_rsp
|
||||
{
|
||||
unsigned char session_handle;
|
||||
uint8_t session_handle;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char session_slot_count : 6; /* 1-based */
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t session_slot_count : 6; /* 1-based */
|
||||
#else
|
||||
unsigned char session_slot_count : 6; /* 1-based */
|
||||
unsigned char __reserved1 : 2;
|
||||
uint8_t session_slot_count : 6; /* 1-based */
|
||||
uint8_t __reserved1 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char active_session_count : 6; /* 1-based */
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t active_session_count : 6; /* 1-based */
|
||||
#else
|
||||
unsigned char active_session_count : 6; /* 1-based */
|
||||
unsigned char __reserved2 : 2;
|
||||
uint8_t active_session_count : 6; /* 1-based */
|
||||
uint8_t __reserved2 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char user_id : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
uint8_t user_id : 6;
|
||||
#else
|
||||
unsigned char user_id : 6;
|
||||
unsigned char __reserved3 : 2;
|
||||
uint8_t user_id : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved4 : 4;
|
||||
unsigned char privilege_level : 4;
|
||||
uint8_t __reserved4 : 4;
|
||||
uint8_t privilege_level : 4;
|
||||
#else
|
||||
unsigned char privilege_level : 4;
|
||||
unsigned char __reserved4 : 4;
|
||||
uint8_t privilege_level : 4;
|
||||
uint8_t __reserved4 : 4;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char auxiliary_data : 4;
|
||||
unsigned char channel_number : 4;
|
||||
uint8_t auxiliary_data : 4;
|
||||
uint8_t channel_number : 4;
|
||||
#else
|
||||
unsigned char channel_number : 4;
|
||||
unsigned char auxiliary_data : 4;
|
||||
uint8_t channel_number : 4;
|
||||
uint8_t auxiliary_data : 4;
|
||||
#endif
|
||||
|
||||
union
|
||||
@ -96,25 +96,25 @@ struct get_session_info_rsp
|
||||
/* Only exists if channel type is 802.3 LAN */
|
||||
struct
|
||||
{
|
||||
unsigned char console_ip[4]; /* MSBF */
|
||||
unsigned char console_mac[6]; /* MSBF */
|
||||
uint8_t console_ip[4]; /* MSBF */
|
||||
uint8_t console_mac[6]; /* MSBF */
|
||||
uint16_t console_port; /* LSBF */
|
||||
} lan_data;
|
||||
|
||||
/* Only exists if channel type is async. serial modem */
|
||||
struct
|
||||
{
|
||||
unsigned char session_channel_activity_type;
|
||||
uint8_t session_channel_activity_type;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved5 : 4;
|
||||
unsigned char destination_selector : 4;
|
||||
uint8_t __reserved5 : 4;
|
||||
uint8_t destination_selector : 4;
|
||||
#else
|
||||
unsigned char destination_selector : 4;
|
||||
unsigned char __reserved5 : 4;
|
||||
uint8_t destination_selector : 4;
|
||||
uint8_t __reserved5 : 4;
|
||||
#endif
|
||||
|
||||
unsigned char console_ip[4]; /* MSBF */
|
||||
uint8_t console_ip[4]; /* MSBF */
|
||||
|
||||
/* Only exists if session is PPP */
|
||||
uint16_t console_port; /* LSBF */
|
||||
|
@ -48,19 +48,19 @@
|
||||
|
||||
|
||||
struct sol_config_parameters {
|
||||
unsigned char set_in_progress;
|
||||
unsigned char enabled;
|
||||
unsigned char force_encryption;
|
||||
unsigned char force_authentication;
|
||||
unsigned char privilege_level;
|
||||
unsigned char character_accumulate_level;
|
||||
unsigned char character_send_threshold;
|
||||
unsigned char retry_count;
|
||||
unsigned char retry_interval;
|
||||
unsigned char non_volatile_bit_rate;
|
||||
unsigned char volatile_bit_rate;
|
||||
unsigned char payload_channel;
|
||||
unsigned short payload_port;
|
||||
uint8_t set_in_progress;
|
||||
uint8_t enabled;
|
||||
uint8_t force_encryption;
|
||||
uint8_t force_authentication;
|
||||
uint8_t privilege_level;
|
||||
uint8_t character_accumulate_level;
|
||||
uint8_t character_send_threshold;
|
||||
uint8_t retry_count;
|
||||
uint8_t retry_interval;
|
||||
uint8_t non_volatile_bit_rate;
|
||||
uint8_t volatile_bit_rate;
|
||||
uint8_t payload_channel;
|
||||
uint16_t payload_port;
|
||||
};
|
||||
|
||||
|
||||
@ -69,17 +69,17 @@ struct sol_config_parameters {
|
||||
* From table 24-2 of the IPMI v2.0 spec
|
||||
*/
|
||||
struct activate_payload_rsp {
|
||||
unsigned char auxiliary_data[4];
|
||||
unsigned char inbound_payload_size[2]; /* LS byte first */
|
||||
unsigned char outbound_payload_size[2]; /* LS byte first */
|
||||
unsigned char payload_udp_port[2]; /* LS byte first */
|
||||
unsigned char payload_vlan_number[2]; /* LS byte first */
|
||||
uint8_t auxiliary_data[4];
|
||||
uint8_t inbound_payload_size[2]; /* LS byte first */
|
||||
uint8_t outbound_payload_size[2]; /* LS byte first */
|
||||
uint8_t payload_udp_port[2]; /* LS byte first */
|
||||
uint8_t payload_vlan_number[2]; /* LS byte first */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
int ipmi_sol_main(struct ipmi_intf *, int, char **);
|
||||
int ipmi_get_sol_info(struct ipmi_intf * intf,
|
||||
unsigned char channel,
|
||||
uint8_t channel,
|
||||
struct sol_config_parameters * params);
|
||||
|
||||
|
||||
|
@ -48,41 +48,41 @@
|
||||
*/
|
||||
struct user_access_rsp {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved1 : 2;
|
||||
unsigned char maximum_ids : 6;
|
||||
uint8_t __reserved1 : 2;
|
||||
uint8_t maximum_ids : 6;
|
||||
#else
|
||||
unsigned char maximum_ids : 6;
|
||||
unsigned char __reserved1 : 2;
|
||||
uint8_t maximum_ids : 6;
|
||||
uint8_t __reserved1 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char enabled_user_count : 6;
|
||||
uint8_t __reserved2 : 2;
|
||||
uint8_t enabled_user_count : 6;
|
||||
#else
|
||||
unsigned char enabled_user_count : 6;
|
||||
unsigned char __reserved2 : 2;
|
||||
uint8_t enabled_user_count : 6;
|
||||
uint8_t __reserved2 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char fixed_name_count : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
uint8_t fixed_name_count : 6;
|
||||
#else
|
||||
unsigned char fixed_name_count : 6;
|
||||
unsigned char __reserved3 : 2;
|
||||
uint8_t fixed_name_count : 6;
|
||||
uint8_t __reserved3 : 2;
|
||||
#endif
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved4 : 1;
|
||||
unsigned char no_callin_access : 1;
|
||||
unsigned char link_auth_access : 1;
|
||||
unsigned char ipmi_messaging_access : 1;
|
||||
unsigned char channel_privilege_limit : 4;
|
||||
uint8_t __reserved4 : 1;
|
||||
uint8_t no_callin_access : 1;
|
||||
uint8_t link_auth_access : 1;
|
||||
uint8_t ipmi_messaging_access : 1;
|
||||
uint8_t channel_privilege_limit : 4;
|
||||
#else
|
||||
unsigned char channel_privilege_limit : 4;
|
||||
unsigned char ipmi_messaging_access : 1;
|
||||
unsigned char link_auth_access : 1;
|
||||
unsigned char no_callin_access : 1;
|
||||
unsigned char __reserved4 : 1;
|
||||
uint8_t channel_privilege_limit : 4;
|
||||
uint8_t ipmi_messaging_access : 1;
|
||||
uint8_t link_auth_access : 1;
|
||||
uint8_t no_callin_access : 1;
|
||||
uint8_t __reserved4 : 1;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -673,12 +673,12 @@ const struct valstr jedec_id5_vals[] = {
|
||||
};
|
||||
|
||||
int
|
||||
ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
|
||||
ipmi_spd_print(struct ipmi_intf * intf, uint8_t id)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct fru_info fru;
|
||||
unsigned char spd_data[256], msg_data[4];
|
||||
uint8_t spd_data[256], msg_data[4];
|
||||
int len, offset, size;
|
||||
|
||||
msg_data[0] = id;
|
||||
|
@ -50,17 +50,17 @@
|
||||
|
||||
extern int verbose;
|
||||
|
||||
uint32_t buf2long(unsigned char * buf)
|
||||
uint32_t buf2long(uint8_t * buf)
|
||||
{
|
||||
return (uint32_t)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
|
||||
}
|
||||
|
||||
unsigned short buf2short(unsigned char * buf)
|
||||
uint16_t buf2short(uint8_t * buf)
|
||||
{
|
||||
return (unsigned short)(buf[1] << 8 | buf[0]);
|
||||
return (uint16_t)(buf[1] << 8 | buf[0]);
|
||||
}
|
||||
|
||||
const char * buf2str(unsigned char * buf, int len)
|
||||
const char * buf2str(uint8_t * buf, int len)
|
||||
{
|
||||
static char str[1024];
|
||||
int i;
|
||||
@ -78,7 +78,7 @@ const char * buf2str(unsigned char * buf, int len)
|
||||
return (const char *)str;
|
||||
}
|
||||
|
||||
void printbuf(const unsigned char * buf, int len, const char * desc)
|
||||
void printbuf(const uint8_t * buf, int len, const char * desc)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -97,7 +97,7 @@ void printbuf(const unsigned char * buf, int len, const char * desc)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
const char * val2str(unsigned short val, const struct valstr *vs)
|
||||
const char * val2str(uint16_t val, const struct valstr *vs)
|
||||
{
|
||||
static char un_str[16];
|
||||
int i = 0;
|
||||
@ -114,7 +114,7 @@ const char * val2str(unsigned short val, const struct valstr *vs)
|
||||
return un_str;
|
||||
}
|
||||
|
||||
unsigned short str2val(const char *str, const struct valstr *vs)
|
||||
uint16_t str2val(const char *str, const struct valstr *vs)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -132,10 +132,10 @@ unsigned short str2val(const char *str, const struct valstr *vs)
|
||||
* @d: buffer to check
|
||||
* @s: position in buffer to start checksum from
|
||||
*/
|
||||
unsigned char
|
||||
ipmi_csum(unsigned char * d, int s)
|
||||
uint8_t
|
||||
ipmi_csum(uint8_t * d, int s)
|
||||
{
|
||||
unsigned char c = 0;
|
||||
uint8_t c = 0;
|
||||
for (; s > 0; s--, d++)
|
||||
c += *d;
|
||||
return -c;
|
||||
|
@ -63,9 +63,9 @@ void printf_channel_usage (void);
|
||||
* specificed by the parameter n
|
||||
*/
|
||||
static const char *
|
||||
ipmi_1_5_authtypes(unsigned char n)
|
||||
ipmi_1_5_authtypes(uint8_t n)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
static char supportedTypes[128];
|
||||
|
||||
bzero(supportedTypes, 128);
|
||||
@ -90,13 +90,13 @@ ipmi_1_5_authtypes(unsigned char n)
|
||||
*/
|
||||
int
|
||||
ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
|
||||
unsigned char channel,
|
||||
unsigned char priv)
|
||||
uint8_t channel,
|
||||
uint8_t priv)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct get_channel_auth_cap_rsp auth_cap;
|
||||
unsigned char msg_data[2];
|
||||
uint8_t msg_data[2];
|
||||
|
||||
msg_data[0] = channel | 0x80; // Ask for IPMI v2 data as well
|
||||
msg_data[1] = priv;
|
||||
@ -184,11 +184,11 @@ ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
|
||||
*
|
||||
*/
|
||||
int
|
||||
ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
uint8_t rqdata[2];
|
||||
struct get_channel_info_rsp channel_info;
|
||||
struct get_channel_access_rsp channel_access;
|
||||
|
||||
@ -345,11 +345,11 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned char userid)
|
||||
ipmi_get_user_access(struct ipmi_intf * intf, uint8_t channel, uint8_t userid)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req1, req2;
|
||||
unsigned char rqdata[2];
|
||||
uint8_t rqdata[2];
|
||||
struct get_user_access_rsp user_access;
|
||||
int curr_uid, max_uid = 0, init = 1;
|
||||
|
||||
@ -433,10 +433,10 @@ ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned ch
|
||||
static int
|
||||
ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned char channel, userid;
|
||||
uint8_t channel, userid;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
uint8_t rqdata[2];
|
||||
struct get_user_access_rsp user_access;
|
||||
struct set_user_access_data set_access;
|
||||
int i;
|
||||
@ -448,8 +448,8 @@ ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
channel = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
userid = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
channel = (uint8_t)strtol(argv[0], NULL, 0);
|
||||
userid = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
@ -507,7 +507,7 @@ ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = IPMI_SET_USER_ACCESS;
|
||||
req.msg.data = (unsigned char *) &set_access;
|
||||
req.msg.data = (uint8_t *) &set_access;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
@ -526,8 +526,8 @@ ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
ipmi_get_channel_medium(struct ipmi_intf * intf, unsigned char channel)
|
||||
uint8_t
|
||||
ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -558,7 +558,7 @@ ipmi_get_channel_medium(struct ipmi_intf * intf, unsigned char channel)
|
||||
return info.channel_medium;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
uint8_t
|
||||
ipmi_current_channel_medium(struct ipmi_intf * intf)
|
||||
{
|
||||
return ipmi_get_channel_medium(intf, 0xE);
|
||||
@ -597,18 +597,18 @@ ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
printf_channel_usage();
|
||||
else
|
||||
retval = ipmi_get_channel_auth_cap(intf,
|
||||
(unsigned char)strtol(argv[1], NULL, 0),
|
||||
(unsigned char)strtol(argv[2], NULL, 0));
|
||||
(uint8_t)strtol(argv[1], NULL, 0),
|
||||
(uint8_t)strtol(argv[2], NULL, 0));
|
||||
}
|
||||
else if (strncmp(argv[0], "getaccess", 10) == 0)
|
||||
{
|
||||
if ((argc < 2) || (argc > 3))
|
||||
printf_channel_usage();
|
||||
else {
|
||||
unsigned char ch = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
unsigned char id = 0;
|
||||
uint8_t ch = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
uint8_t id = 0;
|
||||
if (argc == 3)
|
||||
id = (unsigned char)strtol(argv[2], NULL, 0);
|
||||
id = (uint8_t)strtol(argv[2], NULL, 0);
|
||||
retval = ipmi_get_user_access(intf, ch, id);
|
||||
}
|
||||
}
|
||||
@ -621,9 +621,9 @@ ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
if (argc > 2)
|
||||
printf_channel_usage();
|
||||
else {
|
||||
unsigned char ch = 0xe;
|
||||
uint8_t ch = 0xe;
|
||||
if (argc == 2)
|
||||
ch = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
ch = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
retval = ipmi_get_channel_info(intf, ch);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ static const struct valstr ipmi_chassis_power_control_vals[] = {
|
||||
};
|
||||
|
||||
static int
|
||||
ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ctl)
|
||||
ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -126,8 +126,8 @@ ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
struct ipmi_rs * rsp;
|
||||
|
||||
struct {
|
||||
unsigned char interval;
|
||||
unsigned char force_on;
|
||||
uint8_t interval;
|
||||
uint8_t force_on;
|
||||
} identify_data;
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
@ -141,10 +141,10 @@ ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
identify_data.interval = 0;
|
||||
identify_data.force_on = 1;
|
||||
} else {
|
||||
identify_data.interval = (unsigned char)atoi(arg);
|
||||
identify_data.interval = (uint8_t)atoi(arg);
|
||||
identify_data.force_on = 0;
|
||||
}
|
||||
req.msg.data = (unsigned char *)&identify_data;
|
||||
req.msg.data = (uint8_t *)&identify_data;
|
||||
/* The Force Identify On byte is optional and not
|
||||
* supported by all devices-- if force is not specified,
|
||||
* we pass only one data byte; if specified, we pass two
|
||||
@ -359,11 +359,11 @@ ipmi_chassis_status(struct ipmi_intf * intf)
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len)
|
||||
ipmi_chassis_set_bootparam(struct ipmi_intf * intf, uint8_t param, uint8_t * data, int len)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[16];
|
||||
uint8_t msg_data[16];
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
|
||||
@ -397,14 +397,14 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[3];
|
||||
uint8_t msg_data[3];
|
||||
|
||||
if (arg == NULL)
|
||||
return -1;
|
||||
|
||||
memset(msg_data, 0, 3);
|
||||
|
||||
msg_data[0] = (unsigned char)atoi(arg) & 0x7f;
|
||||
msg_data[0] = (uint8_t)atoi(arg) & 0x7f;
|
||||
msg_data[1] = 0;
|
||||
msg_data[2] = 0;
|
||||
|
||||
@ -437,7 +437,7 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
|
||||
static int
|
||||
ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg)
|
||||
{
|
||||
unsigned char flags[5];
|
||||
uint8_t flags[5];
|
||||
int rc = 0;
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
@ -474,7 +474,7 @@ ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg)
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char policy)
|
||||
ipmi_chassis_power_policy(struct ipmi_intf * intf, uint8_t policy)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -539,7 +539,7 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
rc = ipmi_chassis_status(intf);
|
||||
}
|
||||
else if (strncmp(argv[0], "power", 5) == 0) {
|
||||
unsigned char ctl = 0;
|
||||
uint8_t ctl = 0;
|
||||
|
||||
if ((argc < 2) || (strncmp(argv[1], "help", 4) == 0)) {
|
||||
lprintf(LOG_NOTICE, "chassis power Commands: status, on, off, cycle, reset, diag, soft");
|
||||
@ -595,7 +595,7 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
lprintf(LOG_NOTICE, " previous : return to previous state when power is restored");
|
||||
lprintf(LOG_NOTICE, " always-off : stay off after power is restored");
|
||||
} else {
|
||||
unsigned char ctl;
|
||||
uint8_t ctl;
|
||||
if (strncmp(argv[1], "list", 4) == 0)
|
||||
ctl = IPMI_CHASSIS_POLICY_NO_CHANGE;
|
||||
else if (strncmp(argv[1], "always-on", 9) == 0)
|
||||
|
@ -59,8 +59,8 @@ ipmi_send_platform_event(struct ipmi_intf * intf, int num)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[8];
|
||||
unsigned char chmed;
|
||||
uint8_t rqdata[8];
|
||||
uint8_t chmed;
|
||||
int p = 0;
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
@ -140,11 +140,11 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct sel_event_record sel_event;
|
||||
unsigned char rqdata[8];
|
||||
uint8_t rqdata[8];
|
||||
char buf[1024];
|
||||
char * ptr, * tok;
|
||||
int i, j;
|
||||
unsigned char chmed;
|
||||
uint8_t chmed;
|
||||
int rc = 0;
|
||||
|
||||
if (file == NULL)
|
||||
@ -204,7 +204,7 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
||||
j = i++;
|
||||
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM)
|
||||
j++;
|
||||
rqdata[j] = (unsigned char)strtol(tok, NULL, 0);
|
||||
rqdata[j] = (uint8_t)strtol(tok, NULL, 0);
|
||||
tok = strtok(NULL, " ");
|
||||
}
|
||||
if (i < 7) {
|
||||
@ -248,7 +248,7 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
||||
int
|
||||
ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned char c;
|
||||
uint8_t c;
|
||||
int rc = 0;
|
||||
|
||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
||||
@ -269,7 +269,7 @@ ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
rc = ipmi_event_fromfile(intf, argv[1]);
|
||||
}
|
||||
} else {
|
||||
c = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
c = (uint8_t)strtol(argv[0], NULL, 0);
|
||||
rc = ipmi_send_platform_event(intf, c);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
extern int verbose;
|
||||
extern int ipmi_spd_print(struct ipmi_intf * intf, unsigned char id);
|
||||
extern int ipmi_spd_print(struct ipmi_intf * intf, uint8_t id);
|
||||
|
||||
/* get_fru_area_str - Parse FRU area string from raw data
|
||||
*
|
||||
@ -59,7 +59,7 @@ extern int ipmi_spd_print(struct ipmi_intf * intf, unsigned char id);
|
||||
* returns pointer to FRU area string
|
||||
*/
|
||||
static char *
|
||||
get_fru_area_str(unsigned char * data, int * offset)
|
||||
get_fru_area_str(uint8_t * data, int * offset)
|
||||
{
|
||||
static const char bcd_plus[] = "0123456789 -.:,_";
|
||||
char * str;
|
||||
@ -164,14 +164,14 @@ get_fru_area_str(unsigned char * data, int * offset)
|
||||
* returns 0 if successful
|
||||
*/
|
||||
static int
|
||||
read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, unsigned char id,
|
||||
unsigned int offset, unsigned int length, unsigned char *frubuf)
|
||||
read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
|
||||
uint32_t offset, uint32_t length, uint8_t *frubuf)
|
||||
{
|
||||
static unsigned int fru_data_rqst_size = 32;
|
||||
unsigned int off = offset, tmp, finish;
|
||||
static uint32_t fru_data_rqst_size = 32;
|
||||
uint32_t off = offset, tmp, finish;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
uint8_t msg_data[4];
|
||||
|
||||
if (offset > fru->size) {
|
||||
lprintf(LOG_ERR, "Read FRU Area offset incorrect: %d > %d",
|
||||
@ -198,13 +198,13 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, unsigned char id,
|
||||
do {
|
||||
tmp = fru->access ? off >> 1 : off;
|
||||
msg_data[0] = id;
|
||||
msg_data[1] = (unsigned char)(tmp & 0xff);
|
||||
msg_data[2] = (unsigned char)(tmp >> 8);
|
||||
msg_data[1] = (uint8_t)(tmp & 0xff);
|
||||
msg_data[2] = (uint8_t)(tmp >> 8);
|
||||
tmp = finish - off;
|
||||
if (tmp > fru_data_rqst_size)
|
||||
msg_data[3] = (unsigned char)fru_data_rqst_size;
|
||||
msg_data[3] = (uint8_t)fru_data_rqst_size;
|
||||
else
|
||||
msg_data[3] = (unsigned char)tmp;
|
||||
msg_data[3] = (uint8_t)tmp;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp == NULL) {
|
||||
@ -245,10 +245,10 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, unsigned char id,
|
||||
*/
|
||||
static void
|
||||
fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
unsigned char id, unsigned int offset)
|
||||
uint8_t id, uint32_t offset)
|
||||
{
|
||||
unsigned char * fru_area, * fru_data;
|
||||
unsigned int fru_len, area_len, i;
|
||||
uint8_t * fru_area, * fru_data;
|
||||
uint32_t fru_len, area_len, i;
|
||||
|
||||
i = offset;
|
||||
fru_len = 0;
|
||||
@ -317,10 +317,10 @@ fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
*/
|
||||
static void
|
||||
fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
unsigned char id, unsigned int offset)
|
||||
uint8_t id, uint32_t offset)
|
||||
{
|
||||
unsigned char * fru_area, * fru_data;
|
||||
unsigned int fru_len, area_len, i;
|
||||
uint8_t * fru_area, * fru_data;
|
||||
uint32_t fru_len, area_len, i;
|
||||
|
||||
i = offset;
|
||||
fru_len = 0;
|
||||
@ -401,10 +401,10 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
*/
|
||||
static void
|
||||
fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
unsigned char id, unsigned int offset)
|
||||
uint8_t id, uint32_t offset)
|
||||
{
|
||||
unsigned char * fru_area, * fru_data;
|
||||
unsigned int fru_len, area_len, i;
|
||||
uint8_t * fru_area, * fru_data;
|
||||
uint32_t fru_len, area_len, i;
|
||||
|
||||
i = offset;
|
||||
fru_len = 0;
|
||||
@ -504,17 +504,17 @@ fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
*/
|
||||
static void
|
||||
fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
unsigned char id, unsigned int offset)
|
||||
uint8_t id, uint32_t offset)
|
||||
{
|
||||
unsigned char * fru_data;
|
||||
unsigned int fru_len, i;
|
||||
uint8_t * fru_data;
|
||||
uint32_t fru_len, i;
|
||||
struct fru_multirec_header * h;
|
||||
struct fru_multirec_powersupply * ps;
|
||||
struct fru_multirec_dcoutput * dc;
|
||||
struct fru_multirec_dcload * dl;
|
||||
unsigned short peak_capacity;
|
||||
unsigned char peak_hold_up_time;
|
||||
unsigned int last_off, len;
|
||||
uint16_t peak_capacity;
|
||||
uint8_t peak_hold_up_time;
|
||||
uint32_t last_off, len;
|
||||
|
||||
i = last_off = offset;
|
||||
fru_len = 0;
|
||||
@ -680,13 +680,13 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
* returns 1 if device not present
|
||||
*/
|
||||
static int
|
||||
__ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
__ipmi_fru_print(struct ipmi_intf * intf, uint8_t id)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct fru_info fru;
|
||||
struct fru_header header;
|
||||
unsigned char msg_data[4];
|
||||
uint8_t msg_data[4];
|
||||
|
||||
memset(&fru, 0, sizeof(struct fru_info));
|
||||
memset(&header, 0, sizeof(struct fru_header));
|
||||
@ -816,7 +816,7 @@ int
|
||||
ipmi_fru_print(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru)
|
||||
{
|
||||
char desc[17];
|
||||
unsigned char save_addr;
|
||||
uint8_t save_addr;
|
||||
int rc = 0;
|
||||
|
||||
if (fru == NULL)
|
||||
|
@ -60,12 +60,12 @@ extern int verbose;
|
||||
|
||||
|
||||
static struct lan_param *
|
||||
get_lan_param(struct ipmi_intf * intf, unsigned char chan, int param)
|
||||
get_lan_param(struct ipmi_intf * intf, uint8_t chan, int param)
|
||||
{
|
||||
struct lan_param * p;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
uint8_t msg_data[4];
|
||||
|
||||
p = &ipmi_lan_params[param];
|
||||
if (p == NULL)
|
||||
@ -103,8 +103,8 @@ get_lan_param(struct ipmi_intf * intf, unsigned char chan, int param)
|
||||
* this may take a long time...
|
||||
*/
|
||||
static int
|
||||
set_lan_param_wait(struct ipmi_intf * intf, unsigned char chan,
|
||||
int param, unsigned char * data, int len)
|
||||
set_lan_param_wait(struct ipmi_intf * intf, uint8_t chan,
|
||||
int param, uint8_t * data, int len)
|
||||
{
|
||||
struct lan_param * p;
|
||||
int timeout = 3; /* 3 second timeout */
|
||||
@ -148,12 +148,12 @@ set_lan_param_wait(struct ipmi_intf * intf, unsigned char chan,
|
||||
}
|
||||
|
||||
static int
|
||||
__set_lan_param(struct ipmi_intf * intf, unsigned char chan,
|
||||
int param, unsigned char * data, int len, int wait)
|
||||
__set_lan_param(struct ipmi_intf * intf, uint8_t chan,
|
||||
int param, uint8_t * data, int len, int wait)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[32];
|
||||
uint8_t msg_data[32];
|
||||
|
||||
if (param < 0)
|
||||
return -1;
|
||||
@ -205,7 +205,7 @@ __set_lan_param(struct ipmi_intf * intf, unsigned char chan,
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_lanp_lock_state(struct ipmi_intf * intf, unsigned char chan)
|
||||
ipmi_lanp_lock_state(struct ipmi_intf * intf, uint8_t chan)
|
||||
{
|
||||
struct lan_param * p;
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS);
|
||||
@ -213,9 +213,9 @@ ipmi_lanp_lock_state(struct ipmi_intf * intf, unsigned char chan)
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_lanp_lock(struct ipmi_intf * intf, unsigned char chan)
|
||||
ipmi_lanp_lock(struct ipmi_intf * intf, uint8_t chan)
|
||||
{
|
||||
unsigned char val = 1;
|
||||
uint8_t val = 1;
|
||||
int inp, try = 3;
|
||||
|
||||
while ((inp = ipmi_lanp_lock_state(intf, chan)) != val) {
|
||||
@ -226,9 +226,9 @@ ipmi_lanp_lock(struct ipmi_intf * intf, unsigned char chan)
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_lanp_unlock(struct ipmi_intf * intf, unsigned char chan)
|
||||
ipmi_lanp_unlock(struct ipmi_intf * intf, uint8_t chan)
|
||||
{
|
||||
unsigned char val;
|
||||
uint8_t val;
|
||||
int rc;
|
||||
|
||||
val = 2;
|
||||
@ -241,8 +241,8 @@ ipmi_lanp_unlock(struct ipmi_intf * intf, unsigned char chan)
|
||||
}
|
||||
|
||||
static int
|
||||
set_lan_param(struct ipmi_intf * intf, unsigned char chan,
|
||||
int param, unsigned char * data, int len)
|
||||
set_lan_param(struct ipmi_intf * intf, uint8_t chan,
|
||||
int param, uint8_t * data, int len)
|
||||
{
|
||||
int rc;
|
||||
ipmi_lanp_lock(intf, chan);
|
||||
@ -254,10 +254,10 @@ set_lan_param(struct ipmi_intf * intf, unsigned char chan,
|
||||
|
||||
static int
|
||||
lan_set_arp_interval(struct ipmi_intf * intf,
|
||||
unsigned char chan, unsigned char * ival)
|
||||
uint8_t chan, uint8_t * ival)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char interval;
|
||||
uint8_t interval;
|
||||
int rc = 0;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP);
|
||||
@ -265,7 +265,7 @@ lan_set_arp_interval(struct ipmi_intf * intf,
|
||||
return -1;
|
||||
|
||||
if (ival != 0) {
|
||||
interval = ((unsigned char)atoi(ival) * 2) - 1;
|
||||
interval = ((uint8_t)atoi(ival) * 2) - 1;
|
||||
rc = set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1);
|
||||
} else {
|
||||
interval = lp->data[0];
|
||||
@ -279,10 +279,10 @@ lan_set_arp_interval(struct ipmi_intf * intf,
|
||||
|
||||
static int
|
||||
lan_set_arp_generate(struct ipmi_intf * intf,
|
||||
unsigned char chan, unsigned char ctl)
|
||||
uint8_t chan, uint8_t ctl)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char data;
|
||||
uint8_t data;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP);
|
||||
if (lp == NULL)
|
||||
@ -301,10 +301,10 @@ lan_set_arp_generate(struct ipmi_intf * intf,
|
||||
|
||||
static int
|
||||
lan_set_arp_respond(struct ipmi_intf * intf,
|
||||
unsigned char chan, unsigned char ctl)
|
||||
uint8_t chan, uint8_t ctl)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char data;
|
||||
uint8_t data;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP);
|
||||
if (lp == NULL)
|
||||
@ -322,10 +322,10 @@ lan_set_arp_respond(struct ipmi_intf * intf,
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
|
||||
{
|
||||
struct lan_param * p;
|
||||
unsigned char medium;
|
||||
uint8_t medium;
|
||||
int rc = 0;
|
||||
|
||||
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
||||
@ -446,10 +446,10 @@ ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
|
||||
/* Configure Authentication Types */
|
||||
static int
|
||||
ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char * level, char * types)
|
||||
ipmi_lan_set_auth(struct ipmi_intf * intf, uint8_t chan, char * level, char * types)
|
||||
{
|
||||
unsigned char data[5];
|
||||
unsigned char authtype = 0;
|
||||
uint8_t data[5];
|
||||
uint8_t authtype = 0;
|
||||
char * p;
|
||||
struct lan_param * lp;
|
||||
|
||||
@ -504,11 +504,11 @@ ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char * level, cha
|
||||
|
||||
static int
|
||||
ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
unsigned char userid, unsigned char * password)
|
||||
uint8_t userid, uint8_t * password)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[18];
|
||||
uint8_t data[18];
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data[0] = userid & 0x3f;/* user ID */
|
||||
@ -543,11 +543,11 @@ ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_set_channel_access(struct ipmi_intf * intf, unsigned char channel, unsigned char enable)
|
||||
ipmi_set_channel_access(struct ipmi_intf * intf, uint8_t channel, uint8_t enable)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[3];
|
||||
uint8_t rqdata[3];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
|
||||
@ -602,11 +602,11 @@ ipmi_set_channel_access(struct ipmi_intf * intf, unsigned char channel, unsigned
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_set_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned char userid)
|
||||
ipmi_set_user_access(struct ipmi_intf * intf, uint8_t channel, uint8_t userid)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[4];
|
||||
uint8_t rqdata[4];
|
||||
|
||||
memset(rqdata, 0, 4);
|
||||
rqdata[0] = 0x90 | (channel & 0xf);
|
||||
@ -635,9 +635,9 @@ ipmi_set_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned ch
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmdline_macaddr(char * arg, unsigned char * buf)
|
||||
get_cmdline_macaddr(char * arg, uint8_t * buf)
|
||||
{
|
||||
unsigned m1, m2, m3, m4, m5, m6;
|
||||
uint8_t m1, m2, m3, m4, m5, m6;
|
||||
if (sscanf(arg, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
&m1, &m2, &m3, &m4, &m5, &m6) != 6) {
|
||||
lprintf(LOG_ERR, "Invalid MAC address: %s", arg);
|
||||
@ -653,9 +653,9 @@ get_cmdline_macaddr(char * arg, unsigned char * buf)
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmdline_ipaddr(char * arg, unsigned char * buf)
|
||||
get_cmdline_ipaddr(char * arg, uint8_t * buf)
|
||||
{
|
||||
unsigned ip1, ip2, ip3, ip4;
|
||||
uint8_t ip1, ip2, ip3, ip4;
|
||||
if (sscanf(arg, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
|
||||
lprintf(LOG_ERR, "Invalid IP address: %s", arg);
|
||||
return -1;
|
||||
@ -697,8 +697,8 @@ static void ipmi_lan_set_usage(void)
|
||||
static int
|
||||
ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned char data[32];
|
||||
unsigned char chan, medium;
|
||||
uint8_t data[32];
|
||||
uint8_t chan, medium;
|
||||
int rc = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
@ -712,7 +712,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
chan = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
chan = (uint8_t)strtol(argv[0], NULL, 0);
|
||||
|
||||
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
||||
lprintf(LOG_ERR, "Invalid Channel %d", chan);
|
||||
@ -926,9 +926,9 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
|
||||
if ((strncmp(argv[0], "printconf", 9) == 0) ||
|
||||
(strncmp(argv[0], "print", 5) == 0)) {
|
||||
unsigned char chan = 7;
|
||||
uint8_t chan = 7;
|
||||
if (argc > 1)
|
||||
chan = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
chan = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
|
||||
lprintf(LOG_NOTICE, "usage: lan print <channel>");
|
||||
else
|
||||
|
@ -84,23 +84,23 @@ ipmi_mc_reset(struct ipmi_intf * intf, int cmd)
|
||||
|
||||
struct bmc_enables_data {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char oem2 : 1;
|
||||
unsigned char oem1 : 1;
|
||||
unsigned char oem0 : 1;
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char system_event_log : 1;
|
||||
unsigned char event_msgbuf : 1;
|
||||
unsigned char event_msgbuf_intr : 1;
|
||||
unsigned char receive_msg_intr : 1;
|
||||
uint8_t oem2 : 1;
|
||||
uint8_t oem1 : 1;
|
||||
uint8_t oem0 : 1;
|
||||
uint8_t __reserved : 1;
|
||||
uint8_t system_event_log : 1;
|
||||
uint8_t event_msgbuf : 1;
|
||||
uint8_t event_msgbuf_intr : 1;
|
||||
uint8_t receive_msg_intr : 1;
|
||||
#else
|
||||
unsigned char receive_msg_intr : 1;
|
||||
unsigned char event_msgbuf_intr : 1;
|
||||
unsigned char event_msgbuf : 1;
|
||||
unsigned char system_event_log : 1;
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char oem0 : 1;
|
||||
unsigned char oem1 : 1;
|
||||
unsigned char oem2 : 1;
|
||||
uint8_t receive_msg_intr : 1;
|
||||
uint8_t event_msgbuf_intr : 1;
|
||||
uint8_t event_msgbuf : 1;
|
||||
uint8_t system_event_log : 1;
|
||||
uint8_t __reserved : 1;
|
||||
uint8_t oem0 : 1;
|
||||
uint8_t oem1 : 1;
|
||||
uint8_t oem2 : 1;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
@ -216,7 +216,7 @@ ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct bitfield_data * bf;
|
||||
unsigned char en;
|
||||
uint8_t en;
|
||||
int i;
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
@ -346,7 +346,7 @@ ipmi_mc_get_deviceid(struct ipmi_intf * intf)
|
||||
printf("Manufacturer ID : %lu\n",
|
||||
(long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id));
|
||||
printf("Product ID : %u (0x%02x%02x)\n",
|
||||
buf2short((unsigned char *)(devid->product_id)),
|
||||
buf2short((uint8_t *)(devid->product_id)),
|
||||
devid->product_id[1], devid->product_id[0]);
|
||||
printf("Device Available : %s\n",
|
||||
(devid->fw_rev1 & IPM_DEV_FWREV1_AVAIL_MASK) ?
|
||||
|
@ -141,7 +141,7 @@ ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val)
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_pef_print_field(const char * fmt[2], const char * label, uint32_t val)
|
||||
ipmi_pef_print_field(const char * fmt[2], const char * label, unsigned long val)
|
||||
{ /*
|
||||
// print a 'field' (observes 'verbose' flag)
|
||||
*/
|
||||
@ -176,7 +176,7 @@ ipmi_pef_print_hex(const char * text, uint32_t val)
|
||||
void
|
||||
ipmi_pef_print_str(const char * text, const char * val)
|
||||
{ /* string */
|
||||
ipmi_pef_print_field(pef_fld_fmts[F_STR], text, (uint32_t)val);
|
||||
ipmi_pef_print_field(pef_fld_fmts[F_STR], text, (unsigned long)val);
|
||||
}
|
||||
|
||||
void
|
||||
@ -526,7 +526,7 @@ ipmi_pef_print_event_info(struct pef_cfgparm_filter_table_entry * pef, char * bu
|
||||
// print PEF entry Event info: class, severity, trigger, etc.
|
||||
*/
|
||||
static char * classes[] = {"Discrete", "Threshold", "OEM"};
|
||||
unsigned short offmask;
|
||||
uint16_t offmask;
|
||||
char * p;
|
||||
int i;
|
||||
uint8_t t;
|
||||
|
@ -49,17 +49,17 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char netfn, cmd;
|
||||
uint8_t netfn, cmd;
|
||||
int i;
|
||||
unsigned char data[32];
|
||||
uint8_t data[32];
|
||||
|
||||
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
||||
lprintf(LOG_NOTICE, "RAW Commands: raw <netfn> <cmd> [data]");
|
||||
return -1;
|
||||
}
|
||||
|
||||
netfn = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
cmd = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
netfn = (uint8_t)strtol(argv[0], NULL, 0);
|
||||
cmd = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -68,7 +68,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
req.msg.data = data;
|
||||
|
||||
for (i=2; i<argc; i++) {
|
||||
unsigned char val = (unsigned char)strtol(argv[i], NULL, 0);
|
||||
uint8_t val = (uint8_t)strtol(argv[i], NULL, 0);
|
||||
req.msg.data[i-2] = val;
|
||||
req.msg.data_len++;
|
||||
}
|
||||
|
@ -70,15 +70,15 @@ static struct sdr_record_list * sdr_list_head = NULL;
|
||||
static struct sdr_record_list * sdr_list_tail = NULL;
|
||||
static struct ipmi_sdr_iterator * sdr_list_itr = NULL;
|
||||
|
||||
/* utos - convert unsigned value to 2's complement signed
|
||||
/* utos - convert unsigned 32bit value to 2's complement signed
|
||||
*
|
||||
* @val: unsigned value to convert
|
||||
* @bits: number of bits in value
|
||||
*
|
||||
* returns 2s complement signed integer
|
||||
*/
|
||||
int
|
||||
utos(unsigned val, unsigned bits)
|
||||
int32_t
|
||||
utos(uint32_t val, int bits)
|
||||
{
|
||||
int x = pow(10, bits-1);
|
||||
if (val & x) {
|
||||
@ -97,7 +97,7 @@ utos(unsigned val, unsigned bits)
|
||||
*/
|
||||
float
|
||||
sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor,
|
||||
unsigned char val)
|
||||
uint8_t val)
|
||||
{
|
||||
int m, b, k1, k2;
|
||||
|
||||
@ -115,7 +115,7 @@ sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor,
|
||||
if (val & 0x80) val ++;
|
||||
/* Deliberately fall through to case 2. */
|
||||
case 2:
|
||||
return (float)(((m * (signed char)val) +
|
||||
return (float)(((m * (int8_t)val) +
|
||||
(b * pow(10, k1))) * pow(10, k2));
|
||||
default:
|
||||
/* Oops! This isn't an analog sensor. */
|
||||
@ -130,7 +130,7 @@ sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor,
|
||||
*
|
||||
* returns raw sensor reading
|
||||
*/
|
||||
unsigned char
|
||||
uint8_t
|
||||
sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor,
|
||||
float val)
|
||||
{
|
||||
@ -153,9 +153,9 @@ sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor,
|
||||
result = (((val / pow(10, k2)) - (b * pow(10, k1))) / m);
|
||||
|
||||
if ((result -(int)result) >= .5)
|
||||
return (unsigned char)ceil(result);
|
||||
return (uint8_t)ceil(result);
|
||||
else
|
||||
return (unsigned char)result;
|
||||
return (uint8_t)result;
|
||||
}
|
||||
|
||||
/* ipmi_sdr_get_sensor_reading - retrieve a raw sensor reading
|
||||
@ -166,7 +166,7 @@ sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor,
|
||||
* returns ipmi response structure
|
||||
*/
|
||||
struct ipmi_rs *
|
||||
ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor)
|
||||
ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, uint8_t sensor)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
|
||||
@ -189,7 +189,7 @@ ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor)
|
||||
* or "OEM reserved"
|
||||
*/
|
||||
const char *
|
||||
ipmi_sdr_get_sensor_type_desc(const unsigned char type)
|
||||
ipmi_sdr_get_sensor_type_desc(const uint8_t type)
|
||||
{
|
||||
if (type <= SENSOR_TYPE_MAX)
|
||||
return sensor_type_desc[type];
|
||||
@ -210,7 +210,7 @@ ipmi_sdr_get_sensor_type_desc(const unsigned char type)
|
||||
* us = unspecified (not used)
|
||||
*/
|
||||
const char *
|
||||
ipmi_sdr_get_status(unsigned char stat)
|
||||
ipmi_sdr_get_status(uint8_t stat)
|
||||
{
|
||||
if (stat & (SDR_SENSOR_STAT_LO_NR | SDR_SENSOR_STAT_HI_NR))
|
||||
return "nr";
|
||||
@ -232,8 +232,8 @@ ipmi_sdr_get_status(unsigned char stat)
|
||||
* returns NULL on error
|
||||
*/
|
||||
static struct sdr_get_rs *
|
||||
ipmi_sdr_get_header(struct ipmi_intf * intf, unsigned short reserve_id,
|
||||
unsigned short record_id)
|
||||
ipmi_sdr_get_header(struct ipmi_intf * intf, uint16_t reserve_id,
|
||||
uint16_t record_id)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
@ -249,7 +249,7 @@ ipmi_sdr_get_header(struct ipmi_intf * intf, unsigned short reserve_id,
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR;
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data = (uint8_t *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
@ -366,7 +366,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
int i=0, validread=1, do_unit=1;
|
||||
float val = 0.0;
|
||||
struct ipmi_rs * rsp;
|
||||
unsigned char min_reading, max_reading;
|
||||
uint8_t min_reading, max_reading;
|
||||
|
||||
if (sensor == NULL)
|
||||
return -1;
|
||||
@ -544,7 +544,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
||||
printf(" Sensor Reading : ");
|
||||
if (validread)
|
||||
printf("%xh\n", (unsigned int)val);
|
||||
printf("%xh\n", (uint32_t)val);
|
||||
else
|
||||
printf("Not Present\n");
|
||||
ipmi_sdr_print_discrete_state(sensor->sensor.type,
|
||||
@ -560,7 +560,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
|
||||
printf(" Sensor Reading : ");
|
||||
if (validread) {
|
||||
unsigned short raw_tol = __TO_TOL(sensor->mtol);
|
||||
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
||||
float tol = sdr_convert_sensor_reading(sensor, raw_tol * 2);
|
||||
printf("%.*f (+/- %.*f) %s\n",
|
||||
(val==(int)val) ? 0 : 3,
|
||||
@ -585,7 +585,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
SENSOR_PRINT_THRESH("Lower critical", lower.critical, 0x02);
|
||||
SENSOR_PRINT_THRESH("Lower non-critical", lower.non_critical, 0x01);
|
||||
|
||||
min_reading = (unsigned char)sdr_convert_sensor_reading(
|
||||
min_reading = (uint8_t)sdr_convert_sensor_reading(
|
||||
sensor, sensor->sensor_min);
|
||||
if ((sensor->unit.analog == 0 && sensor->sensor_min == 0x00) ||
|
||||
(sensor->unit.analog == 1 && sensor->sensor_min == 0xff) ||
|
||||
@ -594,7 +594,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
else
|
||||
printf(" Minimum sensor range : %.3f\n", (float)min_reading);
|
||||
|
||||
max_reading = (unsigned char)sdr_convert_sensor_reading(
|
||||
max_reading = (uint8_t)sdr_convert_sensor_reading(
|
||||
sensor, sensor->sensor_max);
|
||||
if ((sensor->unit.analog == 0 && sensor->sensor_max == 0xff) ||
|
||||
(sensor->unit.analog == 1 && sensor->sensor_max == 0x00) ||
|
||||
@ -623,7 +623,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf * intf,
|
||||
}
|
||||
|
||||
static inline int
|
||||
get_offset(unsigned char x)
|
||||
get_offset(uint8_t x)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<8; i++)
|
||||
@ -641,11 +641,11 @@ get_offset(unsigned char x)
|
||||
*
|
||||
* no meaningful return value
|
||||
*/
|
||||
void ipmi_sdr_print_discrete_state(unsigned char sensor_type,
|
||||
unsigned char event_type,
|
||||
unsigned char state)
|
||||
void ipmi_sdr_print_discrete_state(uint8_t sensor_type,
|
||||
uint8_t event_type,
|
||||
uint8_t state)
|
||||
{
|
||||
unsigned char typ;
|
||||
uint8_t typ;
|
||||
struct ipmi_event_sensor_types *evt;
|
||||
int pre = 0;
|
||||
|
||||
@ -1125,8 +1125,8 @@ ipmi_sdr_print_sensor_oem(struct ipmi_intf * intf,
|
||||
* returns -1 on error
|
||||
*/
|
||||
int
|
||||
ipmi_sdr_print_rawentry(struct ipmi_intf * intf, unsigned char type,
|
||||
unsigned char * raw, int len)
|
||||
ipmi_sdr_print_rawentry(struct ipmi_intf * intf, uint8_t type,
|
||||
uint8_t * raw, int len)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
@ -1224,7 +1224,7 @@ ipmi_sdr_print_listentry(struct ipmi_intf * intf,
|
||||
* returns -1 on error
|
||||
*/
|
||||
int
|
||||
ipmi_sdr_print_sdr(struct ipmi_intf * intf, unsigned char type)
|
||||
ipmi_sdr_print_sdr(struct ipmi_intf * intf, uint8_t type)
|
||||
{
|
||||
struct sdr_get_rs * header;
|
||||
struct ipmi_sdr_iterator * itr;
|
||||
@ -1239,7 +1239,7 @@ ipmi_sdr_print_sdr(struct ipmi_intf * intf, unsigned char type)
|
||||
}
|
||||
|
||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
||||
unsigned char * rec;
|
||||
uint8_t * rec;
|
||||
|
||||
if (type != header->type && type != 0xff)
|
||||
continue;
|
||||
@ -1272,7 +1272,7 @@ ipmi_sdr_print_sdr(struct ipmi_intf * intf, unsigned char type)
|
||||
*/
|
||||
int
|
||||
ipmi_sdr_get_reservation(struct ipmi_intf * intf,
|
||||
unsigned short *reserve_id)
|
||||
uint16_t *reserve_id)
|
||||
{
|
||||
struct ipmi_rs *rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -1369,14 +1369,14 @@ ipmi_sdr_start(struct ipmi_intf * intf)
|
||||
* returns raw SDR data
|
||||
* returns NULL on error
|
||||
*/
|
||||
unsigned char *
|
||||
uint8_t *
|
||||
ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
|
||||
struct ipmi_sdr_iterator * itr)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
unsigned char * data;
|
||||
uint8_t * data;
|
||||
int i = 0, len = header->length;
|
||||
|
||||
if (len < 1)
|
||||
@ -1395,7 +1395,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR;
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data = (uint8_t *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
/* read SDR record with partial reads
|
||||
@ -1567,8 +1567,8 @@ ipmi_sdr_list_empty(struct ipmi_intf * intf)
|
||||
* returns NULL on error
|
||||
*/
|
||||
struct sdr_record_list *
|
||||
ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, unsigned char num,
|
||||
unsigned char type)
|
||||
ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, uint8_t num,
|
||||
uint8_t type)
|
||||
{
|
||||
struct sdr_get_rs * header;
|
||||
struct sdr_record_list * e;
|
||||
@ -1612,7 +1612,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, unsigned char num,
|
||||
|
||||
/* now keep looking */
|
||||
while ((header = ipmi_sdr_get_next_header(intf, sdr_list_itr)) != NULL) {
|
||||
unsigned char * rec;
|
||||
uint8_t * rec;
|
||||
struct sdr_record_list * sdrr;
|
||||
|
||||
sdrr = malloc(sizeof(struct sdr_record_list));
|
||||
@ -1726,7 +1726,7 @@ ipmi_sdr_find_sdr_byentity(struct ipmi_intf * intf, struct entity_id * entity)
|
||||
|
||||
/* now keep looking */
|
||||
while ((header = ipmi_sdr_get_next_header(intf, sdr_list_itr)) != NULL) {
|
||||
unsigned char * rec;
|
||||
uint8_t * rec;
|
||||
struct sdr_record_list * sdrr;
|
||||
|
||||
sdrr = malloc(sizeof(struct sdr_record_list));
|
||||
@ -1844,7 +1844,7 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf * intf, char * id)
|
||||
|
||||
/* now keep looking */
|
||||
while ((header = ipmi_sdr_get_next_header(intf, sdr_list_itr)) != NULL) {
|
||||
unsigned char * rec;
|
||||
uint8_t * rec;
|
||||
struct sdr_record_list * sdrr;
|
||||
|
||||
sdrr = malloc(sizeof(struct sdr_record_list));
|
||||
@ -2104,8 +2104,8 @@ ipmi_sdr_dump_bin(struct ipmi_intf * intf, const char * ofile)
|
||||
/* go through sdr records */
|
||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
||||
int r;
|
||||
unsigned char h[5];
|
||||
unsigned char * rec;
|
||||
uint8_t h[5];
|
||||
uint8_t * rec;
|
||||
|
||||
lprintf(LOG_INFO, "Record ID %04x (%d bytes)",
|
||||
header->id, header->length);
|
||||
@ -2156,7 +2156,7 @@ ipmi_sdr_print_entity(struct ipmi_intf * intf, char * entitystr)
|
||||
{
|
||||
struct sdr_record_list * list, * entry;
|
||||
struct entity_id entity;
|
||||
unsigned int id, instance;
|
||||
uint32_t id, instance;
|
||||
int rc = 0;
|
||||
|
||||
if (sscanf(entitystr, "%u.%u", &id, &instance) != 2) {
|
||||
|
@ -56,7 +56,7 @@ static const struct valstr event_dir_vals[] = {
|
||||
};
|
||||
|
||||
static const char *
|
||||
ipmi_get_event_type(unsigned char code)
|
||||
ipmi_get_event_type(uint8_t code)
|
||||
{
|
||||
if (code == 0)
|
||||
return "Unspecified";
|
||||
@ -74,7 +74,7 @@ ipmi_get_event_type(unsigned char code)
|
||||
static char *
|
||||
ipmi_sel_timestamp(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[40];
|
||||
static uint8_t tbuf[40];
|
||||
time_t s = (time_t)stamp;
|
||||
memset(tbuf, 0, 40);
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
|
||||
@ -84,7 +84,7 @@ ipmi_sel_timestamp(uint32_t stamp)
|
||||
static char *
|
||||
ipmi_sel_timestamp_date(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[11];
|
||||
static uint8_t tbuf[11];
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&s));
|
||||
return tbuf;
|
||||
@ -93,7 +93,7 @@ ipmi_sel_timestamp_date(uint32_t stamp)
|
||||
static char *
|
||||
ipmi_sel_timestamp_time(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[9];
|
||||
static uint8_t tbuf[9];
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&s));
|
||||
return tbuf;
|
||||
@ -102,7 +102,7 @@ ipmi_sel_timestamp_time(uint32_t stamp)
|
||||
void
|
||||
ipmi_get_event_desc(struct sel_event_record * rec, char ** desc)
|
||||
{
|
||||
unsigned char code, offset;
|
||||
uint8_t code, offset;
|
||||
struct ipmi_event_sensor_types *evt;
|
||||
|
||||
if (desc == NULL)
|
||||
@ -136,7 +136,7 @@ ipmi_get_event_desc(struct sel_event_record * rec, char ** desc)
|
||||
}
|
||||
|
||||
const char *
|
||||
ipmi_sel_get_sensor_type(unsigned char code)
|
||||
ipmi_sel_get_sensor_type(uint8_t code)
|
||||
{
|
||||
struct ipmi_event_sensor_types *st = sensor_specific_types;
|
||||
while (st->type) {
|
||||
@ -152,7 +152,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short e, f;
|
||||
uint16_t e, f;
|
||||
int pctfull = 0;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -231,14 +231,14 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned short
|
||||
ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short id,
|
||||
static uint16_t
|
||||
ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id,
|
||||
struct sel_event_record * evt)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
unsigned char msg_data[6];
|
||||
unsigned short next;
|
||||
uint8_t msg_data[6];
|
||||
uint16_t next;
|
||||
|
||||
memset(msg_data, 0, 6);
|
||||
msg_data[0] = 0x00; /* no reserve id, not partial get */
|
||||
@ -580,7 +580,7 @@ ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short next_id = 0, curr_id = 0;
|
||||
uint16_t next_id = 0, curr_id = 0;
|
||||
struct sel_event_record evt;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -643,7 +643,7 @@ ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned short
|
||||
static uint16_t
|
||||
ipmi_sel_reserve(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
@ -680,7 +680,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
static unsigned char tbuf[40];
|
||||
static uint8_t tbuf[40];
|
||||
uint32_t timei;
|
||||
time_t time;
|
||||
|
||||
@ -752,7 +752,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
||||
}
|
||||
|
||||
timei = (uint32_t)time;
|
||||
req.msg.data = (unsigned char *)&timei;
|
||||
req.msg.data = (uint8_t *)&timei;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
@ -780,8 +780,8 @@ ipmi_sel_clear(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short reserve_id;
|
||||
unsigned char msg_data[6];
|
||||
uint16_t reserve_id;
|
||||
uint8_t msg_data[6];
|
||||
|
||||
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
|
||||
@ -823,8 +823,8 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short id;
|
||||
unsigned char msg_data[4];
|
||||
uint16_t id;
|
||||
uint8_t msg_data[4];
|
||||
int rc = 0;
|
||||
|
||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
||||
@ -873,7 +873,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
static int
|
||||
ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned short id;
|
||||
uint16_t id;
|
||||
int i, oldv;
|
||||
struct sel_event_record evt;
|
||||
struct sdr_record_list * sdr;
|
||||
@ -890,7 +890,7 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return -1;
|
||||
|
||||
for (i=0; i<argc; i++) {
|
||||
id = (unsigned short)strtol(argv[i], NULL, 0);
|
||||
id = (uint16_t)strtol(argv[i], NULL, 0);
|
||||
|
||||
lprintf(LOG_DEBUG, "Looking up SEL entry 0x%x", id);
|
||||
|
||||
|
@ -49,7 +49,7 @@ extern int verbose;
|
||||
|
||||
static
|
||||
struct ipmi_rs *
|
||||
ipmi_sensor_get_sensor_thresholds(struct ipmi_intf * intf, unsigned char sensor)
|
||||
ipmi_sensor_get_sensor_thresholds(struct ipmi_intf * intf, uint8_t sensor)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -68,9 +68,9 @@ ipmi_sensor_get_sensor_thresholds(struct ipmi_intf * intf, unsigned char sensor)
|
||||
static
|
||||
struct ipmi_rs *
|
||||
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf * intf,
|
||||
unsigned char sensor,
|
||||
unsigned char threshold,
|
||||
unsigned char setting)
|
||||
uint8_t sensor,
|
||||
uint8_t threshold,
|
||||
uint8_t setting)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -97,7 +97,7 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf * intf,
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_SE;
|
||||
req.msg.cmd = SET_SENSOR_THRESHOLDS;
|
||||
req.msg.data = (unsigned char *)&set_thresh_rq;
|
||||
req.msg.data = (uint8_t *)&set_thresh_rq;
|
||||
req.msg.data_len = sizeof(set_thresh_rq);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
@ -112,7 +112,7 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
||||
char id[17];
|
||||
char * unitstr = "discrete";
|
||||
int validread=1;
|
||||
unsigned char val = 0;
|
||||
uint8_t val = 0;
|
||||
struct ipmi_rs * rsp;
|
||||
|
||||
if (!sensor)
|
||||
@ -330,12 +330,7 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
||||
|
||||
printf(" Sensor Reading : ");
|
||||
if (validread) {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned raw_tol = sensor->mtol & 0x3f;
|
||||
#else
|
||||
unsigned raw_tol = (sensor->mtol & 0x3f00) >> 8;
|
||||
#endif
|
||||
|
||||
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
||||
float tol = sdr_convert_sensor_reading(sensor, raw_tol * 2);
|
||||
printf("%.*f (+/- %.*f) %s\n",
|
||||
(val==(int)val) ? 0 : 3,
|
||||
@ -400,7 +395,7 @@ void ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
||||
char id[17];
|
||||
char * unitstr = "discrete";
|
||||
int validread=1;
|
||||
unsigned char val = 0;
|
||||
uint8_t val = 0;
|
||||
struct ipmi_rs * rsp;
|
||||
|
||||
if (!sensor)
|
||||
@ -491,7 +486,7 @@ ipmi_sensor_list(struct ipmi_intf * intf)
|
||||
|
||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL)
|
||||
{
|
||||
unsigned char * rec = ipmi_sdr_get_record(intf, header, itr);
|
||||
uint8_t * rec = ipmi_sdr_get_record(intf, header, itr);
|
||||
if (!rec)
|
||||
continue;
|
||||
|
||||
@ -524,7 +519,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
char * id,
|
||||
* thresh;
|
||||
unsigned char settingMask;
|
||||
uint8_t settingMask;
|
||||
float setting;
|
||||
struct sdr_record_list * sdr;
|
||||
struct ipmi_rs * rsp;
|
||||
|
@ -263,7 +263,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
|
||||
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[5]; // max length of the variable length request
|
||||
uint8_t rqdata[5]; // max length of the variable length request
|
||||
struct get_session_info_rsp session_info;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -294,7 +294,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
|
||||
break;
|
||||
case IPMI_SESSION_REQUEST_BY_HANDLE:
|
||||
rqdata[0] = 0xFE;
|
||||
rqdata[1] = (unsigned char)id_or_handle;
|
||||
rqdata[1] = (uint8_t)id_or_handle;
|
||||
req.msg.data_len = 2;
|
||||
break;
|
||||
case IPMI_SESSION_REQUEST_ALL:
|
||||
|
@ -78,12 +78,12 @@ extern int verbose;
|
||||
int
|
||||
ipmi_get_sol_info(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char channel,
|
||||
uint8_t channel,
|
||||
struct sol_config_parameters * params)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[4];
|
||||
uint8_t data[4];
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||
req.msg.cmd = IMPI_GET_SOL_CONFIG_PARAMETERS;
|
||||
@ -346,7 +346,7 @@ ipmi_get_sol_info(
|
||||
* ipmi_print_sol_info
|
||||
*/
|
||||
static int
|
||||
ipmi_print_sol_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
ipmi_print_sol_info(struct ipmi_intf * intf, uint8_t channel)
|
||||
{
|
||||
struct sol_config_parameters params;
|
||||
if (ipmi_get_sol_info(intf, channel, ¶ms))
|
||||
@ -426,13 +426,13 @@ ipmi_print_sol_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
*/
|
||||
static int
|
||||
ipmi_sol_set_param(struct ipmi_intf * intf,
|
||||
unsigned char channel,
|
||||
uint8_t channel,
|
||||
const char * param,
|
||||
const char * value)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[4];
|
||||
uint8_t data[4];
|
||||
int bGuarded = 1; /* Use set-in-progress indicator? */
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT; /* 0x0c */
|
||||
@ -611,7 +611,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
|
||||
|
||||
req.msg.data_len = 4;
|
||||
data[1] = SOL_PARAMETER_CHARACTER_INTERVAL;
|
||||
data[2] = (unsigned char)strtol(value, NULL, 0);
|
||||
data[2] = (uint8_t)strtol(value, NULL, 0);
|
||||
|
||||
/* We need other values to complete the request */
|
||||
if (ipmi_get_sol_info(intf, channel, ¶ms))
|
||||
@ -634,7 +634,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
|
||||
|
||||
req.msg.data_len = 4;
|
||||
data[1] = SOL_PARAMETER_CHARACTER_INTERVAL;
|
||||
data[3] = (unsigned char)strtol(value, NULL, 0);
|
||||
data[3] = (uint8_t)strtol(value, NULL, 0);
|
||||
|
||||
/* We need other values to complete the request */
|
||||
if (ipmi_get_sol_info(intf, channel, ¶ms))
|
||||
@ -657,7 +657,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
|
||||
|
||||
req.msg.data_len = 4;
|
||||
data[1] = SOL_PARAMETER_SOL_RETRY;
|
||||
data[2] = (unsigned char)strtol(value, NULL, 0) & 0x03;
|
||||
data[2] = (uint8_t)strtol(value, NULL, 0) & 0x03;
|
||||
|
||||
/* We need other values to complete the request */
|
||||
if (ipmi_get_sol_info(intf, channel, ¶ms))
|
||||
@ -680,7 +680,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
|
||||
|
||||
req.msg.data_len = 4;
|
||||
data[1] = SOL_PARAMETER_SOL_RETRY;
|
||||
data[3] = (unsigned char)strtol(value, NULL, 0);
|
||||
data[3] = (uint8_t)strtol(value, NULL, 0);
|
||||
|
||||
/* We need other values to complete the request */
|
||||
if (ipmi_get_sol_info(intf, channel, ¶ms))
|
||||
@ -983,7 +983,7 @@ ipmi_sol_deactivate(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[6];
|
||||
uint8_t data[6];
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = IPMI_DEACTIVATE_PAYLOAD;
|
||||
@ -1026,8 +1026,8 @@ ipmi_sol_deactivate(struct ipmi_intf * intf)
|
||||
static int
|
||||
processSolUserInput(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char * input,
|
||||
unsigned short buffer_length)
|
||||
uint8_t * input,
|
||||
uint16_t buffer_length)
|
||||
{
|
||||
static int escape_pending = 0;
|
||||
static int last_was_cr = 1;
|
||||
@ -1254,9 +1254,9 @@ ipmi_sol_activate(struct ipmi_intf * intf)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct activate_payload_rsp ap_rsp;
|
||||
unsigned char data[6];
|
||||
unsigned char bSolEncryption = 1;
|
||||
unsigned char bSolAuthentication = 1;
|
||||
uint8_t data[6];
|
||||
uint8_t bSolEncryption = 1;
|
||||
uint8_t bSolAuthentication = 1;
|
||||
|
||||
/*
|
||||
* This command is only available over RMCP+ (the lanplus
|
||||
@ -1426,12 +1426,12 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
* Info
|
||||
*/
|
||||
else if (!strncmp(argv[0], "info", 4)) {
|
||||
unsigned char channel;
|
||||
uint8_t channel;
|
||||
|
||||
if (argc == 1)
|
||||
channel = 0x0E; /* Ask about the current channel */
|
||||
else if (argc == 2)
|
||||
channel = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
channel = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
else
|
||||
{
|
||||
print_sol_usage();
|
||||
@ -1446,12 +1446,12 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
* Set a parameter value
|
||||
*/
|
||||
else if (!strncmp(argv[0], "set", 3)) {
|
||||
unsigned char channel;
|
||||
uint8_t channel;
|
||||
|
||||
if (argc == 3)
|
||||
channel = 0x0E; /* Ask about the current channel */
|
||||
else if (argc == 4)
|
||||
channel = (unsigned char)strtol(argv[3], NULL, 0);
|
||||
channel = (uint8_t)strtol(argv[3], NULL, 0);
|
||||
else
|
||||
{
|
||||
print_sol_set_usage();
|
||||
|
@ -77,14 +77,14 @@ extern int csv_output;
|
||||
static int
|
||||
ipmi_get_user_access(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char channel_number,
|
||||
unsigned char user_id,
|
||||
uint8_t channel_number,
|
||||
uint8_t user_id,
|
||||
struct user_access_rsp * user_access)
|
||||
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[2];
|
||||
uint8_t msg_data[2];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
|
||||
@ -134,13 +134,13 @@ ipmi_get_user_access(
|
||||
static int
|
||||
ipmi_get_user_name(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char user_id,
|
||||
uint8_t user_id,
|
||||
char * user_name)
|
||||
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[1];
|
||||
uint8_t msg_data[1];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
|
||||
@ -173,7 +173,7 @@ ipmi_get_user_name(
|
||||
|
||||
static void
|
||||
dump_user_access(
|
||||
unsigned char user_id,
|
||||
uint8_t user_id,
|
||||
const char * user_name,
|
||||
struct user_access_rsp * user_access)
|
||||
{
|
||||
@ -201,7 +201,7 @@ dump_user_access(
|
||||
|
||||
static void
|
||||
dump_user_access_csv(
|
||||
unsigned char user_id,
|
||||
uint8_t user_id,
|
||||
const char * user_name,
|
||||
struct user_access_rsp * user_access)
|
||||
{
|
||||
@ -220,12 +220,12 @@ dump_user_access_csv(
|
||||
static int
|
||||
ipmi_print_user_list(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char channel_number)
|
||||
uint8_t channel_number)
|
||||
{
|
||||
/* This is where you were! */
|
||||
char user_name[17];
|
||||
struct user_access_rsp user_access;
|
||||
unsigned char current_user_id = 1;
|
||||
uint8_t current_user_id = 1;
|
||||
|
||||
|
||||
do
|
||||
@ -271,7 +271,7 @@ ipmi_print_user_list(
|
||||
static int
|
||||
ipmi_print_user_summary(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char channel_number)
|
||||
uint8_t channel_number)
|
||||
{
|
||||
struct user_access_rsp user_access;
|
||||
|
||||
@ -309,12 +309,12 @@ ipmi_print_user_summary(
|
||||
static int
|
||||
ipmi_user_set_username(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char user_id,
|
||||
uint8_t user_id,
|
||||
const char * name)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[17];
|
||||
uint8_t msg_data[17];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
|
||||
@ -356,8 +356,8 @@ ipmi_user_set_username(
|
||||
static int
|
||||
ipmi_user_set_password(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char user_id,
|
||||
unsigned char operation,
|
||||
uint8_t user_id,
|
||||
uint8_t operation,
|
||||
const char * password,
|
||||
int is_twenty_byte_password)
|
||||
{
|
||||
@ -416,7 +416,7 @@ ipmi_user_set_password(
|
||||
static int
|
||||
ipmi_user_test_password(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char user_id,
|
||||
uint8_t user_id,
|
||||
const char * password,
|
||||
int is_twenty_byte_password)
|
||||
{
|
||||
@ -464,7 +464,7 @@ print_user_usage()
|
||||
|
||||
|
||||
const char *
|
||||
ipmi_user_build_password_prompt(unsigned char user_id)
|
||||
ipmi_user_build_password_prompt(uint8_t user_id)
|
||||
{
|
||||
static char prompt[128];
|
||||
memset(prompt, 0, 128);
|
||||
@ -499,12 +499,12 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
*/
|
||||
else if (strncmp(argv[0], "summary", 7) == 0)
|
||||
{
|
||||
unsigned char channel;
|
||||
uint8_t channel;
|
||||
|
||||
if (argc == 1)
|
||||
channel = 0x0E; /* Ask about the current channel */
|
||||
else if (argc == 2)
|
||||
channel = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
channel = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
else
|
||||
{
|
||||
print_user_usage();
|
||||
@ -520,12 +520,12 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
*/
|
||||
else if (strncmp(argv[0], "list", 4) == 0)
|
||||
{
|
||||
unsigned char channel;
|
||||
uint8_t channel;
|
||||
|
||||
if (argc == 1)
|
||||
channel = 0x0E; /* Ask about the current channel */
|
||||
else if (argc == 2)
|
||||
channel = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
channel = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
else
|
||||
{
|
||||
print_user_usage();
|
||||
@ -549,7 +549,7 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
char * password = NULL;
|
||||
int password_length = atoi(argv[2]);
|
||||
unsigned char user_id = (unsigned char)strtol(argv[1],
|
||||
uint8_t user_id = (uint8_t)strtol(argv[1],
|
||||
NULL,
|
||||
0);
|
||||
if (user_id == 0)
|
||||
@ -606,7 +606,7 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
(strncmp("password", argv[1], 8) == 0))
|
||||
{
|
||||
char * password = NULL;
|
||||
unsigned char user_id = (unsigned char)strtol(argv[2],
|
||||
uint8_t user_id = (uint8_t)strtol(argv[2],
|
||||
NULL,
|
||||
0);
|
||||
if (user_id == 0)
|
||||
@ -684,7 +684,7 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
}
|
||||
|
||||
retval = ipmi_user_set_username(intf,
|
||||
(unsigned char)strtol(argv[2],
|
||||
(uint8_t)strtol(argv[2],
|
||||
NULL,
|
||||
0),
|
||||
argv[3]);
|
||||
@ -703,8 +703,8 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
else if ((strncmp(argv[0], "disable", 7) == 0) ||
|
||||
(strncmp(argv[0], "enable", 6) == 0))
|
||||
{
|
||||
unsigned char user_id;
|
||||
unsigned char operation;
|
||||
uint8_t user_id;
|
||||
uint8_t operation;
|
||||
char null_password[16]; /* Not used, but required */
|
||||
|
||||
memset(null_password, 0, sizeof(null_password));
|
||||
@ -715,7 +715,7 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
user_id = (unsigned char)strtol(argv[1],
|
||||
user_id = (uint8_t)strtol(argv[1],
|
||||
NULL,
|
||||
0);
|
||||
if (user_id == 0)
|
||||
|
@ -135,7 +135,7 @@ static int enable_event_msg_buffer(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char bmc_global_enables;
|
||||
uint8_t bmc_global_enables;
|
||||
|
||||
/* we must read/modify/write bmc global enables */
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -192,7 +192,7 @@ static void read_event(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_addr addr;
|
||||
struct ipmi_recv recv;
|
||||
unsigned char data[80];
|
||||
uint8_t data[80];
|
||||
int rv;
|
||||
|
||||
recv.addr = (char *) &addr;
|
||||
|
@ -230,15 +230,15 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
printf("Set session password\n");
|
||||
}
|
||||
else if (strncmp(argv[0], "authtype", 8) == 0) {
|
||||
unsigned char authtype;
|
||||
authtype = (unsigned char)str2val(argv[1], ipmi_authtype_session_vals);
|
||||
uint8_t authtype;
|
||||
authtype = (uint8_t)str2val(argv[1], ipmi_authtype_session_vals);
|
||||
ipmi_intf_session_set_authtype(intf, authtype);
|
||||
printf("Set session authtype to %s\n",
|
||||
val2str(intf->session->authtype_set, ipmi_authtype_session_vals));
|
||||
}
|
||||
else if (strncmp(argv[0], "privlvl", 7) == 0) {
|
||||
unsigned char privlvl;
|
||||
privlvl = (unsigned char)str2val(argv[1], ipmi_privlvl_vals);
|
||||
uint8_t privlvl;
|
||||
privlvl = (uint8_t)str2val(argv[1], ipmi_privlvl_vals);
|
||||
ipmi_intf_session_set_privlvl(intf, privlvl);
|
||||
printf("Set session privilege level to %s\n",
|
||||
val2str(intf->session->privlvl, ipmi_privlvl_vals));
|
||||
@ -249,11 +249,11 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
printf("Set session port to %d\n", intf->session->port);
|
||||
}
|
||||
else if (strncmp(argv[0], "localaddr", 9) == 0) {
|
||||
intf->my_addr = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
intf->my_addr = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
printf("Set local IPMB address to 0x%02x\n", intf->my_addr);
|
||||
}
|
||||
else if (strncmp(argv[0], "targetaddr", 10) == 0) {
|
||||
intf->target_addr = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
intf->target_addr = (uint8_t)strtol(argv[1], NULL, 0);
|
||||
printf("Set remote IPMB address to 0x%02x\n", intf->target_addr);
|
||||
}
|
||||
else {
|
||||
|
@ -237,9 +237,9 @@ int
|
||||
main(int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_intf * intf = NULL;
|
||||
unsigned char privlvl = 0;
|
||||
unsigned char target_addr = 0;
|
||||
unsigned char my_addr = 0;
|
||||
uint8_t privlvl = 0;
|
||||
uint8_t target_addr = 0;
|
||||
uint8_t my_addr = 0;
|
||||
int authtype = -1;
|
||||
char * tmp = NULL;
|
||||
char * hostname = NULL;
|
||||
@ -264,7 +264,7 @@ main(int argc, char ** argv)
|
||||
intfname = strdup(optarg);
|
||||
if (intfname == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
@ -288,7 +288,7 @@ main(int argc, char ** argv)
|
||||
hostname = strdup(optarg);
|
||||
if (hostname == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
@ -311,7 +311,7 @@ main(int argc, char ** argv)
|
||||
password = strdup(tmp);
|
||||
if (password == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -319,7 +319,7 @@ main(int argc, char ** argv)
|
||||
username = strdup(optarg);
|
||||
if (username == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
break;
|
||||
#ifndef __sun /* some options not enabled on solaris yet */
|
||||
@ -335,7 +335,7 @@ main(int argc, char ** argv)
|
||||
password = strdup(optarg);
|
||||
if (password == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* Prevent password snooping with ps */
|
||||
@ -350,7 +350,7 @@ main(int argc, char ** argv)
|
||||
password = strdup(tmp);
|
||||
if (password == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
else if ((tmp = getenv("IPMI_PASSWORD")))
|
||||
@ -360,7 +360,7 @@ main(int argc, char ** argv)
|
||||
password = strdup(tmp);
|
||||
if (password == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -368,7 +368,7 @@ main(int argc, char ** argv)
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
privlvl = (unsigned char)str2val(optarg, ipmi_privlvl_vals);
|
||||
privlvl = (uint8_t)str2val(optarg, ipmi_privlvl_vals);
|
||||
if (!privlvl)
|
||||
lprintf(LOG_WARN, "Invalid privilege level %s", optarg);
|
||||
break;
|
||||
@ -376,10 +376,10 @@ main(int argc, char ** argv)
|
||||
authtype = (int)str2val(optarg, ipmi_authtype_session_vals);
|
||||
break;
|
||||
case 't':
|
||||
target_addr = (unsigned char)strtol(optarg, NULL, 0);
|
||||
target_addr = (uint8_t)strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'm':
|
||||
my_addr = (unsigned char)strtol(optarg, NULL, 0);
|
||||
my_addr = (uint8_t)strtol(optarg, NULL, 0);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -399,23 +399,6 @@ main(int argc, char ** argv)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* load interface */
|
||||
intf = ipmi_intf_load(intfname);
|
||||
if (!intf) {
|
||||
lprintf(LOG_ERR, "Error loading interface %s", intfname);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
intf->thump = thump;
|
||||
|
||||
if (authspecial) {
|
||||
intf->session->authspecial = authspecial;
|
||||
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
||||
}
|
||||
|
||||
/* setup log */
|
||||
log_init(progname, 0, verbose);
|
||||
|
||||
/*
|
||||
* If the user has specified a hostname (-H option)
|
||||
* then this is a remote access session.
|
||||
@ -435,11 +418,36 @@ main(int argc, char ** argv)
|
||||
password = strdup(tmp);
|
||||
if (password == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
exit(EXIT_FAILURE);
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if no interface was specified but a
|
||||
* hostname was then use LAN by default
|
||||
* otherwise the default is hardcoded
|
||||
* to use the first entry in the list
|
||||
*/
|
||||
if (intfname == NULL && hostname != NULL)
|
||||
intfname = strdup("lan");
|
||||
|
||||
/* load interface */
|
||||
intf = ipmi_intf_load(intfname);
|
||||
if (intf == NULL) {
|
||||
lprintf(LOG_ERR, "Error loading interface %s", intfname);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
intf->thump = thump;
|
||||
|
||||
if (authspecial > 0) {
|
||||
intf->session->authspecial = authspecial;
|
||||
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
||||
}
|
||||
|
||||
/* setup log */
|
||||
log_init(progname, 0, verbose);
|
||||
|
||||
/* set session variables */
|
||||
if (hostname != NULL)
|
||||
ipmi_intf_session_set_hostname(intf, hostname);
|
||||
@ -450,7 +458,7 @@ main(int argc, char ** argv)
|
||||
if (port > 0)
|
||||
ipmi_intf_session_set_port(intf, port);
|
||||
if (authtype >= 0)
|
||||
ipmi_intf_session_set_authtype(intf, (unsigned char)authtype);
|
||||
ipmi_intf_session_set_authtype(intf, (uint8_t)authtype);
|
||||
if (privlvl > 0)
|
||||
ipmi_intf_session_set_privlvl(intf, privlvl);
|
||||
else
|
||||
|
@ -192,7 +192,7 @@ ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password)
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, unsigned char level)
|
||||
ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t level)
|
||||
{
|
||||
if (intf->session == NULL)
|
||||
return;
|
||||
@ -210,7 +210,7 @@ ipmi_intf_session_set_port(struct ipmi_intf * intf, int port)
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_intf_session_set_authtype(struct ipmi_intf * intf, unsigned char authtype)
|
||||
ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype)
|
||||
{
|
||||
if (intf->session == NULL)
|
||||
return;
|
||||
|
@ -68,6 +68,6 @@ struct asf_hdr {
|
||||
uint8_t len;
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_asf(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
int handle_asf(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
|
||||
#endif /* IPMI_ASF_H */
|
||||
|
@ -66,11 +66,11 @@
|
||||
*
|
||||
* Use OpenSSL implementation of MD5 algorithm if found
|
||||
*/
|
||||
unsigned char * ipmi_auth_md5(struct ipmi_session * s, unsigned char * data, int data_len)
|
||||
uint8_t * ipmi_auth_md5(struct ipmi_session * s, uint8_t * data, int data_len)
|
||||
{
|
||||
#ifdef HAVE_CRYPTO_MD5
|
||||
MD5_CTX ctx;
|
||||
static unsigned char md[16];
|
||||
static uint8_t md[16];
|
||||
uint32_t temp;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
@ -82,11 +82,11 @@ unsigned char * ipmi_auth_md5(struct ipmi_session * s, unsigned char * data, int
|
||||
memset(&ctx, 0, sizeof(MD5_CTX));
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, (const unsigned char *)s->authcode, 16);
|
||||
MD5_Update(&ctx, (const unsigned char *)&s->session_id, 4);
|
||||
MD5_Update(&ctx, (const unsigned char *)data, data_len);
|
||||
MD5_Update(&ctx, (const unsigned char *)&temp, sizeof(uint32_t));
|
||||
MD5_Update(&ctx, (const unsigned char *)s->authcode, 16);
|
||||
MD5_Update(&ctx, (const uint8_t *)s->authcode, 16);
|
||||
MD5_Update(&ctx, (const uint8_t *)&s->session_id, 4);
|
||||
MD5_Update(&ctx, (const uint8_t *)data, data_len);
|
||||
MD5_Update(&ctx, (const uint8_t *)&temp, sizeof(uint32_t));
|
||||
MD5_Update(&ctx, (const uint8_t *)s->authcode, 16);
|
||||
MD5_Final(md, &ctx);
|
||||
|
||||
if (verbose > 3)
|
||||
@ -130,11 +130,11 @@ unsigned char * ipmi_auth_md5(struct ipmi_session * s, unsigned char * data, int
|
||||
* Use OpenSSL implementation of MD2 algorithm if found.
|
||||
* This function is analogous to ipmi_auth_md5
|
||||
*/
|
||||
unsigned char * ipmi_auth_md2(struct ipmi_session * s, unsigned char * data, int data_len)
|
||||
uint8_t * ipmi_auth_md2(struct ipmi_session * s, uint8_t * data, int data_len)
|
||||
{
|
||||
#ifdef HAVE_CRYPTO_MD2
|
||||
MD2_CTX ctx;
|
||||
static unsigned char md[16];
|
||||
static uint8_t md[16];
|
||||
uint32_t temp;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
@ -146,11 +146,11 @@ unsigned char * ipmi_auth_md2(struct ipmi_session * s, unsigned char * data, int
|
||||
memset(&ctx, 0, sizeof(MD2_CTX));
|
||||
|
||||
MD2_Init(&ctx);
|
||||
MD2_Update(&ctx, (const unsigned char *)s->authcode, 16);
|
||||
MD2_Update(&ctx, (const unsigned char *)&s->session_id, 4);
|
||||
MD2_Update(&ctx, (const unsigned char *)data, data_len);
|
||||
MD2_Update(&ctx, (const unsigned char *)&temp, sizeof(uint32_t));
|
||||
MD2_Update(&ctx, (const unsigned char *)s->authcode, 16);
|
||||
MD2_Update(&ctx, (const uint8_t *)s->authcode, 16);
|
||||
MD2_Update(&ctx, (const uint8_t *)&s->session_id, 4);
|
||||
MD2_Update(&ctx, (const uint8_t *)data, data_len);
|
||||
MD2_Update(&ctx, (const uint8_t *)&temp, sizeof(uint32_t));
|
||||
MD2_Update(&ctx, (const uint8_t *)s->authcode, 16);
|
||||
MD2_Final(md, &ctx);
|
||||
|
||||
if (verbose > 3)
|
||||
@ -158,7 +158,7 @@ unsigned char * ipmi_auth_md2(struct ipmi_session * s, unsigned char * data, int
|
||||
|
||||
return md;
|
||||
#else /*HAVE_CRYPTO_MD2*/
|
||||
static unsigned char md[16];
|
||||
static uint8_t md[16];
|
||||
memset(md, 0, 16);
|
||||
printf("WARNING: No internal support for MD2! "
|
||||
"Please re-compile with OpenSSL.\n");
|
||||
@ -167,12 +167,12 @@ unsigned char * ipmi_auth_md2(struct ipmi_session * s, unsigned char * data, int
|
||||
}
|
||||
|
||||
/* special authentication method */
|
||||
unsigned char * ipmi_auth_special(struct ipmi_session * s)
|
||||
uint8_t * ipmi_auth_special(struct ipmi_session * s)
|
||||
{
|
||||
#ifdef HAVE_CRYPTO_MD5
|
||||
MD5_CTX ctx;
|
||||
static unsigned char md[16];
|
||||
unsigned char challenge[16];
|
||||
static uint8_t md[16];
|
||||
uint8_t challenge[16];
|
||||
int i;
|
||||
|
||||
memset(challenge, 0, 16);
|
||||
@ -180,7 +180,7 @@ unsigned char * ipmi_auth_special(struct ipmi_session * s)
|
||||
memset(&ctx, 0, sizeof(MD5_CTX));
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, (const unsigned char *)s->authcode, strlen(s->authcode));
|
||||
MD5_Update(&ctx, (const uint8_t *)s->authcode, strlen(s->authcode));
|
||||
MD5_Final(md, &ctx);
|
||||
|
||||
for (i=0; i<16; i++)
|
||||
@ -190,7 +190,7 @@ unsigned char * ipmi_auth_special(struct ipmi_session * s)
|
||||
memset(&ctx, 0, sizeof(MD5_CTX));
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, (const unsigned char *)challenge, 16);
|
||||
MD5_Update(&ctx, (const uint8_t *)challenge, 16);
|
||||
MD5_Final(md, &ctx);
|
||||
|
||||
return md;
|
||||
@ -198,7 +198,7 @@ unsigned char * ipmi_auth_special(struct ipmi_session * s)
|
||||
int i;
|
||||
md5_state_t state;
|
||||
static md5_byte_t digest[16];
|
||||
unsigned char challenge[16];
|
||||
uint8_t challenge[16];
|
||||
|
||||
memset(challenge, 0, 16);
|
||||
memset(digest, 0, 16);
|
||||
|
@ -37,8 +37,8 @@
|
||||
#ifndef IPMI_AUTH_H
|
||||
#define IPMI_AUTH_H
|
||||
|
||||
unsigned char * ipmi_auth_md2(struct ipmi_session * s, unsigned char * data, int data_len);
|
||||
unsigned char * ipmi_auth_md5(struct ipmi_session * s, unsigned char * data, int data_len);
|
||||
unsigned char * ipmi_auth_special(struct ipmi_session * s);
|
||||
uint8_t * ipmi_auth_md2(struct ipmi_session * s, uint8_t * data, int data_len);
|
||||
uint8_t * ipmi_auth_md5(struct ipmi_session * s, uint8_t * data, int data_len);
|
||||
uint8_t * ipmi_auth_special(struct ipmi_session * s);
|
||||
|
||||
#endif /*IPMI_AUTH_H*/
|
||||
|
@ -76,7 +76,7 @@ extern int verbose;
|
||||
|
||||
static sigjmp_buf jmpbuf;
|
||||
|
||||
static int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
static int ipmi_lan_send_packet(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
static struct ipmi_rs * ipmi_lan_recv_packet(struct ipmi_intf * intf);
|
||||
static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf);
|
||||
static int ipmi_lan_setup(struct ipmi_intf * intf);
|
||||
@ -162,7 +162,7 @@ ipmi_req_add_entry(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
}
|
||||
|
||||
static struct ipmi_rq_entry *
|
||||
ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
ipmi_req_lookup_entry(uint8_t seq, uint8_t cmd)
|
||||
{
|
||||
struct ipmi_rq_entry * e = ipmi_req_entries;
|
||||
while (e && (e->rq_seq != seq || e->req.msg.cmd != cmd)) {
|
||||
@ -174,7 +174,7 @@ ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_req_remove_entry(unsigned char seq, unsigned char cmd)
|
||||
ipmi_req_remove_entry(uint8_t seq, uint8_t cmd)
|
||||
{
|
||||
struct ipmi_rq_entry * p, * e;
|
||||
|
||||
@ -222,12 +222,12 @@ ipmi_req_clear_entries(void)
|
||||
}
|
||||
|
||||
static int
|
||||
get_random(void *data, unsigned int len)
|
||||
get_random(void *data, int len)
|
||||
{
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
int rv;
|
||||
|
||||
if (fd == -1)
|
||||
if (fd < 0 || len < 0)
|
||||
return errno;
|
||||
|
||||
rv = read(fd, data, len);
|
||||
@ -236,7 +236,7 @@ get_random(void *data, unsigned int len)
|
||||
return rv;
|
||||
}
|
||||
|
||||
int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, int data_len)
|
||||
int ipmi_lan_send_packet(struct ipmi_intf * intf, uint8_t * data, int data_len)
|
||||
{
|
||||
if (verbose > 2)
|
||||
printbuf(data, data_len, "send_packet");
|
||||
@ -368,7 +368,7 @@ ipmi_lan_ping(struct ipmi_intf * intf)
|
||||
.class = RMCP_CLASS_ASF,
|
||||
.seq = 0xff,
|
||||
};
|
||||
unsigned char * data;
|
||||
uint8_t * data;
|
||||
int len = sizeof(rmcp_ping) + sizeof(asf_ping);
|
||||
int rv;
|
||||
|
||||
@ -406,14 +406,14 @@ ipmi_lan_ping(struct ipmi_intf * intf)
|
||||
static void ipmi_lan_thump_first(struct ipmi_intf * intf)
|
||||
{
|
||||
/* is this random data? */
|
||||
unsigned char data[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
uint8_t data[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x07, 0x20, 0x18, 0xc8, 0xc2, 0x01, 0x01, 0x3c };
|
||||
ipmi_lan_send_packet(intf, data, 16);
|
||||
}
|
||||
|
||||
static void ipmi_lan_thump(struct ipmi_intf * intf)
|
||||
{
|
||||
unsigned char data[10] = "thump";
|
||||
uint8_t data[10] = "thump";
|
||||
ipmi_lan_send_packet(intf, data, 10);
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
.class = RMCP_CLASS_IPMI,
|
||||
.seq = 0xff,
|
||||
};
|
||||
unsigned char * msg, * temp;
|
||||
uint8_t * msg, * temp;
|
||||
int cs, mp, tmp;
|
||||
int ap = 0;
|
||||
int len = 0;
|
||||
@ -761,7 +761,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
return rsp;
|
||||
}
|
||||
|
||||
unsigned char * ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp, int * llen)
|
||||
uint8_t * ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp, int * llen)
|
||||
{
|
||||
struct rmcp_hdr rmcp = {
|
||||
.ver = RMCP_VERSION_1,
|
||||
@ -771,7 +771,7 @@ unsigned char * ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp
|
||||
struct ipmi_session * s = intf->session;
|
||||
int cs, mp, ap = 0, tmp;
|
||||
int len;
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
|
||||
len = rsp->data_len + 22;
|
||||
if (s->active)
|
||||
@ -836,7 +836,7 @@ unsigned char * ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp
|
||||
msg[len++] = ipmi_csum(msg+cs, tmp);
|
||||
|
||||
if (s->active) {
|
||||
unsigned char * d;
|
||||
uint8_t * d;
|
||||
switch (s->authtype) {
|
||||
case IPMI_SESSION_AUTHTYPE_MD5:
|
||||
d = ipmi_auth_md5(s, msg+mp, msg[mp-1]);
|
||||
@ -855,7 +855,7 @@ unsigned char * ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp
|
||||
|
||||
int ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
||||
{
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
int len, rv;
|
||||
|
||||
msg = ipmi_lan_build_rsp(intf, rsp, &len);
|
||||
@ -912,7 +912,7 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_session * s = intf->session;
|
||||
unsigned char msg_data[2];
|
||||
uint8_t msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_E;
|
||||
msg_data[1] = s->privlvl;
|
||||
@ -1026,7 +1026,7 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_session * s = intf->session;
|
||||
unsigned char msg_data[17];
|
||||
uint8_t msg_data[17];
|
||||
|
||||
memset(msg_data, 0, 17);
|
||||
msg_data[0] = s->authtype;
|
||||
@ -1080,7 +1080,7 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_session * s = intf->session;
|
||||
unsigned char msg_data[22];
|
||||
uint8_t msg_data[22];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
@ -1090,7 +1090,7 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
msg_data[1] = s->privlvl;
|
||||
|
||||
if (s->authspecial) {
|
||||
unsigned char * special = ipmi_auth_special(s);
|
||||
uint8_t * special = ipmi_auth_special(s);
|
||||
memcpy(s->authcode, special, 16);
|
||||
memset(msg_data + 2, 0, 16);
|
||||
lprintf(LOG_DEBUG, " OEM Auth : %s",
|
||||
@ -1188,7 +1188,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char privlvl = intf->session->privlvl;
|
||||
uint8_t privlvl = intf->session->privlvl;
|
||||
|
||||
if (privlvl <= IPMI_SESSION_PRIV_USER)
|
||||
return 0; /* no need to set higher */
|
||||
@ -1225,7 +1225,7 @@ ipmi_close_session_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
uint8_t msg_data[4];
|
||||
uint32_t session_id = intf->session->session_id;
|
||||
|
||||
if (intf->session->active == 0)
|
||||
|
@ -53,7 +53,7 @@ struct ipmi_rs * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req
|
||||
int ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf);
|
||||
void ipmi_lan_close(struct ipmi_intf * intf);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
|
||||
int ipmi_lan_ping(struct ipmi_intf * intf);
|
||||
|
||||
extern struct ipmi_intf ipmi_lan_intf;
|
||||
|
@ -86,6 +86,6 @@ struct rmcp_pong {
|
||||
uint8_t reserved[6];
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_rmcp(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
int handle_rmcp(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
|
||||
#endif /* IPMI_RMCP_H */
|
||||
|
@ -68,6 +68,6 @@ struct asf_hdr {
|
||||
uint8_t len;
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_asf(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
int handle_asf(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
|
||||
#endif /* IPMI_ASF_H */
|
||||
|
@ -81,22 +81,22 @@ static sigjmp_buf jmpbuf;
|
||||
|
||||
static int ipmi_lanplus_setup(struct ipmi_intf * intf);
|
||||
static int ipmi_lanplus_keepalive(struct ipmi_intf * intf);
|
||||
static int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
static int ipmi_lan_send_packet(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
static struct ipmi_rs * ipmi_lan_recv_packet(struct ipmi_intf * intf);
|
||||
static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf);
|
||||
static struct ipmi_rs * ipmi_lanplus_send_ipmi_cmd(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||
static struct ipmi_rs * ipmi_lanplus_send_payload(struct ipmi_intf * intf,
|
||||
struct ipmi_v2_payload * payload);
|
||||
static void getIpmiPayloadWireRep(
|
||||
unsigned char * out,
|
||||
uint8_t * out,
|
||||
struct ipmi_rq * req,
|
||||
unsigned char rq_seq);
|
||||
uint8_t rq_seq);
|
||||
static void getSolPayloadWireRep(
|
||||
unsigned char * msg,
|
||||
uint8_t * msg,
|
||||
struct ipmi_v2_payload * payload);
|
||||
static void read_open_session_response(struct ipmi_rs * rsp, int offset);
|
||||
static void read_rakp2_message(struct ipmi_rs * rsp, int offset, unsigned char alg);
|
||||
static void read_rakp4_message(struct ipmi_rs * rsp, int offset, unsigned char alg);
|
||||
static void read_rakp2_message(struct ipmi_rs * rsp, int offset, uint8_t alg);
|
||||
static void read_rakp4_message(struct ipmi_rs * rsp, int offset, uint8_t alg);
|
||||
static void read_session_data(struct ipmi_rs * rsp, int * offset, struct ipmi_session *s);
|
||||
static void read_session_data_v15(struct ipmi_rs * rsp, int * offset, struct ipmi_session *s);
|
||||
static void read_session_data_v2x(struct ipmi_rs * rsp, int * offset, struct ipmi_session *s);
|
||||
@ -135,11 +135,11 @@ extern int verbose;
|
||||
* Reverse the order of arbitrarily long strings of bytes
|
||||
*/
|
||||
void lanplus_swap(
|
||||
unsigned char * buffer,
|
||||
uint8_t * buffer,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
unsigned char temp;
|
||||
uint8_t temp;
|
||||
|
||||
for (i =0; i < length/2; ++i)
|
||||
{
|
||||
@ -194,7 +194,7 @@ static const struct valstr ipmi_channel_medium_vals[] = {
|
||||
};
|
||||
|
||||
static struct ipmi_rq_entry *
|
||||
ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
ipmi_req_lookup_entry(uint8_t seq, uint8_t cmd)
|
||||
{
|
||||
struct ipmi_rq_entry * e = ipmi_req_entries;
|
||||
while (e && (e->rq_seq != seq || e->req.msg.cmd != cmd)) {
|
||||
@ -206,7 +206,7 @@ ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_req_remove_entry(unsigned char seq, unsigned char cmd)
|
||||
ipmi_req_remove_entry(uint8_t seq, uint8_t cmd)
|
||||
{
|
||||
struct ipmi_rq_entry * p, * e;
|
||||
|
||||
@ -258,7 +258,7 @@ ipmi_req_clear_entries(void)
|
||||
int
|
||||
ipmi_lan_send_packet(
|
||||
struct ipmi_intf * intf,
|
||||
unsigned char * data, int
|
||||
uint8_t * data, int
|
||||
data_len)
|
||||
{
|
||||
if (verbose >= 2)
|
||||
@ -352,9 +352,9 @@ ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
||||
struct asf_hdr asf;
|
||||
uint32_t iana;
|
||||
uint32_t oem;
|
||||
unsigned char sup_entities;
|
||||
unsigned char sup_interact;
|
||||
unsigned char reserved[6];
|
||||
uint8_t sup_entities;
|
||||
uint8_t sup_interact;
|
||||
uint8_t reserved[6];
|
||||
} * pong;
|
||||
|
||||
if (!rsp)
|
||||
@ -412,7 +412,7 @@ ipmiv2_lan_ping(struct ipmi_intf * intf)
|
||||
.class = RMCP_CLASS_ASF,
|
||||
.seq = 0xff,
|
||||
};
|
||||
unsigned char * data;
|
||||
uint8_t * data;
|
||||
int len = sizeof(rmcp_ping) + sizeof(asf_ping);
|
||||
int rv;
|
||||
|
||||
@ -457,7 +457,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
struct ipmi_session * session = intf->session;
|
||||
|
||||
int offset, rv;
|
||||
unsigned short payload_size;
|
||||
uint16_t payload_size;
|
||||
|
||||
rsp = ipmi_lan_recv_packet(intf);
|
||||
|
||||
@ -772,7 +772,7 @@ void
|
||||
read_rakp2_message(
|
||||
struct ipmi_rs * rsp,
|
||||
int offset,
|
||||
unsigned char auth_alg)
|
||||
uint8_t auth_alg)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -853,7 +853,7 @@ void
|
||||
read_rakp4_message(
|
||||
struct ipmi_rs * rsp,
|
||||
int offset,
|
||||
unsigned char integrity_alg)
|
||||
uint8_t integrity_alg)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1152,9 +1152,9 @@ void read_sol_packet(struct ipmi_rs * rsp, int * offset)
|
||||
* param rq_seq [in] is the IPMI command sequence number.
|
||||
*/
|
||||
void getIpmiPayloadWireRep(
|
||||
unsigned char * msg,
|
||||
uint8_t * msg,
|
||||
struct ipmi_rq * req,
|
||||
unsigned char rq_seq)
|
||||
uint8_t rq_seq)
|
||||
{
|
||||
int cs, mp, tmp, i;
|
||||
|
||||
@ -1205,7 +1205,7 @@ void getIpmiPayloadWireRep(
|
||||
* param payload [in] holds the v2 payload with our SOL data
|
||||
*/
|
||||
void getSolPayloadWireRep(
|
||||
unsigned char * msg, /* output */
|
||||
uint8_t * msg, /* output */
|
||||
struct ipmi_v2_payload * payload) /* input */
|
||||
{
|
||||
int i = 0;
|
||||
@ -1277,9 +1277,9 @@ ipmi_lanplus_build_v2x_msg(
|
||||
struct ipmi_intf * intf, /* in */
|
||||
struct ipmi_v2_payload * payload, /* in */
|
||||
int * msg_len, /* out */
|
||||
unsigned char ** msg_data) /* out */
|
||||
uint8_t ** msg_data) /* out */
|
||||
{
|
||||
unsigned int session_trailer_length = 0;
|
||||
uint32_t session_trailer_length = 0;
|
||||
struct ipmi_session * session = intf->session;
|
||||
struct rmcp_hdr rmcp = {
|
||||
.ver = RMCP_VERSION_1,
|
||||
@ -1288,7 +1288,7 @@ ipmi_lanplus_build_v2x_msg(
|
||||
};
|
||||
|
||||
/* msg will hold the entire message to be sent */
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
|
||||
int len = 0;
|
||||
|
||||
@ -1446,9 +1446,9 @@ ipmi_lanplus_build_v2x_msg(
|
||||
if ((session->v2_data.session_state == LANPLUS_STATE_ACTIVE) &&
|
||||
(session->v2_data.auth_alg != IPMI_AUTH_RAKP_NONE))
|
||||
{
|
||||
unsigned int i, hmac_length, integrity_pad_size = 0, hmac_input_size;
|
||||
unsigned char * hmac_output;
|
||||
unsigned int start_of_session_trailer =
|
||||
uint32_t i, hmac_length, integrity_pad_size = 0, hmac_input_size;
|
||||
uint8_t * hmac_output;
|
||||
uint32_t start_of_session_trailer =
|
||||
IPMI_LANPLUS_OFFSET_PAYLOAD +
|
||||
payload->payload_length;
|
||||
|
||||
@ -1457,7 +1457,7 @@ ipmi_lanplus_build_v2x_msg(
|
||||
* Determine the required integrity pad length. We have to make the
|
||||
* data range covered by the authcode a multiple of 4.
|
||||
*/
|
||||
unsigned int length_before_authcode =
|
||||
uint32_t length_before_authcode =
|
||||
12 + /* the stuff before the payload */
|
||||
payload->payload_length +
|
||||
1 + /* pad length field */
|
||||
@ -1552,7 +1552,7 @@ ipmi_lanplus_build_v2x_ipmi_cmd(
|
||||
* know the sequence number when we generate our IPMI
|
||||
* representation far below.
|
||||
*/
|
||||
static unsigned char curr_seq = 0;
|
||||
static uint8_t curr_seq = 0;
|
||||
if (curr_seq >= 64)
|
||||
curr_seq = 0;
|
||||
|
||||
@ -1632,7 +1632,7 @@ ipmi_lanplus_build_v15_ipmi_cmd(
|
||||
.class = RMCP_CLASS_IPMI,
|
||||
.seq = 0xff,
|
||||
};
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
int cs, mp, len = 0, tmp;
|
||||
struct ipmi_session * session = intf->session;
|
||||
struct ipmi_rq_entry * entry;
|
||||
@ -1775,7 +1775,7 @@ ipmi_lanplus_send_payload(
|
||||
struct ipmi_v2_payload * payload)
|
||||
{
|
||||
struct ipmi_rs * rsp = NULL;
|
||||
unsigned char * msg_data;
|
||||
uint8_t * msg_data;
|
||||
int msg_length;
|
||||
struct ipmi_session * session = intf->session;
|
||||
int try = 0;
|
||||
@ -1793,7 +1793,7 @@ ipmi_lanplus_send_payload(
|
||||
|
||||
if (verbose >= 1)
|
||||
{
|
||||
unsigned short i;
|
||||
uint16_t i;
|
||||
|
||||
printf("\n");
|
||||
printf(">> Sending IPMI command payload\n");
|
||||
@ -2127,8 +2127,8 @@ check_sol_packet_for_new_data(
|
||||
struct ipmi_intf * intf,
|
||||
struct ipmi_rs *rsp)
|
||||
{
|
||||
static unsigned char last_received_sequence_number = 0;
|
||||
static unsigned char last_received_byte_count = 0;
|
||||
static uint8_t last_received_sequence_number = 0;
|
||||
static uint8_t last_received_byte_count = 0;
|
||||
int new_data_size = 0;
|
||||
|
||||
|
||||
@ -2137,7 +2137,7 @@ check_sol_packet_for_new_data(
|
||||
(rsp->session.payloadtype == IPMI_PAYLOAD_TYPE_SOL))
|
||||
{
|
||||
/* Store the data length before we mod it */
|
||||
unsigned char unaltered_data_len = rsp->data_len;
|
||||
uint8_t unaltered_data_len = rsp->data_len;
|
||||
|
||||
|
||||
if (rsp->payload.sol_packet.packet_sequence_number ==
|
||||
@ -2292,7 +2292,7 @@ ipmi_get_auth_capabilities_cmd(
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[2];
|
||||
uint8_t msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_E | 0x80; // Ask for IPMI v2 data as well
|
||||
msg_data[1] = intf->session->privlvl;
|
||||
@ -2338,7 +2338,7 @@ impi_close_session_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
uint8_t msg_data[4];
|
||||
uint32_t bmc_session_lsbf;
|
||||
|
||||
if (intf->session->v2_data.session_state != LANPLUS_STATE_ACTIVE)
|
||||
@ -2395,7 +2395,7 @@ ipmi_lanplus_open_session(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_v2_payload v2_payload;
|
||||
struct ipmi_session * session = intf->session;
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
struct ipmi_rs * rsp;
|
||||
int rc = 0;
|
||||
|
||||
@ -2403,7 +2403,7 @@ ipmi_lanplus_open_session(struct ipmi_intf * intf)
|
||||
/*
|
||||
* Build an Open Session Request Payload
|
||||
*/
|
||||
msg = (unsigned char*)malloc(IPMI_OPEN_SESSION_REQUEST_SIZE);
|
||||
msg = (uint8_t*)malloc(IPMI_OPEN_SESSION_REQUEST_SIZE);
|
||||
memset(msg, 0, IPMI_OPEN_SESSION_REQUEST_SIZE);
|
||||
|
||||
msg[0] = 0; /* Message tag */
|
||||
@ -2522,14 +2522,14 @@ ipmi_lanplus_rakp1(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_v2_payload v2_payload;
|
||||
struct ipmi_session * session = intf->session;
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
struct ipmi_rs * rsp;
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* Build a RAKP 1 message
|
||||
*/
|
||||
msg = (unsigned char*)malloc(IPMI_RAKP1_MESSAGE_SIZE);
|
||||
msg = (uint8_t*)malloc(IPMI_RAKP1_MESSAGE_SIZE);
|
||||
memset(msg, 0, IPMI_RAKP1_MESSAGE_SIZE);
|
||||
|
||||
|
||||
@ -2664,7 +2664,7 @@ ipmi_lanplus_rakp3(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_v2_payload v2_payload;
|
||||
struct ipmi_session * session = intf->session;
|
||||
unsigned char * msg;
|
||||
uint8_t * msg;
|
||||
struct ipmi_rs * rsp;
|
||||
|
||||
assert(session->v2_data.session_state == LANPLUS_STATE_RAKP_2_RECEIVED);
|
||||
@ -2672,7 +2672,7 @@ ipmi_lanplus_rakp3(struct ipmi_intf * intf)
|
||||
/*
|
||||
* Build a RAKP 3 message
|
||||
*/
|
||||
msg = (unsigned char*)malloc(IPMI_RAKP3_MESSAGE_MAX_SIZE);
|
||||
msg = (uint8_t*)malloc(IPMI_RAKP3_MESSAGE_MAX_SIZE);
|
||||
memset(msg, 0, IPMI_RAKP3_MESSAGE_MAX_SIZE);
|
||||
|
||||
|
||||
@ -2980,16 +2980,16 @@ ipmi_lanplus_open(struct ipmi_intf * intf)
|
||||
|
||||
void test_crypt1()
|
||||
{
|
||||
unsigned char key[] =
|
||||
uint8_t key[] =
|
||||
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14};
|
||||
|
||||
unsigned short bytes_encrypted;
|
||||
unsigned short bytes_decrypted;
|
||||
unsigned char decrypt_buffer[1000];
|
||||
unsigned char encrypt_buffer[1000];
|
||||
uint16_t bytes_encrypted;
|
||||
uint16_t bytes_decrypted;
|
||||
uint8_t decrypt_buffer[1000];
|
||||
uint8_t encrypt_buffer[1000];
|
||||
|
||||
unsigned char data[] =
|
||||
uint8_t data[] =
|
||||
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
|
||||
0x11, 0x12};
|
||||
@ -3029,13 +3029,13 @@ void test_crypt1()
|
||||
|
||||
void test_crypt2()
|
||||
{
|
||||
unsigned char key[] =
|
||||
uint8_t key[] =
|
||||
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14};
|
||||
unsigned char iv[] =
|
||||
uint8_t iv[] =
|
||||
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14};
|
||||
unsigned char * data = "12345678";
|
||||
uint8_t * data = "12345678";
|
||||
|
||||
char encrypt_buffer[1000];
|
||||
char decrypt_buffer[1000];
|
||||
|
@ -70,14 +70,14 @@
|
||||
* 1 on failure (the authcode does not match)
|
||||
*/
|
||||
int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
const unsigned char * bmc_mac)
|
||||
const uint8_t * bmc_mac)
|
||||
{
|
||||
char * buffer;
|
||||
int bufferLength, i;
|
||||
unsigned char mac[20];
|
||||
uint8_t mac[20];
|
||||
int macLength;
|
||||
|
||||
unsigned int SIDm_lsbf, SIDc_lsbf;
|
||||
uint32_t SIDm_lsbf, SIDc_lsbf;
|
||||
|
||||
|
||||
if (session->v2_data.auth_alg == IPMI_AUTH_RAKP_NONE)
|
||||
@ -210,14 +210,14 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
* 1 on failure (the authcode does not match)
|
||||
*/
|
||||
int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
const unsigned char * bmc_mac)
|
||||
const uint8_t * bmc_mac)
|
||||
{
|
||||
char * buffer;
|
||||
int bufferLength, i;
|
||||
unsigned char mac[20];
|
||||
uint8_t mac[20];
|
||||
int macLength;
|
||||
|
||||
unsigned int SIDc_lsbf;
|
||||
uint32_t SIDc_lsbf;
|
||||
|
||||
if (session->v2_data.auth_alg == IPMI_AUTH_RAKP_NONE)
|
||||
return 1;
|
||||
@ -323,12 +323,12 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
*/
|
||||
int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
const struct ipmi_session * session,
|
||||
unsigned int * mac_length)
|
||||
uint32_t * mac_length)
|
||||
{
|
||||
int ret = 0;
|
||||
int input_buffer_length, i;
|
||||
char * input_buffer;
|
||||
unsigned int SIDm_lsbf;
|
||||
uint32_t SIDm_lsbf;
|
||||
|
||||
|
||||
if (session->v2_data.auth_alg == IPMI_AUTH_RAKP_NONE)
|
||||
@ -554,9 +554,9 @@ int lanplus_generate_sik(struct ipmi_session * session)
|
||||
*/
|
||||
int lanplus_generate_k1(struct ipmi_session * session)
|
||||
{
|
||||
unsigned int mac_length;
|
||||
uint32_t mac_length;
|
||||
|
||||
unsigned char CONST_1[] =
|
||||
uint8_t CONST_1[] =
|
||||
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
|
||||
|
||||
@ -597,9 +597,9 @@ int lanplus_generate_k1(struct ipmi_session * session)
|
||||
*/
|
||||
int lanplus_generate_k2(struct ipmi_session * session)
|
||||
{
|
||||
unsigned int mac_length;
|
||||
uint32_t mac_length;
|
||||
|
||||
unsigned char CONST_2[] =
|
||||
uint8_t CONST_2[] =
|
||||
{0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
|
||||
|
||||
@ -645,16 +645,16 @@ int lanplus_generate_k2(struct ipmi_session * session)
|
||||
* returns 0 on success
|
||||
* 1 on failure
|
||||
*/
|
||||
int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned short * bytes_written)
|
||||
int lanplus_encrypt_payload(uint8_t crypt_alg,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint16_t * bytes_written)
|
||||
{
|
||||
unsigned char * padded_input;
|
||||
unsigned int mod, i, bytes_encrypted;
|
||||
unsigned char pad_length = 0;
|
||||
uint8_t * padded_input;
|
||||
uint32_t mod, i, bytes_encrypted;
|
||||
uint8_t pad_length = 0;
|
||||
|
||||
if (crypt_alg == IPMI_CRYPT_NONE)
|
||||
{
|
||||
@ -678,7 +678,7 @@ int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
if (mod)
|
||||
pad_length = IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE - mod;
|
||||
|
||||
padded_input = (unsigned char*)malloc(input_length + pad_length + 1);
|
||||
padded_input = (uint8_t*)malloc(input_length + pad_length + 1);
|
||||
memcpy(padded_input, input, input_length);
|
||||
|
||||
/* add the pad */
|
||||
@ -745,9 +745,9 @@ int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
int lanplus_has_valid_auth_code(struct ipmi_rs * rs,
|
||||
struct ipmi_session * session)
|
||||
{
|
||||
unsigned char * bmc_authcode;
|
||||
unsigned char generated_authcode[IPMI_MAX_MAC_SIZE];
|
||||
unsigned int generated_authcode_length;
|
||||
uint8_t * bmc_authcode;
|
||||
uint8_t generated_authcode[IPMI_MAX_MAC_SIZE];
|
||||
uint32_t generated_authcode_length;
|
||||
|
||||
|
||||
if ((rs->session.authtype != IPMI_SESSION_AUTHTYPE_RMCP_PLUS) ||
|
||||
@ -802,15 +802,15 @@ int lanplus_has_valid_auth_code(struct ipmi_rs * rs,
|
||||
* returns 0 on success (we were able to successfully decrypt the packet)
|
||||
* 1 on failure (we were unable to successfully decrypt the packet)
|
||||
*/
|
||||
int lanplus_decrypt_payload(unsigned char crypt_alg,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned short * payload_size)
|
||||
int lanplus_decrypt_payload(uint8_t crypt_alg,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint16_t * payload_size)
|
||||
{
|
||||
unsigned char * decrypted_payload;
|
||||
unsigned int bytes_decrypted;
|
||||
uint8_t * decrypted_payload;
|
||||
uint32_t bytes_decrypted;
|
||||
|
||||
if (crypt_alg == IPMI_CRYPT_NONE)
|
||||
{
|
||||
@ -823,7 +823,7 @@ int lanplus_decrypt_payload(unsigned char crypt_alg,
|
||||
/* We only support AES */
|
||||
assert(crypt_alg == IPMI_CRYPT_AES_CBC_128);
|
||||
|
||||
decrypted_payload = (unsigned char*)malloc(input_length);
|
||||
decrypted_payload = (uint8_t*)malloc(input_length);
|
||||
|
||||
lanplus_decrypt_aes_cbc_128(input, /* IV */
|
||||
key, /* Key */
|
||||
@ -837,7 +837,7 @@ int lanplus_decrypt_payload(unsigned char crypt_alg,
|
||||
if (bytes_decrypted != 0)
|
||||
{
|
||||
/* Success */
|
||||
unsigned char conf_pad_length;
|
||||
uint8_t conf_pad_length;
|
||||
int i;
|
||||
|
||||
memmove(output,
|
||||
|
@ -44,27 +44,27 @@
|
||||
*/
|
||||
|
||||
int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
const unsigned char * hmac);
|
||||
const uint8_t * hmac);
|
||||
int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
const unsigned char * hmac);
|
||||
const uint8_t * hmac);
|
||||
int lanplus_generate_rakp3_authcode(char * buffer,
|
||||
const struct ipmi_session * session,
|
||||
unsigned int * auth_length);
|
||||
uint32_t * auth_length);
|
||||
int lanplus_generate_sik(struct ipmi_session * session);
|
||||
int lanplus_generate_k1(struct ipmi_session * session);
|
||||
int lanplus_generate_k2(struct ipmi_session * session);
|
||||
int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned short * bytesWritten);
|
||||
int lanplus_decrypt_payload(unsigned char crypt_alg,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned short * payload_size);
|
||||
int lanplus_encrypt_payload(uint8_t crypt_alg,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint16_t * bytesWritten);
|
||||
int lanplus_decrypt_payload(uint8_t crypt_alg,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint16_t * payload_size);
|
||||
int lanplus_has_valid_auth_code(struct ipmi_rs * rs,
|
||||
struct ipmi_session * session);
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
* returns 0 on success
|
||||
* 1 on failure
|
||||
*/
|
||||
int lanplus_seed_prng(unsigned int bytes)
|
||||
int lanplus_seed_prng(uint32_t bytes)
|
||||
{
|
||||
if (! RAND_load_file("/dev/urandom", bytes))
|
||||
return 1;
|
||||
@ -77,7 +77,7 @@ int lanplus_seed_prng(unsigned int bytes)
|
||||
* 1 on failure
|
||||
*/
|
||||
int
|
||||
lanplus_rand(unsigned char * buffer, unsigned int num_bytes)
|
||||
lanplus_rand(uint8_t * buffer, uint32_t num_bytes)
|
||||
{
|
||||
#define IPMI_LANPLUS_FAKE_RAND 1
|
||||
#ifdef IPMI_LANPLUS_FAKE_RAND
|
||||
@ -111,14 +111,14 @@ lanplus_rand(unsigned char * buffer, unsigned int num_bytes)
|
||||
*
|
||||
* returns a pointer to md
|
||||
*/
|
||||
unsigned char *
|
||||
lanplus_HMAC(unsigned char mac,
|
||||
uint8_t *
|
||||
lanplus_HMAC(uint8_t mac,
|
||||
const void *key,
|
||||
int key_len,
|
||||
const unsigned char *d,
|
||||
const uint8_t *d,
|
||||
int n,
|
||||
unsigned char *md,
|
||||
unsigned int *md_len)
|
||||
uint8_t *md,
|
||||
uint32_t *md_len)
|
||||
{
|
||||
|
||||
const EVP_MD *evp_md;
|
||||
@ -152,12 +152,12 @@ lanplus_HMAC(unsigned char mac,
|
||||
* to 0 on failure, or if 0 bytes were input.
|
||||
*/
|
||||
void
|
||||
lanplus_encrypt_aes_cbc_128(const unsigned char * iv,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned int * bytes_written)
|
||||
lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint32_t * bytes_written)
|
||||
{
|
||||
EVP_CIPHER_CTX ctx;
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
@ -193,7 +193,7 @@ lanplus_encrypt_aes_cbc_128(const unsigned char * iv,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int tmplen;
|
||||
uint32_t tmplen;
|
||||
|
||||
if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, &tmplen))
|
||||
{
|
||||
@ -226,12 +226,12 @@ lanplus_encrypt_aes_cbc_128(const unsigned char * iv,
|
||||
* to 0 on failure, or if 0 bytes were input.
|
||||
*/
|
||||
void
|
||||
lanplus_decrypt_aes_cbc_128(const unsigned char * iv,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned int * bytes_written)
|
||||
lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint32_t * bytes_written)
|
||||
{
|
||||
EVP_CIPHER_CTX ctx;
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
@ -268,7 +268,7 @@ lanplus_decrypt_aes_cbc_128(const unsigned char * iv,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int tmplen;
|
||||
uint32_t tmplen;
|
||||
|
||||
if(!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, &tmplen))
|
||||
{
|
||||
|
@ -39,32 +39,32 @@
|
||||
|
||||
|
||||
int
|
||||
lanplus_seed_prng(unsigned int bytes);
|
||||
lanplus_seed_prng(uint32_t bytes);
|
||||
|
||||
int
|
||||
lanplus_rand(unsigned char * buffer, unsigned int num_bytes);
|
||||
lanplus_rand(uint8_t * buffer, uint32_t num_bytes);
|
||||
|
||||
unsigned char *
|
||||
lanplus_HMAC(unsigned char mac, const void *key, int key_len,
|
||||
const unsigned char *d, int n, unsigned char *md,
|
||||
unsigned int *md_len);
|
||||
uint8_t *
|
||||
lanplus_HMAC(uint8_t mac, const void *key, int key_len,
|
||||
const uint8_t *d, int n, uint8_t *md,
|
||||
uint32_t *md_len);
|
||||
|
||||
void
|
||||
lanplus_encrypt_aes_cbc_128(const unsigned char * iv,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned int * bytes_written);
|
||||
lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint32_t * bytes_written);
|
||||
|
||||
|
||||
void
|
||||
lanplus_decrypt_aes_cbc_128(const unsigned char * iv,
|
||||
const unsigned char * key,
|
||||
const unsigned char * input,
|
||||
unsigned int input_length,
|
||||
unsigned char * output,
|
||||
unsigned int * bytes_written);
|
||||
lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
||||
const uint8_t * key,
|
||||
const uint8_t * input,
|
||||
uint32_t input_length,
|
||||
uint8_t * output,
|
||||
uint32_t * bytes_written);
|
||||
|
||||
|
||||
#endif /* IPMI_LANPLUS_CRYPT_IMPL_H */
|
||||
|
@ -83,7 +83,7 @@ void lanplus_dump_open_session_response(const struct ipmi_rs * rsp)
|
||||
|
||||
|
||||
|
||||
void lanplus_dump_rakp2_message(const struct ipmi_rs * rsp, unsigned char auth_alg)
|
||||
void lanplus_dump_rakp2_message(const struct ipmi_rs * rsp, uint8_t auth_alg)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -137,7 +137,7 @@ void lanplus_dump_rakp2_message(const struct ipmi_rs * rsp, unsigned char auth_a
|
||||
|
||||
|
||||
|
||||
void lanplus_dump_rakp4_message(const struct ipmi_rs * rsp, unsigned char auth_alg)
|
||||
void lanplus_dump_rakp4_message(const struct ipmi_rs * rsp, uint8_t auth_alg)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
|
||||
/* See the implementation file for documentation */
|
||||
void lanplus_dump_open_session_response(const struct ipmi_rs * rsp);
|
||||
void lanplus_dump_rakp2_message(const struct ipmi_rs * rsp, unsigned char auth_alg);
|
||||
void lanplus_dump_rakp4_message(const struct ipmi_rs * rsp, unsigned char auth_alg);
|
||||
void lanplus_dump_rakp2_message(const struct ipmi_rs * rsp, uint8_t auth_alg);
|
||||
void lanplus_dump_rakp4_message(const struct ipmi_rs * rsp, uint8_t auth_alg);
|
||||
|
||||
|
||||
#endif /* IPMI_LANPLUS_DUMP_H */
|
||||
|
@ -75,6 +75,6 @@ struct rmcp_hdr {
|
||||
uint8_t class;
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_rmcp(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
int handle_rmcp(struct ipmi_intf * intf, uint8_t * data, int data_len);
|
||||
|
||||
#endif /* IPMI_RMCP_H */
|
||||
|
@ -71,23 +71,23 @@ ipmi_openipmi_open(struct ipmi_intf * intf)
|
||||
|
||||
if (intf->fd < 0) {
|
||||
intf->fd = open(IPMI_OPENIPMI_DEVFS, O_RDWR);
|
||||
lperror(LOG_ERR, "intf_open: Could not open device at %s or %s",
|
||||
lperror(LOG_ERR, "Could not open device at %s or %s",
|
||||
IPMI_OPENIPMI_DEV, IPMI_OPENIPMI_DEVFS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SET_GETS_EVENTS_CMD, &i) < 0) {
|
||||
lperror(LOG_ERR, "intf_open: Could not enable event receiver");
|
||||
lperror(LOG_ERR, "Could not enable event receiver");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (intf->my_addr != 0) {
|
||||
unsigned int a = intf->my_addr;
|
||||
if (ioctl(intf->fd, IPMICTL_SET_MY_ADDRESS_CMD, &a) < 0) {
|
||||
lperror(LOG_ERR, "intf_open: Could not set IPMB address");
|
||||
lperror(LOG_ERR, "Could not set IPMB address");
|
||||
return -1;
|
||||
}
|
||||
lprintf(LOG_DEBUG, "intf_open: Set IPMB address to 0x%x",
|
||||
lprintf(LOG_DEBUG, "Set IPMB address to 0x%x",
|
||||
intf->my_addr);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
|
||||
if (verbose > 2)
|
||||
printbuf(req->msg.data, req->msg.data_len,
|
||||
"intf_open: request message");
|
||||
"OpenIPMI Request Message");
|
||||
|
||||
/*
|
||||
* setup and send message
|
||||
@ -146,11 +146,11 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
ipmb_addr.slave_addr = intf->target_addr;
|
||||
_req.addr = (char *) &ipmb_addr;
|
||||
_req.addr_len = sizeof(ipmb_addr);
|
||||
lprintf(LOG_DEBUG, "intf_open: Sending request to "
|
||||
lprintf(LOG_DEBUG, "Sending request to "
|
||||
"IPMB target @ 0x%x", intf->target_addr);
|
||||
} else {
|
||||
/* otherwise use system interface */
|
||||
lprintf(LOG_DEBUG+2, "intf_open: Sending request to "
|
||||
lprintf(LOG_DEBUG+2, "Sending request to "
|
||||
"System Interface");
|
||||
_req.addr = (char *) &bmc_addr;
|
||||
_req.addr_len = sizeof(bmc_addr);
|
||||
@ -163,7 +163,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
_req.msg.data_len = req->msg.data_len;
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SEND_COMMAND, &_req) < 0) {
|
||||
lperror(LOG_ERR, "intf_open: Unable to send command");
|
||||
lperror(LOG_ERR, "Unable to send command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -175,11 +175,11 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
FD_SET(intf->fd, &rset);
|
||||
|
||||
if (select(intf->fd+1, &rset, NULL, NULL, NULL) < 0) {
|
||||
lperror(LOG_ERR, "intf_open: I/O Error");
|
||||
lperror(LOG_ERR, "I/O Error");
|
||||
return NULL;
|
||||
}
|
||||
if (FD_ISSET(intf->fd, &rset) == 0) {
|
||||
lprintf(LOG_ERR, "intf_open: No data available");
|
||||
lprintf(LOG_ERR, "No data available");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
|
||||
/* get data */
|
||||
if (ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv) < 0) {
|
||||
lperror(LOG_ERR, "intf_open: Error receiving message");
|
||||
lperror(LOG_ERR, "Error receiving message");
|
||||
if (errno != EMSGSIZE)
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user