bfg-common 1.3.239 → 1.3.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +526 -526
- package/components/common/BadBrowser.vue +16 -12
- package/components/common/accordion/Accordion.vue +1 -0
- package/components/common/accordion/Recursion.vue +2 -0
- package/components/common/accordion/lib/models/interfaces.ts +1 -0
- package/components/common/adapterManager/AddAdapterModal.vue +8 -5
- package/components/common/adapterManager/AddAdapterWarningModal.vue +1 -0
- package/components/common/adapterManager/ui/actions/AddAdapterButton.vue +2 -0
- package/components/common/adapterManager/ui/actions/MoveDownAdapterButton.vue +2 -0
- package/components/common/adapterManager/ui/actions/MoveUpAdapterButton.vue +2 -0
- package/components/common/adapterManager/ui/actions/RemoveAdapterButton.vue +2 -0
- package/components/common/adapterManager/ui/table/Adapters.vue +14 -13
- package/components/common/adapterManager/ui/table/Header.vue +6 -4
- package/components/common/adapterManager/ui/table/Table.vue +13 -4
- package/components/common/browse/Browse.vue +5 -1
- package/components/common/browse/blocks/Container.vue +3 -0
- package/components/common/browse/blocks/contents/Files.vue +1 -0
- package/components/common/context/ContextRecursion.vue +6 -1
- package/components/common/details/DetailsItem.vue +3 -0
- package/components/common/diagramMain/Header.vue +4 -0
- package/components/common/diagramMain/adapter/AdapterItem.vue +2 -0
- package/components/common/diagramMain/adapter/Contents.vue +2 -0
- package/components/common/diagramMain/lib/models/interfaces.ts +1 -0
- package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +1 -0
- package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +13 -27
- package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +1 -0
- package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +3 -0
- package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +8 -0
- package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +6 -0
- package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +2 -0
- package/components/common/diagramMain/modals/lib/config/networkModal.ts +4 -0
- package/components/common/diagramMain/modals/lib/config/portModal.ts +7 -2
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +19 -13
- package/components/common/diagramMain/modals/remove/RemoveModal.vue +5 -0
- package/components/common/diagramMain/modals/viewSettings/ViewSettings.vue +11 -7
- package/components/common/diagramMain/network/Contents.vue +5 -4
- package/components/common/diagramMain/port/Port.vue +1 -0
- package/components/common/feedback/Buttons.vue +2 -0
- package/components/common/feedback/Feedback.vue +9 -2
- package/components/common/feedback/Message.vue +9 -0
- package/components/common/feedback/VisitPortal.vue +11 -2
- package/components/common/help/navbar/left/Left.vue +1 -0
- package/components/common/help/navbar/right/Right.vue +12 -2
- package/components/common/help/navbar/right/lib/models/interfaces.ts +1 -0
- package/components/common/home/alertsTable/AlertsTable.vue +1 -0
- package/components/common/modals/Confirmation.vue +10 -2
- package/components/common/modals/Rename.vue +1 -0
- package/components/common/monitor/advanced/tools/Tools.vue +10 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/Actions.vue +7 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +6 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +14 -1
- package/components/common/monitor/overview/filters/Filters.vue +12 -5
- package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +4 -0
- package/components/common/pages/Tasks.vue +120 -120
- package/components/common/perPage/PerPage.vue +1 -0
- package/components/common/recursionTree/RecursionTree.vue +205 -203
- package/components/common/recursionTree/lib/models/interfaces.ts +4 -2
- package/components/common/select/button/ButtonDropdown.vue +2 -0
- package/components/common/select/button/lib/models/interfaces.ts +1 -0
- package/components/common/select/input/Input.vue +1 -0
- package/components/common/select/radio/RadioGroup.vue +2 -0
- package/components/common/select/radio/lib/models/interfaces.ts +1 -0
- package/components/common/shortcuts/Block.vue +2 -0
- package/components/common/shortcuts/Category.vue +1 -0
- package/components/common/shortcuts/lib/models/interfaces.ts +1 -0
- package/components/common/spiceConsole/Drawer.vue +4 -0
- package/components/common/spiceConsole/keyboard/Keyboard.vue +1 -0
- package/components/common/spiceConsole/keyboard/lib/config/keyboardRows.ts +81 -6
- package/components/common/spiceConsole/keyboard/lib/models/interfaces.ts +1 -0
- package/components/common/split/horizontal/Horizontal.vue +1 -0
- package/components/common/vm/actions/add/Add.vue +576 -575
- package/components/common/vm/actions/clone/Clone.vue +518 -518
- package/components/common/vm/actions/clone/select/options/Options.vue +9 -3
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +269 -269
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +693 -693
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +7 -2
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +2 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuModel.vue +225 -220
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +2 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Iommu.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Pc.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Sa.vue +2 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/Tooltip.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +59 -59
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/MemoryHotPlug.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/Location.vue +6 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +5 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/Mode.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/Sharing.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/Location.vue +2 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +295 -294
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +12 -4
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +165 -165
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIo.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelection.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +3 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/Graphics.vue +6 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/TotalVideoMemory.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/model/Model.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/Menu.vue +6 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/Secure.vue +6 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/lib/models/interfaces.ts +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +4 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/FileTransfer.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/FolderSharing.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/PlaybackCompression.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/PowerControl.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +6 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +7 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/sharePolicy/SharePolicy.vue +5 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +2 -1
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +1 -0
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +6 -1
- package/components/common/vm/actions/common/select/compatibility/Compatibility.vue +31 -27
- package/components/common/vm/actions/common/select/name/Name.vue +7 -1
- package/components/common/vm/actions/common/select/os/os.vue +7 -1
- package/components/common/vm/actions/common/select/storage/lib/config/config.ts +166 -166
- package/components/common/vm/actions/editSettings/EditSettings.vue +313 -313
- package/components/common/weekSelect/WeekSelect.vue +143 -112
- package/components/common/weekSelect/lib/config/options.ts +10 -10
- package/components/common/weekSelect/lib/models/interfaces.ts +1 -0
- package/components/common/wizards/datastore/add/local/createName/CreateName.vue +1 -0
- package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +8 -7
- package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +9 -1
- package/components/common/wizards/datastore/add/nfs/configuration/serversList/DeletePopover.vue +6 -3
- package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +1 -0
- package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +3 -0
- package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +2 -0
- package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +2 -0
- package/components/common/wizards/datastore/add/types/Types.vue +1 -0
- package/components/common/wizards/network/add/modals/SelectNetwork.vue +16 -3
- package/components/common/wizards/network/add/modals/SelectStandardSwitch.vue +10 -2
- package/components/common/wizards/network/add/modals/SelectSwitch.vue +10 -2
- package/components/common/wizards/network/add/steps/ConnectionSettings.vue +5 -1
- package/components/common/wizards/network/add/steps/IpFourSettings.vue +12 -2
- package/components/common/wizards/network/add/steps/PortProperties.vue +16 -3
- package/components/common/wizards/network/add/steps/SelectConnectionType.vue +6 -3
- package/components/common/wizards/network/add/steps/SelectedTargetDevice.vue +11 -0
- package/components/common/wizards/vm/common/tooltip/Tooltip.vue +2 -0
- package/components/common/wizards/vm/migrate/select/network/Network.vue +1 -0
- package/components/common/wizards/vm/migrate/select/network/table/network/Network.vue +1 -0
- package/components/common/wizards/vm/migrate/select/storage/Storage.vue +5 -1
- package/components/common/wizards/vm/migrate/select/storage/configure/disk/Disk.vue +1 -0
- package/components/common/wizards/vm/migrate/select/storage/diskFormat/DiskFormat.vue +1 -0
- package/components/common/wizards/vm/migrate/select/storage/policy/Policy.vue +1 -0
- package/components/common/wizards/vm/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +1 -0
- package/components/common/wizards/vm/migrate/select/targetServer/new/New.vue +9 -1
- package/composables/useAppVersion.ts +21 -21
- package/composables/useEnvLanguage.ts +20 -20
- package/lib/utils/sendTask.ts +72 -72
- package/minify.js +146 -146
- package/package.json +1 -1
- package/public/spice-console/application/codec.js +257 -257
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console/network/spicechannel.js +369 -369
- package/store/main/lib/interfaces.ts +9 -9
- package/store/tasks/actions.ts +133 -133
- package/store/tasks/getters.ts +25 -25
- package/store/tasks/lib/models/interfaces.ts +18 -18
- package/store/tasks/mutations.ts +58 -58
- package/store/tasks/state.ts +16 -16
|
@@ -1,369 +1,369 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2016 eyeOS
|
|
3
|
-
|
|
4
|
-
This file is part of Open365.
|
|
5
|
-
|
|
6
|
-
Open365 is free software: you can redistribute it and/or modify
|
|
7
|
-
it under the terms of the GNU Affero General Public License as
|
|
8
|
-
published by the Free Software Foundation, either version 3 of the
|
|
9
|
-
License, or (at your option) any later version.
|
|
10
|
-
|
|
11
|
-
This program is distributed in the hope that it will be useful,
|
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
GNU Affero General Public License for more details.
|
|
15
|
-
|
|
16
|
-
You should have received a copy of the GNU Affero General Public License
|
|
17
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
//Must fire event types: connectionId and message
|
|
21
|
-
|
|
22
|
-
wdi.SpiceChannel = $.spcExtend(wdi.EventObject.prototype, {
|
|
23
|
-
counter: 0,
|
|
24
|
-
ackWindow: 0,
|
|
25
|
-
connectionId: 0,
|
|
26
|
-
socketQ: null,
|
|
27
|
-
packetReassembler: null,
|
|
28
|
-
channel: 1,
|
|
29
|
-
codec: wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG,
|
|
30
|
-
proxy: null,
|
|
31
|
-
token: null,
|
|
32
|
-
|
|
33
|
-
init: function (c) {
|
|
34
|
-
this.superInit()
|
|
35
|
-
this.socketQ = c.socketQ || new wdi.SocketQueue()
|
|
36
|
-
this.packetReassembler =
|
|
37
|
-
c.packetReassembler ||
|
|
38
|
-
wdi.ReassemblerFactory.getPacketReassembler(this.socketQ)
|
|
39
|
-
this.setListeners()
|
|
40
|
-
this.ackWindow = 0
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
// startHandshakeTimeout: function () {
|
|
44
|
-
// var self = this
|
|
45
|
-
// this.handshakeTimeout = window.setTimeout(function () {
|
|
46
|
-
// var err = new Error('Handshake timeout')
|
|
47
|
-
// err.code = 4200
|
|
48
|
-
// wdi.Debug.error('Handshake timeout reached, raising error')
|
|
49
|
-
// self.fire('error', err)
|
|
50
|
-
// }, 5000)
|
|
51
|
-
// },
|
|
52
|
-
|
|
53
|
-
fireHandshakeTimeoutError: function () {
|
|
54
|
-
var err = new Error('Handshake timeout')
|
|
55
|
-
err.code = 4200
|
|
56
|
-
wdi.Debug.error('Handshake timeout reached, raising error')
|
|
57
|
-
this.fire('error', err)
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
// cancelHandshakeTimeout: function () {
|
|
61
|
-
// clearTimeout(this.handshakeTimeout)
|
|
62
|
-
// },
|
|
63
|
-
|
|
64
|
-
setListeners: function () {
|
|
65
|
-
var date
|
|
66
|
-
var self = this
|
|
67
|
-
this.packetReassembler.addListener(
|
|
68
|
-
'packetComplete',
|
|
69
|
-
function (e) {
|
|
70
|
-
var rawMessage = e
|
|
71
|
-
if (rawMessage.status === 'spicePacket') {
|
|
72
|
-
wdi.Debug.log('packetComplete spicePacket')
|
|
73
|
-
// self.cancelHandshakeTimeout()
|
|
74
|
-
if (wdi.logOperations) {
|
|
75
|
-
wdi.DataLogger.logNetworkTime()
|
|
76
|
-
date = Date.now()
|
|
77
|
-
}
|
|
78
|
-
var rsm = this.getRawSpiceMessage(rawMessage.data)
|
|
79
|
-
if (rsm) {
|
|
80
|
-
if (
|
|
81
|
-
wdi.logOperations &&
|
|
82
|
-
rsm.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY
|
|
83
|
-
) {
|
|
84
|
-
wdi.DataLogger.setStartTime(date)
|
|
85
|
-
}
|
|
86
|
-
this.fire('message', rsm)
|
|
87
|
-
}
|
|
88
|
-
} else if (rawMessage.status === 'reply') {
|
|
89
|
-
wdi.Debug.log('packetComplete reply')
|
|
90
|
-
var packet = this.getRedLinkReplyBytes(rawMessage.data)
|
|
91
|
-
this.send(packet)
|
|
92
|
-
} else if (rawMessage.status === 'errorCode') {
|
|
93
|
-
wdi.Debug.log('packetComplete errorCode')
|
|
94
|
-
var packet = this.getErrorCodeBytes(rawMessage.data)
|
|
95
|
-
if (packet) {
|
|
96
|
-
this.send(packet)
|
|
97
|
-
if (this.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
|
|
98
|
-
// Custom code
|
|
99
|
-
// Set codec
|
|
100
|
-
this.changeCodec(this.codec)
|
|
101
|
-
// Custom code end
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
this.fire('channelConnected')
|
|
105
|
-
} else {
|
|
106
|
-
self.fireHandshakeTimeoutError()
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
this
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
this.socketQ.addListener(
|
|
113
|
-
'open',
|
|
114
|
-
function () {
|
|
115
|
-
var packet = this.getRedLinkMessBytes()
|
|
116
|
-
this.send(packet)
|
|
117
|
-
this.proxy ? this.proxy.end() : false
|
|
118
|
-
},
|
|
119
|
-
this
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
this.socketQ.addListener(
|
|
123
|
-
'close',
|
|
124
|
-
function (e) {
|
|
125
|
-
if (this.channel === 1) {
|
|
126
|
-
this.fire('error', e)
|
|
127
|
-
}
|
|
128
|
-
this.socketQ.disconnect()
|
|
129
|
-
},
|
|
130
|
-
this
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
this.socketQ.addListener(
|
|
134
|
-
'error',
|
|
135
|
-
function (e) {
|
|
136
|
-
this.fire('error', e)
|
|
137
|
-
this.socketQ.disconnect()
|
|
138
|
-
},
|
|
139
|
-
this
|
|
140
|
-
)
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
changeCodec: function (codec) {
|
|
144
|
-
this.sendObject(
|
|
145
|
-
[
|
|
146
|
-
...wdi.SpiceObject.numberTo16(2),
|
|
147
|
-
...wdi.SpiceObject.numberTo16(codec),
|
|
148
|
-
...wdi.SpiceObject.numberTo16(3),
|
|
149
|
-
],
|
|
150
|
-
wdi.SpiceVars.SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
wdi.currentCodec = codec
|
|
154
|
-
|
|
155
|
-
console.log(`codec changed: ${codec}`)
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
connect: function (connectionInfo, channel, connectionId, proxy) {
|
|
159
|
-
var url = wdi.Utils.generateWebSocketUrl(
|
|
160
|
-
connectionInfo.protocol,
|
|
161
|
-
connectionInfo.host,
|
|
162
|
-
connectionInfo.port,
|
|
163
|
-
connectionInfo.vmHost,
|
|
164
|
-
connectionInfo.vmPort,
|
|
165
|
-
'spice',
|
|
166
|
-
connectionInfo.vmInfoToken,
|
|
167
|
-
connectionInfo.vmid
|
|
168
|
-
)
|
|
169
|
-
this.channel = channel
|
|
170
|
-
this.connectionId = connectionId || 0
|
|
171
|
-
this.socketQ.connect(url)
|
|
172
|
-
// this.startHandshakeTimeout()
|
|
173
|
-
this.proxy = proxy
|
|
174
|
-
this.token = connectionInfo.token
|
|
175
|
-
this.packetReassembler.start()
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
disconnect: function () {
|
|
179
|
-
wdi.Debug.log('spicechannel disconnect')
|
|
180
|
-
this.counter = 0
|
|
181
|
-
this.ackWindow = 0
|
|
182
|
-
this.connectionId = 0
|
|
183
|
-
this.socketQ.disconnect()
|
|
184
|
-
this.socketQ = null
|
|
185
|
-
this.packetReassembler.dispose()
|
|
186
|
-
this.packetReassembler = null
|
|
187
|
-
this.channel = 1
|
|
188
|
-
this.proxy = null
|
|
189
|
-
this.token = null
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
send: function (data, flush) {
|
|
193
|
-
this.socketQ.send(data, flush)
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
sendObject: function (data, type, flush) {
|
|
197
|
-
// TODO: Unhardcode this value
|
|
198
|
-
var bufSize = 2048
|
|
199
|
-
for (var current = 0; current < data.length; current += bufSize) {
|
|
200
|
-
var part = data.slice(current, current + bufSize)
|
|
201
|
-
var packet = new wdi.SpiceDataHeader({
|
|
202
|
-
type: type,
|
|
203
|
-
size: part.length,
|
|
204
|
-
}).marshall()
|
|
205
|
-
|
|
206
|
-
packet = packet.concat(part)
|
|
207
|
-
|
|
208
|
-
this.send(packet, flush)
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
// Custom code
|
|
213
|
-
arrayOfNumberToUint32: function (arrayOfNumber) {
|
|
214
|
-
let v = 0
|
|
215
|
-
for (let n of arrayOfNumber) {
|
|
216
|
-
v |= 1 << n
|
|
217
|
-
}
|
|
218
|
-
return v
|
|
219
|
-
},
|
|
220
|
-
// Custom code end
|
|
221
|
-
|
|
222
|
-
setAckWindow: function (window) {
|
|
223
|
-
this.ackWindow = window
|
|
224
|
-
this.counter = 0
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
getRawSpiceMessage: function (rawData) {
|
|
228
|
-
var headerQueue = wdi.GlobalPool.create('ViewQueue')
|
|
229
|
-
var body = wdi.GlobalPool.create('ViewQueue')
|
|
230
|
-
|
|
231
|
-
var header = new Uint8Array(
|
|
232
|
-
rawData,
|
|
233
|
-
0,
|
|
234
|
-
wdi.SpiceDataHeader.prototype.objectSize
|
|
235
|
-
)
|
|
236
|
-
headerQueue.setData(header)
|
|
237
|
-
var headerObj = new wdi.SpiceDataHeader().demarshall(headerQueue)
|
|
238
|
-
wdi.GlobalPool.discard('ViewQueue', headerQueue)
|
|
239
|
-
var rawBody = rawData.subarray(wdi.SpiceDataHeader.prototype.objectSize)
|
|
240
|
-
body.setData(rawBody)
|
|
241
|
-
|
|
242
|
-
this.counter++
|
|
243
|
-
|
|
244
|
-
if (this.ackWindow && this.counter === this.ackWindow) {
|
|
245
|
-
this.counter = 0
|
|
246
|
-
var ack = new wdi.SpiceDataHeader({
|
|
247
|
-
type: wdi.SpiceVars.SPICE_MSGC_ACK,
|
|
248
|
-
size: 0,
|
|
249
|
-
}).marshall()
|
|
250
|
-
this.send(ack)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
var packet = wdi.PacketLinkFactory.extract(headerObj, body) || false
|
|
254
|
-
if (packet) {
|
|
255
|
-
wdi.PacketLinkProcess.process(headerObj, packet, this)
|
|
256
|
-
wdi.GlobalPool.discard('ViewQueue', body)
|
|
257
|
-
return false
|
|
258
|
-
} else {
|
|
259
|
-
var rawSpiceMessage = wdi.GlobalPool.create('RawSpiceMessage')
|
|
260
|
-
rawSpiceMessage.set(headerObj, body, this.channel)
|
|
261
|
-
return rawSpiceMessage
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
//This functions are to avoid hardcoded values on logic
|
|
266
|
-
getRedLinkReplyBytes: function (data) {
|
|
267
|
-
if (this.token) {
|
|
268
|
-
var newq = new wdi.ViewQueue()
|
|
269
|
-
newq.setData(data)
|
|
270
|
-
newq.eatBytes(wdi.SpiceLinkHeader.prototype.objectSize)
|
|
271
|
-
var myBody = new wdi.SpiceLinkReply().demarshall(newq)
|
|
272
|
-
|
|
273
|
-
//Returnnig void bytes or encrypted ticket
|
|
274
|
-
var key = wdi.SpiceObject.stringHexToBytes(
|
|
275
|
-
RSA_public_encrypt(this.token, myBody.pub_key)
|
|
276
|
-
)
|
|
277
|
-
return key
|
|
278
|
-
} else {
|
|
279
|
-
return wdi.SpiceObject.stringToBytesPadding('', 128)
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
getRedLinkMessBytes: function () {
|
|
284
|
-
// var header = new wdi.SpiceLinkHeader({magic:1363428690, major_version:2, minor_version:2, size:22}).marshall();
|
|
285
|
-
// var body = new wdi.SpiceLinkMess({
|
|
286
|
-
// connection_id:this.connectionId,
|
|
287
|
-
// channel_type:this.channel,
|
|
288
|
-
// caps_offset:18,
|
|
289
|
-
// num_common_caps: 1,
|
|
290
|
-
// num_channel_caps: 0,
|
|
291
|
-
// common_caps: (1 << wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER)
|
|
292
|
-
// }).marshall();
|
|
293
|
-
|
|
294
|
-
// Custom code
|
|
295
|
-
// TODO uncomment this code for send caps
|
|
296
|
-
var header = new wdi.SpiceLinkHeader({
|
|
297
|
-
magic: 1363428690,
|
|
298
|
-
major_version: 2,
|
|
299
|
-
minor_version: 2,
|
|
300
|
-
size: 26,
|
|
301
|
-
}).marshall()
|
|
302
|
-
var body = new wdi.SpiceLinkMess({
|
|
303
|
-
connection_id: this.connectionId,
|
|
304
|
-
channel_type: this.channel,
|
|
305
|
-
caps_offset: 18,
|
|
306
|
-
num_common_caps: 1,
|
|
307
|
-
num_channel_caps: 1,
|
|
308
|
-
common_caps: 1 << wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER,
|
|
309
|
-
channel_caps: this.arrayOfNumberToUint32([
|
|
310
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_SIZED_STREAM,
|
|
311
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_STREAM_REPORT,
|
|
312
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MONITORS_CONFIG,
|
|
313
|
-
|
|
314
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MULTI_CODEC,
|
|
315
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE,
|
|
316
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_MJPEG,
|
|
317
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP8,
|
|
318
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H264,
|
|
319
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP9,
|
|
320
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H265,
|
|
321
|
-
|
|
322
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_LZ4_COMPRESSION,
|
|
323
|
-
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_COMPRESSION,
|
|
324
|
-
]),
|
|
325
|
-
}).marshall()
|
|
326
|
-
// Custom code end
|
|
327
|
-
|
|
328
|
-
return header.concat(body)
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
getErrorCodeBytes: function (data) {
|
|
332
|
-
var errorQ = wdi.GlobalPool.create('ViewQueue')
|
|
333
|
-
errorQ.setData(data)
|
|
334
|
-
var errorCode = wdi.SpiceObject.bytesToInt32NoAllocate(errorQ)
|
|
335
|
-
wdi.GlobalPool.discard('ViewQueue', errorQ)
|
|
336
|
-
if (errorCode === 0) {
|
|
337
|
-
if (this.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
|
|
338
|
-
var redDisplayInit = new wdi.SpiceDataHeader({
|
|
339
|
-
type: wdi.SpiceVars.SPICE_MSGC_DISPLAY_INIT,
|
|
340
|
-
size: 14,
|
|
341
|
-
}).marshall()
|
|
342
|
-
//TODO: ultrahardcoded value here, move to configuration
|
|
343
|
-
|
|
344
|
-
//DUE To high level storage the memory specified for cache
|
|
345
|
-
//is 2-3 times bigger than expected.
|
|
346
|
-
var cache_size = 1
|
|
347
|
-
|
|
348
|
-
var body = new wdi.SpiceCDisplayInit({
|
|
349
|
-
pixmap_cache_id: 1,
|
|
350
|
-
pixmap_cache_size: cache_size,
|
|
351
|
-
glz_dictionary_id: 0,
|
|
352
|
-
glz_dictionary_window_size: 0,
|
|
353
|
-
}).marshall()
|
|
354
|
-
|
|
355
|
-
return redDisplayInit.concat(body)
|
|
356
|
-
} else if (this.channel == wdi.SpiceVars.SPICE_CHANNEL_MAIN) {
|
|
357
|
-
return new wdi.SpiceDataHeader({
|
|
358
|
-
type: wdi.SpiceVars.SPICE_MSGC_MAIN_ATTACH_CHANNELS,
|
|
359
|
-
size: 0,
|
|
360
|
-
}).marshall()
|
|
361
|
-
}
|
|
362
|
-
} else {
|
|
363
|
-
throw new wdi.Exception({
|
|
364
|
-
message: 'Server refused client',
|
|
365
|
-
errorCode: 2,
|
|
366
|
-
})
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
})
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2016 eyeOS
|
|
3
|
+
|
|
4
|
+
This file is part of Open365.
|
|
5
|
+
|
|
6
|
+
Open365 is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Affero General Public License as
|
|
8
|
+
published by the Free Software Foundation, either version 3 of the
|
|
9
|
+
License, or (at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Affero General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
//Must fire event types: connectionId and message
|
|
21
|
+
|
|
22
|
+
wdi.SpiceChannel = $.spcExtend(wdi.EventObject.prototype, {
|
|
23
|
+
counter: 0,
|
|
24
|
+
ackWindow: 0,
|
|
25
|
+
connectionId: 0,
|
|
26
|
+
socketQ: null,
|
|
27
|
+
packetReassembler: null,
|
|
28
|
+
channel: 1,
|
|
29
|
+
codec: wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG,
|
|
30
|
+
proxy: null,
|
|
31
|
+
token: null,
|
|
32
|
+
|
|
33
|
+
init: function (c) {
|
|
34
|
+
this.superInit()
|
|
35
|
+
this.socketQ = c.socketQ || new wdi.SocketQueue()
|
|
36
|
+
this.packetReassembler =
|
|
37
|
+
c.packetReassembler ||
|
|
38
|
+
wdi.ReassemblerFactory.getPacketReassembler(this.socketQ)
|
|
39
|
+
this.setListeners()
|
|
40
|
+
this.ackWindow = 0
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// startHandshakeTimeout: function () {
|
|
44
|
+
// var self = this
|
|
45
|
+
// this.handshakeTimeout = window.setTimeout(function () {
|
|
46
|
+
// var err = new Error('Handshake timeout')
|
|
47
|
+
// err.code = 4200
|
|
48
|
+
// wdi.Debug.error('Handshake timeout reached, raising error')
|
|
49
|
+
// self.fire('error', err)
|
|
50
|
+
// }, 5000)
|
|
51
|
+
// },
|
|
52
|
+
|
|
53
|
+
fireHandshakeTimeoutError: function () {
|
|
54
|
+
var err = new Error('Handshake timeout')
|
|
55
|
+
err.code = 4200
|
|
56
|
+
wdi.Debug.error('Handshake timeout reached, raising error')
|
|
57
|
+
this.fire('error', err)
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// cancelHandshakeTimeout: function () {
|
|
61
|
+
// clearTimeout(this.handshakeTimeout)
|
|
62
|
+
// },
|
|
63
|
+
|
|
64
|
+
setListeners: function () {
|
|
65
|
+
var date
|
|
66
|
+
var self = this
|
|
67
|
+
this.packetReassembler.addListener(
|
|
68
|
+
'packetComplete',
|
|
69
|
+
function (e) {
|
|
70
|
+
var rawMessage = e
|
|
71
|
+
if (rawMessage.status === 'spicePacket') {
|
|
72
|
+
wdi.Debug.log('packetComplete spicePacket')
|
|
73
|
+
// self.cancelHandshakeTimeout()
|
|
74
|
+
if (wdi.logOperations) {
|
|
75
|
+
wdi.DataLogger.logNetworkTime()
|
|
76
|
+
date = Date.now()
|
|
77
|
+
}
|
|
78
|
+
var rsm = this.getRawSpiceMessage(rawMessage.data)
|
|
79
|
+
if (rsm) {
|
|
80
|
+
if (
|
|
81
|
+
wdi.logOperations &&
|
|
82
|
+
rsm.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY
|
|
83
|
+
) {
|
|
84
|
+
wdi.DataLogger.setStartTime(date)
|
|
85
|
+
}
|
|
86
|
+
this.fire('message', rsm)
|
|
87
|
+
}
|
|
88
|
+
} else if (rawMessage.status === 'reply') {
|
|
89
|
+
wdi.Debug.log('packetComplete reply')
|
|
90
|
+
var packet = this.getRedLinkReplyBytes(rawMessage.data)
|
|
91
|
+
this.send(packet)
|
|
92
|
+
} else if (rawMessage.status === 'errorCode') {
|
|
93
|
+
wdi.Debug.log('packetComplete errorCode')
|
|
94
|
+
var packet = this.getErrorCodeBytes(rawMessage.data)
|
|
95
|
+
if (packet) {
|
|
96
|
+
this.send(packet)
|
|
97
|
+
if (this.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
|
|
98
|
+
// Custom code
|
|
99
|
+
// Set codec
|
|
100
|
+
this.changeCodec(this.codec)
|
|
101
|
+
// Custom code end
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.fire('channelConnected')
|
|
105
|
+
} else {
|
|
106
|
+
self.fireHandshakeTimeoutError()
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
this
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
this.socketQ.addListener(
|
|
113
|
+
'open',
|
|
114
|
+
function () {
|
|
115
|
+
var packet = this.getRedLinkMessBytes()
|
|
116
|
+
this.send(packet)
|
|
117
|
+
this.proxy ? this.proxy.end() : false
|
|
118
|
+
},
|
|
119
|
+
this
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
this.socketQ.addListener(
|
|
123
|
+
'close',
|
|
124
|
+
function (e) {
|
|
125
|
+
if (this.channel === 1) {
|
|
126
|
+
this.fire('error', e)
|
|
127
|
+
}
|
|
128
|
+
this.socketQ.disconnect()
|
|
129
|
+
},
|
|
130
|
+
this
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
this.socketQ.addListener(
|
|
134
|
+
'error',
|
|
135
|
+
function (e) {
|
|
136
|
+
this.fire('error', e)
|
|
137
|
+
this.socketQ.disconnect()
|
|
138
|
+
},
|
|
139
|
+
this
|
|
140
|
+
)
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
changeCodec: function (codec) {
|
|
144
|
+
this.sendObject(
|
|
145
|
+
[
|
|
146
|
+
...wdi.SpiceObject.numberTo16(2),
|
|
147
|
+
...wdi.SpiceObject.numberTo16(codec),
|
|
148
|
+
...wdi.SpiceObject.numberTo16(3),
|
|
149
|
+
],
|
|
150
|
+
wdi.SpiceVars.SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
wdi.currentCodec = codec
|
|
154
|
+
|
|
155
|
+
console.log(`codec changed: ${codec}`)
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
connect: function (connectionInfo, channel, connectionId, proxy) {
|
|
159
|
+
var url = wdi.Utils.generateWebSocketUrl(
|
|
160
|
+
connectionInfo.protocol,
|
|
161
|
+
connectionInfo.host,
|
|
162
|
+
connectionInfo.port,
|
|
163
|
+
connectionInfo.vmHost,
|
|
164
|
+
connectionInfo.vmPort,
|
|
165
|
+
'spice',
|
|
166
|
+
connectionInfo.vmInfoToken,
|
|
167
|
+
connectionInfo.vmid
|
|
168
|
+
)
|
|
169
|
+
this.channel = channel
|
|
170
|
+
this.connectionId = connectionId || 0
|
|
171
|
+
this.socketQ.connect(url)
|
|
172
|
+
// this.startHandshakeTimeout()
|
|
173
|
+
this.proxy = proxy
|
|
174
|
+
this.token = connectionInfo.token
|
|
175
|
+
this.packetReassembler.start()
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
disconnect: function () {
|
|
179
|
+
wdi.Debug.log('spicechannel disconnect')
|
|
180
|
+
this.counter = 0
|
|
181
|
+
this.ackWindow = 0
|
|
182
|
+
this.connectionId = 0
|
|
183
|
+
this.socketQ.disconnect()
|
|
184
|
+
this.socketQ = null
|
|
185
|
+
this.packetReassembler.dispose()
|
|
186
|
+
this.packetReassembler = null
|
|
187
|
+
this.channel = 1
|
|
188
|
+
this.proxy = null
|
|
189
|
+
this.token = null
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
send: function (data, flush) {
|
|
193
|
+
this.socketQ.send(data, flush)
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
sendObject: function (data, type, flush) {
|
|
197
|
+
// TODO: Unhardcode this value
|
|
198
|
+
var bufSize = 2048
|
|
199
|
+
for (var current = 0; current < data.length; current += bufSize) {
|
|
200
|
+
var part = data.slice(current, current + bufSize)
|
|
201
|
+
var packet = new wdi.SpiceDataHeader({
|
|
202
|
+
type: type,
|
|
203
|
+
size: part.length,
|
|
204
|
+
}).marshall()
|
|
205
|
+
|
|
206
|
+
packet = packet.concat(part)
|
|
207
|
+
|
|
208
|
+
this.send(packet, flush)
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
// Custom code
|
|
213
|
+
arrayOfNumberToUint32: function (arrayOfNumber) {
|
|
214
|
+
let v = 0
|
|
215
|
+
for (let n of arrayOfNumber) {
|
|
216
|
+
v |= 1 << n
|
|
217
|
+
}
|
|
218
|
+
return v
|
|
219
|
+
},
|
|
220
|
+
// Custom code end
|
|
221
|
+
|
|
222
|
+
setAckWindow: function (window) {
|
|
223
|
+
this.ackWindow = window
|
|
224
|
+
this.counter = 0
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
getRawSpiceMessage: function (rawData) {
|
|
228
|
+
var headerQueue = wdi.GlobalPool.create('ViewQueue')
|
|
229
|
+
var body = wdi.GlobalPool.create('ViewQueue')
|
|
230
|
+
|
|
231
|
+
var header = new Uint8Array(
|
|
232
|
+
rawData,
|
|
233
|
+
0,
|
|
234
|
+
wdi.SpiceDataHeader.prototype.objectSize
|
|
235
|
+
)
|
|
236
|
+
headerQueue.setData(header)
|
|
237
|
+
var headerObj = new wdi.SpiceDataHeader().demarshall(headerQueue)
|
|
238
|
+
wdi.GlobalPool.discard('ViewQueue', headerQueue)
|
|
239
|
+
var rawBody = rawData.subarray(wdi.SpiceDataHeader.prototype.objectSize)
|
|
240
|
+
body.setData(rawBody)
|
|
241
|
+
|
|
242
|
+
this.counter++
|
|
243
|
+
|
|
244
|
+
if (this.ackWindow && this.counter === this.ackWindow) {
|
|
245
|
+
this.counter = 0
|
|
246
|
+
var ack = new wdi.SpiceDataHeader({
|
|
247
|
+
type: wdi.SpiceVars.SPICE_MSGC_ACK,
|
|
248
|
+
size: 0,
|
|
249
|
+
}).marshall()
|
|
250
|
+
this.send(ack)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var packet = wdi.PacketLinkFactory.extract(headerObj, body) || false
|
|
254
|
+
if (packet) {
|
|
255
|
+
wdi.PacketLinkProcess.process(headerObj, packet, this)
|
|
256
|
+
wdi.GlobalPool.discard('ViewQueue', body)
|
|
257
|
+
return false
|
|
258
|
+
} else {
|
|
259
|
+
var rawSpiceMessage = wdi.GlobalPool.create('RawSpiceMessage')
|
|
260
|
+
rawSpiceMessage.set(headerObj, body, this.channel)
|
|
261
|
+
return rawSpiceMessage
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
//This functions are to avoid hardcoded values on logic
|
|
266
|
+
getRedLinkReplyBytes: function (data) {
|
|
267
|
+
if (this.token) {
|
|
268
|
+
var newq = new wdi.ViewQueue()
|
|
269
|
+
newq.setData(data)
|
|
270
|
+
newq.eatBytes(wdi.SpiceLinkHeader.prototype.objectSize)
|
|
271
|
+
var myBody = new wdi.SpiceLinkReply().demarshall(newq)
|
|
272
|
+
|
|
273
|
+
//Returnnig void bytes or encrypted ticket
|
|
274
|
+
var key = wdi.SpiceObject.stringHexToBytes(
|
|
275
|
+
RSA_public_encrypt(this.token, myBody.pub_key)
|
|
276
|
+
)
|
|
277
|
+
return key
|
|
278
|
+
} else {
|
|
279
|
+
return wdi.SpiceObject.stringToBytesPadding('', 128)
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
getRedLinkMessBytes: function () {
|
|
284
|
+
// var header = new wdi.SpiceLinkHeader({magic:1363428690, major_version:2, minor_version:2, size:22}).marshall();
|
|
285
|
+
// var body = new wdi.SpiceLinkMess({
|
|
286
|
+
// connection_id:this.connectionId,
|
|
287
|
+
// channel_type:this.channel,
|
|
288
|
+
// caps_offset:18,
|
|
289
|
+
// num_common_caps: 1,
|
|
290
|
+
// num_channel_caps: 0,
|
|
291
|
+
// common_caps: (1 << wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER)
|
|
292
|
+
// }).marshall();
|
|
293
|
+
|
|
294
|
+
// Custom code
|
|
295
|
+
// TODO uncomment this code for send caps
|
|
296
|
+
var header = new wdi.SpiceLinkHeader({
|
|
297
|
+
magic: 1363428690,
|
|
298
|
+
major_version: 2,
|
|
299
|
+
minor_version: 2,
|
|
300
|
+
size: 26,
|
|
301
|
+
}).marshall()
|
|
302
|
+
var body = new wdi.SpiceLinkMess({
|
|
303
|
+
connection_id: this.connectionId,
|
|
304
|
+
channel_type: this.channel,
|
|
305
|
+
caps_offset: 18,
|
|
306
|
+
num_common_caps: 1,
|
|
307
|
+
num_channel_caps: 1,
|
|
308
|
+
common_caps: 1 << wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER,
|
|
309
|
+
channel_caps: this.arrayOfNumberToUint32([
|
|
310
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_SIZED_STREAM,
|
|
311
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_STREAM_REPORT,
|
|
312
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MONITORS_CONFIG,
|
|
313
|
+
|
|
314
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MULTI_CODEC,
|
|
315
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE,
|
|
316
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_MJPEG,
|
|
317
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP8,
|
|
318
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H264,
|
|
319
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP9,
|
|
320
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H265,
|
|
321
|
+
|
|
322
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_LZ4_COMPRESSION,
|
|
323
|
+
wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_COMPRESSION,
|
|
324
|
+
]),
|
|
325
|
+
}).marshall()
|
|
326
|
+
// Custom code end
|
|
327
|
+
|
|
328
|
+
return header.concat(body)
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
getErrorCodeBytes: function (data) {
|
|
332
|
+
var errorQ = wdi.GlobalPool.create('ViewQueue')
|
|
333
|
+
errorQ.setData(data)
|
|
334
|
+
var errorCode = wdi.SpiceObject.bytesToInt32NoAllocate(errorQ)
|
|
335
|
+
wdi.GlobalPool.discard('ViewQueue', errorQ)
|
|
336
|
+
if (errorCode === 0) {
|
|
337
|
+
if (this.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
|
|
338
|
+
var redDisplayInit = new wdi.SpiceDataHeader({
|
|
339
|
+
type: wdi.SpiceVars.SPICE_MSGC_DISPLAY_INIT,
|
|
340
|
+
size: 14,
|
|
341
|
+
}).marshall()
|
|
342
|
+
//TODO: ultrahardcoded value here, move to configuration
|
|
343
|
+
|
|
344
|
+
//DUE To high level storage the memory specified for cache
|
|
345
|
+
//is 2-3 times bigger than expected.
|
|
346
|
+
var cache_size = 1
|
|
347
|
+
|
|
348
|
+
var body = new wdi.SpiceCDisplayInit({
|
|
349
|
+
pixmap_cache_id: 1,
|
|
350
|
+
pixmap_cache_size: cache_size,
|
|
351
|
+
glz_dictionary_id: 0,
|
|
352
|
+
glz_dictionary_window_size: 0,
|
|
353
|
+
}).marshall()
|
|
354
|
+
|
|
355
|
+
return redDisplayInit.concat(body)
|
|
356
|
+
} else if (this.channel == wdi.SpiceVars.SPICE_CHANNEL_MAIN) {
|
|
357
|
+
return new wdi.SpiceDataHeader({
|
|
358
|
+
type: wdi.SpiceVars.SPICE_MSGC_MAIN_ATTACH_CHANNELS,
|
|
359
|
+
size: 0,
|
|
360
|
+
}).marshall()
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
throw new wdi.Exception({
|
|
364
|
+
message: 'Server refused client',
|
|
365
|
+
errorCode: 2,
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
})
|