How to use rQshiftStr method in redwood

Best JavaScript code snippet using redwood

b50f34067432b62ac9f323957fb8960b5b4b3d0b_0_1.js

Source:b50f34067432b62ac9f323957fb8960b5b4b3d0b_0_1.js Github

copy

Full Screen

...9 case 'ProtocolVersion' :10 if (ws.rQlen() < 12) {11 return fail("Incomplete protocol version");12 }13 sversion = ws.rQshiftStr(12).substr(4,7);14 Util.Info("Server ProtocolVersion: " + sversion);15 is_repeater = 0;16 switch (sversion) {17 case "000.000": is_repeater = 1; break; // UltraVNC repeater18 case "003.003": rfb_version = 3.3; break;19 case "003.006": rfb_version = 3.3; break; // UltraVNC20 case "003.889": rfb_version = 3.3; break; // Apple Remote Desktop21 case "003.007": rfb_version = 3.7; break;22 case "003.008": rfb_version = 3.8; break;23 case "004.000": rfb_version = 3.8; break; // Intel AMT KVM24 case "004.001": rfb_version = 3.8; break; // RealVNC 4.625 default:26 return fail("Invalid server version " + sversion);27 }28 if (is_repeater) { 29 repeaterID = conf.repeaterID;30 while(repeaterID.length < 250)31 repeaterID += "\0";32 ws.send_string(repeaterID);33 break;34 }35 if (rfb_version > rfb_max_version) { 36 rfb_version = rfb_max_version;37 }38 if (! test_mode) {39 sendTimer = setInterval(function() {40 // Send updates either at a rate of one update41 // every 50ms, or whatever slower rate the network42 // can handle.43 ws.flush();44 }, 50);45 }46 cversion = "00" + parseInt(rfb_version,10) +47 ".00" + ((rfb_version * 10) % 10);48 ws.send_string("RFB " + cversion + "\n");49 updateState('Security', "Sent ProtocolVersion: " + cversion);50 break;51 case 'Security' :52 if (rfb_version >= 3.7) {53 // Server sends supported list, client decides 54 num_types = ws.rQshift8();55 if (ws.rQwait("security type", num_types, 1)) { return false; }56 if (num_types === 0) {57 strlen = ws.rQshift32();58 reason = ws.rQshiftStr(strlen);59 return fail("Security failure: " + reason);60 }61 rfb_auth_scheme = 0;62 types = ws.rQshiftBytes(num_types);63 Util.Debug("Server security types: " + types);64 for (i=0; i < types.length; i+=1) {65 if ((types[i] > rfb_auth_scheme) && (types[i] < 3)) {66 rfb_auth_scheme = types[i];67 }68 }69 if (rfb_auth_scheme === 0) {70 return fail("Unsupported security types: " + types);71 }72 73 ws.send([rfb_auth_scheme]);74 } else {75 // Server decides76 if (ws.rQwait("security scheme", 4)) { return false; }77 rfb_auth_scheme = ws.rQshift32();78 //rfb_auth_scheme = ws.rQshiftStr(12);79 }80 updateState('Authentication',81 "Authenticating using scheme: " + rfb_auth_scheme);82 init_msg(); // Recursive fallthrough (workaround JSLint complaint)83 break;84 // Triggered by fallthough, not by server message85 case 'Authentication' :86 //Util.Debug("Security auth scheme: " + rfb_auth_scheme);87 switch (rfb_auth_scheme) {88 case 0: // connection failed89 if (ws.rQwait("auth reason", 4)) { return false; }90 strlen = ws.rQshift32();91 reason = ws.rQshiftStr(strlen);92 return fail("Auth failure: " + reason);93 case 1: // no authentication94 if (rfb_version >= 3.8) {95 updateState('SecurityResult');96 return;97 }98 // Fall through to ClientInitialisation99 break;100 case 2: // VNC authentication101 if (rfb_password.length === 0) {102 // Notify via both callbacks since it is kind of103 // a RFB state change and a UI interface issue.104 updateState('password', "Password Required");105 conf.onPasswordRequired(that);106 return;107 }108 if (ws.rQwait("auth challenge", 16)) { return false; }109 challenge = ws.rQshiftBytes(16);110 //Util.Debug("Password: " + rfb_password);111 //Util.Debug("Challenge: " + challenge +112 // " (" + challenge.length + ")");113 response = genDES(rfb_password, challenge);114 //Util.Debug("Response: " + response +115 // " (" + response.length + ")");116 117 //Util.Debug("Sending DES encrypted auth response");118 ws.send(response);119 updateState('SecurityResult');120 return;121 default:122 fail("Unsupported auth scheme: " + rfb_auth_scheme);123 return;124 }125 updateState('ClientInitialisation', "No auth required");126 init_msg(); // Recursive fallthrough (workaround JSLint complaint)127 break;128 case 'SecurityResult' :129 if (ws.rQwait("VNC auth response ", 4)) { return false; }130 switch (ws.rQshift32()) {131 case 0: // OK132 // Fall through to ClientInitialisation133 break;134 case 1: // failed135 if (rfb_version >= 3.8) {136 length = ws.rQshift32();137 if (ws.rQwait("SecurityResult reason", length, 8)) {138 return false;139 }140 reason = ws.rQshiftStr(length);141 fail(reason);142 } else {143 fail("Authentication failed");144 }145 return;146 case 2: // too-many147 return fail("Too many auth attempts");148 }149 updateState('ClientInitialisation', "Authentication OK");150 init_msg(); // Recursive fallthrough (workaround JSLint complaint)151 break;152 // Triggered by fallthough, not by server message153 case 'ClientInitialisation' :154 ws.send([conf.shared ? 1 : 0]); // ClientInitialisation155 updateState('ServerInitialisation', "Authentication OK");156 break;157 case 'ServerInitialisation' :158 if (ws.rQwait("server initialization", 24)) { return false; }159 /* Screen size */160 fb_width = ws.rQshift16();161 fb_height = ws.rQshift16();162 /* PIXEL_FORMAT */163 bpp = ws.rQshift8();164 depth = ws.rQshift8();165 big_endian = ws.rQshift8();166 true_color = ws.rQshift8();167 red_max = ws.rQshift16();168 green_max = ws.rQshift16();169 blue_max = ws.rQshift16();170 red_shift = ws.rQshift8();171 green_shift = ws.rQshift8();172 blue_shift = ws.rQshift8();173 ws.rQshiftStr(3); // padding174 Util.Info("Screen: " + fb_width + "x" + fb_height + 175 ", bpp: " + bpp + ", depth: " + depth +176 ", big_endian: " + big_endian +177 ", true_color: " + true_color +178 ", red_max: " + red_max +179 ", green_max: " + green_max +180 ", blue_max: " + blue_max +181 ", red_shift: " + red_shift +182 ", green_shift: " + green_shift +183 ", blue_shift: " + blue_shift);184 if (big_endian !== 0) {185 Util.Warn("Server native endian is not little endian");186 }187 if (red_shift !== 16) {188 Util.Warn("Server native red-shift is not 16");189 }190 if (blue_shift !== 0) {191 Util.Warn("Server native blue-shift is not 0");192 }193 /* Connection name/title */194 name_length = ws.rQshift32();195 fb_name = ws.rQshiftStr(name_length);196 197 if (conf.true_color && fb_name === "Intel(r) AMT KVM")198 {199 Util.Warn("Intel AMT KVM only support 8/16 bit depths. Disabling true color");200 conf.true_color = false;201 }202 display.set_true_color(conf.true_color);203 display.resize(fb_width, fb_height);204 keyboard.grab();205 mouse.grab();206 if (conf.true_color) {207 fb_Bpp = 4;208 fb_depth = 3;209 } else {...

Full Screen

Full Screen

websock.js

Source:websock.js Github

copy

Full Screen

...102 (rQ[rQi++] << 16) +103 (rQ[rQi++] << 8) +104 (rQ[rQi++] );105}106function rQshiftStr(len) {107 if (typeof(len) === 'undefined') { len = rQlen(); }108 var arr = rQ.slice(rQi, rQi + len);109 rQi += len;110 return arr.map(function (num) {111 return String.fromCharCode(num); } ).join('');112}113function rQshiftBytes(len) {114 if (typeof(len) === 'undefined') { len = rQlen(); }115 rQi += len;116 return rQ.slice(rQi-len, rQi);117}118function rQslice(start, end) {119 if (end) {120 return rQ.slice(rQi + start, rQi + end);...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run redwood automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful