[virt-tools-list] [virt-viewer 08/20] Add OvirtVmDisplay::secure_port

Christophe Fergeau cfergeau at redhat.com
Wed Jun 13 12:23:16 UTC 2012


---
 src/ovirt-proxy.c      |   11 +++++++++++
 src/ovirt-vm-display.c |   17 +++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/ovirt-proxy.c b/src/ovirt-proxy.c
index 653c3eb..7a5f2f4 100644
--- a/src/ovirt-proxy.c
+++ b/src/ovirt-proxy.c
@@ -69,6 +69,7 @@ static void dump_display(OvirtVmDisplay *display)
     guint monitor_count;
     gchar *address;
     guint port;
+    guint secure_port;
     gchar *ticket;
     guint expiry;
 
@@ -77,6 +78,7 @@ static void dump_display(OvirtVmDisplay *display)
                  "monitor-count", &monitor_count,
                  "address", &address,
                  "port", &port,
+                 "secure-port", &secure_port,
                  "ticket", &ticket,
                  "expiry", &expiry,
                  NULL);
@@ -86,6 +88,7 @@ static void dump_display(OvirtVmDisplay *display)
     g_print("\t\tMonitors: %d\n", monitor_count);
     g_print("\t\tAddress: %s\n", address);
     g_print("\t\tPort: %d\n", port);
+    g_print("\t\tSecure Port: %d\n", secure_port);
     g_print("\t\tTicket: %s\n", ticket);
     g_print("\t\tExpiry: %d\n", expiry);
     g_free(address);
@@ -163,6 +166,7 @@ static gboolean vm_set_display_from_xml(OvirtVm *vm,
     const char *type_key = g_intern_string("type");
     const char *address_key = g_intern_string("address");
     const char *port_key = g_intern_string("port");
+    const char *secure_port_key = g_intern_string("secure_port");
     const char *monitors_key = g_intern_string("monitors");
 
     if (root == NULL) {
@@ -202,6 +206,13 @@ static gboolean vm_set_display_from_xml(OvirtVm *vm,
                      NULL);
     }
 
+    node = g_hash_table_lookup(root->children, secure_port_key);
+    if (node != NULL) {
+        g_object_set(G_OBJECT(display),
+                     "secure-port", strtoul(node->content, NULL, 0),
+                     NULL);
+    }
+
     /* FIXME: this overrides the ticket/expiry which may
      * already be set
      */
diff --git a/src/ovirt-vm-display.c b/src/ovirt-vm-display.c
index deebbe1..cf87815 100644
--- a/src/ovirt-vm-display.c
+++ b/src/ovirt-vm-display.c
@@ -32,6 +32,7 @@ struct _OvirtVmDisplayPrivate {
     OvirtVmDisplayType type;
     char *address;
     guint port;
+    guint secure_port;
     guint monitor_count;
     char *ticket;
     guint expiry;
@@ -44,6 +45,7 @@ enum {
     PROP_TYPE,
     PROP_ADDRESS,
     PROP_PORT,
+    PROP_SECURE_PORT,
     PROP_MONITOR_COUNT,
     PROP_TICKET,
     PROP_EXPIRY
@@ -66,6 +68,9 @@ static void ovirt_vm_display_get_property(GObject *object,
     case PROP_PORT:
         g_value_set_uint(value, display->priv->port);
         break;
+    case PROP_SECURE_PORT:
+        g_value_set_uint(value, display->priv->secure_port);
+        break;
     case PROP_MONITOR_COUNT:
         g_value_set_uint(value, display->priv->monitor_count);
         break;
@@ -98,6 +103,9 @@ static void ovirt_vm_display_set_property(GObject *object,
     case PROP_PORT:
         display->priv->port = g_value_get_uint(value);
         break;
+    case PROP_SECURE_PORT:
+        display->priv->secure_port = g_value_get_uint(value);
+        break;
     case PROP_MONITOR_COUNT:
         display->priv->monitor_count = g_value_get_uint(value);
         break;
@@ -160,6 +168,15 @@ static void ovirt_vm_display_class_init(OvirtVmDisplayClass *klass)
                                                       G_PARAM_READWRITE |
                                                       G_PARAM_STATIC_STRINGS));
     g_object_class_install_property(object_class,
+                                    PROP_SECURE_PORT,
+                                    g_param_spec_uint("secure-port",
+                                                      "Secure Port",
+                                                      "Secure Display Port",
+                                                      0, G_MAXUINT16,
+                                                      0,
+                                                      G_PARAM_READWRITE |
+                                                      G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
                                     PROP_MONITOR_COUNT,
                                     g_param_spec_uint("monitor-count",
                                                       "Monitor Count",
-- 
1.7.10.2




More information about the virt-tools-list mailing list