summaryrefslogtreecommitdiff
path: root/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_node.h
blob: e093d5ab0b192565663e5c5eebe49d6ac225e8b1 (plain)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * Copyright (C) 2017 Red Hat, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Gris Ge <fge@redhat.com>
 */

#ifndef _LIB_OPEN_ISCSI_USR_NODE_H_
#define _LIB_OPEN_ISCSI_USR_NODE_H_

#include "libopeniscsiusr_common.h"

/**
 * iscsi_node_dump_config() - Dump all configurations of specified iSCSI
 * node.
 *
 * Dump all configurations of specified iSCSI node. Will skip empty
 * configuration.
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 * @show_secret:
 *	Whether show CHAP secret. If set as false, will show password as
 *	"********"
 *
 * Return:
 *	const char *.
 *	Need to free this memory by free().
 */
__DLL_EXPORT const char *iscsi_node_dump_config(struct iscsi_node *node,
						bool show_secret);

/**
 * iscsi_node_dump_config() - Print all configurations of specified iSCSI
 * node to STDOUT.
 *
 * Print all configurations of specified iSCSI node.
 * For empty configuration, it will be shown as "name = <empty>".
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 * @show_secret:
 *	Whether show CHAP secret. If set as false, will show password as
 *	"********"
 *
 * Return:
 *	void
 */
__DLL_EXPORT void iscsi_node_print_config(struct iscsi_node *node,
					  bool show_secret);

/**
 * iscsi_node_target_name_get() - Retrieve target name of specified iSCSI node.
 *
 * Retrieve the target name of specified iSCSI node.
 * Examples: "iqn.2003-01.org.linux-iscsi.org:iscsi-targetcli"
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	const char *.
 *	No need to free this memory, the resources will get freed by
 *	iscsi_node_free() or iscsi_nodes_free().
 */
__DLL_EXPORT const char *iscsi_node_target_name_get
	(struct iscsi_node *node);

/**
 * iscsi_node_conn_is_ipv6() - Check whether specified node is using ipv6
 * connection.
 *
 * Check whether specified node is using ipv6 connection.
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	bool
 */
__DLL_EXPORT bool iscsi_node_conn_is_ipv6(struct iscsi_node *node);

/**
 * iscsi_node_conn_address_get() - Retrieve connection address of specified
 * iSCSI node.
 *
 * Retrieve the iscsi connection target address of specified iSCSI node.
 * Examples: "192.168.1.1"
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	const char *.
 *	No need to free this memory, the resources will get freed by
 *	iscsi_node_free() or iscsi_nodes_free().
 */
__DLL_EXPORT const char *iscsi_node_conn_address_get(struct iscsi_node *node);

/**
 * iscsi_node_conn_port_get() - Retrieve connection port of specified iSCSI
 * node.
 *
 * Retrieve the iscsi connection target port of specified iSCSI node.
 * Examples: "3260"
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	uint32_t
 */
__DLL_EXPORT uint32_t iscsi_node_conn_port_get(struct iscsi_node *node);

/**
 * iscsi_node_portal_get() - Retrieve connection portal of specified
 * iSCSI node.
 *
 * Retrieve the iscsi connection target portal of specified iSCSI node.
 * Just a combination of iscsi_node_conn_address_get() and
 * iscsi_node_conn_port_get().
 * Examples: "192.168.1.1:3260" and "[::1]:3260"
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	const char *.
 *	No need to free this memory, the resources will get freed by
 *	iscsi_node_free() or iscsi_nodes_free().
 */
__DLL_EXPORT const char *iscsi_node_portal_get(struct iscsi_node *node);

/**
 * iscsi_node_tpgt_get() - Retrieve target portal group tag of specified
 * iSCSI node.
 *
 * Retrieve the target portal group tag of specified iSCSI node.
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	int32_t. -1 for unknown.
 */
__DLL_EXPORT int32_t iscsi_node_tpgt_get(struct iscsi_node *node);

/**
 * iscsi_node_iface_name_get() - Retrieve interface name of specified iSCSI
 * node.
 *
 * Retrieve the interface name of specified iSCSI node.
 * Examples: "default" for iscsi tcp interface.
 *
 * @node:
 *	Pointer of 'struct iscsi_node'.
 *	If this pointer is NULL, your program will be terminated by assert.
 *
 * Return:
 *	const char *.
 *	No need to free this memory, the resources will get freed by
 *	iscsi_node_free() or iscsi_nodes_free().
 */
__DLL_EXPORT const char *iscsi_node_iface_name_get(struct iscsi_node *node);

#endif /* End of _LIB_OPEN_ISCSI_USR_NODE_H_ */