Hi All, I have added support for RDP. Just forwarding the patch for review. Regards, Pritesh
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 2f784e1..309dcae 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -711,6 +711,63 @@ </attribute> </optional> </group> + <group> + <attribute name="type"> + <value>rdp</value> + </attribute> + <optional> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="autoport"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="headless"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="reuseconnection"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="multiconnections"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="listen"> + <ref name="addrIP"/> + </attribute> + </optional> + <optional> + <attribute name="auth"> + <text/> + </attribute> + </optional> + <optional> + <attribute name="authtimeout"> + <ref name="unsignedLong"/> + </attribute> + </optional> + </group> </choice> </element> </define> @@ -1008,6 +1065,11 @@ <param name="pattern">[0-9]+</param> </data> </define> + <define name="unsignedLong"> + <data type="unsignedLong"> + <param name="pattern">[0-9]+</param> + </data> + </define> <define name="countCPU"> <data type="unsignedShort"> <param name="pattern">[0-9]+</param> diff --git a/src/domain_conf.c b/src/domain_conf.c index cfb8bc5..b160edd 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -150,7 +150,8 @@ VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST, VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, "sdl", - "vnc") + "vnc", + "rdp") VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST, "subsystem", @@ -244,6 +245,11 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) VIR_FREE(def->data.sdl.display); VIR_FREE(def->data.sdl.xauth); break; + + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: + VIR_FREE(def->data.rdp.listenAddr); + VIR_FREE(def->data.rdp.auth); + break; } VIR_FREE(def); @@ -1499,6 +1505,69 @@ virDomainGraphicsDefParseXML(virConnectPtr conn, def->data.sdl.fullscreen = 0; def->data.sdl.xauth = virXMLPropString(node, "xauth"); def->data.sdl.display = virXMLPropString(node, "display"); + } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP) { + char *port = virXMLPropString(node, "port"); + char *autoport; + char *headless; + char *authtimeout; + char *reuseconnection; + char *multiconnections; + + if (port) { + if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("cannot parse rdp port %s"), port); + VIR_FREE(port); + goto error; + } + VIR_FREE(port); + } else { + def->data.rdp.port = 0; + def->data.rdp.autoport = 1; + } + + if ((authtimeout = virXMLPropString(node, "authtimeout")) != NULL) { + if (virStrToLong_ull(authtimeout, NULL, 10, &def->data.rdp.authtimeout) < 0) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("cannot parse rdp authentication timeout %s"), authtimeout); + VIR_FREE(authtimeout); + goto error; + } + VIR_FREE(authtimeout); + } + + if ((autoport = virXMLPropString(node, "autoport")) != NULL) { + if (STREQ(autoport, "yes")) { + if (flags & VIR_DOMAIN_XML_INACTIVE) + def->data.rdp.port = 0; + def->data.rdp.autoport = 1; + } + VIR_FREE(autoport); + } + + if ((headless = virXMLPropString(node, "headless")) != NULL) { + if (STREQ(headless, "yes")) { + def->data.rdp.headless = 1; + } + VIR_FREE(headless); + } + + if ((reuseconnection = virXMLPropString(node, "reuseconnection")) != NULL) { + if (STREQ(reuseconnection, "yes")) { + def->data.rdp.reuseconnection = 1; + } + VIR_FREE(reuseconnection); + } + + if ((multiconnections = virXMLPropString(node, "multiconnections")) != NULL) { + if (STREQ(multiconnections, "yes")) { + def->data.rdp.multiconnections = 1; + } + VIR_FREE(multiconnections); + } + + def->data.rdp.listenAddr = virXMLPropString(node, "listen"); + def->data.rdp.auth = virXMLPropString(node, "auth"); } cleanup: @@ -3263,6 +3332,38 @@ virDomainGraphicsDefFormat(virConnectPtr conn, virBufferAddLit(buf, " fullscreen='yes'"); break; + + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: + if (def->data.rdp.port) + virBufferVSprintf(buf, " port='%d'", + def->data.rdp.port); + else if (def->data.rdp.autoport) + virBufferAddLit(buf, " port='0'"); + + if (def->data.rdp.autoport) + virBufferVSprintf(buf, " autoport='yes'"); + + if (def->data.rdp.headless) + virBufferVSprintf(buf, " headless='yes'"); + + if (def->data.rdp.reuseconnection) + virBufferVSprintf(buf, " reuseconnection='yes'"); + + if (def->data.rdp.multiconnections) + virBufferVSprintf(buf, " multiconnections='yes'"); + + if (def->data.rdp.listenAddr) + virBufferVSprintf(buf, " listen='%s'", def->data.rdp.listenAddr); + + if (def->data.rdp.auth) + virBufferVSprintf(buf, " auth='%s'", def->data.rdp.auth); + + if (def->data.rdp.authtimeout) + virBufferVSprintf(buf, " authtimeout='%llu'", + def->data.rdp.authtimeout); + + break; + } virBufferAddLit(buf, "/>\n"); diff --git a/src/domain_conf.h b/src/domain_conf.h index f4eea6b..a52c059 100644 --- a/src/domain_conf.h +++ b/src/domain_conf.h @@ -264,6 +264,7 @@ struct _virDomainSoundDef { enum virDomainGraphicsType { VIR_DOMAIN_GRAPHICS_TYPE_SDL, VIR_DOMAIN_GRAPHICS_TYPE_VNC, + VIR_DOMAIN_GRAPHICS_TYPE_RDP, VIR_DOMAIN_GRAPHICS_TYPE_LAST, }; @@ -285,6 +286,16 @@ struct _virDomainGraphicsDef { char *xauth; int fullscreen; } sdl; + struct { + int port; + char *auth; + char *listenAddr; + int autoport : 1; + int headless : 1; + int reuseconnection : 1; + int multiconnections : 1; + unsigned long long authtimeout; + } rdp; } data; };
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list