xref: /illumos-gate/usr/src/cmd/isns/isnsd/isns_scn.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ISNS_SCN_H
28 #define	_ISNS_SCN_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* raw scn data type */
35 typedef struct scn_raw {
36 	uint32_t event;
37 	int type;
38 	uint32_t uid;
39 	uchar_t *iscsi;
40 	uint32_t ref;
41 	uint32_t ilen;
42 	uint32_t nt;
43 	in6_addr_t *ip;
44 	uint32_t port;
45 	uint32_t dd_id;
46 	uint32_t dds_id;
47 } scn_raw_t;
48 
49 /* scn context data type */
50 typedef struct scn_text {
51 	int flag;
52 	uint32_t ref;
53 	uint32_t uid;
54 	uchar_t *iscsi;
55 	uint32_t ilen;
56 	uint32_t nt;
57 	uint32_t dd_id;
58 	uint32_t dds_id;
59 	struct scn_text *next;
60 } scn_text_t;
61 
62 /* portal data type stroed in scn registry */
63 typedef struct scn_portal {
64 	uint32_t uid;
65 	int sz;
66 	union {
67 		in_addr_t in;
68 		in6_addr_t *in6;
69 	} ip;
70 	uint32_t port;
71 	uint32_t ref;
72 	int so;
73 	struct scn_portal *next;
74 } scn_portal_t;
75 
76 typedef struct scn_list {
77 	union {
78 		scn_text_t *text;
79 		scn_portal_t *portal;
80 	} data;
81 	struct scn_list *next;
82 } scn_list_t;
83 
84 /* scn trigger uint */
85 typedef struct scn {
86 	uint32_t event;
87 	union {
88 		scn_raw_t *raw;
89 		scn_list_t *list;
90 	} data;
91 	struct scn *next;
92 } scn_t;
93 
94 /* scn registry list */
95 typedef struct scn_registry {
96 	uint32_t uid;
97 	uchar_t *name;
98 	uint32_t nlen;
99 	uint32_t bitmap;
100 	union {
101 		scn_portal_t *p;
102 		scn_list_t *l;
103 	} portal;
104 	scn_t *scn;
105 	struct scn_registry *next;
106 } scn_registry_t;
107 
108 
109 /* function prototypes */
110 void *scn_proc(void *);
111 
112 int scn_list_load(uint32_t, uchar_t *, uint32_t, uint32_t);
113 int verify_scn_portal(void);
114 int add_scn_entry(uchar_t *, uint32_t, uint32_t);
115 int remove_scn_entry(uchar_t *);
116 int remove_scn_portal(uint32_t);
117 int make_scn(uint32_t, isns_obj_t *);
118 
119 int connect_to(int, in_addr_t, in6_addr_t *, uint32_t);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* _ISNS_SCN_H */
126