1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  *
3  * Copyright (C) 2015 Peter Hatina <phatina@redhat.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef __UDISKS_ISCSI_UTIL_H__
21 #define __UDISKS_ISCSI_UTIL_H__
22 
23 #include <glib.h>
24 
25 #include <src/udisksdaemon.h>
26 #include "udiskslinuxmoduleiscsi.h"
27 
28 typedef enum
29 {
30   ACTION_LOGIN,
31   ACTION_LOGOUT
32 } libiscsi_login_action;
33 
34 struct libiscsi_context;
35 struct libiscsi_node;
36 
37 gint                     iscsi_login (UDisksLinuxModuleISCSI *module,
38                                       const gchar            *name,
39                                       const gint              tpgt,
40                                       const gchar            *address,
41                                       const gint              port,
42                                       const gchar            *iface,
43                                       GVariant               *params,
44                                       gchar                 **errorstr);
45 
46 gint                     iscsi_logout (UDisksLinuxModuleISCSI *module,
47                                        const gchar            *name,
48                                        const gint              tpgt,
49                                        const gchar            *address,
50                                        const gint              port,
51                                        const gchar            *iface,
52                                        GVariant               *params,
53                                        gchar                 **errorstr);
54 
55 gint      iscsi_discover_send_targets (UDisksLinuxModuleISCSI *module,
56                                        const gchar            *address,
57                                        const guint16           port,
58                                        GVariant               *params,
59                                        GVariant              **nodes,
60                                        gint                   *nodes_cnt,
61                                        gchar                 **errorstr);
62 
63 GVariant *iscsi_libiscsi_nodes_to_gvariant (const struct libiscsi_node  *nodes,
64                                             const gint                   nodes_cnt);
65 void      iscsi_libiscsi_nodes_free        (const struct libiscsi_node  *nodes);
66 
67 UDisksError iscsi_error_to_udisks_error (const gint err);
68 
69 UDisksObject *wait_for_iscsi_object (UDisksDaemon *daemon,
70                                      gpointer      user_data);
71 UDisksObject *wait_for_iscsi_session_object (UDisksDaemon *daemon,
72                                              gpointer      user_data);
73 
74 #endif /* __UDISKS_ISCSI_UTIL_H__ */
75