|
Packit Service |
ed0f68 |
/*
|
|
Packit Service |
ed0f68 |
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
ed0f68 |
* modification, are permitted provided that the following conditions
|
|
Packit Service |
ed0f68 |
* are met:
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Redistribution of source code must retain the above copyright
|
|
Packit Service |
ed0f68 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Redistribution in binary form must reproduce the above copyright
|
|
Packit Service |
ed0f68 |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit Service |
ed0f68 |
* documentation and/or other materials provided with the distribution.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Neither the name of Sun Microsystems, Inc. or the names of
|
|
Packit Service |
ed0f68 |
* contributors may be used to endorse or promote products derived
|
|
Packit Service |
ed0f68 |
* from this software without specific prior written permission.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* This software is provided "AS IS," without a warranty of any kind.
|
|
Packit Service |
ed0f68 |
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
|
Packit Service |
ed0f68 |
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
|
Packit Service |
ed0f68 |
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
|
Packit Service |
ed0f68 |
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
|
Packit Service |
ed0f68 |
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
|
Packit Service |
ed0f68 |
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
|
Packit Service |
ed0f68 |
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
|
Packit Service |
ed0f68 |
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
|
Packit Service |
ed0f68 |
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
|
Packit Service |
ed0f68 |
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
|
Packit Service |
ed0f68 |
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
Packit Service |
ed0f68 |
*/
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#ifndef IPMI_FIREWALL_H
|
|
Packit Service |
ed0f68 |
#define IPMI_FIREWALL_H
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#include <ipmitool/ipmi.h>
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
int ipmi_firewall_main(struct ipmi_intf *, int, char **);
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#define BMC_GET_NETFN_SUPPORT 0x09
|
|
Packit Service |
ed0f68 |
#define BMC_GET_COMMAND_SUPPORT 0x0A
|
|
Packit Service |
ed0f68 |
#define BMC_GET_COMMAND_SUBFUNCTION_SUPPORT 0x0B
|
|
Packit Service |
ed0f68 |
#define BMC_GET_CONFIGURABLE_COMMANDS 0x0C
|
|
Packit Service |
ed0f68 |
#define BMC_GET_CONFIGURABLE_COMMAND_SUBFUNCTIONS 0x0D
|
|
Packit Service |
ed0f68 |
#define BMC_SET_COMMAND_ENABLES 0x60
|
|
Packit Service |
ed0f68 |
#define BMC_GET_COMMAND_ENABLES 0x61
|
|
Packit Service |
ed0f68 |
#define BMC_SET_COMMAND_SUBFUNCTION_ENABLES 0x62
|
|
Packit Service |
ed0f68 |
#define BMC_GET_COMMAND_SUBFUNCTION_ENABLES 0x63
|
|
Packit Service |
ed0f68 |
#define BMC_OEM_NETFN_IANA_SUPPORT 0x64
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#define SET_COMMAND_ENABLE_BYTE (BMC_SET_COMMAND_ENABLES / 8)
|
|
Packit Service |
ed0f68 |
#define SET_COMMAND_ENABLE_BIT (BMC_SET_COMMAND_ENABLES % 8)
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#define MAX_LUN 4
|
|
Packit Service |
ed0f68 |
#define MAX_NETFN 64
|
|
Packit Service |
ed0f68 |
#define MAX_NETFN_PAIR (MAX_NETFN/2)
|
|
Packit Service |
ed0f68 |
#define MAX_COMMAND 256
|
|
Packit Service |
ed0f68 |
#define MAX_SUBFN 32
|
|
Packit Service |
ed0f68 |
#define MAX_COMMAND_BYTES (MAX_COMMAND>>3)
|
|
Packit Service |
ed0f68 |
#define MAX_SUBFN_BYTES (MAX_SUBFN>>3)
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
// support is a bitfield with the following bits set...
|
|
Packit Service |
ed0f68 |
#define BIT_AVAILABLE 0x01
|
|
Packit Service |
ed0f68 |
#define BIT_CONFIGURABLE 0x02
|
|
Packit Service |
ed0f68 |
#define BIT_ENABLED 0x04
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
extern int verbose;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
struct command_support {
|
|
Packit Service |
ed0f68 |
unsigned char support;
|
|
Packit Service |
ed0f68 |
unsigned char version[3];
|
|
Packit Service |
ed0f68 |
unsigned char subfn_support[MAX_SUBFN_BYTES];
|
|
Packit Service |
ed0f68 |
unsigned char subfn_config[MAX_SUBFN_BYTES];
|
|
Packit Service |
ed0f68 |
unsigned char subfn_enable[MAX_SUBFN_BYTES];
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
struct lun_netfn_support {
|
|
Packit Service |
ed0f68 |
unsigned char support;
|
|
Packit Service |
ed0f68 |
struct command_support command[MAX_COMMAND];
|
|
Packit Service |
ed0f68 |
unsigned char command_mask[MAX_COMMAND_BYTES];
|
|
Packit Service |
ed0f68 |
unsigned char config_mask[MAX_COMMAND_BYTES];
|
|
Packit Service |
ed0f68 |
unsigned char enable_mask[MAX_COMMAND_BYTES];
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
struct lun_support {
|
|
Packit Service |
ed0f68 |
unsigned char support;
|
|
Packit Service |
ed0f68 |
struct lun_netfn_support netfn[MAX_NETFN_PAIR];
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
struct bmc_fn_support {
|
|
Packit Service |
ed0f68 |
struct lun_support lun[MAX_LUN];
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
struct ipmi_function_params {
|
|
Packit Service |
ed0f68 |
int channel;
|
|
Packit Service |
ed0f68 |
int lun;
|
|
Packit Service |
ed0f68 |
int netfn;
|
|
Packit Service |
ed0f68 |
int command;
|
|
Packit Service |
ed0f68 |
int subfn;
|
|
Packit Service |
ed0f68 |
unsigned char force;
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
static inline int bit_test(const unsigned char * bf, int n) {
|
|
Packit Service |
ed0f68 |
return !!(bf[n>>3]&(1<<(n%8)));
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
static inline void bit_set(unsigned char * bf, int n, int v) {
|
|
Packit Service |
ed0f68 |
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#endif /*IPMI_FIREWALL_H */
|