Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _VMWARE_TOOLS_UTILS_H_
00020 #define _VMWARE_TOOLS_UTILS_H_
00021
00031 #define VMTOOLS_GUEST_SERVICE "vmsvc"
00032 #define VMTOOLS_USER_SERVICE "vmusr"
00033
00034 #if defined(__cplusplus)
00035 # define VMTOOLS_EXTERN_C extern "C"
00036 #else
00037 # define VMTOOLS_EXTERN_C
00038 #endif
00039
00040 #include <glib.h>
00041 #if defined(G_PLATFORM_WIN32)
00042 # include <windows.h>
00043 #else
00044 # include <signal.h>
00045 # include <sys/time.h>
00046 #endif
00047
00048
00049
00050 #if defined(G_PLATFORM_WIN32)
00051 # if defined(G_INLINE_FUNC)
00052 # undef G_INLINE_FUNC
00053 # endif
00054 # define G_INLINE_FUNC static __inline
00055 #endif
00056
00057
00070 #if defined(G_PLATFORM_WIN32)
00071 # define VMTOOLS_GET_FILENAME_LOCAL(path, err) (gchar *) (path)
00072 #else
00073 # define VMTOOLS_GET_FILENAME_LOCAL(path, err) g_filename_from_utf8((path), \
00074 -1, \
00075 NULL, \
00076 NULL, \
00077 (err))
00078 #endif
00079
00086 #if defined(G_PLATFORM_WIN32)
00087 # define VMTOOLS_RELEASE_FILENAME_LOCAL(path) (void) (path)
00088 #else
00089 # define VMTOOLS_RELEASE_FILENAME_LOCAL(path) g_free(path)
00090 #endif
00091
00093 #define VMTOOLS_WRAP_ARRAY(a) VMTools_WrapArray((a), sizeof *(a), G_N_ELEMENTS(a))
00094
00095
00096 G_BEGIN_DECLS
00097
00098 void
00099 vm_free(void *ptr);
00100
00101 void
00102 VMTools_ConfigLogging(const gchar *defaultDomain,
00103 GKeyFile *cfg,
00104 gboolean force,
00105 gboolean reset);
00106
00107 gboolean
00108 VMTools_LoadConfig(const gchar *path,
00109 GKeyFileFlags flags,
00110 GKeyFile **config,
00111 time_t *mtime);
00112
00113 gboolean
00114 VMTools_WriteConfig(const gchar *path,
00115 GKeyFile *config,
00116 GError **err);
00117
00118 #if defined(G_PLATFORM_WIN32)
00119
00120 gboolean
00121 VMTools_AttachConsole(void);
00122
00123 GSource *
00124 VMTools_NewHandleSource(HANDLE h);
00125
00126 #else
00127
00129 typedef gboolean (*SignalSourceCb)(const siginfo_t *, gpointer);
00130
00131 GSource *
00132 VMTools_NewSignalSource(int signum);
00133
00134 #endif
00135
00136 GSource *
00137 VMTools_CreateTimer(gint timeout);
00138
00139 GArray *
00140 VMTools_WrapArray(gconstpointer data,
00141 guint elemSize,
00142 guint count);
00143
00144 G_END_DECLS
00145
00148 #endif
00149