1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ISCSI_DOOR_H
#define _ISCSI_DOOR_H
#ifdef __cplusplus
extern "C" {
#endif
#define ISCSI_DOOR_REQ_SIGNATURE 0x53435349
#define ISCSI_DOOR_REQ_VERSION_1 1
#define ISCSI_DOOR_MAX_DATA_SIZE 8192
#define ISCSI_DOOR_GETIPNODEBYNAME_REQ 0x0000
#define ISCSI_DOOR_GETIPNODEBYNAME_CNF 0x4000
#define ISCSI_DOOR_ERROR_IND 0x8000
#define ISCSI_DOOR_STATUS_SUCCESS 0x00000000
#define ISCSI_DOOR_STATUS_REQ_LENGTH 0x00000001
#define ISCSI_DOOR_STATUS_REQ_FORMAT 0x00000002
#define ISCSI_DOOR_STATUS_REQ_INVALID 0x00000003
#define ISCSI_DOOR_STATUS_REQ_VERSION 0x00000004
#define ISCSI_DOOR_STATUS_MORE 0x00000005
typedef struct _iscsi_door_msg_hdr {
uint32_t signature;
uint32_t version;
uint32_t opcode;
uint32_t status;
} iscsi_door_msg_hdr_t;
typedef struct _getipnodebyname_req {
iscsi_door_msg_hdr_t hdr;
uint32_t name_offset;
uint32_t name_length;
uint32_t af;
uint32_t flags;
} getipnodebyname_req_t;
typedef struct _getipnodebyname_cnf {
iscsi_door_msg_hdr_t hdr;
uint32_t h_size_needed;
uint32_t h_addr_list_offset;
uint32_t h_addr_list_length;
uint32_t h_addrtype;
uint32_t h_addrlen;
uint32_t h_name_offset;
uint32_t h_name_len;
uint32_t h_alias_list_offset;
uint32_t h_alias_list_length;
int32_t error_num;
} getipnodebyname_cnf_t;
typedef union _iscsi_door_req {
iscsi_door_msg_hdr_t hdr;
getipnodebyname_req_t ginbn_req;
} iscsi_door_req_t;
typedef union _iscsi_door_cnf {
iscsi_door_msg_hdr_t hdr;
getipnodebyname_cnf_t ginbn_cnf;
} iscsi_door_cnf_t;
typedef union _iscsi_door_ind {
iscsi_door_msg_hdr_t hdr;
iscsi_door_msg_hdr_t error_ind;
} iscsi_door_ind_t;
typedef union _iscsi_door_msg {
iscsi_door_msg_hdr_t hdr;
iscsi_door_req_t req;
iscsi_door_cnf_t cnf;
iscsi_door_ind_t ind;
} iscsi_door_msg_t;
#ifdef _KERNEL
/* Defines copied from netdb.h */
#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors,FORMERR,REFUSED,NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
#define AI_V4MAPPED 0x0001 /* IPv4 mapped addresses if no IPv6 */
#define AI_ALL 0x0002 /* IPv6 and IPv4 mapped addresses */
#define AI_ADDRCONFIG 0x0004 /* AAAA or A records only if IPv6/IPv4 cnfgd */
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
};
boolean_t
iscsi_door_ini(void);
boolean_t
iscsi_door_term(void);
boolean_t
iscsi_door_bind(
int did
);
void
iscsi_door_unbind(void);
void
kfreehostent(
struct hostent *hptr
);
struct hostent *
kgetipnodebyname(
const char *name,
int af,
int flags,
int *error_num
);
#else /* !_KERNEL */
#define kfreehostent freehostent
#define kgetipnodebyname getipnodebyname
#endif /* _KERNEL */
/*
* iSCSI initiator SMF service status in kernel
*/
#define ISCSI_SERVICE_ENABLED 0x0
#define ISCSI_SERVICE_DISABLED 0x1
#define ISCSI_SERVICE_TRANSITION 0x2
#ifdef __cplusplus
}
#endif
#endif /* _ISCSI_DOOR_H */
|