/*
* 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 _INET_ILB_CONN_H
#define _INET_ILB_CONN_H
#ifdef __cplusplus
extern "C" {
#endif
struct ilb_conn_s;
/*
* Struct of the conn hash table bucket
*
* ilb_connp: the first conn hash entry in the bucket
* ilb_conn_hash_lock: mutex to protect the list in the bucket
* ilb_conn_cnt: number of conn hash entries in this bucket
*/
typedef struct ilb_conn_hash_s {
#else
#endif
/*
* to a rule or server.
*/
typedef struct ilb_rule_info_s {
/* Info about a TCP connection for tracking */
struct ilb_tcp_track {
};
/*
* Struct to store NAT info of a connection (one direction)
*
* conn_daddr: destination address to be matched to find this info
* conn_saddr: source address to be matched
* conn_dport: destination port to be matched
* conn_sport: source port to be matched
* conn_ip_sum: IP checksum adjustment for NAT
* conn_tp_sum: tranport checksum adjustment for NAT
* conn_tcp_track: TCP connection tracking info
* conn_atime: last access time of this conn cache
* conn_pkt_cnt: packets processed using this conn
* conn_next: next conn info (for conn info linked list)
* conn_prev: previous conn info (for conn info linked list)
* conn_hash: back pointer to the conn hash table bucket
*/
struct ilb_conn_info {
/* Last access time */
};
/*
* Struct (an entry in the conn hash table) to store a NAT info of a
* connection (both directions, client to server and server to client)
*
* conn_l4: transport protocol used in this NAT connection
* conn_expry: expiry time of this entry
* conn_cr_time: creation time of this entry
* conn_c2s: client to back end server info
* conn_s2c_ back end server to client info
* conn_server: pointer to the back end server structure
* conn_rule_cache: rule information needed for this entry (copied from
* the ilb_rule_t struct)
* conn_sticky: pointer to the sticky info of this client, used to do
* reference counting on the sticky info.
* conn_gc: indicates whether this entry needs to be garbage collected
*/
typedef struct ilb_conn_s {
int conn_l4;
/* Client to server, hash and check info */
/* Server to client, hash and check info */
/*
* If the rule is sticky enabled, all ilb_conn_t created from this
* rule will have conn_sticky set to the ilb_sticky_t entry. Otherwise
* conn_sticky is NULL.
*/
} ilb_conn_t;
/*
* Struct of the sticky hash table bucket
*
* sticky_head: the sticky hash list of this bucket
* sticky_lock: mutex to protect the list
* sticki_cnt: number of sticky hash entries in this bucket
*/
typedef struct ilb_sticky_hash_s {
#else
#endif
/*
* Struct to store sticky info of a client.
*
* rule_instance: the rule instance for this entry, for look up purpose
* rule_name: the rule name for this entry
* server: the back end server for this client
* src: the client source address
* expire: the expiry time of this entry
* atime: the last access time of this entry
* nat_src_idx: the index to the NAT source array for this client
* refcnt: reference count
* list: linked list node
* hash: back pointer to the sticky hash buckey of this entry
*/
typedef struct ilb_sticky_s {
int nat_src_idx;
} ilb_sticky_t;
extern void ilb_conn_hash_init(ilb_stack_t *);
extern void ilb_conn_hash_fini(ilb_stack_t *);
extern void ilb_conn_cache_fini(void);
extern void ilb_sticky_hash_init(ilb_stack_t *);
extern void ilb_sticky_hash_fini(ilb_stack_t *);
extern void ilb_sticky_cache_fini(void);
void *, in6_addr_t *);
void ilb_sticky_refrele(struct ilb_sticky_s *);
#ifdef __cplusplus
}
#endif
#endif /* _INET_ILB_CONN_H */