gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vncserver.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2015 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * Authors: Ali Saidi
38  * William Wang
39  */
40 
45 #include <sys/ioctl.h>
46 #include <sys/stat.h>
47 
48 #if defined(__FreeBSD__)
49 #include <termios.h>
50 
51 #else
52 #include <sys/termios.h>
53 
54 #endif
55 #include "base/vnc/vncserver.hh"
56 
57 #include <fcntl.h>
58 #include <poll.h>
59 #include <sys/types.h>
60 #include <unistd.h>
61 
62 #include <cerrno>
63 #include <cstddef>
64 #include <cstdio>
65 
66 #include "base/atomicio.hh"
67 #include "base/bitmap.hh"
68 #include "base/misc.hh"
69 #include "base/output.hh"
70 #include "base/socket.hh"
71 #include "base/trace.hh"
72 #include "debug/VNC.hh"
73 #include "sim/byteswap.hh"
74 #include "sim/core.hh"
75 
76 using namespace std;
77 
79  4, // 4 bytes / pixel
80  16, 8, 0, // R in [23, 16], G in [15, 8], B in [7, 0]
81  8, 8, 8, // 8 bits / channel
83 
92  : PollEvent(fd, e), vncserver(vs)
93 {
94 }
95 
96 void
98 {
99  vncserver->accept();
100 }
101 
106  : PollEvent(fd, e), vncserver(vs)
107 {
108 }
109 
110 void
112 {
113  if (revent & POLLIN)
114  vncserver->data();
115  else if (revent & POLLNVAL)
116  vncserver->detach();
117 }
118 
123  : VncInput(p), listenEvent(NULL), dataEvent(NULL), number(p->number),
124  dataFd(-1), sendUpdate(false),
125  supportsRawEnc(false), supportsResizeEnc(false)
126 {
127  if (p->port)
128  listen(p->port);
129 
131 
132  // We currently only support one pixel format. Extract the pixel
133  // representation from our PixelConverter instance and keep it
134  // around for telling the client and making sure it cooperates
145 
146  DPRINTF(VNC, "Vnc server created at port %d\n", p->port);
147 }
148 
150 {
151  if (dataFd != -1)
152  ::close(dataFd);
153 
154  if (listenEvent)
155  delete listenEvent;
156 
157  if (dataEvent)
158  delete dataEvent;
159 }
160 
161 
162 //socket creation and vnc client attach
163 void
165 {
167  warn_once("Sockets disabled, not accepting vnc client connections");
168  return;
169  }
170 
171  while (!listener.listen(port, true)) {
172  DPRINTF(VNC,
173  "can't bind address vnc server port %d in use PID %d\n",
174  port, getpid());
175  port++;
176  }
177 
178  int p1, p2;
179  p2 = name().rfind('.') - 1;
180  p1 = name().rfind('.', p2);
181  ccprintf(cerr, "Listening for %s connection on port %d\n",
182  name().substr(p1 + 1, p2 - p1), port);
183 
184  listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
186 }
187 
188 // attach a vnc client
189 void
191 {
192  // As a consequence of being called from the PollQueue, we might
193  // have been called from a different thread. Migrate to "our"
194  // thread.
196 
197  if (!listener.islistening())
198  panic("%s: cannot accept a connection if not listening!", name());
199 
200  int fd = listener.accept(true);
201  if (fd < 0) {
202  warn("%s: failed to accept VNC connection!", name());
203  return;
204  }
205 
206  if (dataFd != -1) {
207  char message[] = "vnc server already attached!\n";
208  atomic_write(fd, message, sizeof(message));
209  ::close(fd);
210  return;
211  }
212 
213  dataFd = fd;
214 
215  // Send our version number to the client
216  write((uint8_t *)vncVersion(), strlen(vncVersion()));
217 
218  // read the client response
219  dataEvent = new DataEvent(this, dataFd, POLLIN);
221 
222  inform("VNC client attached\n");
223 }
224 
225 // data called by data event
226 void
228 {
229  // We have new data, see if we can handle it
230  DPRINTF(VNC, "Vnc client message recieved\n");
231 
232  switch (curState) {
235  break;
237  checkSecurity();
238  break;
239  case WaitForClientInit:
240  // Don't care about shared, just need to read it out of the socket
241  uint8_t shared;
242  if (!read(&shared))
243  return;
244 
245  // Send our idea of the frame buffer
246  sendServerInit();
247 
248  break;
249  case NormalPhase:
250  uint8_t message_type;
251  if (!read(&message_type))
252  return;
253 
254  switch (message_type) {
256  setPixelFormat();
257  break;
258  case ClientSetEncodings:
259  setEncodings();
260  break;
262  requestFbUpdate();
263  break;
264  case ClientKeyEvent:
266  break;
267  case ClientPointerEvent:
269  break;
270  case ClientCutText:
271  recvCutText();
272  break;
273  default:
274  warn("Unimplemented message type recv from client: %d\n",
275  message_type);
276  detach();
277  break;
278  }
279  break;
280  default:
281  panic("Unknown vnc server state\n");
282  }
283 }
284 
285 
286 // read from socket
287 bool
288 VncServer::read(uint8_t *buf, size_t len)
289 {
290  if (dataFd < 0)
291  panic("vnc not properly attached.\n");
292 
293  size_t ret;
294  do {
295  ret = ::read(dataFd, buf, len);
296  } while (ret == -1 && errno == EINTR);
297 
298 
299  if (ret != len) {
300  DPRINTF(VNC, "Read failed %d.\n", ret);
301  detach();
302  return false;
303  }
304 
305  return true;
306 }
307 
308 bool
309 VncServer::read1(uint8_t *buf, size_t len)
310 {
311  return read(buf + 1, len - 1);
312 }
313 
314 
315 template<typename T>
316 bool
318 {
319  return read((uint8_t *)val, sizeof(T));
320 }
321 
322 // write to socket
323 bool
324 VncServer::write(const uint8_t *buf, size_t len)
325 {
326  if (dataFd < 0)
327  panic("Vnc client not properly attached.\n");
328 
329  ssize_t ret = atomic_write(dataFd, buf, len);
330 
331  if (ret != len) {
332  DPRINTF(VNC, "Write failed.\n");
333  detach();
334  return false;
335  }
336 
337  return true;
338 }
339 
340 template<typename T>
341 bool
343 {
344  return write((uint8_t *)val, sizeof(T));
345 }
346 
347 bool
348 VncServer::write(const char* str)
349 {
350  return write((uint8_t *)str, strlen(str));
351 }
352 
353 // detach a vnc client
354 void
356 {
357  if (dataFd != -1) {
358  ::close(dataFd);
359  dataFd = -1;
360  }
361 
362  if (!dataEvent || !dataEvent->queued())
363  return;
364 
366  delete dataEvent;
367  dataEvent = NULL;
369 
370  inform("VNC client detached\n");
371  DPRINTF(VNC, "detach vnc client %d\n", number);
372 }
373 
374 void
375 VncServer::sendError(const char* error_msg)
376 {
377  uint32_t len = strlen(error_msg);
378  if (!write(&len))
379  return;
380  write(error_msg);
381 }
382 
383 void
385 {
386  assert(curState == WaitForProtocolVersion);
387 
388  size_t len M5_VAR_USED;
389  char version_string[13];
390 
391  // Null terminate the message so it's easier to work with
392  version_string[12] = 0;
393 
394  if (!read((uint8_t *)version_string, sizeof(version_string) - 1)) {
395  warn("Failed to read protocol version.");
396  return;
397  }
398 
399  uint32_t major, minor;
400 
401  // Figure out the major/minor numbers
402  if (sscanf(version_string, "RFB %03d.%03d\n", &major, &minor) != 2) {
403  warn(" Malformed protocol version %s\n", version_string);
404  sendError("Malformed protocol version\n");
405  detach();
406  return;
407  }
408 
409  DPRINTF(VNC, "Client request protocol version %d.%d\n", major, minor);
410 
411  // If it's not 3.X we don't support it
412  if (major != 3 || minor < 2) {
413  warn("Unsupported VNC client version... disconnecting\n");
414  uint8_t err = AuthInvalid;
415  write(&err);
416  detach();
417  return;
418  }
419  // Auth is different based on version number
420  if (minor < 7) {
421  uint32_t sec_type = htobe((uint32_t)AuthNone);
422  if (!write(&sec_type))
423  return;
424  } else {
425  uint8_t sec_cnt = 1;
426  uint8_t sec_type = htobe((uint8_t)AuthNone);
427  if (!write(&sec_cnt) || !write(&sec_type))
428  return;
429  }
430 
431  // Wait for client to respond
433 }
434 
435 void
437 {
439 
440  uint8_t security_type;
441  if (!read(&security_type))
442  return;
443 
444  if (security_type != AuthNone) {
445  warn("Unknown VNC security type\n");
446  sendError("Unknown security type\n");
447  }
448 
449  DPRINTF(VNC, "Sending security auth OK\n");
450 
451  uint32_t success = htobe(VncOK);
452  if (!write(&success))
453  return;
455 }
456 
457 void
459 {
460  ServerInitMsg msg;
461 
462  DPRINTF(VNC, "Sending server init message to client\n");
463 
464  msg.fbWidth = htobe(videoWidth());
465  msg.fbHeight = htobe(videoHeight());
466 
467  msg.px.bpp = htobe(pixelFormat.bpp);
468  msg.px.depth = htobe(pixelFormat.depth);
477  memset(msg.px.padding, 0, 3);
478  msg.namelen = 2;
479  msg.namelen = htobe(msg.namelen);
480  memcpy(msg.name, "M5", 2);
481 
482  if (!write(&msg))
483  return;
485 }
486 
487 void
489 {
490  DPRINTF(VNC, "Received pixel format from client message\n");
491 
492  PixelFormatMessage pfm;
493  if (!read1((uint8_t *)&pfm, sizeof(PixelFormatMessage)))
494  return;
495 
496  DPRINTF(VNC, " -- bpp = %d; depth = %d; be = %d\n", pfm.px.bpp,
497  pfm.px.depth, pfm.px.bigendian);
498  DPRINTF(VNC, " -- true color = %d red,green,blue max = %d,%d,%d\n",
499  pfm.px.truecolor, betoh(pfm.px.redmax), betoh(pfm.px.greenmax),
500  betoh(pfm.px.bluemax));
501  DPRINTF(VNC, " -- red,green,blue shift = %d,%d,%d\n", pfm.px.redshift,
502  pfm.px.greenshift, pfm.px.blueshift);
503 
504  if (betoh(pfm.px.bpp) != pixelFormat.bpp ||
505  betoh(pfm.px.depth) != pixelFormat.depth ||
508  betoh(pfm.px.redmax) != pixelFormat.redmax ||
510  betoh(pfm.px.bluemax) != pixelFormat.bluemax ||
514  warn("VNC client doesn't support true color raw encoding\n");
515  detach();
516  }
517 }
518 
519 void
521 {
522  DPRINTF(VNC, "Received supported encodings from client\n");
523 
525  if (!read1((uint8_t *)&pem, sizeof(PixelEncodingsMessage)))
526  return;
527 
528  pem.num_encodings = betoh(pem.num_encodings);
529 
530  DPRINTF(VNC, " -- %d encoding present\n", pem.num_encodings);
532 
533  for (int x = 0; x < pem.num_encodings; x++) {
534  int32_t encoding;
535  if (!read(&encoding))
536  return;
537  DPRINTF(VNC, " -- supports %d\n", betoh(encoding));
538 
539  switch (betoh(encoding)) {
540  case EncodingRaw:
541  supportsRawEnc = true;
542  break;
543  case EncodingDesktopSize:
544  supportsResizeEnc = true;
545  break;
546  }
547  }
548 
549  if (!supportsRawEnc) {
550  warn("VNC clients must always support raw encoding\n");
551  detach();
552  }
553 }
554 
555 void
557 {
558  DPRINTF(VNC, "Received frame buffer update request from client\n");
559 
561  if (!read1((uint8_t *)&fbr, sizeof(FrameBufferUpdateReq)))
562  return;
563 
564  fbr.x = betoh(fbr.x);
565  fbr.y = betoh(fbr.y);
566  fbr.width = betoh(fbr.width);
567  fbr.height = betoh(fbr.height);
568 
569  DPRINTF(VNC, " -- x = %d y = %d w = %d h = %d\n", fbr.x, fbr.y, fbr.width,
570  fbr.height);
571 
573 }
574 
575 void
577 {
578  DPRINTF(VNC, "Received keyboard input from client\n");
579  KeyEventMessage kem;
580  if (!read1((uint8_t *)&kem, sizeof(KeyEventMessage)))
581  return;
582 
583  kem.key = betoh(kem.key);
584  DPRINTF(VNC, " -- received key code %d (%s)\n", kem.key, kem.down_flag ?
585  "down" : "up");
586 
587  if (keyboard)
588  keyboard->keyPress(kem.key, kem.down_flag);
589 }
590 
591 void
593 {
594  DPRINTF(VNC, "Received pointer input from client\n");
596 
597  if (!read1((uint8_t *)&pem, sizeof(PointerEventMessage)))
598  return;
599 
600  pem.x = betoh(pem.x);
601  pem.y = betoh(pem.y);
602  DPRINTF(VNC, " -- pointer at x = %d y = %d buttons = %#x\n", pem.x, pem.y,
603  pem.button_mask);
604 
605  if (mouse)
606  mouse->mouseAt(pem.x, pem.y, pem.button_mask);
607 }
608 
609 void
611 {
612  DPRINTF(VNC, "Received client copy buffer message\n");
613 
615  if (!read1((uint8_t *)&cct, sizeof(ClientCutTextMessage)))
616  return;
617 
618  char str[1025];
619  size_t data_len = betoh(cct.length);
620  DPRINTF(VNC, "String length %d\n", data_len);
621  while (data_len > 0) {
622  size_t bytes_to_read = data_len > 1024 ? 1024 : data_len;
623  if (!read((uint8_t *)&str, bytes_to_read))
624  return;
625  str[bytes_to_read] = 0;
626  data_len -= bytes_to_read;
627  DPRINTF(VNC, "Buffer: %s\n", str);
628  }
629 
630 }
631 
632 
633 void
635 {
636 
637  if (dataFd <= 0 || curState != NormalPhase || !sendUpdate) {
638  DPRINTF(VNC, "NOT sending framebuffer update\n");
639  return;
640  }
641 
642  // The client will request data constantly, unless we throttle it
643  sendUpdate = false;
644 
645  DPRINTF(VNC, "Sending framebuffer update\n");
646 
647  FrameBufferUpdate fbu;
648  FrameBufferRect fbr;
649 
651  fbu.num_rects = 1;
652  fbr.x = 0;
653  fbr.y = 0;
654  fbr.width = videoWidth();
655  fbr.height = videoHeight();
656  fbr.encoding = EncodingRaw;
657 
658  // fix up endian
659  fbu.num_rects = htobe(fbu.num_rects);
660  fbr.x = htobe(fbr.x);
661  fbr.y = htobe(fbr.y);
662  fbr.width = htobe(fbr.width);
663  fbr.height = htobe(fbr.height);
664  fbr.encoding = htobe(fbr.encoding);
665 
666  // send headers to client
667  if (!write(&fbu) || !write(&fbr))
668  return;
669 
670  assert(fb);
671 
673  for (int y = 0; y < fb->height(); ++y) {
674  // Convert and send a line at a time
675  uint8_t *raw_pixel(line_buffer.data());
676  for (unsigned x = 0; x < fb->width(); ++x) {
677  pixelConverter.fromPixel(raw_pixel, fb->pixel(x, y));
678  raw_pixel += pixelConverter.length;
679  }
680 
681  if (!write(line_buffer.data(), line_buffer.size()))
682  return;
683  }
684 }
685 
686 void
688 {
689  assert(fb && dataFd > 0 && curState == NormalPhase);
690  DPRINTF(VNC, "Sending framebuffer resize\n");
691 
692  FrameBufferUpdate fbu;
693  FrameBufferRect fbr;
694 
696  fbu.num_rects = 1;
697  fbr.x = 0;
698  fbr.y = 0;
699  fbr.width = videoWidth();
700  fbr.height = videoHeight();
702 
703  // fix up endian
704  fbu.num_rects = htobe(fbu.num_rects);
705  fbr.x = htobe(fbr.x);
706  fbr.y = htobe(fbr.y);
707  fbr.width = htobe(fbr.width);
708  fbr.height = htobe(fbr.height);
709  fbr.encoding = htobe(fbr.encoding);
710 
711  // send headers to client
712  if (!write(&fbu))
713  return;
714  write(&fbr);
715 
716  // No actual data is sent in this message
717 }
718 
719 void
721 {
723 
724  sendUpdate = true;
726 }
727 
728 void
730 {
731  if (dataFd > 0 && curState == NormalPhase) {
732  if (supportsResizeEnc)
734  else
735  // The frame buffer changed size and we can't update the client
736  detach();
737  }
738 }
739 
740 // create the VNC server object
741 VncServer *
742 VncServerParams::create()
743 {
744  return new VncServer(this);
745 }
746 
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
int number
Definition: vncserver.hh:172
#define DPRINTF(x,...)
Definition: trace.hh:212
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
Definition: framebuffer.hh:336
bool queued()
Definition: pollevent.hh:61
virtual bool listen(int port, bool reuse=true)
Definition: socket.cc:90
static const uint32_t AuthInvalid
Authentication modes.
Definition: vncserver.hh:71
PollQueue pollQueue
Definition: pollevent.cc:55
Channel ch_g
Green channel conversion helper.
Definition: framebuffer.hh:196
#define panic(...)
Definition: misc.hh:153
unsigned length
Bytes per pixel when stored in memory (including padding)
Definition: framebuffer.hh:183
PixelFormat pixelFormat
The one and only pixel format we support.
Definition: vncserver.hh:198
virtual void setDirty()
The frame buffer uses this call to notify the vnc server that the frame buffer has been updated and a...
Definition: vncinput.cc:91
void process(int revent)
Definition: vncserver.cc:111
void requestFbUpdate()
Receive message from client asking for updated frame buffer.
Definition: vncserver.cc:556
ListenSocket listener
Definition: vncserver.hh:175
int dataFd
Definition: vncserver.hh:173
void data()
Definition: vncserver.cc:227
void sendFrameBufferResized()
Tell the client that the frame buffer resized.
Definition: vncserver.cc:687
void listen(int port)
Definition: vncserver.cc:164
#define warn_once(...)
Definition: misc.hh:226
Channel ch_b
Blue channel conversion helper.
Definition: framebuffer.hh:198
unsigned mask
Bit mask (after shifting)
Definition: framebuffer.hh:123
VncServer(const Params *p)
VncServer.
Definition: vncserver.cc:122
ConnectionState curState
The rfb prototol state the connection is in.
Definition: vncserver.hh:191
friend class DataEvent
Definition: vncserver.hh:169
void setEncodings()
Receive encodings message from client and process it.
Definition: vncserver.cc:520
Bitfield< 63 > val
Definition: misc.hh:770
Bitfield< 9, 5 > vs
unsigned depth
Number of bits used to represent one pixel value (excluding padding).
Definition: framebuffer.hh:189
void sendError(const char *error_msg)
vnc client Interface
Definition: vncserver.cc:375
void schedule(PollEvent *event)
Definition: pollevent.cc:159
void checkSecurity()
Check that the security exchange was successful.
Definition: vncserver.cc:436
#define warn(...)
Definition: misc.hh:219
ListenEvent(VncServer *vs, int fd, int e)
Poll event for the listen socket.
Definition: vncserver.cc:91
void setPixelFormat()
Receive pixel foramt message from client and process it.
Definition: vncserver.cc:488
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:546
unsigned offset
Offset in bits.
Definition: framebuffer.hh:121
ByteOrder byte_order
Byte order when stored to memory.
Definition: framebuffer.hh:191
unsigned height() const
Frame buffer height in pixels.
Definition: framebuffer.hh:277
static bool allDisabled()
Definition: socket.cc:61
bool read1(uint8_t *buf, size_t len)
Read len -1 bytes from the client into the buffer provided + 1 assert that we read enough bytes...
Definition: vncserver.cc:309
VncInputParams Params
Definition: vncinput.hh:157
void accept()
Definition: vncserver.cc:190
ssize_t atomic_write(int fd, const void *s, size_t n)
Definition: atomicio.cc:66
virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons)=0
called whenever the mouse moves or it's button state changes buttons is a simple mask with each butto...
DataEvent * dataEvent
Definition: vncserver.hh:170
void recvPointerInput()
Recv message from client providing new mouse movement or button click.
Definition: vncserver.cc:592
void frameBufferResized() override
Definition: vncserver.cc:729
static const PixelConverter pixelConverter
Definition: vncserver.hh:307
ListenEvent * listenEvent
Definition: vncserver.hh:156
Channel ch_r
Red channel conversion helper.
Definition: framebuffer.hh:194
bool supportsRawEnc
If the vnc client supports receiving raw data.
Definition: vncserver.hh:201
void setDirty() override
The frame buffer uses this call to notify the vnc server that the frame buffer has been updated and a...
Definition: vncserver.cc:720
VncKeyboard * keyboard
The device to notify when we get key events.
Definition: vncinput.hh:200
void sendServerInit()
Send client our idea about what the frame buffer looks like.
Definition: vncserver.cc:458
const char * vncVersion() const
Definition: vncserver.hh:100
virtual int accept(bool nodelay=false)
Definition: socket.cc:136
EventQueue * eventQueue() const
Definition: eventq.hh:722
friend class ListenEvent
Definition: vncserver.hh:155
Bitfield< 27, 25 > encoding
Definition: types.hh:95
bool read(uint8_t *buf, size_t len)
Read some data from the client.
Definition: vncserver.cc:288
void recvKeyboardInput()
Receive message from client providing new keyboard input.
Definition: vncserver.cc:576
void sendFrameBufferUpdate()
Send a updated frame buffer to the client.
Definition: vncserver.cc:634
static const int NumArgumentRegs M5_VAR_USED
Definition: process.cc:83
VncMouse * mouse
The device to notify when we get mouse events.
Definition: vncinput.hh:206
static const uint32_t AuthNone
Definition: vncserver.hh:72
Bitfield< 9 > e
Definition: miscregs.hh:1376
virtual void keyPress(uint32_t key, bool down)=0
Called when the vnc server receives a key press event from the client.
void checkProtocolVersion()
Check the client's protocol verion for compatibility and send the security types we support...
Definition: vncserver.cc:384
virtual const std::string name() const
Definition: sim_object.hh:117
T htobe(T value)
Definition: byteswap.hh:153
unsigned width() const
Frame buffer width in pixels.
Definition: framebuffer.hh:275
void remove(PollEvent *event)
Definition: pollevent.cc:139
void process(int revent)
Definition: vncserver.cc:97
bool sendUpdate
An update needs to be sent to the client.
Definition: vncserver.hh:195
Declaration of a VNC server.
Bitfield< 18, 16 > len
Definition: miscregs.hh:1626
bool islistening() const
Definition: socket.hh:60
uint16_t videoWidth() const
What is the width of the screen we're displaying.
Definition: vncinput.hh:184
uint8_t padding[3]
Definition: vncinput.hh:113
DataEvent(VncServer *vs, int fd, int e)
Poll event for the data socket.
Definition: vncserver.cc:105
T betoh(T value)
Definition: byteswap.hh:154
void recvCutText()
Receive message from client that there is text in it's paste buffer.
Definition: vncserver.cc:610
Configurable RGB pixel converter.
Definition: framebuffer.hh:91
const FrameBuffer * fb
pointer to the actual data that is stored in the frame buffer device
Definition: vncinput.hh:209
Bitfield< 14, 12 > fd
Definition: types.hh:155
#define inform(...)
Definition: misc.hh:221
Bitfield< 0 > p
Bitfield< 1 > x
Definition: types.hh:105
bool write(const uint8_t *buf, size_t len)
Write a buffer to the client.
Definition: vncserver.cc:324
int getfd() const
Definition: socket.hh:59
void detach()
Definition: vncserver.cc:355
static const uint32_t VncOK
Error conditions.
Definition: vncserver.hh:75
uint32_t fromPixel(const Pixel &pixel) const
Convert a Pixel into a color word.
Definition: framebuffer.hh:149
bool supportsResizeEnc
If the vnc client supports the desktop resize command.
Definition: vncserver.hh:204
uint16_t videoHeight() const
What is the height of the screen we're displaying.
Definition: vncinput.hh:191

Generated on Fri Jun 9 2017 13:03:41 for gem5 by doxygen 1.8.6