Initial version, --vnc option only working.
[virt-click.git] / click.h
1 /* virt-click
2  * Copyright (C) 2011 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18
19 #ifndef click_h_
20 #define click_h_
21
22 #include <vncconnection.h>
23 #include <glib-object.h>
24
25 enum command_qual {
26   CMD_CLICK
27 };
28
29 typedef struct {
30   enum command_qual cmd;
31   union {
32     struct {
33       int x, y;                 /* x, y location */
34       unsigned mask;            /* button mask */
35     } click;
36   };
37 } command_t;
38
39 struct self_t;
40
41 typedef struct {
42   void (*shutdown) (struct self_t *self);
43   int (*click) (struct self_t *self, int x, int y, unsigned mask);
44 } callbacks_t;
45
46 typedef struct self_t {
47   GMainLoop *loop;
48   int ret;
49
50   /* Callbacks. */
51   callbacks_t *callbacks;
52
53   /* Command. */
54   command_t command;
55
56   /* Private data for VNC connections: */
57   gchar *host;
58   int port;
59   VncConnection *conn;
60   gboolean connected;
61 } self_t;
62
63 extern gboolean verbose;
64
65 /* commands.c */
66 extern int vc_parse_command (self_t *self, gchar **args, guint nr_args);
67 extern void vc_issue_command (self_t *self);
68
69 /* vnc.c */
70 extern void vc_vnc_setup (self_t *click, gchar *vnc);
71
72 /* vnc-auth.c */
73 extern void vc_vnc_auth_credential (VncConnection *conn, GValueArray *credList, gpointer opaque);
74 extern void vc_vnc_auth_choose_type (VncConnection *conn, GValueArray *types, gpointer opaque G_GNUC_UNUSED);
75
76 #endif /* click_h_ */