mgmt_util.h revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MGMT_UTIL_H
#define _MGMT_UTIL_H
#include <stdio.h>
#include <limits.h>
#include <libnvpair.h>
#include <libscf.h>
#include "mms.h"
#include "mgmt_sym.h"
/* Generic parsing constant */
#define WHITESPACE " \11\12\15"
/* define commonly used string lengths */
#define MAXSERIALNUMLEN MAXNAMELEN
/* define commonly-used paths */
#define PROCDIR "/proc"
#define TAPEDEVDIR "/dev/rmt"
#define TMP_DIR "/tmp"
/* define commonly used sizes */
/* SMF service states */
typedef enum {
/* data structures for setting options */
typedef struct {
char *name;
char *mmpopt;
char *defval;
int (*validate_func)(char *val);
if (errs) { \
} \
}
} \
}
/* function prototypes */
int
char *cmd[]);
int
/*
* mms_gen_taskid()
*
* Parameters:
* - tid unique task identifier
*
* This function returns a task identifier (TID). All responses to an MMP
* command will include the TID of the initiating command. The TID will be
* unique in the context of a session so that the client can determine which
* responses go with which command. tid must be a buffer of at least 128 bytes.
*/
int mms_gen_taskid(char *tid);
/*
* create_mm_clnt()
*/
int
int
char *fmri,
char **original);
int
int cp_file(
const char *old,
const char *new);
/* helper function to use read() correctly */
int
/*
* mk_wc_path()
*
* Function to generate a path name for working copies of
* files and creates the file.
*/
int
char *original, /* IN - path to original file */
/*
* make_working_copy()
*
* Copies a file to the default temporary location and returns
* the pathname of the copy.
*
*/
int
int
void
mgmt_unsetall_cfgvar(void);
int
/* helper function for MMS lists */
void
mms_list_free_and_destroy(mms_list_t *, void (*)(void *));
/* helper validation functions */
int val_numonly(char *val);
int val_passwd(char *val);
int val_objtype(char *val);
int val_truefalse(char *val);
int val_mms_size(char *val);
int val_density(char *val);
/* MMP helper functions */
int
int
int
int
int
int
void
void
char **
void
int
int
int
const char *
mms_mgmt_get_errstr(int errcode);
int
mgmt_chk_auth(char *authname);
int
void
#endif /* _MGMT_UTIL_H */