ilbadm.h revision dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ILBADM_H
#define _ILBADM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
#include <libilb.h>
#include <libintl.h>
#include <locale.h>
#define ILBADM_VERSION "1.0"
#define ILBADM_COPYRIGHT \
"Copyright 2009 Sun Microsystems, Inc. All rights reserved.\n" \
"Use is subject to license terms.\n"
/*
* flag values
*/
#define OPT_VALUE_LIST 0x0001
#define OPT_IP_RANGE 0x0002
#define OPT_PORTS 0x0004
#define OPT_PORTS_ONLY 0x0008
#define OPT_NAT 0x0010
#define OPT_NUMERIC_ONLY 0x0020
#define ILBD_BAD_VAL (-1)
#define ILBADM_LIST_FULL 0x0001
#define ILBADM_LIST_PARSE 0x0002
#define ILBADM_LIST_ENABLED 0x0004
#define ILBADM_LIST_NOENABLED (~ILBADM_LIST_ENABLED)
#define ILBADM_LIST_DISABLED 0x0008
#define ILBADM_LIST_NODISABLED (~ILBADM_LIST_DISABLED)
#define ILBADM_IMPORT_PRESERVE 0x1000
#define ILBD_NAMESZ ILB_NAMESZ
#define ILB_MAX_PORT UINT16_MAX
typedef enum {
ILBADM_OK = 0,
ILBADM_ASSIGNREQ, /* assignment '=' required */
ILBADM_EINVAL, /* invalid value */
ILBADM_ENOMEM, /* malloc failed */
ILBADM_ENOOPTION, /* mandatory option missing */
ILBADM_ENOPROTO, /* protocol not found in database */
ILBADM_ENOPROXY, /* proxy-src is missing */
ILBADM_ENOSERVICE, /* servicename not found in database */
ILBADM_ENOSGNAME, /* servergroup name missing */
ILBADM_ENORULE, /* rulename missing or no such rule */
ILBADM_ENOSERVER, /* rulename missing or no such rule */
ILBADM_EXPORTFAIL, /* too little space to do export servergroup */
ILBADM_FAIL, /* processing of command failed */
ILBADM_HCPRINT, /* failed to print healthcheck */
ILBADM_INVAL_ADDR, /* invalid address */
ILBADM_INVAL_AF, /* invalid address family */
ILBADM_INVAL_ALG, /* LB algorithm failure */
ILBADM_INVAL_ARGS, /* invalid arguments to command */
ILBADM_INVAL_COMMAND, /* invalid command */
ILBADM_INVAL_KEYWORD, /* invalid keyword */
ILBADM_INVAL_OPER, /* invalid operation type */
ILBADM_INVAL_PORT, /* invalid value specified for port */
ILBADM_INVAL_PROXY, /* proxy-src not allowed */
ILBADM_INVAL_SYNTAX, /* syntax error */
ILBADM_INVAL_SRVID, /* server id is invalid (missing "_" ?) */
ILBADM_LIBERR, /* translation of libilb errors. We also */
/* set it in ilbadm fuctions to indicate */
/* printing of non-generic error messages */
ILBADM_NORECURSIVE, /* recursive import not allowed */
ILBADM_TOOMANYIPADDR, /* too many addresses */
ILBADM_NOKEYWORD_VAL /* no value specified for a keyword */
typedef enum {
ILB_KEY_BAD = -1,
ILB_KEY_SERVRANGE, /* pseudo-key for SG creation */
ILB_KEY_CONNDRAIN, /* otional timers ... */
/*
* we need a few codes for commands, can't use libilb ones
*/
typedef enum {
} ilbadm_cmd_t;
/* filched from snoop_ether.c */
typedef struct val_type {
int v_type;
char v_name[20];
typedef struct key_names {
char k_name[20];
typedef struct servnode {
typedef struct sgroup {
int sg_count;
char *sg_name;
typedef struct cmd_hlp {
char *h_help;
typedef ilbadm_status_t (* cmdfunc_t)(int, char **);
typedef struct cmd_names {
char c_name[25];
ilbadm_status_t ilbadm_add_server_to_group(int, char **);
ilbadm_status_t ilbadm_create_servergroup(int, char **);
ilbadm_status_t ilbadm_destroy_servergroup(int, char **);
ilbadm_status_t ilbadm_rem_server_from_group(int, char **);
ilbadm_status_t ilbadm_create_rule(int, char **);
ilbadm_status_t ilbadm_destroy_rule(int, char **);
ilbadm_status_t ilbadm_enable_rule(int, char **);
ilbadm_status_t ilbadm_disable_rule(int, char **);
ilbadm_status_t ilbadm_show_server(int, char **);
ilbadm_status_t ilbadm_enable_server(int, char **);
ilbadm_status_t ilbadm_disable_server(int, char **);
ilbadm_status_t ilbadm_show_servergroups(int, char **);
ilbadm_status_t ilbadm_show_rules(int, char **);
ilbadm_status_t ilbadm_show_stats(int, char **);
ilbadm_status_t ilbadm_create_hc(int, char **);
ilbadm_status_t ilbadm_destroy_hc(int, char **);
ilbadm_status_t ilbadm_show_hc(int, char **);
ilbadm_status_t ilbadm_show_hc_result(int, char **);
ilbadm_status_t ilbadm_noimport(int, char **);
ilbadm_status_t ilbadm_show_nat(int, char **);
ilbadm_status_t ilbadm_show_persist(int, char **);
int, int *);
ilbadm_status_t ilbadm_import(int, int, char *[], int);
ilbadm_status_t ilbadm_export(int, char *[]);
void print_cmdlist_short(char *, FILE *);
longlong_t *);
char *i_str_from_val(int, ilbadm_val_type_t *);
char *ilbadm_key_to_opt(ilbadm_key_code_t);
void Usage(char *);
void unknown_opt(char **, int);
const char *ilbadm_errstr(ilbadm_status_t);
void ilbadm_err(const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif /* _ILBADM_H */