/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file include internal used definition and data structure of hooks
*/
#ifndef _SYS_HOOK_IMPL_H
#define _SYS_HOOK_IMPL_H
#include <sys/condvar_impl.h>
#include <sys/netstack.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum fwflag_e {
} fwflag_t;
typedef struct flagwait_s {
} flagwait_t;
/*
* The following diagram describes the linking together of data structures
* used in this implementation of callback hooks. The start of it all is
* the "familylist" variable in hook.c. The relationships between data
* structures is:
* - there is a list of hook families;
* - each hook family can have a list of hook events;
* - each hook_event_t must be uniquely associated with one family and event;
* - each hook event can have a list of registered hooks to call.
*
* familylist +--------------+
* | | hook_event_t |<--\
* | +--------------+ |
* V |
* +-------------------+ ->+------------------+ | ->+--------------+
* | hook_family_int_t | / | hook_event_int_t | | / | hook_int_t |
* | +---------------+ | / | | / / | +----------+ |
* | | hook_family_t | | / | hei_event---------/ / | | hook_t | |
* | +---------------+ | / | hei_nhead----------\ / | +----------+ |
* | | / | | X | |
* | hfi_head------------/ | hei_head-----------/ \ | hi_entry--\ |
* | hfi_entry--\ | | hei_entry--\ | | +-----------|--+
* +------------|------+ +------------|-----+ | |
* | | | |
* V V | V
* +-------------------+ +------------------+ | +--------------+
* | hook_family_int_t | | hook_event_int_t | | | hook_int_t |
* V
* +--------------+
* |
* ...
*/
typedef struct hook_hook_kstat {
/*
* hook_int: internal storage of hook
*/
typedef struct hook_int {
char *hi_ksname;
} hook_int_t;
/*
* hook_int_head: tail queue of hook_int
*/
typedef struct hook_notify {
void *hn_arg;
typedef struct hook_event_kstat {
/*
* hook_event_int: internal storage of hook_event
*/
typedef struct hook_event_int {
/*
* hook_event_int_head: singly-linked list of hook_event_int
*/
/*
* hook_family_int: internal storage of hook_family
*/
typedef struct hook_family_int {
/*
* hook_family_int_head: singly-linked list of hook_family
*/
/*
* hook stack instances
*/
struct hook_stack {
int hks_shutdown;
};
/*
* Names of hooks families currently defined by Solaris
*/
extern int hook_event_notify_register(hook_family_int_t *, char *,
hook_notify_fn_t, void *);
extern int hook_event_notify_unregister(hook_family_int_t *, char *,
void **);
void *);
extern int hook_family_remove(hook_family_int_t *);
extern int hook_family_shutdown(hook_family_int_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_HOOK_IMPL_H */