Changeset 33386 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Oct 24, 2010 3:57:55 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r33313 r33386 180 180 mfNoLoggedInUsers = true; 181 181 182 /* If there is a VRDPconnection, drop it. */183 ComPtr<I RemoteDisplayInfo> info;184 hrc = gConsole->COMGETTER( RemoteDisplayInfo)(info.asOutParam());182 /* If there is a connection, drop it. */ 183 ComPtr<IVRDEServerInfo> info; 184 hrc = gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam()); 185 185 if (SUCCEEDED(hrc) && info) 186 186 { … … 189 189 if (SUCCEEDED(hrc) && cClients > 0) 190 190 { 191 ComPtr <IVRD PServer> vrdpServer;192 hrc = machine->COMGETTER(VRD PServer)(vrdpServer.asOutParam());193 if (SUCCEEDED(hrc) && vrd pServer)191 ComPtr <IVRDEServer> vrdeServer; 192 hrc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam()); 193 if (SUCCEEDED(hrc) && vrdeServer) 194 194 { 195 vrd pServer->COMSETTER(Enabled)(FALSE);196 vrd pServer->COMSETTER(Enabled)(TRUE);195 vrdeServer->COMSETTER(Enabled)(FALSE); 196 vrdeServer->COMSETTER(Enabled)(TRUE); 197 197 } 198 198 } … … 236 236 refcnt = 0; 237 237 #endif 238 mLastVRD PPort = -1;238 mLastVRDEPort = -1; 239 239 } 240 240 … … 310 310 break; 311 311 } 312 case VBoxEventType_On RemoteDisplayInfoChanged:313 { 314 ComPtr<I RemoteDisplayInfoChangedEvent> rdicev = aEvent;312 case VBoxEventType_OnVRDEServerInfoChanged: 313 { 314 ComPtr<IVRDEServerInfoChangedEvent> rdicev = aEvent; 315 315 Assert(rdicev); 316 316 … … 318 318 if (gConsole) 319 319 { 320 ComPtr<I RemoteDisplayInfo> info;321 gConsole->COMGETTER( RemoteDisplayInfo)(info.asOutParam());320 ComPtr<IVRDEServerInfo> info; 321 gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam()); 322 322 if (info) 323 323 { 324 324 LONG port; 325 325 info->COMGETTER(Port)(&port); 326 if (port != mLastVRD PPort)326 if (port != mLastVRDEPort) 327 327 { 328 328 if (port == -1) 329 RTPrintf("VRD Pserver is inactive.\n");329 RTPrintf("VRDE server is inactive.\n"); 330 330 else if (port == 0) 331 RTPrintf("VRD Pserver failed to start.\n");331 RTPrintf("VRDE server failed to start.\n"); 332 332 else 333 RTPrintf(" Listening on port %d.\n", port);334 335 mLastVRD PPort = port;333 RTPrintf("VRDE server is listening on port %d.\n", port); 334 335 mLastVRDEPort = port; 336 336 } 337 337 } … … 365 365 long refcnt; 366 366 #endif 367 long mLastVRD PPort;367 long mLastVRDEPort; 368 368 }; 369 369 … … 446 446 #endif 447 447 #ifdef VBOX_WITH_VRDP 448 " -v, -vrd p, --vrdp on|off|config Enable (default) or disable the VRDP\n"448 " -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE\n" 449 449 " server or don't change the setting\n" 450 " -p, -vrdpport, --vrdpport <ports> Comma-separated list of ports the VRDP\n" 451 " server can bind to. Use a dash between\n" 450 " -e, -vrdeproperty, --vrdeproperty <name=[value]> Set a VRDE property:\n" 451 " \"TCP/Ports\" - comma-separated list of ports\n" 452 " the VRDE server can bind to. Use a dash between\n" 452 453 " two port numbers to specify a range\n" 453 " -a, -vrdpaddress, --vrdpaddress <ip> Interface IP the VRDP will bind to \n" 454 " \"TCP/Address\" - interface IP the VRDE server\n" 455 " will bind to\n" 454 456 #endif 455 457 #ifdef VBOX_FFMPEG … … 517 519 { 518 520 #ifdef VBOX_WITH_VRDP 519 const char *vrdpPort = NULL; 520 const char *vrdpAddress = NULL; 521 const char *vrdpEnabled = NULL; 521 const char *vrdePort = NULL; 522 const char *vrdeAddress = NULL; 523 const char *vrdeEnabled = NULL; 524 int cVRDEProperties = 0; 525 const char *aVRDEProperties[16]; 522 526 #endif 523 527 #ifdef VBOX_WITH_VNC … … 572 576 { "--startvm", 's', RTGETOPT_REQ_STRING }, 573 577 #ifdef VBOX_WITH_VRDP 574 { "-vrdpport", 'p', RTGETOPT_REQ_STRING }, 575 { "--vrdpport", 'p', RTGETOPT_REQ_STRING }, 576 { "-vrdpaddress", 'a', RTGETOPT_REQ_STRING }, 577 { "--vrdpaddress", 'a', RTGETOPT_REQ_STRING }, 578 { "-vrdp", 'v', RTGETOPT_REQ_STRING }, 579 { "--vrdp", 'v', RTGETOPT_REQ_STRING }, 578 { "-vrdpport", 'p', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 579 { "--vrdpport", 'p', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 580 { "-vrdpaddress", 'a', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 581 { "--vrdpaddress", 'a', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 582 { "-vrdp", 'v', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 583 { "--vrdp", 'v', RTGETOPT_REQ_STRING }, /* VRDE: deprecated. */ 584 { "-vrde", 'v', RTGETOPT_REQ_STRING }, 585 { "--vrde", 'v', RTGETOPT_REQ_STRING }, 586 { "-vrdesetproperty", 'e', RTGETOPT_REQ_STRING }, 587 { "--vrdesetproperty", 'e', RTGETOPT_REQ_STRING }, 580 588 #endif /* VBOX_WITH_VRDP defined */ 581 589 #ifdef VBOX_WITH_VNC … … 628 636 #ifdef VBOX_WITH_VRDP 629 637 case 'p': 630 vrdpPort = ValueUnion.psz; 638 RTPrintf("Warning: '-p' or '-vrdpport' are deprecated. Use '-e \"TCP/Ports=%s\"'\n", ValueUnion.psz); 639 vrdePort = ValueUnion.psz; 631 640 break; 632 641 case 'a': 633 vrdpAddress = ValueUnion.psz; 642 RTPrintf("Warning: '-a' or '-vrdpaddress' are deprecated. Use '-e \"TCP/Address=%s\"'\n", ValueUnion.psz); 643 vrdeAddress = ValueUnion.psz; 634 644 break; 635 645 case 'v': 636 vrdpEnabled = ValueUnion.psz; 646 vrdeEnabled = ValueUnion.psz; 647 break; 648 case 'e': 649 if (cVRDEProperties < RT_ELEMENTS(aVRDEProperties)) 650 aVRDEProperties[cVRDEProperties++] = ValueUnion.psz; 651 else 652 RTPrintf("Warning: too many VRDE properties. Ignored: '%s'\n", ValueUnion.psz); 637 653 break; 638 654 #endif /* VBOX_WITH_VRDP defined */ … … 995 1011 eventTypes.push_back(VBoxEventType_OnMouseCapabilityChanged); 996 1012 eventTypes.push_back(VBoxEventType_OnStateChanged); 997 eventTypes.push_back(VBoxEventType_On RemoteDisplayInfoChanged);1013 eventTypes.push_back(VBoxEventType_OnVRDEServerInfoChanged); 998 1014 eventTypes.push_back(VBoxEventType_OnCanShowWindow); 999 1015 eventTypes.push_back(VBoxEventType_OnShowWindow); … … 1002 1018 1003 1019 #ifdef VBOX_WITH_VRDP 1004 /* default is to enable the RDP server (backward compatibility) */ 1005 BOOL fVRDPEnable = true; 1006 BOOL fVRDPEnabled; 1007 ComPtr <IVRDPServer> vrdpServer; 1008 CHECK_ERROR_BREAK(machine, COMGETTER(VRDPServer)(vrdpServer.asOutParam())); 1009 CHECK_ERROR_BREAK(vrdpServer, COMGETTER(Enabled)(&fVRDPEnabled)); 1010 1011 if (vrdpEnabled != NULL) 1012 { 1013 /* -vrdp on|off|config */ 1014 if (!strcmp(vrdpEnabled, "off") || !strcmp(vrdpEnabled, "disable")) 1015 fVRDPEnable = false; 1016 else if (!strcmp(vrdpEnabled, "config")) 1017 { 1018 if (!fVRDPEnabled) 1019 fVRDPEnable = false; 1020 } 1021 else if (strcmp(vrdpEnabled, "on") && strcmp(vrdpEnabled, "enable")) 1022 { 1023 RTPrintf("-vrdp requires an argument (on|off|config)\n"); 1024 break; 1025 } 1026 } 1027 1028 if (fVRDPEnable) 1029 { 1030 Log(("VBoxHeadless: Enabling VRDP server...\n")); 1031 1032 /* set VRDP port if requested by the user */ 1033 if (vrdpPort != NULL) 1034 { 1035 Bstr bstr = vrdpPort; 1036 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(bstr.raw())); 1037 } 1038 /* set VRDP address if requested by the user */ 1039 if (vrdpAddress != NULL) 1040 { 1041 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpAddress).raw())); 1042 } 1043 /* enable VRDP server (only if currently disabled) */ 1044 if (!fVRDPEnabled) 1045 { 1046 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled)(TRUE)); 1020 /* default is to enable the remote desktop server (backward compatibility) */ 1021 BOOL fVRDEEnable = true; 1022 BOOL fVRDEEnabled; 1023 ComPtr <IVRDEServer> vrdeServer; 1024 CHECK_ERROR_BREAK(machine, COMGETTER(VRDEServer)(vrdeServer.asOutParam())); 1025 CHECK_ERROR_BREAK(vrdeServer, COMGETTER(Enabled)(&fVRDEEnabled)); 1026 1027 if (vrdeEnabled != NULL) 1028 { 1029 /* -vrdeServer on|off|config */ 1030 if (!strcmp(vrdeEnabled, "off") || !strcmp(vrdeEnabled, "disable")) 1031 fVRDEEnable = false; 1032 else if (!strcmp(vrdeEnabled, "config")) 1033 { 1034 if (!fVRDEEnabled) 1035 fVRDEEnable = false; 1036 } 1037 else if (strcmp(vrdeEnabled, "on") && strcmp(vrdeEnabled, "enable")) 1038 { 1039 RTPrintf("-vrdeServer requires an argument (on|off|config)\n"); 1040 break; 1041 } 1042 } 1043 1044 if (fVRDEEnable) 1045 { 1046 Log(("VBoxHeadless: Enabling VRDE server...\n")); 1047 1048 /* set VRDE port if requested by the user */ 1049 if (vrdePort != NULL) 1050 { 1051 Bstr bstr = vrdePort; 1052 CHECK_ERROR_BREAK(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), bstr.raw())); 1053 } 1054 /* set VRDE address if requested by the user */ 1055 if (vrdeAddress != NULL) 1056 { 1057 CHECK_ERROR_BREAK(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(vrdeAddress).raw())); 1058 } 1059 1060 /* Set VRDE properties. */ 1061 if (cVRDEProperties > 0) 1062 { 1063 int i; 1064 for (i = 0; i < cVRDEProperties; i++) 1065 { 1066 /* Parse 'name=value' */ 1067 char *pszProperty = RTStrDup(aVRDEProperties[i]); 1068 if (pszProperty) 1069 { 1070 char *pDelimiter = strchr(pszProperty, '='); 1071 if (pDelimiter) 1072 { 1073 *pDelimiter = '\0'; 1074 1075 Bstr bstrName = pszProperty; 1076 Bstr bstrValue = &pDelimiter[1]; 1077 CHECK_ERROR_BREAK(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw())); 1078 } 1079 else 1080 { 1081 RTPrintf("Error: Invalid VRDE property '%s'\n", aVRDEProperties[i]); 1082 RTStrFree(pszProperty); 1083 rc = E_INVALIDARG; 1084 break; 1085 } 1086 RTStrFree(pszProperty); 1087 } 1088 else 1089 { 1090 RTPrintf("Error: Failed to allocate memory for VRDE property '%s'\n", aVRDEProperties[i]); 1091 rc = E_OUTOFMEMORY; 1092 break; 1093 } 1094 } 1095 if (FAILED(rc)) 1096 break; 1097 } 1098 1099 /* enable VRDE server (only if currently disabled) */ 1100 if (!fVRDEEnabled) 1101 { 1102 CHECK_ERROR_BREAK(vrdeServer, COMSETTER(Enabled)(TRUE)); 1047 1103 } 1048 1104 } 1049 1105 else 1050 1106 { 1051 /* disable VRD Pserver (only if currently enabled */1052 if (fVRD PEnabled)1053 { 1054 CHECK_ERROR_BREAK(vrd pServer, COMSETTER(Enabled)(FALSE));1107 /* disable VRDE server (only if currently enabled */ 1108 if (fVRDEEnabled) 1109 { 1110 CHECK_ERROR_BREAK(vrdeServer, COMSETTER(Enabled)(FALSE)); 1055 1111 } 1056 1112 } … … 1137 1193 #endif /* defined(VBOX_FFMPEG) */ 1138 1194 1139 /* we don't have to disable VRD Phere because we don't save the settings of the VM */1195 /* we don't have to disable VRDE here because we don't save the settings of the VM */ 1140 1196 } 1141 1197 while (0); -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h
r28800 r33386 1 1 /** @file 2 2 * 3 * VBox frontends: VRD P (headless RDPserver):3 * VBox frontends: VRDE (headless Remote Desktop server): 4 4 * Header file with registration call for ffmpeg framebuffer 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 2006-20 07Oracle Corporation8 * Copyright (C) 2006-2010 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 */ 18 18 19 #ifndef __H_VBOX VRDP20 #define __H_VBOX VRDP19 #ifndef __H_VBOXHEADLESS 20 #define __H_VBOXHEADLESS 21 21 22 22 #include <VBox/com/VirtualBox.h> … … 47 47 typedef FNREGISTERFFMPEGFB *PFNREGISTERFFMPEGFB; 48 48 49 #endif // __H_VBOX VRDP49 #endif // __H_VBOXHEADLESS
Note:
See TracChangeset
for help on using the changeset viewer.