Main Page | Class List | Directories | File List | Class Members | File Members

ipmi_user.h

Go to the documentation of this file.
00001 /*
00002  * ipmi_user.h
00003  *
00004  * MontaVista IPMI interface for users/passwords
00005  *
00006  * Author: MontaVista Software, Inc.
00007  *         Corey Minyard <minyard@mvista.com>
00008  *         source@mvista.com
00009  *
00010  * Copyright 2004 MontaVista Software Inc.
00011  *
00012  *  This program is free software; you can redistribute it and/or
00013  *  modify it under the terms of the GNU Lesser General Public License
00014  *  as published by the Free Software Foundation; either version 2 of
00015  *  the License, or (at your option) any later version.
00016  *
00017  *
00018  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00019  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00020  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00021  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00022  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00023  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00024  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00025  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00026  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00027  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028  *
00029  *  You should have received a copy of the GNU Lesser General Public
00030  *  License along with this program; if not, write to the Free
00031  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00032  */
00033 
00034 #ifndef _IPMI_USER_H
00035 #define _IPMI_USER_H
00036 
00037 #include <OpenIPMI/ipmi_mc.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 /*
00044  * A list of users.
00045  */
00046 typedef struct ipmi_user_list_s ipmi_user_list_t;
00047 
00048 /*
00049  * Fetch the users from the given MC and get the user info for the
00050  * given channel.  The user name and password is global for all
00051  * channels on an MC, the rest of the parameters are per-channel.
00052  * You can fetch a specific user number, or IPMI_MC_ALL_USERS
00053  * to fetch everything.
00054  */
00055 typedef void (*ipmi_user_list_cb)(ipmi_mc_t        *mc,
00056                                   int              err,
00057                                   ipmi_user_list_t *list,
00058                                   void             *cb_data);
00059 #define IPMI_MC_ALL_USERS       0
00060 int ipmi_mc_get_users(ipmi_mc_t         *mc,
00061                       unsigned int      channel,
00062                       unsigned int      user,
00063                       ipmi_user_list_cb handler,
00064                       void              *cb_data);
00065 
00066 int ipmi_user_list_get_channel(ipmi_user_list_t *list, unsigned int *channel);
00067 int ipmi_user_list_get_max_user(ipmi_user_list_t *list, unsigned int *max);
00068 int ipmi_user_list_get_enabled_users(ipmi_user_list_t *list, unsigned int *e);
00069 int ipmi_user_list_get_fixed_users(ipmi_user_list_t *list, unsigned int *f);
00070 
00071 /*
00072  * You may not keep the user list returned from ipmi_mc_get_users(),
00073  * but this lets you keep a copy of it and free that copy.  DO NOT
00074  * free the copy given to you by ipmi_mc_get_users().
00075  */
00076 ipmi_user_list_t *ipmi_user_list_copy(ipmi_user_list_t *list);
00077 void ipmi_user_list_free(ipmi_user_list_t *list);
00078 
00079 /*
00080  * An individual user.
00081  */
00082 typedef struct ipmi_user_s ipmi_user_t;
00083 
00084 /*
00085  * Get the number of users and fetch individual users.  Note
00086  * that the fetched user is a copy and must be freed with
00087  * ipmi_user_free().  The users are indexed sequentially and
00088  * not necessarily by number.
00089  */
00090 unsigned int ipmi_user_list_get_user_count(ipmi_user_list_t *users);
00091 ipmi_user_t *ipmi_user_list_get_user(ipmi_user_list_t *list,
00092                                      unsigned int     idx);
00093 
00094 /*
00095  * Allows users to be copied and freed.
00096  */
00097 ipmi_user_t *ipmi_user_copy(ipmi_user_t *user);
00098 void ipmi_user_free(ipmi_user_t *user);
00099 
00100 /* Write the user info to the given user number on the given MC.  Note
00101    that the user number in the user data structure is ignore, the
00102    passed in one is used. */
00103 int ipmi_mc_set_user(ipmi_mc_t       *mc,
00104                      unsigned int    channel,
00105                      unsigned int    num,
00106                      ipmi_user_t     *user,
00107                      ipmi_mc_done_cb handler,
00108                      void            *cb_data);
00109 
00110 int ipmi_user_get_channel(ipmi_user_t *user, unsigned int *channel);
00111 
00112 /*
00113  * Get/set the number for the user.
00114  */
00115 int ipmi_user_get_num(ipmi_user_t *user, unsigned int *num);
00116 int ipmi_user_set_num(ipmi_user_t *user, unsigned int num);
00117 
00118 /*
00119  * Get/set the name for the user.  When getting the name, the pointer
00120  * to "len" should point to a value of the length of "name".  "len"
00121  * will be updated to the actual number of characters copied.  The
00122  * password set is for 16-byte passwords, the password2 is for 20-byte
00123  * passwords.
00124  */
00125 int ipmi_user_get_name_len(ipmi_user_t *user, unsigned int *len);
00126 int ipmi_user_get_name(ipmi_user_t *user, char *name, unsigned int *len);
00127 int ipmi_user_set_name(ipmi_user_t *user, char *name, unsigned int len);
00128 int ipmi_user_set_password(ipmi_user_t *user, char *pw, unsigned int len);
00129 int ipmi_user_set_password2(ipmi_user_t *user, char *pw, unsigned int len);
00130 
00131 /*
00132  * Various bits of information about a user, this is per-channel.
00133  */
00134 int ipmi_user_get_link_auth_enabled(ipmi_user_t *user, unsigned int *val);
00135 int ipmi_user_set_link_auth_enabled(ipmi_user_t *user, unsigned int val);
00136 int ipmi_user_get_msg_auth_enabled(ipmi_user_t *user, unsigned int *val);
00137 int ipmi_user_set_msg_auth_enabled(ipmi_user_t *user, unsigned int val);
00138 int ipmi_user_get_access_cb_only(ipmi_user_t *user, unsigned int *val);
00139 int ipmi_user_set_access_cb_only(ipmi_user_t *user, unsigned int val);
00140 int ipmi_user_get_privilege_limit(ipmi_user_t *user, unsigned int *val);
00141 int ipmi_user_set_privilege_limit(ipmi_user_t *user, unsigned int val);
00142 int ipmi_user_get_session_limit(ipmi_user_t *user, unsigned int *val);
00143 int ipmi_user_set_session_limit(ipmi_user_t *user, unsigned int val);
00144 
00145 /*
00146  * The enable for the user.  Note that the enable value cannot be
00147  * fetched and will return an error unless set.
00148  */
00149 int ipmi_user_get_enable(ipmi_user_t *user, unsigned int *val);
00150 int ipmi_user_set_enable(ipmi_user_t *user, unsigned int val);
00151 
00152 
00153 /*
00154  * Normally only the fields set for a user are actually modified.
00155  * This will force all fields to be written.
00156  */
00157 int ipmi_user_set_all(ipmi_user_t *user);
00158 
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162 
00163 #endif /* _IPMI_USER_H */

© sourcejam.com 2005-2008