xref: /onnv-gate/usr/src/cmd/isns/isnsd/isns_esi.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM 
22*7836SJohn.Forte@Sun.COM /*
23*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
25*7836SJohn.Forte@Sun.COM  */
26*7836SJohn.Forte@Sun.COM 
27*7836SJohn.Forte@Sun.COM #ifndef	_ISNS_ESI_H
28*7836SJohn.Forte@Sun.COM #define	_ISNS_ESI_H
29*7836SJohn.Forte@Sun.COM 
30*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
31*7836SJohn.Forte@Sun.COM extern "C" {
32*7836SJohn.Forte@Sun.COM #endif
33*7836SJohn.Forte@Sun.COM 
34*7836SJohn.Forte@Sun.COM typedef enum {
35*7836SJohn.Forte@Sun.COM 	EV_ESI = 1,
36*7836SJohn.Forte@Sun.COM 	EV_REG_EXP
37*7836SJohn.Forte@Sun.COM } ev_type_t;
38*7836SJohn.Forte@Sun.COM 
39*7836SJohn.Forte@Sun.COM #define	EV_FLAG_INIT	(0x01)
40*7836SJohn.Forte@Sun.COM #define	EV_FLAG_AGAIN	(0x02)
41*7836SJohn.Forte@Sun.COM #define	EV_FLAG_WAKEUP	(0x04)
42*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REMOVE	(0x08)
43*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REM_P1	(0x10)
44*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REM_P2	(0x20)
45*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REM_P3	(0x40)
46*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REM_P4	(0x80)
47*7836SJohn.Forte@Sun.COM 
48*7836SJohn.Forte@Sun.COM #define	EV_FLAG_REM_P	(0xF0)
49*7836SJohn.Forte@Sun.COM 
50*7836SJohn.Forte@Sun.COM typedef struct esi_portal {
51*7836SJohn.Forte@Sun.COM 	int sz;
52*7836SJohn.Forte@Sun.COM 	in_addr_t ip4;
53*7836SJohn.Forte@Sun.COM 	in6_addr_t *ip6;
54*7836SJohn.Forte@Sun.COM 	uint32_t port;
55*7836SJohn.Forte@Sun.COM 	uint32_t esip;
56*7836SJohn.Forte@Sun.COM 	uint32_t ref;
57*7836SJohn.Forte@Sun.COM 	int so;
58*7836SJohn.Forte@Sun.COM 	struct esi_portal *next;
59*7836SJohn.Forte@Sun.COM } esi_portal_t;
60*7836SJohn.Forte@Sun.COM 
61*7836SJohn.Forte@Sun.COM typedef struct ev {
62*7836SJohn.Forte@Sun.COM 	ev_type_t type;
63*7836SJohn.Forte@Sun.COM 	uint32_t uid;
64*7836SJohn.Forte@Sun.COM 	uint32_t intval;
65*7836SJohn.Forte@Sun.COM 	int flags;
66*7836SJohn.Forte@Sun.COM 	uchar_t *eid;
67*7836SJohn.Forte@Sun.COM 	uint32_t eid_len;
68*7836SJohn.Forte@Sun.COM 	esi_portal_t *portal;
69*7836SJohn.Forte@Sun.COM 	pthread_mutex_t mtx;
70*7836SJohn.Forte@Sun.COM 	struct ev *next;
71*7836SJohn.Forte@Sun.COM } ev_t;
72*7836SJohn.Forte@Sun.COM 
73*7836SJohn.Forte@Sun.COM /* function prototypes */
74*7836SJohn.Forte@Sun.COM int esi_load(uint32_t, uchar_t *, uint32_t);
75*7836SJohn.Forte@Sun.COM int esi_add(uint32_t, uchar_t *, uint32_t);
76*7836SJohn.Forte@Sun.COM int esi_remove(uint32_t);
77*7836SJohn.Forte@Sun.COM int esi_remove_obj(const isns_obj_t *, int);
78*7836SJohn.Forte@Sun.COM int verify_esi_portal();
79*7836SJohn.Forte@Sun.COM uint32_t get_stopwatch(int);
80*7836SJohn.Forte@Sun.COM uint32_t ev_intval(void *);
81*7836SJohn.Forte@Sun.COM int ev_match(void *, uint32_t);
82*7836SJohn.Forte@Sun.COM int ev_remove(void *, uint32_t, int, int);
83*7836SJohn.Forte@Sun.COM void ev_free(void *);
84*7836SJohn.Forte@Sun.COM int evf_init(void *);
85*7836SJohn.Forte@Sun.COM int evf_again(void *);
86*7836SJohn.Forte@Sun.COM int evf_wakeup(void *);
87*7836SJohn.Forte@Sun.COM int evf_rem(void *);
88*7836SJohn.Forte@Sun.COM int evf_rem_pending(void *);
89*7836SJohn.Forte@Sun.COM void evf_zero(void *);
90*7836SJohn.Forte@Sun.COM 
91*7836SJohn.Forte@Sun.COM void evl_append(void *);
92*7836SJohn.Forte@Sun.COM void evl_strip(void *);
93*7836SJohn.Forte@Sun.COM int evl_remove(uint32_t, uint32_t, int);
94*7836SJohn.Forte@Sun.COM 
95*7836SJohn.Forte@Sun.COM void *esi_proc(void *);
96*7836SJohn.Forte@Sun.COM 
97*7836SJohn.Forte@Sun.COM void portal_dies(uint32_t);
98*7836SJohn.Forte@Sun.COM void reg_expiring(void *);
99*7836SJohn.Forte@Sun.COM 
100*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
101*7836SJohn.Forte@Sun.COM }
102*7836SJohn.Forte@Sun.COM #endif
103*7836SJohn.Forte@Sun.COM 
104*7836SJohn.Forte@Sun.COM #endif /* _ISNS_ESI_H */
105