gem5  v20.1.0.0
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 
42 #include <sys/ioctl.h>
43 #include <sys/stat.h>
44 
45 #if defined(__FreeBSD__)
46 #include <termios.h>
47 
48 #else
49 #include <sys/termios.h>
50 
51 #endif
52 #include "base/vnc/vncserver.hh"
53 
54 #include <fcntl.h>
55 #include <poll.h>
56 #include <sys/types.h>
57 #include <unistd.h>
58 
59 #include <cerrno>
60 #include <cstddef>
61 #include <cstdio>
62 
63 #include "base/atomicio.hh"
64 #include "base/logging.hh"
65 #include "base/output.hh"
66 #include "base/socket.hh"
67 #include "base/trace.hh"
68 #include "debug/VNC.hh"
69 #include "sim/byteswap.hh"
70 #include "sim/core.hh"
71 
72 using namespace std;
73 
75  4, // 4 bytes / pixel
76  16, 8, 0, // R in [23, 16], G in [15, 8], B in [7, 0]
77  8, 8, 8, // 8 bits / channel
78  ByteOrder::little);
79 
88  : PollEvent(fd, e), vncserver(vs)
89 {
90 }
91 
92 void
94 {
95  vncserver->accept();
96 }
97 
102  : PollEvent(fd, e), vncserver(vs)
103 {
104 }
105 
106 void
108 {
109  if (revent & POLLIN)
110  vncserver->data();
111  else if (revent & POLLNVAL)
112  vncserver->detach();
113 }
114 
119  : VncInput(p), listenEvent(NULL), dataEvent(NULL), number(p->number),
120  dataFd(-1), sendUpdate(false),
121  supportsRawEnc(false), supportsResizeEnc(false)
122 {
123  if (p->port)
124  listen(p->port);
125 
127 
128  // We currently only support one pixel format. Extract the pixel
129  // representation from our PixelConverter instance and keep it
130  // around for telling the client and making sure it cooperates
133  pixelFormat.bigendian = pixelConverter.byte_order == ByteOrder::big;
141 
142  DPRINTF(VNC, "Vnc server created at port %d\n", p->port);
143 }
144 
146 {
147  if (dataFd != -1)
148  ::close(dataFd);
149 
150  if (listenEvent)
151  delete listenEvent;
152 
153  if (dataEvent)
154  delete dataEvent;
155 }
156 
157 
158 //socket creation and vnc client attach
159 void
161 {
163  warn_once("Sockets disabled, not accepting vnc client connections");
164  return;
165  }
166 
167  while (!listener.listen(port, true)) {
168  DPRINTF(VNC,
169  "can't bind address vnc server port %d in use PID %d\n",
170  port, getpid());
171  port++;
172  }
173 
174  ccprintf(cerr, "%s: Listening for connections on port %d\n",
175  name(), port);
176 
177  listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
179 }
180 
181 // attach a vnc client
182 void
184 {
185  // As a consequence of being called from the PollQueue, we might
186  // have been called from a different thread. Migrate to "our"
187  // thread.
189 
190  if (!listener.islistening())
191  panic("%s: cannot accept a connection if not listening!", name());
192 
193  int fd = listener.accept(true);
194  if (fd < 0) {
195  warn("%s: failed to accept VNC connection!", name());
196  return;
197  }
198 
199  if (dataFd != -1) {
200  char message[] = "vnc server already attached!\n";
201  atomic_write(fd, message, sizeof(message));
202  ::close(fd);
203  return;
204  }
205 
206  dataFd = fd;
207 
208  // Send our version number to the client
209  write((uint8_t *)vncVersion(), strlen(vncVersion()));
210 
211  // read the client response
212  dataEvent = new DataEvent(this, dataFd, POLLIN);
214 
215  inform("VNC client attached\n");
216 }
217 
218 // data called by data event
219 void
221 {
222  // We have new data, see if we can handle it
223  DPRINTF(VNC, "Vnc client message recieved\n");
224 
225  switch (curState) {
228  break;
230  checkSecurity();
231  break;
232  case WaitForClientInit:
233  // Don't care about shared, just need to read it out of the socket
234  uint8_t shared;
235  if (!read(&shared))
236  return;
237 
238  // Send our idea of the frame buffer
239  sendServerInit();
240 
241  break;
242  case NormalPhase:
243  uint8_t message_type;
244  if (!read(&message_type))
245  return;
246 
247  switch (message_type) {
249  setPixelFormat();
250  break;
251  case ClientSetEncodings:
252  setEncodings();
253  break;
255  requestFbUpdate();
256  break;
257  case ClientKeyEvent:
259  break;
260  case ClientPointerEvent:
262  break;
263  case ClientCutText:
264  recvCutText();
265  break;
266  default:
267  warn("Unimplemented message type recv from client: %d\n",
268  message_type);
269  detach();
270  break;
271  }
272  break;
273  default:
274  panic("Unknown vnc server state\n");
275  }
276 }
277 
278 
279 // read from socket
280 bool
281 VncServer::read(uint8_t *buf, size_t len)
282 {
283  if (dataFd < 0)
284  panic("vnc not properly attached.\n");
285 
286  size_t ret;
287  do {
288  ret = ::read(dataFd, buf, len);
289  } while (ret == -1 && errno == EINTR);
290 
291 
292  if (ret != len) {
293  DPRINTF(VNC, "Read failed %d.\n", ret);
294  detach();
295  return false;
296  }
297 
298  return true;
299 }
300 
301 bool
302 VncServer::read1(uint8_t *buf, size_t len)
303 {
304  return read(buf + 1, len - 1);
305 }
306 
307 
308 template<typename T>
309 bool
311 {
312  return read((uint8_t *)val, sizeof(T));
313 }
314 
315 // write to socket
316 bool
317 VncServer::write(const uint8_t *buf, size_t len)
318 {
319  if (dataFd < 0)
320  panic("Vnc client not properly attached.\n");
321 
322  ssize_t ret = atomic_write(dataFd, buf, len);
323 
324  if (ret != len) {
325  DPRINTF(VNC, "Write failed.\n");
326  detach();
327  return false;
328  }
329 
330  return true;
331 }
332 
333 template<typename T>
334 bool
336 {
337  return write((uint8_t *)val, sizeof(T));
338 }
339 
340 bool
341 VncServer::write(const char* str)
342 {
343  return write((uint8_t *)str, strlen(str));
344 }
345 
346 // detach a vnc client
347 void
349 {
350  if (dataFd != -1) {
351  ::close(dataFd);
352  dataFd = -1;
353  }
354 
355  if (!dataEvent || !dataEvent->queued())
356  return;
357 
359  delete dataEvent;
360  dataEvent = NULL;
362 
363  inform("VNC client detached\n");
364  DPRINTF(VNC, "detach vnc client %d\n", number);
365 }
366 
367 void
368 VncServer::sendError(const char* error_msg)
369 {
370  uint32_t len = strlen(error_msg);
371  if (!write(&len))
372  return;
373  write(error_msg);
374 }
375 
376 void
378 {
379  assert(curState == WaitForProtocolVersion);
380 
381  size_t len M5_VAR_USED;
382  char version_string[13];
383 
384  // Null terminate the message so it's easier to work with
385  version_string[12] = 0;
386 
387  if (!read((uint8_t *)version_string, sizeof(version_string) - 1)) {
388  warn("Failed to read protocol version.");
389  return;
390  }
391 
392  uint32_t major, minor;
393 
394  // Figure out the major/minor numbers
395  if (sscanf(version_string, "RFB %03d.%03d\n", &major, &minor) != 2) {
396  warn(" Malformed protocol version %s\n", version_string);
397  sendError("Malformed protocol version\n");
398  detach();
399  return;
400  }
401 
402  DPRINTF(VNC, "Client request protocol version %d.%d\n", major, minor);
403 
404  // If it's not 3.X we don't support it
405  if (major != 3 || minor < 2) {
406  warn("Unsupported VNC client version... disconnecting\n");
407  uint8_t err = AuthInvalid;
408  write(&err);
409  detach();
410  return;
411  }
412  // Auth is different based on version number
413  if (minor < 7) {
414  uint32_t sec_type = htobe((uint32_t)AuthNone);
415  if (!write(&sec_type))
416  return;
417  } else {
418  uint8_t sec_cnt = 1;
419  uint8_t sec_type = htobe((uint8_t)AuthNone);
420  if (!write(&sec_cnt) || !write(&sec_type))
421  return;
422  }
423 
424  // Wait for client to respond
426 }
427 
428 void
430 {
432 
433  uint8_t security_type;
434  if (!read(&security_type))
435  return;
436 
437  if (security_type != AuthNone) {
438  warn("Unknown VNC security type\n");
439  sendError("Unknown security type\n");
440  }
441 
442  DPRINTF(VNC, "Sending security auth OK\n");
443 
444  uint32_t success = htobe(VncOK);
445  if (!write(&success))
446  return;
448 }
449 
450 void
452 {
453  ServerInitMsg msg;
454 
455  DPRINTF(VNC, "Sending server init message to client\n");
456 
457  msg.fbWidth = htobe(videoWidth());
458  msg.fbHeight = htobe(videoHeight());
459 
460  msg.px.bpp = htobe(pixelFormat.bpp);
461  msg.px.depth = htobe(pixelFormat.depth);
470  memset(msg.px.padding, 0, 3);
471  msg.namelen = 2;
472  msg.namelen = htobe(msg.namelen);
473  memcpy(msg.name, "M5", 2);
474 
475  if (!write(&msg))
476  return;
478 }
479 
480 void
482 {
483  DPRINTF(VNC, "Received pixel format from client message\n");
484 
485  PixelFormatMessage pfm;
486  if (!read1((uint8_t *)&pfm, sizeof(PixelFormatMessage)))
487  return;
488 
489  DPRINTF(VNC, " -- bpp = %d; depth = %d; be = %d\n", pfm.px.bpp,
490  pfm.px.depth, pfm.px.bigendian);
491  DPRINTF(VNC, " -- true color = %d red,green,blue max = %d,%d,%d\n",
492  pfm.px.truecolor, betoh(pfm.px.redmax), betoh(pfm.px.greenmax),
493  betoh(pfm.px.bluemax));
494  DPRINTF(VNC, " -- red,green,blue shift = %d,%d,%d\n", pfm.px.redshift,
495  pfm.px.greenshift, pfm.px.blueshift);
496 
497  if (betoh(pfm.px.bpp) != pixelFormat.bpp ||
498  betoh(pfm.px.depth) != pixelFormat.depth ||
499  betoh(pfm.px.bigendian) != pixelFormat.bigendian ||
500  betoh(pfm.px.truecolor) != pixelFormat.truecolor ||
501  betoh(pfm.px.redmax) != pixelFormat.redmax ||
502  betoh(pfm.px.greenmax) != pixelFormat.greenmax ||
503  betoh(pfm.px.bluemax) != pixelFormat.bluemax ||
504  betoh(pfm.px.redshift) != pixelFormat.redshift ||
505  betoh(pfm.px.greenshift) != pixelFormat.greenshift ||
506  betoh(pfm.px.blueshift) != pixelFormat.blueshift) {
507  warn("VNC client doesn't support true color raw encoding\n");
508  detach();
509  }
510 }
511 
512 void
514 {
515  DPRINTF(VNC, "Received supported encodings from client\n");
516 
518  if (!read1((uint8_t *)&pem, sizeof(PixelEncodingsMessage)))
519  return;
520 
521  pem.num_encodings = betoh(pem.num_encodings);
522 
523  DPRINTF(VNC, " -- %d encoding present\n", pem.num_encodings);
525 
526  for (int x = 0; x < pem.num_encodings; x++) {
527  int32_t encoding;
528  if (!read(&encoding))
529  return;
530  DPRINTF(VNC, " -- supports %d\n", betoh(encoding));
531 
532  switch (betoh(encoding)) {
533  case EncodingRaw:
534  supportsRawEnc = true;
535  break;
536  case EncodingDesktopSize:
537  supportsResizeEnc = true;
538  break;
539  }
540  }
541 
542  if (!supportsRawEnc) {
543  warn("VNC clients must always support raw encoding\n");
544  detach();
545  }
546 }
547 
548 void
550 {
551  DPRINTF(VNC, "Received frame buffer update request from client\n");
552 
554  if (!read1((uint8_t *)&fbr, sizeof(FrameBufferUpdateReq)))
555  return;
556 
557  fbr.x = betoh(fbr.x);
558  fbr.y = betoh(fbr.y);
559  fbr.width = betoh(fbr.width);
560  fbr.height = betoh(fbr.height);
561 
562  DPRINTF(VNC, " -- x = %d y = %d w = %d h = %d\n", fbr.x, fbr.y, fbr.width,
563  fbr.height);
564 
566 }
567 
568 void
570 {
571  DPRINTF(VNC, "Received keyboard input from client\n");
572  KeyEventMessage kem;
573  if (!read1((uint8_t *)&kem, sizeof(KeyEventMessage)))
574  return;
575 
576  kem.key = betoh(kem.key);
577  DPRINTF(VNC, " -- received key code %d (%s)\n", kem.key, kem.down_flag ?
578  "down" : "up");
579 
580  if (keyboard)
581  keyboard->keyPress(kem.key, kem.down_flag);
582 }
583 
584 void
586 {
587  DPRINTF(VNC, "Received pointer input from client\n");
589 
590  if (!read1((uint8_t *)&pem, sizeof(PointerEventMessage)))
591  return;
592 
593  pem.x = betoh(pem.x);
594  pem.y = betoh(pem.y);
595  DPRINTF(VNC, " -- pointer at x = %d y = %d buttons = %#x\n", pem.x, pem.y,
596  pem.button_mask);
597 
598  if (mouse)
599  mouse->mouseAt(pem.x, pem.y, pem.button_mask);
600 }
601 
602 void
604 {
605  DPRINTF(VNC, "Received client copy buffer message\n");
606 
608  if (!read1((uint8_t *)&cct, sizeof(ClientCutTextMessage)))
609  return;
610 
611  char str[1025];
612  size_t data_len = betoh(cct.length);
613  DPRINTF(VNC, "String length %d\n", data_len);
614  while (data_len > 0) {
615  size_t bytes_to_read = data_len > 1024 ? 1024 : data_len;
616  if (!read((uint8_t *)&str, bytes_to_read))
617  return;
618  str[bytes_to_read] = 0;
619  data_len -= bytes_to_read;
620  DPRINTF(VNC, "Buffer: %s\n", str);
621  }
622 
623 }
624 
625 
626 void
628 {
629 
630  if (dataFd <= 0 || curState != NormalPhase || !sendUpdate) {
631  DPRINTF(VNC, "NOT sending framebuffer update\n");
632  return;
633  }
634 
635  // The client will request data constantly, unless we throttle it
636  sendUpdate = false;
637 
638  DPRINTF(VNC, "Sending framebuffer update\n");
639 
640  FrameBufferUpdate fbu;
641  FrameBufferRect fbr;
642 
644  fbu.num_rects = 1;
645  fbr.x = 0;
646  fbr.y = 0;
647  fbr.width = videoWidth();
648  fbr.height = videoHeight();
649  fbr.encoding = EncodingRaw;
650 
651  // fix up endian
652  fbu.num_rects = htobe(fbu.num_rects);
653  fbr.x = htobe(fbr.x);
654  fbr.y = htobe(fbr.y);
655  fbr.width = htobe(fbr.width);
656  fbr.height = htobe(fbr.height);
657  fbr.encoding = htobe(fbr.encoding);
658 
659  // send headers to client
660  if (!write(&fbu) || !write(&fbr))
661  return;
662 
663  assert(fb);
664 
666  for (int y = 0; y < fb->height(); ++y) {
667  // Convert and send a line at a time
668  uint8_t *raw_pixel(line_buffer.data());
669  for (unsigned x = 0; x < fb->width(); ++x) {
670  pixelConverter.fromPixel(raw_pixel, fb->pixel(x, y));
671  raw_pixel += pixelConverter.length;
672  }
673 
674  if (!write(line_buffer.data(), line_buffer.size()))
675  return;
676  }
677 }
678 
679 void
681 {
682  assert(fb && dataFd > 0 && curState == NormalPhase);
683  DPRINTF(VNC, "Sending framebuffer resize\n");
684 
685  FrameBufferUpdate fbu;
686  FrameBufferRect fbr;
687 
689  fbu.num_rects = 1;
690  fbr.x = 0;
691  fbr.y = 0;
692  fbr.width = videoWidth();
693  fbr.height = videoHeight();
695 
696  // fix up endian
697  fbu.num_rects = htobe(fbu.num_rects);
698  fbr.x = htobe(fbr.x);
699  fbr.y = htobe(fbr.y);
700  fbr.width = htobe(fbr.width);
701  fbr.height = htobe(fbr.height);
702  fbr.encoding = htobe(fbr.encoding);
703 
704  // send headers to client
705  if (!write(&fbu))
706  return;
707  write(&fbr);
708 
709  // No actual data is sent in this message
710 }
711 
712 void
714 {
716 
717  sendUpdate = true;
719 }
720 
721 void
723 {
724  if (dataFd > 0 && curState == NormalPhase) {
725  if (supportsResizeEnc)
727  else
728  // The frame buffer changed size and we can't update the client
729  detach();
730  }
731 }
732 
733 // create the VNC server object
734 VncServer *
735 VncServerParams::create()
736 {
737  return new VncServer(this);
738 }
739 
VncInput::PixelFormat::truecolor
uint8_t truecolor
Definition: vncinput.hh:103
VncServer::setEncodings
void setEncodings()
Receive encodings message from client and process it.
Definition: vncserver.cc:513
VncServer::ServerInitMsg::name
char name[2]
Definition: vncserver.hh:114
VncInput::PixelFormatMessage
Definition: vncinput.hh:113
vncserver.hh
VncServer::ServerFrameBufferUpdate
@ ServerFrameBufferUpdate
Definition: vncserver.hh:75
PixelConverter::Channel::mask
unsigned mask
Bit mask (after shifting)
Definition: pixel.hh:119
socket.hh
VncServer::sendError
void sendError(const char *error_msg)
vnc client Interface
Definition: vncserver.cc:368
VncServer::FrameBufferRect::x
uint16_t x
Definition: vncserver.hh:124
VncServer::write
bool write(const uint8_t *buf, size_t len)
Write a buffer to the client.
Definition: vncserver.cc:317
warn
#define warn(...)
Definition: logging.hh:239
ListenSocket::listen
virtual bool listen(int port, bool reuse=true)
Definition: socket.cc:99
VncServer::dataFd
int dataFd
Definition: vncserver.hh:169
VncInput::PixelEncodingsMessage::num_encodings
uint16_t num_encodings
Definition: vncinput.hh:122
VncServer::ServerInitMsg
Definition: vncserver.hh:109
VncServer::supportsResizeEnc
bool supportsResizeEnc
If the vnc client supports the desktop resize command.
Definition: vncserver.hh:200
VncServer::AuthNone
const static uint32_t AuthNone
Definition: vncserver.hh:68
atomicio.hh
PixelConverter
Configurable RGB pixel converter.
Definition: pixel.hh:87
VncServer::read1
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:302
VncServer::~VncServer
~VncServer()
Definition: vncserver.cc:145
warn_once
#define warn_once(...)
Definition: logging.hh:243
VncServer::accept
void accept()
Definition: vncserver.cc:183
VncServer::ServerInitMsg::fbHeight
uint16_t fbHeight
Definition: vncserver.hh:111
MipsISA::vs
Bitfield< 9, 5 > vs
Definition: pra_constants.hh:146
VncMouse::mouseAt
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...
ArmISA::fd
Bitfield< 14, 12 > fd
Definition: types.hh:159
ListenSocket::accept
virtual int accept(bool nodelay=false)
Definition: socket.cc:148
VncInput::Params
VncInputParams Params
Definition: vncinput.hh:154
VncServer::setDirty
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:713
VncServer::WaitForClientInit
@ WaitForClientInit
Definition: vncserver.hh:104
VncServer::VncOK
const static uint32_t VncOK
Error conditions.
Definition: vncserver.hh:71
std::vector< uint8_t >
VncInput::FrameBufferUpdateReq::x
uint16_t x
Definition: vncinput.hh:128
PollQueue::schedule
void schedule(PollEvent *event)
Definition: pollevent.cc:159
VncInput::PixelFormat::bpp
uint8_t bpp
Definition: vncinput.hh:100
PixelConverter::ch_g
Channel ch_g
Green channel conversion helper.
Definition: pixel.hh:192
FrameBuffer::pixel
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
Definition: framebuffer.hh:157
VncInput::PixelFormat::greenmax
uint16_t greenmax
Definition: vncinput.hh:105
PixelConverter::byte_order
ByteOrder byte_order
Byte order when stored to memory.
Definition: pixel.hh:187
VncServer::DataEvent::DataEvent
DataEvent(VncServer *vs, int fd, int e)
Poll event for the data socket.
Definition: vncserver.cc:101
VncServer::requestFbUpdate
void requestFbUpdate()
Receive message from client asking for updated frame buffer.
Definition: vncserver.cc:549
output.hh
VncInput
Definition: vncinput.hh:85
VncServer::FrameBufferRect::y
uint16_t y
Definition: vncserver.hh:125
VncServer
Definition: vncserver.hh:58
VncInput::PixelFormat::redmax
uint16_t redmax
Definition: vncinput.hh:104
VncInput::setDirty
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:92
VncServer::sendFrameBufferResized
void sendFrameBufferResized()
Tell the client that the frame buffer resized.
Definition: vncserver.cc:680
VncInput::PointerEventMessage
Definition: vncinput.hh:141
VncServer::dataEvent
DataEvent * dataEvent
Definition: vncserver.hh:166
VncServer::pixelConverter
static const PixelConverter pixelConverter
Definition: vncserver.hh:303
VncServer::FrameBufferRect::width
uint16_t width
Definition: vncserver.hh:126
VncServer::ListenEvent::process
void process(int revent)
Definition: vncserver.cc:93
VncServer::VncServer
VncServer(const Params *p)
VncServer.
Definition: vncserver.cc:118
VncServer::curState
ConnectionState curState
The rfb prototol state the connection is in.
Definition: vncserver.hh:187
VncServer::FrameBufferUpdate::type
uint8_t type
Definition: vncserver.hh:118
VncInput::PixelFormat::greenshift
uint8_t greenshift
Definition: vncinput.hh:108
pollQueue
PollQueue pollQueue
Definition: pollevent.cc:55
VncServer::DataEvent
friend class DataEvent
Definition: vncserver.hh:165
VncInput::ClientCutTextMessage
Definition: vncinput.hh:148
VncServer::FrameBufferRect::height
uint16_t height
Definition: vncserver.hh:127
VncInput::PixelFormat::padding
uint8_t padding[3]
Definition: vncinput.hh:110
VncServer::sendServerInit
void sendServerInit()
Send client our idea about what the frame buffer looks like.
Definition: vncserver.cc:451
VncInput::FrameBufferUpdateReq
Definition: vncinput.hh:125
VncInput::PixelFormat::depth
uint8_t depth
Definition: vncinput.hh:101
VncInput::KeyEventMessage::key
uint32_t key
Definition: vncinput.hh:138
PixelConverter::length
unsigned length
Bytes per pixel when stored in memory (including padding)
Definition: pixel.hh:179
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
ListenSocket::getfd
int getfd() const
Definition: socket.hh:72
VncServer::sendUpdate
bool sendUpdate
An update needs to be sent to the client.
Definition: vncserver.hh:191
VncServer::WaitForSecurityResponse
@ WaitForSecurityResponse
Definition: vncserver.hh:103
VncInput::PixelFormat::redshift
uint8_t redshift
Definition: vncinput.hh:107
PixelConverter::depth
unsigned depth
Number of bits used to represent one pixel value (excluding padding).
Definition: pixel.hh:185
VncInput::PixelFormat::blueshift
uint8_t blueshift
Definition: vncinput.hh:109
VncInput::keyboard
VncKeyboard * keyboard
The device to notify when we get key events.
Definition: vncinput.hh:197
VncServer::checkSecurity
void checkSecurity()
Check that the security exchange was successful.
Definition: vncserver.cc:429
ListenSocket::islistening
bool islistening() const
Definition: socket.hh:73
VncServer::recvKeyboardInput
void recvKeyboardInput()
Receive message from client providing new keyboard input.
Definition: vncserver.cc:569
VncServer::sendFrameBufferUpdate
void sendFrameBufferUpdate()
Send a updated frame buffer to the client.
Definition: vncserver.cc:627
VncServer::WaitForProtocolVersion
@ WaitForProtocolVersion
Definition: vncserver.hh:102
VncServer::FrameBufferUpdate
Definition: vncserver.hh:117
RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:69
VncServer::checkProtocolVersion
void checkProtocolVersion()
Check the client's protocol verion for compatibility and send the security types we support.
Definition: vncserver.cc:377
VncServer::FrameBufferRect::encoding
int32_t encoding
Definition: vncserver.hh:128
VncServer::recvPointerInput
void recvPointerInput()
Recv message from client providing new mouse movement or button click.
Definition: vncserver.cc:585
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
PixelConverter::ch_b
Channel ch_b
Blue channel conversion helper.
Definition: pixel.hh:194
core.hh
betoh
T betoh(T value)
Definition: byteswap.hh:143
EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:996
VncInput::ClientSetEncodings
@ ClientSetEncodings
Definition: vncinput.hh:92
VncKeyboard::keyPress
virtual void keyPress(uint32_t key, bool down)=0
Called when the vnc server receives a key press event from the client.
VncServer::AuthInvalid
const static uint32_t AuthInvalid
Authentication modes.
Definition: vncserver.hh:67
VncInput::ClientPointerEvent
@ ClientPointerEvent
Definition: vncinput.hh:95
VncServer::FrameBufferUpdate::num_rects
uint16_t num_rects
Definition: vncserver.hh:120
VncServer::supportsRawEnc
bool supportsRawEnc
If the vnc client supports receiving raw data.
Definition: vncserver.hh:197
VncInput::PixelFormat::bluemax
uint16_t bluemax
Definition: vncinput.hh:106
VncServer::EncodingDesktopSize
@ EncodingDesktopSize
Definition: vncserver.hh:86
PollEvent::queued
bool queued()
Definition: pollevent.hh:70
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
VncInput::ClientCutText
@ ClientCutText
Definition: vncinput.hh:96
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
VncServer::ServerInitMsg::px
PixelFormat px
Definition: vncserver.hh:112
VncInput::PixelEncodingsMessage
Definition: vncinput.hh:119
VncInput::videoWidth
uint16_t videoWidth() const
What is the width of the screen we're displaying.
Definition: vncinput.hh:181
VncServer::number
int number
Definition: vncserver.hh:168
ListenSocket::allDisabled
static bool allDisabled()
Definition: socket.cc:70
VncServer::setPixelFormat
void setPixelFormat()
Receive pixel foramt message from client and process it.
Definition: vncserver.cc:481
EventQueue::ScopedMigration
Definition: eventq.hh:665
PixelConverter::Channel::offset
unsigned offset
Offset in bits.
Definition: pixel.hh:117
VncServer::DataEvent::process
void process(int revent)
Definition: vncserver.cc:107
PixelConverter::ch_r
Channel ch_r
Red channel conversion helper.
Definition: pixel.hh:190
inform
#define inform(...)
Definition: logging.hh:240
VncServer::FrameBufferRect
Definition: vncserver.hh:123
VncServer::recvCutText
void recvCutText()
Receive message from client that there is text in it's paste buffer.
Definition: vncserver.cc:603
PollQueue::remove
void remove(PollEvent *event)
Definition: pollevent.cc:139
VncServer::ListenEvent
friend class ListenEvent
Definition: vncserver.hh:151
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
VncServer::ServerInitMsg::fbWidth
uint16_t fbWidth
Definition: vncserver.hh:110
htobe
T htobe(T value)
Definition: byteswap.hh:142
VncServer::vncVersion
const char * vncVersion() const
Definition: vncserver.hh:96
ArmISA::len
Bitfield< 18, 16 > len
Definition: miscregs_types.hh:439
VncServer::frameBufferResized
void frameBufferResized() override
Definition: vncserver.cc:722
VncServer::listenEvent
ListenEvent * listenEvent
Definition: vncserver.hh:152
ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:127
VncServer::ListenEvent::ListenEvent
ListenEvent(VncServer *vs, int fd, int e)
Poll event for the listen socket.
Definition: vncserver.cc:87
VncInput::fb
const FrameBuffer * fb
pointer to the actual data that is stored in the frame buffer device
Definition: vncinput.hh:206
VncInput::ClientSetPixelFormat
@ ClientSetPixelFormat
Definition: vncinput.hh:91
logging.hh
VncServer::ServerInitMsg::namelen
uint32_t namelen
Definition: vncserver.hh:113
VncInput::PixelFormat::bigendian
uint8_t bigendian
Definition: vncinput.hh:102
VncServer::detach
void detach()
Definition: vncserver.cc:348
VncServer::pixelFormat
PixelFormat pixelFormat
The one and only pixel format we support.
Definition: vncserver.hh:194
VncServer::EncodingRaw
@ EncodingRaw
Definition: vncserver.hh:83
atomic_write
ssize_t atomic_write(int fd, const void *s, size_t n)
Definition: atomicio.cc:64
trace.hh
FrameBuffer::width
unsigned width() const
Frame buffer width in pixels.
Definition: framebuffer.hh:96
ArmISA::err
Bitfield< 6 > err
Definition: miscregs_types.hh:744
PollEvent
Definition: pollevent.hh:41
VncInput::videoHeight
uint16_t videoHeight() const
What is the height of the screen we're displaying.
Definition: vncinput.hh:188
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
FrameBuffer::height
unsigned height() const
Frame buffer height in pixels.
Definition: framebuffer.hh:98
VncInput::ClientKeyEvent
@ ClientKeyEvent
Definition: vncinput.hh:94
VncServer::listener
ListenSocket listener
Definition: vncserver.hh:171
VncInput::mouse
VncMouse * mouse
The device to notify when we get mouse events.
Definition: vncinput.hh:203
VncServer::NormalPhase
@ NormalPhase
Definition: vncserver.hh:106
ArmISA::encoding
Bitfield< 27, 25 > encoding
Definition: types.hh:99
VncServer::data
void data()
Definition: vncserver.cc:220
VncServer::listen
void listen(int port)
Definition: vncserver.cc:160
VncServer::read
bool read(uint8_t *buf, size_t len)
Read some data from the client.
Definition: vncserver.cc:281
VncInput::ClientFrameBufferUpdate
@ ClientFrameBufferUpdate
Definition: vncinput.hh:93
byteswap.hh
VncInput::PointerEventMessage::x
uint16_t x
Definition: vncinput.hh:144
VncInput::KeyEventMessage
Definition: vncinput.hh:134
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
PixelConverter::fromPixel
uint32_t fromPixel(const Pixel &pixel) const
Convert a Pixel into a color word.
Definition: pixel.hh:145

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17