ipmi_channel.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistribution of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistribution in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * Neither the name of Sun Microsystems, Inc. or the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * This software is provided "AS IS," without a warranty of any kind.
  20. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
  21. * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  22. * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
  23. * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
  24. * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
  25. * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
  26. * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
  27. * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
  28. * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
  29. * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
  30. * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  31. */
  32. #ifndef IPMI_CHANNEL_H
  33. #define IPMI_CHANNEL_H
  34. #if HAVE_CONFIG_H
  35. # include <config.h>
  36. #endif
  37. #include <ipmitool/ipmi.h>
  38. #define IPMI_GET_CHANNEL_AUTH_CAP 0x38
  39. #define IPMI_SET_CHANNEL_ACCESS 0x40
  40. #define IPMI_GET_CHANNEL_ACCESS 0x41
  41. #define IPMI_GET_CHANNEL_INFO 0x42
  42. #define IPMI_SET_USER_ACCESS 0x43
  43. #define IPMI_GET_USER_ACCESS 0x44
  44. #define IPMI_SET_USER_NAME 0x45
  45. #define IPMI_GET_USER_NAME 0x46
  46. #define IPMI_SET_USER_PASSWORD 0x47
  47. #define IPMI_GET_CHANNEL_CIPHER_SUITES 0x54
  48. /* These are for channel_info_t.session_support */
  49. #define IPMI_CHANNEL_SESSION_LESS 0x00
  50. #define IPMI_CHANNEL_SESSION_SINGLE 0x40
  51. #define IPMI_CHANNEL_SESSION_MULTI 0x80
  52. #define IPMI_CHANNEL_SESSION_BASED 0xC0
  53. /* (22.24) Get Channel Info */
  54. struct channel_info_t {
  55. uint8_t channel;
  56. uint8_t medium;
  57. uint8_t protocol;
  58. uint8_t session_support;
  59. uint8_t active_sessions;
  60. uint8_t vendor_id[3];
  61. uint8_t aux_info[2];
  62. };
  63. /* (22.23) Get Channel Access */
  64. struct channel_access_t {
  65. uint8_t access_mode;
  66. uint8_t alerting;
  67. uint8_t channel;
  68. uint8_t per_message_auth;
  69. uint8_t privilege_limit;
  70. uint8_t user_level_auth;
  71. };
  72. /*
  73. * The Get Authentication Capabilities response structure
  74. * From table 22-15 of the IPMI v2.0 spec
  75. */
  76. #ifdef HAVE_PRAGMA_PACK
  77. #pragma pack(1)
  78. #endif
  79. struct get_channel_auth_cap_rsp {
  80. uint8_t channel_number;
  81. #if WORDS_BIGENDIAN
  82. uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
  83. uint8_t __reserved1 : 1;
  84. uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
  85. #else
  86. uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
  87. uint8_t __reserved1 : 1;
  88. uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
  89. #endif
  90. #if WORDS_BIGENDIAN
  91. uint8_t __reserved2 : 2;
  92. uint8_t kg_status : 1; /* two-key login status */
  93. uint8_t per_message_auth : 1; /* per-message authentication status */
  94. uint8_t user_level_auth : 1; /* user-level authentication status */
  95. uint8_t non_null_usernames : 1; /* one or more non-null users exist */
  96. uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
  97. uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
  98. #else
  99. uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
  100. uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
  101. uint8_t non_null_usernames : 1; /* one or more non-null users exist */
  102. uint8_t user_level_auth : 1; /* user-level authentication status */
  103. uint8_t per_message_auth : 1; /* per-message authentication status */
  104. uint8_t kg_status : 1; /* two-key login status */
  105. uint8_t __reserved2 : 2;
  106. #endif
  107. #if WORDS_BIGENDIAN
  108. uint8_t __reserved3 : 6;
  109. uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
  110. uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
  111. #else
  112. uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
  113. uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
  114. uint8_t __reserved3 : 6;
  115. #endif
  116. uint8_t oem_id[3]; /* IANA enterprise number for auth type */
  117. uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */
  118. } ATTRIBUTE_PACKING;
  119. #ifdef HAVE_PRAGMA_PACK
  120. #pragma pack(0)
  121. #endif
  122. int _ipmi_get_channel_access(struct ipmi_intf *intf,
  123. struct channel_access_t *channel_access,
  124. uint8_t get_volatile_settings);
  125. int _ipmi_get_channel_info(struct ipmi_intf *intf,
  126. struct channel_info_t *channel_info);
  127. int _ipmi_set_channel_access(struct ipmi_intf *intf,
  128. struct channel_access_t channel_access, uint8_t access_option,
  129. uint8_t privilege_option);
  130. uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel);
  131. uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf);
  132. int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv);
  133. int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv);
  134. int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
  135. #endif /*IPMI_CHANNEL_H*/