123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- #ifndef IPMI_H
- #define IPMI_H
- #include "ipmitool_def.h"
- #include <stdlib.h>
- #include <stdio.h>
- #include <inttypes.h>
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <ipmitool/helper.h>
- #include <ipmitool/ipmi_cc.h>
- #if HAVE_CONFIG_H
- # include <config.h>
- #endif
- #define IPMI_BUF_SIZE 1024
- #define IPMI_MAX_MD_SIZE 0x20
- #if HAVE_PRAGMA_PACK
- #define ATTRIBUTE_PACKING
- #else
- #define ATTRIBUTE_PACKING __attribute__ ((packed))
- #endif
- #define IPMI_PAYLOAD_TYPE_IPMI 0x00
- #define IPMI_PAYLOAD_TYPE_SOL 0x01
- #define IPMI_PAYLOAD_TYPE_OEM 0x02
- #define IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST 0x10
- #define IPMI_PAYLOAD_TYPE_RMCP_OPEN_RESPONSE 0x11
- #define IPMI_PAYLOAD_TYPE_RAKP_1 0x12
- #define IPMI_PAYLOAD_TYPE_RAKP_2 0x13
- #define IPMI_PAYLOAD_TYPE_RAKP_3 0x14
- #define IPMI_PAYLOAD_TYPE_RAKP_4 0x15
- extern int verbose;
- extern int csv_output;
- struct ipmi_rq {
- struct {
- uint8_t netfn:6;
- uint8_t lun:2;
- uint8_t cmd;
- uint8_t target_cmd;
- uint16_t data_len;
- uint8_t *data;
- } msg;
- };
- struct ipmi_v2_payload {
- uint16_t payload_length;
- uint8_t payload_type;
- union {
- struct {
- uint8_t rq_seq;
- struct ipmi_rq *request;
- } ipmi_request;
- struct {
- uint8_t rs_seq;
- struct ipmi_rs *response;
- } ipmi_response;
-
- struct {
- uint8_t *request;
- } open_session_request;
-
- struct {
- uint8_t *message;
- } rakp_1_message;
-
- struct {
- uint8_t *message;
- } rakp_2_message;
-
- struct {
- uint8_t *message;
- } rakp_3_message;
-
- struct {
- uint8_t *message;
- } rakp_4_message;
- struct {
- 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;
- uint8_t assert_ring_wor;
- uint8_t generate_break;
- uint8_t deassert_cts;
- uint8_t deassert_dcd_dsr;
- uint8_t flush_inbound;
- uint8_t flush_outbound;
- } sol_packet;
- } payload;
- };
- struct ipmi_rq_entry {
- struct ipmi_rq req;
- struct ipmi_intf *intf;
- uint8_t rq_seq;
- uint8_t *msg_data;
- int msg_len;
- int bridging_level;
- struct ipmi_rq_entry *next;
- };
- struct ipmi_rs {
- uint8_t ccode;
- uint8_t data[IPMI_BUF_SIZE];
-
- int data_len;
- struct {
- uint8_t netfn;
- uint8_t cmd;
- uint8_t seq;
- uint8_t lun;
- } msg;
- struct {
- uint8_t authtype;
- uint32_t seq;
- uint32_t id;
- uint8_t bEncrypted;
- uint8_t bAuthenticated;
- uint8_t payloadtype;
-
- uint16_t msglen;
- } session;
-
- union {
- struct {
- 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 {
- 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 {
- uint8_t message_tag;
- uint8_t rakp_return_code;
- uint32_t console_id;
- uint8_t bmc_rand[16];
- uint8_t bmc_guid[16];
- uint8_t key_exchange_auth_code[IPMI_MAX_MD_SIZE];
- } rakp2_message;
- struct {
- uint8_t message_tag;
- uint8_t rakp_return_code;
- uint32_t console_id;
- uint8_t integrity_check_value[IPMI_MAX_MD_SIZE];
- } rakp4_message;
- struct {
- uint8_t packet_sequence_number;
- uint8_t acked_packet_number;
- uint8_t accepted_character_count;
- uint8_t is_nack;
- uint8_t transfer_unavailable;
- uint8_t sol_inactive;
- uint8_t transmit_overrun;
- uint8_t break_detected;
- } sol_packet;
- } payload;
- };
- #define IPMI_NETFN_CHASSIS 0x0
- #define IPMI_NETFN_BRIDGE 0x2
- #define IPMI_NETFN_SE 0x4
- #define IPMI_NETFN_APP 0x6
- #define IPMI_NETFN_FIRMWARE 0x8
- #define IPMI_NETFN_STORAGE 0xa
- #define IPMI_NETFN_TRANSPORT 0xc
- #define IPMI_NETFN_PICMG 0x2C
- #define IPMI_NETFN_DCGRP 0x2C
- #define IPMI_NETFN_OEM 0x2E
- #define IPMI_NETFN_ISOL 0x34
- #define IPMI_NETFN_TSOL 0x30
- #define IPMI_BMC_SLAVE_ADDR 0x20
- #define IPMI_REMOTE_SWID 0x81
- typedef enum IPMI_OEM {
- IPMI_OEM_UNKNOWN = 0,
-
- IPMI_OEM_IBM_2 = 2,
- IPMI_OEM_HP = 11,
- IPMI_OEM_SUN = 42,
- IPMI_OEM_NOKIA = 94,
- IPMI_OEM_BULL = 107,
- IPMI_OEM_HITACHI_116 = 116,
- IPMI_OEM_NEC = 119,
- IPMI_OEM_TOSHIBA = 186,
- IPMI_OEM_ERICSSON = 193,
- IPMI_OEM_INTEL = 343,
- IPMI_OEM_TATUNG = 373,
- IPMI_OEM_HITACHI_399 = 399,
- IPMI_OEM_DELL = 674,
- IPMI_OEM_LMC = 2168,
- IPMI_OEM_RADISYS = 4337,
- IPMI_OEM_BROADCOM = 4413,
-
- IPMI_OEM_IBM_4769 = 4769,
- IPMI_OEM_MAGNUM = 5593,
- IPMI_OEM_TYAN = 6653,
- IPMI_OEM_QUANTA = 7244,
- IPMI_OEM_NEWISYS = 9237,
- IPMI_OEM_ADVANTECH = 10297,
- IPMI_OEM_FUJITSU_SIEMENS = 10368,
- IPMI_OEM_AVOCENT = 10418,
- IPMI_OEM_PEPPERCON = 10437,
- IPMI_OEM_SUPERMICRO = 10876,
- IPMI_OEM_OSA = 11102,
- IPMI_OEM_GOOGLE = 11129,
- IPMI_OEM_PICMG = 12634,
- IPMI_OEM_RARITAN = 13742,
- IPMI_OEM_KONTRON = 15000,
- IPMI_OEM_PPS = 16394,
-
- IPMI_OEM_IBM_20301 = 20301,
- IPMI_OEM_AMI = 20974,
-
- IPMI_OEM_ADLINK_24339 = 24339,
- IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458,
- IPMI_OEM_VITA = 33196,
- IPMI_OEM_SUPERMICRO_47488 = 47488
- } IPMI_OEM;
- extern const struct valstr completion_code_vals[];
- #endif
|