keysock.h revision 75d94465dbafa487b716482dc36d5150a4ec9853
/*
* 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_KEYSOCK_H
#define _INET_KEYSOCK_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Object to represent database of options to search passed to
* {sock,tpi}optcom_req() interface routine to take care of option
* management and associated methods.
*/
extern optdb_obj_t keysock_opt_obj;
extern uint_t keysock_max_optsize;
/*
* KEYSOCK stack instances
*/
struct keysock_stack {
/*
* keysock_plumbed: zero if plumb not attempted, positive if it
* succeeded, negative if it failed.
*/
int keystack_plumbed;
struct keysockparam_s *keystack_params;
/* Protects the NDD variables. */
/* List of open PF_KEY sockets, protected by keysock_list_lock. */
struct keysock_s *keystack_list;
/*
* Consumers table. If an entry is NULL, keysock maintains
* the table.
*/
#define KEYSOCK_MAX_CONSUMERS 256
/*
* atomic_cas_32() works best for a known 32-bit quantity.
*/
/*
* This integer counts the number of extended REGISTERed sockets. This
* determines if we should send extended REGISTERs.
*/
/*
* Global sequence space for SADB_ACQUIRE messages of any sort.
*/
};
typedef struct keysock_stack keysock_stack_t;
/*
* keysock session state (one per open PF_KEY socket (i.e. as a driver))
*
* I keep these in a linked list, and assign a monotonically increasing
* serial ## (which is also the minor number).
*/
typedef struct keysock_s {
/* Protected by keysock_list_lock. */
/* Also protected by keysock_list_lock. */
} keysock_t;
/* DANGER: Setting this requires EXTRA */
/* privilege on an MLS box. */
/* My apologies for the ugliness of this macro. And using constants. */
/*
* Keysock consumers (i.e. AH, ESP), in array based on sadb_msg_satype.
* For module instances.
*/
typedef struct keysock_consumer_s {
/* Other goodies as a need them. */
/* Can only set flags when keysock_consumer_lock is held. */
extern int keysock_plumb_ipsec(netstack_t *);
#ifdef __cplusplus
}
#endif
#endif /* _INET_KEYSOCK_H */