+Hostname1 *hostnamed_interf;
+
+GMainLoop *hostnamed_loop;
+
+guint bus_descriptor;
+gboolean dbus_interface_exported; /* reliable because of gdbus operational guarantees */
+
+gchar *HOSTNAME, *STATIC_HOSTNAME, *PRETTY_HOSTNAME;
+gchar *CHASSIS, *ICON;
+gchar *KERN_NAME, *KERN_RELEASE, *KERN_VERS, *OS_CPENAME;
+
+/* TODO no specific vm or laptop icon in gnome
+ * NOTE paravirtualization on xen is only available for linuxes right now
+ * dmesg on linux systems reveals xen and virtualization method (HVM or PVM)
+ * but we will worry about those later */
+
+/* add any sysctl strings that suggest virtualization here */
+const struct SYSCTL_LOOKUP_TABLE chassis_indicator_table[] =
+{
+ { "QEMU Virtual CPU", "vm", NULL, FALSE, FALSE }, /* could be QEMU running in userspace or as part of KVM */
+ { "KVM", "vm", "drive-multidisk", FALSE, FALSE },
+ { "SmartDC HVM", "vm", "drive-multidisk", TRUE, TRUE }, /* illumos-joyent kvm */
+ { "VirtualBox", "vm", "drive-multidisk", TRUE, TRUE },
+ { "VMware, Inc.", "vm", "drive-multidisk", TRUE, TRUE },
+ { "VMware Virtual Platform", "vm", "drive-multidisk", TRUE, TRUE },
+ { "Parallels", "vm", "drive-multidisk", TRUE, TRUE }, /* need verification */
+ { "Xen", "vm", "drive-multidisk", FALSE, FALSE }
+}; /* TODO: chroots, etc. are the actual "containers", add them */
+
+/* archs to check against when determining if machine is server */
+const gchar *server_archs[] = {
+ "hppa",
+ "sparc",
+ "sparc64"
+};
+
+/* --- begin method/property/dbus signal code --- */
+
+/* TODO the extra boolean passed to these funcs is for policykit auth */
+/* TODO complete call with error, message, etc */
+static gboolean
+on_handle_set_hostname(Hostname1 *hn1_passed_interf,
+ GDBusMethodInvocation *invoc,
+ const gchar *greet,
+ gpointer data) {
+ GVariant *params;
+ gchar *proposed_hostname, *valid_hostname_buf;
+ gboolean policykit_auth, ret;
+ size_t check_length, bad_length;
+
+ bad_length = MAXHOSTNAMELEN + 1;
+ proposed_hostname = NULL;
+ ret = FALSE;
+
+ params = g_dbus_method_invocation_get_parameters(invoc);
+ g_variant_get(params, "(sb)", &proposed_hostname, &policykit_auth);
+
+ if(proposed_hostname && (valid_hostname_buf = g_hostname_to_ascii(proposed_hostname))) {
+
+ check_length = strnlen(proposed_hostname, bad_length);
+
+ if(check_length < bad_length && !sethostname(proposed_hostname, check_length))
+ ret = TRUE;
+ }
+
+ if(ret)
+ hostname1_complete_set_hostname(hn1_passed_interf, invoc);
+
+ if(proposed_hostname)
+ g_free(proposed_hostname);
+ if(valid_hostname_buf)
+ g_free(valid_hostname_buf);
+
+ return ret;
+}
+
+static gboolean
+on_handle_set_static_hostname(Hostname1 *hn1_passed_interf,
+ GDBusMethodInvocation *invoc,
+ const gchar *greet,
+ gpointer data) {
+ return FALSE;
+}
+
+static gboolean
+on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf,
+ GDBusMethodInvocation *invoc,
+ const gchar *greet,
+ gpointer data) {
+ return FALSE;
+}
+
+static gboolean
+on_handle_set_chassis(Hostname1 *hn1_passed_interf,
+ GDBusMethodInvocation *invoc,
+ const gchar *greet,
+ gpointer data) {
+ return FALSE;
+}
+
+static gboolean
+on_handle_set_icon_name(Hostname1 *hn1_passed_interf,
+ GDBusMethodInvocation *invoc,
+ const gchar *greet,
+ gpointer data) {
+ return FALSE;
+}
+
+/* note: all hostnamed/hostname1's properties are read-only,
+ * and do not need set_ functions, gdbus-codegen realized
+ * this from the XML and handled the to-be error of trying
+ * to set a read-only property's value
+ */
+
+const gchar *
+our_get_hostname() {
+
+ if(HOSTNAME)
+ return HOSTNAME;
+
+ return "localhost";
+}
+
+const gchar *
+our_get_static_hostname() {
+
+ if(STATIC_HOSTNAME)
+ return STATIC_HOSTNAME;
+ else if(HOSTNAME)
+ return HOSTNAME;