+Real implementation of 'captive-cmdline' client
[captive.git] / src / client / cmdline / main.h
1 /* $Id$
2  * Include file for client cmdline interface control functions for libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
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; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #ifndef _CAPTIVE_CLIENT_CMDLINE_MAIN_H
21 #define _CAPTIVE_CLIENT_CMDLINE_MAIN_H 1
22
23
24 #include <glib/gtypes.h>
25 #include <libgnomevfs/gnome-vfs-result.h>
26
27
28 #define CMDLINE_MAIN_ERROR (cmdline_main_error_quark())
29 GQuark cmdline_main_error_quark(void);
30
31 typedef enum {
32         CMDLINE_MAIN_ERROR_UNKNOWN_COMMAND,
33         CMDLINE_MAIN_ERROR_INVALID_COMMAND_ARGUMENTS,
34         CMDLINE_MAIN_ERROR_READING_COMMAND_CONFIG,
35         CMDLINE_MAIN_ERROR_EXCEEDING_COMMAND_OPTION,
36         CMDLINE_MAIN_ERROR_INVALID_COMMAND_ARGUMENT_COUNT,
37         CMDLINE_MAIN_ERROR_GENERIC_ERROR,
38         } CmdlineMainError;
39
40
41 struct cmdline_command {
42         const gchar *name,*description;
43         const struct poptOption *table;
44         void (*func)(const char **cmd_argv,GError **errp);
45         gint argsn_min,argsn_max;
46         };
47
48 extern const struct cmdline_command cmdline_command_table[];
49
50
51 void invoke_cmd(int cmd_argc,const char **cmd_argv);
52 void err_cleanup(GError **errp);
53 gboolean errvfsresult_to_gerr(GError **errp,GnomeVFSResult errvfsresult);
54
55
56 #endif /* _CAPTIVE_CLIENT_CMDLINE_MAIN_H */