Blame libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_node.h

Packit eace71
/*
Packit eace71
 * Copyright (C) 2017 Red Hat, Inc.
Packit eace71
 *
Packit eace71
 * This program is free software: you can redistribute it and/or modify
Packit eace71
 * it under the terms of the GNU General Public License as published by
Packit eace71
 * the Free Software Foundation, either version 3 of the License, or
Packit eace71
 * (at your option) any later version.
Packit eace71
 *
Packit eace71
 * This program is distributed in the hope that it will be useful,
Packit eace71
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit eace71
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit eace71
 * GNU General Public License for more details.
Packit eace71
 *
Packit eace71
 * You should have received a copy of the GNU General Public License
Packit eace71
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit eace71
 *
Packit eace71
 * Author: Gris Ge <fge@redhat.com>
Packit eace71
 */
Packit eace71
Packit eace71
#ifndef _LIB_OPEN_ISCSI_USR_NODE_H_
Packit eace71
#define _LIB_OPEN_ISCSI_USR_NODE_H_
Packit eace71
Packit eace71
#include "libopeniscsiusr_common.h"
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_dump_config() - Dump all configurations of specified iSCSI
Packit eace71
 * node.
Packit eace71
 *
Packit eace71
 * Dump all configurations of specified iSCSI node. Will skip empty
Packit eace71
 * configuration.
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 * @show_secret:
Packit eace71
 *	Whether show CHAP secret. If set as false, will show password as
Packit eace71
 *	"********"
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	const char *.
Packit eace71
 *	Need to free this memory by free().
Packit eace71
 */
Packit eace71
__DLL_EXPORT const char *iscsi_node_dump_config(struct iscsi_node *node,
Packit eace71
						bool show_secret);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_dump_config() - Print all configurations of specified iSCSI
Packit eace71
 * node to STDOUT.
Packit eace71
 *
Packit eace71
 * Print all configurations of specified iSCSI node.
Packit eace71
 * For empty configuration, it will be shown as "name = <empty>".
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 * @show_secret:
Packit eace71
 *	Whether show CHAP secret. If set as false, will show password as
Packit eace71
 *	"********"
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	void
Packit eace71
 */
Packit eace71
__DLL_EXPORT void iscsi_node_print_config(struct iscsi_node *node,
Packit eace71
					  bool show_secret);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_target_name_get() - Retrieve target name of specified iSCSI node.
Packit eace71
 *
Packit eace71
 * Retrieve the target name of specified iSCSI node.
Packit eace71
 * Examples: "iqn.2003-01.org.linux-iscsi.org:iscsi-targetcli"
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	const char *.
Packit eace71
 *	No need to free this memory, the resources will get freed by
Packit eace71
 *	iscsi_node_free() or iscsi_nodes_free().
Packit eace71
 */
Packit eace71
__DLL_EXPORT const char *iscsi_node_target_name_get
Packit eace71
	(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_conn_is_ipv6() - Check whether specified node is using ipv6
Packit eace71
 * connection.
Packit eace71
 *
Packit eace71
 * Check whether specified node is using ipv6 connection.
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	bool
Packit eace71
 */
Packit eace71
__DLL_EXPORT bool iscsi_node_conn_is_ipv6(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_conn_address_get() - Retrieve connection address of specified
Packit eace71
 * iSCSI node.
Packit eace71
 *
Packit eace71
 * Retrieve the iscsi connection target address of specified iSCSI node.
Packit eace71
 * Examples: "192.168.1.1"
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	const char *.
Packit eace71
 *	No need to free this memory, the resources will get freed by
Packit eace71
 *	iscsi_node_free() or iscsi_nodes_free().
Packit eace71
 */
Packit eace71
__DLL_EXPORT const char *iscsi_node_conn_address_get(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_conn_port_get() - Retrieve connection port of specified iSCSI
Packit eace71
 * node.
Packit eace71
 *
Packit eace71
 * Retrieve the iscsi connection target port of specified iSCSI node.
Packit eace71
 * Examples: "3260"
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	uint32_t
Packit eace71
 */
Packit eace71
__DLL_EXPORT uint32_t iscsi_node_conn_port_get(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_portal_get() - Retrieve connection portal of specified
Packit eace71
 * iSCSI node.
Packit eace71
 *
Packit eace71
 * Retrieve the iscsi connection target portal of specified iSCSI node.
Packit eace71
 * Just a combination of iscsi_node_conn_address_get() and
Packit eace71
 * iscsi_node_conn_port_get().
Packit eace71
 * Examples: "192.168.1.1:3260" and "[::1]:3260"
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	const char *.
Packit eace71
 *	No need to free this memory, the resources will get freed by
Packit eace71
 *	iscsi_node_free() or iscsi_nodes_free().
Packit eace71
 */
Packit eace71
__DLL_EXPORT const char *iscsi_node_portal_get(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_tpgt_get() - Retrieve target portal group tag of specified
Packit eace71
 * iSCSI node.
Packit eace71
 *
Packit eace71
 * Retrieve the target portal group tag of specified iSCSI node.
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	int32_t. -1 for unknown.
Packit eace71
 */
Packit eace71
__DLL_EXPORT int32_t iscsi_node_tpgt_get(struct iscsi_node *node);
Packit eace71
Packit eace71
/**
Packit eace71
 * iscsi_node_iface_name_get() - Retrieve interface name of specified iSCSI
Packit eace71
 * node.
Packit eace71
 *
Packit eace71
 * Retrieve the interface name of specified iSCSI node.
Packit eace71
 * Examples: "default" for iscsi tcp interface.
Packit eace71
 *
Packit eace71
 * @node:
Packit eace71
 *	Pointer of 'struct iscsi_node'.
Packit eace71
 *	If this pointer is NULL, your program will be terminated by assert.
Packit eace71
 *
Packit eace71
 * Return:
Packit eace71
 *	const char *.
Packit eace71
 *	No need to free this memory, the resources will get freed by
Packit eace71
 *	iscsi_node_free() or iscsi_nodes_free().
Packit eace71
 */
Packit eace71
__DLL_EXPORT const char *iscsi_node_iface_name_get(struct iscsi_node *node);
Packit eace71
Packit eace71
#endif /* End of _LIB_OPEN_ISCSI_USR_NODE_H_ */