/*
* 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 _LIBILB_H
#define _LIBILB_H
#ifdef __cplusplus
extern "C" {
#endif
/* make sure these values stay in sync with definitions in ilb.h! */
/*
* information whether we're interested in names or numerical information
*/
/*
* server status information
*/
/*
* macros to determine, and for some cases, set status of server
*/
#define ILB_IS_SRV_ENABLED(f) \
((f & ILB_FLAGS_SRV_ENABLED) == ILB_FLAGS_SRV_ENABLED)
/* producers of these statuses are libilb and ilbd functions */
typedef enum {
ILB_STATUS_OK = 0,
/* that of the servers */
/* rule port */
/* not being used by a rule */
/* server's */
} ilb_status_t;
typedef struct {
union {
} _au;
/* Supported load balancing algorithm type */
typedef enum {
} ilb_algo_t;
/* Supported load balancing method */
typedef enum {
} ilb_topo_t;
/*
* note: pointer to a non-existant struct
*/
/*
* Health check related information
*/
/* HC state of a server */
typedef enum {
/*
* Struct representing a server in a hc object
*
* hcs_rule_name: rule using this server
* hcs_ID: server ID
* hcs_hc_name: hc object this server is associated with
* hcs_IP: IP address of the server
* hcs_fail_cnt: number of fail hc probe
* hcs_status: hc status of the server
* hcs_rtt: (in microsec) smoothed average RTT to the server
* hcs_lasttime: last time hc test was done (as returned by time(2))
* hcs_nexttime: next time hc test will be done (as returned by (time(2))
*/
typedef struct {
} ilb_hc_srv_t;
/* Probe flags to be used in r_hcpflag in struct rule data. */
typedef enum {
/*
* Struct representing a hc object
*
* hci_name: name of the hc object
* hci_test: hc test to be done, TCP, UDP, or user supplied path name
* hci_timeout: (in sec) test time out
* hci_interval: (in sec) test execution interval
* hci_def_ping: true if default ping is done; false otherwise
*/
typedef struct {
typedef struct rule_data {
/* not all fields are valid in all calls where this is used */
typedef struct server_data {
/* assigned by system, not user */
/*
* Struct to represent a server group.
*
* sgd_name: server group name
* sgd_flags: flags
* sgd_srvcount: number of servers in the group (not used in sever group
* creation); filled in when used by call back function for
* ilb_walk_servergroups().
*/
typedef struct sg_data {
/*
* Struct to represent a NAT entry in kernel.
*
* nat_proto: transport protocol used in this NAT entry
*
* nat_out_global: IP address of client's request
* nat_out_global_port: port number of client's request
* nat_in_global: VIP of a rule for the NAT entry
* nat_in_global_port: port of a rule for the NAT entry
*
* nat_out_local: half NAT: IP address of client's request
* full NAT: NAT'ed IP addres of client' request
* nat_out_local_port: half NAT: port number of client's request
* full NAT: NAT'ed port number of client's request
* nat_in_local: IP address of back end server handling this request
* nat_in_local_port: port number in back end server handling thi request
*
* (*) IPv4 address is represented as IPv4 mapped IPv6 address.
*/
typedef struct {
/*
* Struct to represet a persistent entry in kernel.
*
* rule_name: the name of rule for a persistent entry
* req_addr: the client's IP address (*)
* srv_addr: the server's IP address (*) handling the client's request
*
* (*) IPv4 address is represented as IPv4 mapped IPv6 address.
*/
typedef struct {
/*
* Function prototype of the call back function of those walker functions.
*
* Note: the storage of the data item parameter (ilb_sg_data_t/
* ilb_server_data_/ilb_rule_data_t/ilb_hc_info_t/ilb_hc_srv_t) will be
* freed after calling the call back function. If the call back function
* needs to keep a copy of the data, it must copy the data content.
*/
void *);
const char *, void *);
void *);
void *);
void *);
/*
* ilb_open creates a session handle that every caller into
* libilb needs to use
*/
/*
* relinquish the session handle
*/
/* support and general functions */
const char *ilb_errstr(ilb_status_t);
/* rule-related functions */
void *);
/* servergroup functionality */
const char *, void *);
const char *, void *);
/* functions for individual servers */
const char *);
const char *);
/* health check-related functions */
const char *, void *);
/* To show NAT table entries of ILB */
boolean_t *);
/* To show persistent table entries of ILB */
boolean_t *);
/* PRIVATE */
#ifdef __cplusplus
}
#endif
#endif /* _LIBILB_H */