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