libilb_impl.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 _LIBILB_IMPL_H
#define _LIBILB_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <netdb.h>
#include <libilb.h>
#include <thread.h>
#include <synch.h>
#if !defined max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
/* The UNIX domain socket path to talk to ilbd. */
#define SOCKET_PATH "/var/run/daemon/ilb_sock"
/* The max message size for communicating with ilbd */
#define ILBD_MSG_SIZE 102400
/*
* moral equivalent of ntohl for IPv6 addresses, MSB and LSB (64 bit each),
* assign to uint64_t variables
*/
#define INV6_N2H_MSB64(addr) \
#define INV6_N2H_LSB64(addr) \
/*
* moral equiv. of htonl of MSB and LSB 64-bit portions to an IPv6 address
*/
else \
do { \
if (IN6_IS_ADDR_V4MAPPED(_i)) { \
} else { \
} \
} while (0)
typedef enum {
ILBD_BAD_CMD = 0,
/* servergroup commands */
ILBD_RETRIEVE_SG_NAMES, /* names of all SGs registered */
ILBD_RETRIEVE_SG_HOSTS, /* all hosts for a given SG (hndl) */
ILBD_SRV_ADDR2ID, /* fill in serverID for given address */
ILBD_SRV_ID2ADDR, /* fill in address from given serverID */
/* rule commands */
ILBD_SHOW_NAT, /* list the NAT table */
ILBD_SHOW_PERSIST, /* list the sticky table */
ILBD_CMD_OK, /* Requested operation succeeds. */
ILBD_CMD_ERROR /* Rquested operation fails. */
} ilbd_cmd_t;
typedef struct sg_srv {
} ilb_sg_srv_t;
typedef struct sg_info {
char sg_name[ILB_SGNAME_SZ];
typedef char ilbd_name_t[ILB_NAMESZ];
typedef struct ilbd_namelist {
typedef struct rule_info {
char rl_name[ILB_NAMESZ];
struct in6_addr rl_nat_src_start;
struct in6_addr rl_nat_src_end;
struct in6_addr rl_stickymask;
char rl_sgname[ILB_SGNAME_SZ];
char rl_hcname[ILB_NAMESZ];
/*
* Struct to represent show NAT request and reply.
*
* sn_num: (request) indicates the number of entries wanted;
* (reply) the number of entries returned;
*/
typedef struct {
/*
* Struct to represent the set of servers associated with a hc object.
*
* rs_num_srvs: number of servers in this struct.
* rs_srvs: array of servers.
*/
typedef struct {
typedef struct ilb_handle_impl {
int h_socket;
/*
* Communication flags used in ilb_comm_t.
*
* ILB_COMM_END: end of communication
*/
#define ILB_COMM_END 0x1
/*
* The message structure used to communicate with ilbd.
*
* ic_cmd: the message type.
* ic_flags: communication flags
* ic_data: message data (is uint32_t aligned).
*/
typedef struct {
} ilb_comm_t;
size_t *);
void i_ilb_close_comm(ilb_handle_t);
size_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBILB_IMPL_H */