ipclassifier.h revision ee4701ba584519e1c0863c954f4b88202c87851b
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _INET_IPCLASSIFIER_H
#define _INET_IPCLASSIFIER_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* ==============================
* = The CONNECTION =
* ==============================
*/
/*
* The connection structure contains the common information/flags/ref needed.
* Implementation will keep the connection struct, the layers (with their
* respective data for event i.e. tcp_t if event was tcp_input) all in one
* contiguous memory location.
*/
/* Conn Flags */
/* Flags identifying the type of conn */
#define IPCL_SCTPCONN 0x00000002
#define IPCL_IPCCONN 0x00000004
/* Conn Masks */
#define IPCL_REMOVED 0x00000020
#define IPCL_REUSED 0x00000040
#define IPCL_IS_TCP4(connp) \
#define IPCL_IS_TCP4_CONNECTED_NO_POLICY(connp) \
(((connp)->conn_flags & \
== (IPCL_TCP4|IPCL_CONNECTED))
#define IPCL_IS_CONNECTED(connp) \
#define IPCL_IS_BOUND(connp) \
#define IPCL_IS_TCP4_BOUND(connp) \
(((connp)->conn_flags & \
#define IPCL_IS_FULLY_BOUND(connp) \
#define IPCL_IS_TCP(connp) \
/*
* IPCL_UDP is set on the conn when udp is directly above ip;
* this flag is cleared the moment udp is popped.
*/
#define IPCL_IS_UDP(connp) \
#define IPCL_IS_IPTUN(connp) \
typedef struct
{
int ctb_depth;
#define IP_STACK_DEPTH 15
} conn_trace_t;
struct conn_s {
unsigned int
/*
* This option can take on values in [-1, 1] so we store it
* +1. Manifest constants IPV6_USE_MIN_MTU_* describe these
* values.
*/
conn_nexthop_set : 1,
pad_to_bit_31 : 1;
void *conn_pad1;
void *conn_void[1];
struct {
union {
/* Used for classifier match performance */
struct {
} tcpu_ports;
} u_port;
/* this is used only when an unbind is in progress.. */
int conn_ilg_allocated; /* Number allocated */
int conn_ilg_inuse; /* Number currently used */
int conn_ilg_walker_cnt; /* No of ilg walkers */
/* XXXX get rid of this, once ilg_delete_all is fixed */
int conn_orig_bound_ifindex; /* BOUND_IF before MOVE */
/* IPv6 MC IF before MOVE */
int conn_orig_xmit_ifindex; /* IP_XMIT_IF before move */
/* mtuinfo from IPV6_PACKET_TOO_BIG conditional on conn_pathmtu_valid */
struct ip6_mtuinfo mtuinfo;
#ifdef CONN_DEBUG
#define CONN_TRACE_MAX 10
int conn_trace_last; /* ndx of last used tracebuf */
#endif
};
/*
* connf_t - connection fanout data.
*
* The hash tables and their linkage (conn_t.{hashnextp, hashprevp} are
* protected by the per-bucket lock. Each conn_t inserted in the list
* points back at the connf_t that heads the bucket.
*/
struct connf_s {
struct conn_s *connf_head;
};
#define CONN_INC_REF(connp) { \
}
#define CONN_INC_REF_LOCKED(connp) { \
}
#define CONN_DEC_REF(connp) { \
/* Refcnt can't increase again, safe to drop lock */ \
} else { \
} \
}
#define _IPCL_V4_MATCH_ANY(addr) \
/*
* IPCL_PROTO_MATCH() only matches conns with the specified zoneid, while
* IPCL_PROTO_MATCH_V6() can match other conns in the multicast case, see
* ip_fanout_proto().
*/
fanout_flags, zoneid) \
((protocol) == IPPROTO_RSVP)))
fanout_flags, zoneid) \
!(connp)->conn_ipv6_v6only)
}
}
!(connp)->conn_ipv6_v6only)
!(connp)->conn_ipv6_v6only)
}
}
#define ipcl_proto_search(protocol) \
#define CONN_G_HASH_SIZE 1024
/* Raw socket hash function. */
/*
* This is similar to IPCL_BIND_MATCH except that the local port check
* is changed to a wildcard port check.
*/
(connp)->conn_lport == 0 && \
(connp)->conn_lport == 0 && \
/* hash tables */
extern connf_t rts_clients;
extern connf_t *ipcl_conn_fanout;
extern connf_t *ipcl_bind_fanout;
extern connf_t *ipcl_udp_fanout;
extern connf_t *ipcl_globalhash_fanout;
extern connf_t *ipcl_raw_fanout;
extern uint_t ipcl_conn_fanout_size;
extern uint_t ipcl_bind_fanout_size;
extern uint_t ipcl_udp_fanout_size;
extern uint_t ipcl_raw_fanout_size;
/* Function prototypes */
extern void ipcl_init(void);
extern void ipcl_destroy(void);
extern void ipcl_conn_destroy(conn_t *);
void ipcl_hash_remove(conn_t *);
uint16_t);
uint32_t);
void ipcl_globalhash_insert(conn_t *);
void ipcl_globalhash_remove(conn_t *);
int conn_trace_ref(conn_t *);
int conn_untrace_ref(conn_t *);
#ifdef __cplusplus
}
#endif
#endif /* _INET_IPCLASSIFIER_H */