| 74 | |
| 75 | |
| 76 | void VGLTrans::sendHeader(rrframeheader h, bool eof) |
| 77 | { |
| 78 | if(version.major == 0 && version.minor == 0) |
| 79 | { |
| 80 | // Fake up an old (protocol v1.0) EOF packet and see if the client sends |
| 81 | // back a CTS signal. If so, it needs protocol 1.0 |
| 82 | rrframeheader_v1 h1; char reply = 0; |
| 83 | CONVERT_HEADER(h, h1); |
| 84 | h1.flags = RR_EOF; |
| 85 | ENDIANIZE_V1(h1); |
| 86 | if(socket) |
| 87 | { |
| 88 | send((char *)&h1, sizeof_rrframeheader_v1); |
| 89 | recv(&reply, 1); |
| 90 | if(reply == 1) |
| 91 | { |
| 92 | version.major = 1; version.minor = 0; |
| 93 | } |
| 94 | else if(reply == 'V') |
| 95 | { |
| 96 | rrversion v; |
| 97 | version.id[0] = reply; |
| 98 | recv(&version.id[1], sizeof_rrversion - 1); |
| 99 | if(strncmp(version.id, "VGL", 3) || version.major < 1) |
| 100 | THROW("Error reading client version"); |
| 101 | v = version; |
| 102 | v.major = RR_MAJOR_VERSION; v.minor = RR_MINOR_VERSION; |
| 103 | send((char *)&v, sizeof_rrversion); |
| 104 | } |
| 105 | if(fconfig.verbose) |
| 106 | vglout.println("[VGL] Client version: %d.%d", version.major, |
| 107 | version.minor); |
| 108 | } |
| 109 | } |
| 110 | if((version.major < 2 || (version.major == 2 && version.minor < 1)) |
| 111 | && h.compress != RRCOMP_JPEG) |
| 112 | THROW("This compression mode requires VirtualGL Client v2.1 or later"); |
| 113 | if(eof) h.flags = RR_EOF; |
| 114 | if(version.major == 1 && version.minor == 0) |
| 115 | { |
| 116 | rrframeheader_v1 h1; |
| 117 | if(h.dpynum > 255) THROW("Display number out of range for v1.0 client"); |
| 118 | CONVERT_HEADER(h, h1); |
| 119 | ENDIANIZE_V1(h1); |
| 120 | if(socket) |
| 121 | { |
| 122 | send((char *)&h1, sizeof_rrframeheader_v1); |
| 123 | if(eof) |
| 124 | { |
| 125 | char cts = 0; |
| 126 | recv(&cts, 1); |
| 127 | if(cts < 1 || cts > 2) THROW("CTS Error"); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | else |
| 132 | { |
| 133 | ENDIANIZE(h); |
no test coverage detected