xref: /titanic_52/usr/src/cmd/isns/isnsd/isns_scn.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
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_SCN_H
28*fcf3ce44SJohn Forte #define	_ISNS_SCN_H
29*fcf3ce44SJohn Forte 
30*fcf3ce44SJohn Forte #ifdef __cplusplus
31*fcf3ce44SJohn Forte extern "C" {
32*fcf3ce44SJohn Forte #endif
33*fcf3ce44SJohn Forte 
34*fcf3ce44SJohn Forte /* raw scn data type */
35*fcf3ce44SJohn Forte typedef struct scn_raw {
36*fcf3ce44SJohn Forte 	uint32_t event;
37*fcf3ce44SJohn Forte 	int type;
38*fcf3ce44SJohn Forte 	uint32_t uid;
39*fcf3ce44SJohn Forte 	uchar_t *iscsi;
40*fcf3ce44SJohn Forte 	uint32_t ref;
41*fcf3ce44SJohn Forte 	uint32_t ilen;
42*fcf3ce44SJohn Forte 	uint32_t nt;
43*fcf3ce44SJohn Forte 	in6_addr_t *ip;
44*fcf3ce44SJohn Forte 	uint32_t port;
45*fcf3ce44SJohn Forte 	uint32_t dd_id;
46*fcf3ce44SJohn Forte 	uint32_t dds_id;
47*fcf3ce44SJohn Forte } scn_raw_t;
48*fcf3ce44SJohn Forte 
49*fcf3ce44SJohn Forte /* scn context data type */
50*fcf3ce44SJohn Forte typedef struct scn_text {
51*fcf3ce44SJohn Forte 	int flag;
52*fcf3ce44SJohn Forte 	uint32_t ref;
53*fcf3ce44SJohn Forte 	uint32_t uid;
54*fcf3ce44SJohn Forte 	uchar_t *iscsi;
55*fcf3ce44SJohn Forte 	uint32_t ilen;
56*fcf3ce44SJohn Forte 	uint32_t nt;
57*fcf3ce44SJohn Forte 	uint32_t dd_id;
58*fcf3ce44SJohn Forte 	uint32_t dds_id;
59*fcf3ce44SJohn Forte 	struct scn_text *next;
60*fcf3ce44SJohn Forte } scn_text_t;
61*fcf3ce44SJohn Forte 
62*fcf3ce44SJohn Forte /* portal data type stroed in scn registry */
63*fcf3ce44SJohn Forte typedef struct scn_portal {
64*fcf3ce44SJohn Forte 	uint32_t uid;
65*fcf3ce44SJohn Forte 	int sz;
66*fcf3ce44SJohn Forte 	union {
67*fcf3ce44SJohn Forte 		in_addr_t in;
68*fcf3ce44SJohn Forte 		in6_addr_t *in6;
69*fcf3ce44SJohn Forte 	} ip;
70*fcf3ce44SJohn Forte 	uint32_t port;
71*fcf3ce44SJohn Forte 	uint32_t ref;
72*fcf3ce44SJohn Forte 	int so;
73*fcf3ce44SJohn Forte 	struct scn_portal *next;
74*fcf3ce44SJohn Forte } scn_portal_t;
75*fcf3ce44SJohn Forte 
76*fcf3ce44SJohn Forte typedef struct scn_list {
77*fcf3ce44SJohn Forte 	union {
78*fcf3ce44SJohn Forte 		scn_text_t *text;
79*fcf3ce44SJohn Forte 		scn_portal_t *portal;
80*fcf3ce44SJohn Forte 	} data;
81*fcf3ce44SJohn Forte 	struct scn_list *next;
82*fcf3ce44SJohn Forte } scn_list_t;
83*fcf3ce44SJohn Forte 
84*fcf3ce44SJohn Forte /* scn trigger uint */
85*fcf3ce44SJohn Forte typedef struct scn {
86*fcf3ce44SJohn Forte 	uint32_t event;
87*fcf3ce44SJohn Forte 	union {
88*fcf3ce44SJohn Forte 		scn_raw_t *raw;
89*fcf3ce44SJohn Forte 		scn_list_t *list;
90*fcf3ce44SJohn Forte 	} data;
91*fcf3ce44SJohn Forte 	struct scn *next;
92*fcf3ce44SJohn Forte } scn_t;
93*fcf3ce44SJohn Forte 
94*fcf3ce44SJohn Forte /* scn registry list */
95*fcf3ce44SJohn Forte typedef struct scn_registry {
96*fcf3ce44SJohn Forte 	uint32_t uid;
97*fcf3ce44SJohn Forte 	uchar_t *name;
98*fcf3ce44SJohn Forte 	uint32_t nlen;
99*fcf3ce44SJohn Forte 	uint32_t bitmap;
100*fcf3ce44SJohn Forte 	union {
101*fcf3ce44SJohn Forte 		scn_portal_t *p;
102*fcf3ce44SJohn Forte 		scn_list_t *l;
103*fcf3ce44SJohn Forte 	} portal;
104*fcf3ce44SJohn Forte 	scn_t *scn;
105*fcf3ce44SJohn Forte 	struct scn_registry *next;
106*fcf3ce44SJohn Forte } scn_registry_t;
107*fcf3ce44SJohn Forte 
108*fcf3ce44SJohn Forte 
109*fcf3ce44SJohn Forte /* function prototypes */
110*fcf3ce44SJohn Forte void *scn_proc(void *);
111*fcf3ce44SJohn Forte 
112*fcf3ce44SJohn Forte int scn_list_load(uint32_t, uchar_t *, uint32_t, uint32_t);
113*fcf3ce44SJohn Forte int verify_scn_portal(void);
114*fcf3ce44SJohn Forte int add_scn_entry(uchar_t *, uint32_t, uint32_t);
115*fcf3ce44SJohn Forte int remove_scn_entry(uchar_t *);
116*fcf3ce44SJohn Forte int remove_scn_portal(uint32_t);
117*fcf3ce44SJohn Forte int make_scn(uint32_t, isns_obj_t *);
118*fcf3ce44SJohn Forte 
119*fcf3ce44SJohn Forte int connect_to(int, in_addr_t, in6_addr_t *, uint32_t);
120*fcf3ce44SJohn Forte 
121*fcf3ce44SJohn Forte #ifdef __cplusplus
122*fcf3ce44SJohn Forte }
123*fcf3ce44SJohn Forte #endif
124*fcf3ce44SJohn Forte 
125*fcf3ce44SJohn Forte #endif /* _ISNS_SCN_H */
126