9b84e315ebfe956e6739114f58d22bc0df982699
[libguestfs.git] / src / guestfs.h
1 /* libguestfs
2  * Copyright (C) 2009 Red Hat Inc. 
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #ifndef GUESTFS_H_
20 #define GUESTFS_H_
21
22 /* For API documentation, please read the manual page guestfs(3). */
23
24 typedef struct guestfs_h guestfs_h;
25
26 /* Create and destroy the guest handle. */
27 extern guestfs_h *guestfs_create (void);
28 extern void guestfs_free (guestfs_h *g);
29
30 /* Guest configuration. */
31 extern int guestfs_config (guestfs_h *g,
32                            const char *qemu_param, const char *qemu_value);
33 extern int guestfs_add_drive (guestfs_h *g, const char *filename);
34 extern int guestfs_add_cdrom (guestfs_h *g, const char *filename);
35
36 /* Steps to start up the guest. */
37 extern int guestfs_launch (guestfs_h *g);
38 extern int guestfs_wait_ready (guestfs_h *g);
39 extern int guestfs_ready (guestfs_h *g);
40
41 /* Kill the guest subprocess. */
42 extern int guestfs_kill_subprocess (guestfs_h *g);
43
44 /* Error handling. */
45 typedef void (*guestfs_abort_fn) (void);
46 extern void guestfs_set_out_of_memory_handler (guestfs_h *g, guestfs_abort_fn);
47 extern guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);
48
49 extern void guestfs_set_exit_on_error (guestfs_h *g, int exit_on_error);
50 extern int guestfs_get_exit_on_error (guestfs_h *g);
51
52 extern void guestfs_set_verbose (guestfs_h *g, int verbose);
53 extern int guestfs_get_verbose (guestfs_h *g);
54
55 #endif /* GUESTFS_H_ */