Lines Matching refs:client
44 static void Dummy(rfbClient* client) { in Dummy() argument
46 static rfbBool DummyPoint(rfbClient* client, int x, int y) { in DummyPoint() argument
49 static void DummyRect(rfbClient* client, int x, int y, int w, int h) { in DummyRect() argument
53 static char* NoPassword(rfbClient* client) { in NoPassword() argument
62 static char* ReadPassword(rfbClient* client) { in ReadPassword() argument
66 return NoPassword(client); in ReadPassword()
91 static rfbBool MallocFrameBuffer(rfbClient* client) { in MallocFrameBuffer() argument
94 if(client->frameBuffer) in MallocFrameBuffer()
95 free(client->frameBuffer); in MallocFrameBuffer()
101 allocSize = (uint64_t)client->width * client->height * client->format.bitsPerPixel/8; in MallocFrameBuffer()
108 client->frameBuffer=malloc( (size_t)allocSize ); in MallocFrameBuffer()
110 if (client->frameBuffer == NULL) in MallocFrameBuffer()
113 return client->frameBuffer?TRUE:FALSE; in MallocFrameBuffer()
141 rfbClient* client=(rfbClient*)calloc(sizeof(rfbClient),1); in rfbGetClient() local
142 if(!client) { in rfbGetClient()
146 initAppData(&client->appData); in rfbGetClient()
147 client->endianTest = 1; in rfbGetClient()
148 client->programName=""; in rfbGetClient()
149 client->serverHost=strdup(""); in rfbGetClient()
150 client->serverPort=5900; in rfbGetClient()
152 client->destHost = NULL; in rfbGetClient()
153 client->destPort = 5900; in rfbGetClient()
155 client->CurrentKeyboardLedState = 0; in rfbGetClient()
156 client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint; in rfbGetClient()
159 client->updateRect.x = -1; in rfbGetClient()
161 client->frameBuffer = NULL; in rfbGetClient()
162 client->outputWindow = 0; in rfbGetClient()
164 client->format.bitsPerPixel = bytesPerPixel*8; in rfbGetClient()
165 client->format.depth = bitsPerSample*samplesPerPixel; in rfbGetClient()
166 client->appData.requestedDepth=client->format.depth; in rfbGetClient()
167 client->format.bigEndian = *(char *)&client->endianTest?FALSE:TRUE; in rfbGetClient()
168 client->format.trueColour = TRUE; in rfbGetClient()
170 if (client->format.bitsPerPixel == 8) { in rfbGetClient()
171 client->format.redMax = 7; in rfbGetClient()
172 client->format.greenMax = 7; in rfbGetClient()
173 client->format.blueMax = 3; in rfbGetClient()
174 client->format.redShift = 0; in rfbGetClient()
175 client->format.greenShift = 3; in rfbGetClient()
176 client->format.blueShift = 6; in rfbGetClient()
178 client->format.redMax = (1 << bitsPerSample) - 1; in rfbGetClient()
179 client->format.greenMax = (1 << bitsPerSample) - 1; in rfbGetClient()
180 client->format.blueMax = (1 << bitsPerSample) - 1; in rfbGetClient()
181 if(!client->format.bigEndian) { in rfbGetClient()
182 client->format.redShift = 0; in rfbGetClient()
183 client->format.greenShift = bitsPerSample; in rfbGetClient()
184 client->format.blueShift = bitsPerSample * 2; in rfbGetClient()
186 if(client->format.bitsPerPixel==8*3) { in rfbGetClient()
187 client->format.redShift = bitsPerSample*2; in rfbGetClient()
188 client->format.greenShift = bitsPerSample*1; in rfbGetClient()
189 client->format.blueShift = 0; in rfbGetClient()
191 client->format.redShift = bitsPerSample*3; in rfbGetClient()
192 client->format.greenShift = bitsPerSample*2; in rfbGetClient()
193 client->format.blueShift = bitsPerSample; in rfbGetClient()
198 client->bufoutptr=client->buf; in rfbGetClient()
199 client->buffered=0; in rfbGetClient()
202 client->raw_buffer_size = -1; in rfbGetClient()
203 client->decompStreamInited = FALSE; in rfbGetClient()
206 memset(client->zlibStreamActive,0,sizeof(rfbBool)*4); in rfbGetClient()
207 client->jpegSrcManager = NULL; in rfbGetClient()
211 client->HandleCursorPos = DummyPoint; in rfbGetClient()
212 client->SoftCursorLockArea = DummyRect; in rfbGetClient()
213 client->SoftCursorUnlockScreen = Dummy; in rfbGetClient()
214 client->GotFrameBufferUpdate = DummyRect; in rfbGetClient()
215 client->FinishedFrameBufferUpdate = NULL; in rfbGetClient()
216 client->GetPassword = ReadPassword; in rfbGetClient()
217 client->MallocFrameBuffer = MallocFrameBuffer; in rfbGetClient()
218 client->Bell = Dummy; in rfbGetClient()
219 client->CurrentKeyboardLedState = 0; in rfbGetClient()
220 client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint; in rfbGetClient()
221 client->QoS_DSCP = 0; in rfbGetClient()
223 client->authScheme = 0; in rfbGetClient()
224 client->subAuthScheme = 0; in rfbGetClient()
225 client->GetCredential = NULL; in rfbGetClient()
226 client->tlsSession = NULL; in rfbGetClient()
227 client->sock = -1; in rfbGetClient()
228 client->listenSock = -1; in rfbGetClient()
229 client->listenAddress = NULL; in rfbGetClient()
230 client->listen6Sock = -1; in rfbGetClient()
231 client->listen6Address = NULL; in rfbGetClient()
232 client->clientAuthSchemes = NULL; in rfbGetClient()
233 return client; in rfbGetClient()
236 static rfbBool rfbInitConnection(rfbClient* client) in rfbInitConnection() argument
241 if (!client->listenSpecified) { in rfbInitConnection()
242 if (!client->serverHost) in rfbInitConnection()
244 if (client->destHost) { in rfbInitConnection()
245 …if (!ConnectToRFBRepeater(client,client->serverHost,client->serverPort,client->destHost,client->de… in rfbInitConnection()
248 if (!ConnectToRFBServer(client,client->serverHost,client->serverPort)) in rfbInitConnection()
255 if (!InitialiseRFBConnection(client)) in rfbInitConnection()
258 client->width=client->si.framebufferWidth; in rfbInitConnection()
259 client->height=client->si.framebufferHeight; in rfbInitConnection()
260 if (!client->MallocFrameBuffer(client)) in rfbInitConnection()
263 if (!SetFormatAndEncodings(client)) in rfbInitConnection()
266 if (client->updateRect.x < 0) { in rfbInitConnection()
267 client->updateRect.x = client->updateRect.y = 0; in rfbInitConnection()
268 client->updateRect.w = client->width; in rfbInitConnection()
269 client->updateRect.h = client->height; in rfbInitConnection()
272 if (client->appData.scaleSetting>1) in rfbInitConnection()
274 if (!SendScaleSetting(client, client->appData.scaleSetting)) in rfbInitConnection()
276 if (!SendFramebufferUpdateRequest(client, in rfbInitConnection()
277 client->updateRect.x / client->appData.scaleSetting, in rfbInitConnection()
278 client->updateRect.y / client->appData.scaleSetting, in rfbInitConnection()
279 client->updateRect.w / client->appData.scaleSetting, in rfbInitConnection()
280 client->updateRect.h / client->appData.scaleSetting, in rfbInitConnection()
286 if (!SendFramebufferUpdateRequest(client, in rfbInitConnection()
287 client->updateRect.x, client->updateRect.y, in rfbInitConnection()
288 client->updateRect.w, client->updateRect.h, in rfbInitConnection()
296 rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) { in rfbInitClient() argument
300 if(client->programName==0) in rfbInitClient()
301 client->programName=argv[0]; in rfbInitClient()
306 listenForIncomingConnections(client); in rfbInitClient()
309 listenForIncomingConnectionsNoFork(client, -1); in rfbInitClient()
312 client->serverPort = -1; in rfbInitClient()
315 client->appData.encodingsString = argv[i+1]; in rfbInitClient()
318 client->appData.compressLevel = atoi(argv[i+1]); in rfbInitClient()
321 client->appData.qualityLevel = atoi(argv[i+1]); in rfbInitClient()
324 client->appData.scaleSetting = atoi(argv[i+1]); in rfbInitClient()
327 client->QoS_DSCP = atoi(argv[i+1]); in rfbInitClient()
332 if(client->destHost) in rfbInitClient()
333 free(client->destHost); in rfbInitClient()
334 client->destPort = 5900; in rfbInitClient()
336 client->destHost = strdup(argv[i+1]); in rfbInitClient()
338 client->destHost[(int)(colon-argv[i+1])] = '\0'; in rfbInitClient()
339 client->destPort = atoi(colon+1); in rfbInitClient()
345 if(client->serverHost) in rfbInitClient()
346 free(client->serverHost); in rfbInitClient()
349 client->serverHost = strdup(argv[i]); in rfbInitClient()
350 client->serverHost[(int)(colon-argv[i])] = '\0'; in rfbInitClient()
351 client->serverPort = atoi(colon+1); in rfbInitClient()
353 client->serverHost = strdup(argv[i]); in rfbInitClient()
355 if(client->serverPort >= 0 && client->serverPort < 5900) in rfbInitClient()
356 client->serverPort += 5900; in rfbInitClient()
367 if(!rfbInitConnection(client)) { in rfbInitClient()
368 rfbClientCleanup(client); in rfbInitClient()
375 void rfbClientCleanup(rfbClient* client) { in rfbClientCleanup() argument
381 if (client->zlibStreamActive[i] == TRUE ) { in rfbClientCleanup()
382 if (inflateEnd (&client->zlibStream[i]) != Z_OK && in rfbClientCleanup()
383 client->zlibStream[i].msg != NULL) in rfbClientCleanup()
384 rfbClientLog("inflateEnd: %s\n", client->zlibStream[i].msg); in rfbClientCleanup()
388 if ( client->decompStreamInited == TRUE ) { in rfbClientCleanup()
389 if (inflateEnd (&client->decompStream) != Z_OK && in rfbClientCleanup()
390 client->decompStream.msg != NULL) in rfbClientCleanup()
391 rfbClientLog("inflateEnd: %s\n", client->decompStream.msg ); in rfbClientCleanup()
394 if (client->jpegSrcManager) in rfbClientCleanup()
395 free(client->jpegSrcManager); in rfbClientCleanup()
399 FreeTLS(client); in rfbClientCleanup()
401 while (client->clientData) { in rfbClientCleanup()
402 rfbClientData* next = client->clientData->next; in rfbClientCleanup()
403 free(client->clientData); in rfbClientCleanup()
404 client->clientData = next; in rfbClientCleanup()
407 if (client->sock >= 0) in rfbClientCleanup()
408 close(client->sock); in rfbClientCleanup()
409 if (client->listenSock >= 0) in rfbClientCleanup()
410 close(client->listenSock); in rfbClientCleanup()
411 free(client->desktopName); in rfbClientCleanup()
412 free(client->serverHost); in rfbClientCleanup()
413 if (client->destHost) in rfbClientCleanup()
414 free(client->destHost); in rfbClientCleanup()
415 if (client->clientAuthSchemes) in rfbClientCleanup()
416 free(client->clientAuthSchemes); in rfbClientCleanup()
417 free(client); in rfbClientCleanup()