gem5  v21.1.0.2
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 
71 namespace gem5
72 {
73 
74 const PixelConverter VncServer::pixelConverter(
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(std::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  GEM5_VAR_USED size_t len;
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_version, minor_version;
393 
394  // Figure out the major/minor numbers
395  if (sscanf(version_string, "RFB %03d.%03d\n", &major_version,
396  &minor_version) != 2) {
397  warn(" Malformed protocol version %s\n", version_string);
398  sendError("Malformed protocol version\n");
399  detach();
400  return;
401  }
402 
403  DPRINTF(VNC, "Client request protocol version %d.%d\n", major_version,
404  minor_version);
405 
406  // If it's not 3.X we don't support it
407  if (major_version != 3 || minor_version < 2) {
408  warn("Unsupported VNC client version... disconnecting\n");
409  uint8_t err = AuthInvalid;
410  write(&err);
411  detach();
412  return;
413  }
414  // Auth is different based on version number
415  if (minor_version < 7) {
416  uint32_t sec_type = htobe((uint32_t)AuthNone);
417  if (!write(&sec_type))
418  return;
419  } else {
420  uint8_t sec_cnt = 1;
421  uint8_t sec_type = htobe((uint8_t)AuthNone);
422  if (!write(&sec_cnt) || !write(&sec_type))
423  return;
424  }
425 
426  // Wait for client to respond
428 }
429 
430 void
432 {
434 
435  uint8_t security_type;
436  if (!read(&security_type))
437  return;
438 
439  if (security_type != AuthNone) {
440  warn("Unknown VNC security type\n");
441  sendError("Unknown security type\n");
442  }
443 
444  DPRINTF(VNC, "Sending security auth OK\n");
445 
446  uint32_t success = htobe(VncOK);
447  if (!write(&success))
448  return;
450 }
451 
452 void
454 {
455  ServerInitMsg msg;
456 
457  DPRINTF(VNC, "Sending server init message to client\n");
458 
459  msg.fbWidth = htobe(videoWidth());
460  msg.fbHeight = htobe(videoHeight());
461 
462  msg.px.bpp = htobe(pixelFormat.bpp);
463  msg.px.depth = htobe(pixelFormat.depth);
472  memset(msg.px.padding, 0, 3);
473  msg.namelen = 2;
474  msg.namelen = htobe(msg.namelen);
475  std::memcpy(msg.name, "M5", 2);
476 
477  if (!write(&msg))
478  return;
480 }
481 
482 void
484 {
485  DPRINTF(VNC, "Received pixel format from client message\n");
486 
487  PixelFormatMessage pfm;
488  if (!read1((uint8_t *)&pfm, sizeof(PixelFormatMessage)))
489  return;
490 
491  DPRINTF(VNC, " -- bpp = %d; depth = %d; be = %d\n", pfm.px.bpp,
492  pfm.px.depth, pfm.px.bigendian);
493  DPRINTF(VNC, " -- true color = %d red,green,blue max = %d,%d,%d\n",
494  pfm.px.truecolor, betoh(pfm.px.redmax), betoh(pfm.px.greenmax),
495  betoh(pfm.px.bluemax));
496  DPRINTF(VNC, " -- red,green,blue shift = %d,%d,%d\n", pfm.px.redshift,
497  pfm.px.greenshift, pfm.px.blueshift);
498 
499  if (betoh(pfm.px.bpp) != pixelFormat.bpp ||
500  betoh(pfm.px.depth) != pixelFormat.depth ||
501  betoh(pfm.px.bigendian) != pixelFormat.bigendian ||
502  betoh(pfm.px.truecolor) != pixelFormat.truecolor ||
503  betoh(pfm.px.redmax) != pixelFormat.redmax ||
504  betoh(pfm.px.greenmax) != pixelFormat.greenmax ||
505  betoh(pfm.px.bluemax) != pixelFormat.bluemax ||
506  betoh(pfm.px.redshift) != pixelFormat.redshift ||
507  betoh(pfm.px.greenshift) != pixelFormat.greenshift ||
508  betoh(pfm.px.blueshift) != pixelFormat.blueshift) {
509  warn("VNC client doesn't support true color raw encoding\n");
510  detach();
511  }
512 }
513 
514 void
516 {
517  DPRINTF(VNC, "Received supported encodings from client\n");
518 
520  if (!read1((uint8_t *)&pem, sizeof(PixelEncodingsMessage)))
521  return;
522 
523  pem.num_encodings = betoh(pem.num_encodings);
524 
525  DPRINTF(VNC, " -- %d encoding present\n", pem.num_encodings);
527 
528  for (int x = 0; x < pem.num_encodings; x++) {
529  int32_t encoding;
530  if (!read(&encoding))
531  return;
532  DPRINTF(VNC, " -- supports %d\n", betoh(encoding));
533 
534  switch (betoh(encoding)) {
535  case EncodingRaw:
536  supportsRawEnc = true;
537  break;
538  case EncodingDesktopSize:
539  supportsResizeEnc = true;
540  break;
541  }
542  }
543 
544  if (!supportsRawEnc) {
545  warn("VNC clients must always support raw encoding\n");
546  detach();
547  }
548 }
549 
550 void
552 {
553  DPRINTF(VNC, "Received frame buffer update request from client\n");
554 
556  if (!read1((uint8_t *)&fbr, sizeof(FrameBufferUpdateReq)))
557  return;
558 
559  fbr.x = betoh(fbr.x);
560  fbr.y = betoh(fbr.y);
561  fbr.width = betoh(fbr.width);
562  fbr.height = betoh(fbr.height);
563 
564  DPRINTF(VNC, " -- x = %d y = %d w = %d h = %d\n", fbr.x, fbr.y, fbr.width,
565  fbr.height);
566 
568 }
569 
570 void
572 {
573  DPRINTF(VNC, "Received keyboard input from client\n");
574  KeyEventMessage kem;
575  if (!read1((uint8_t *)&kem, sizeof(KeyEventMessage)))
576  return;
577 
578  kem.key = betoh(kem.key);
579  DPRINTF(VNC, " -- received key code %d (%s)\n", kem.key, kem.down_flag ?
580  "down" : "up");
581 
582  if (keyboard)
583  keyboard->keyPress(kem.key, kem.down_flag);
584 }
585 
586 void
588 {
589  DPRINTF(VNC, "Received pointer input from client\n");
591 
592  if (!read1((uint8_t *)&pem, sizeof(PointerEventMessage)))
593  return;
594 
595  pem.x = betoh(pem.x);
596  pem.y = betoh(pem.y);
597  DPRINTF(VNC, " -- pointer at x = %d y = %d buttons = %#x\n", pem.x, pem.y,
598  pem.button_mask);
599 
600  if (mouse)
601  mouse->mouseAt(pem.x, pem.y, pem.button_mask);
602 }
603 
604 void
606 {
607  DPRINTF(VNC, "Received client copy buffer message\n");
608 
610  if (!read1((uint8_t *)&cct, sizeof(ClientCutTextMessage)))
611  return;
612 
613  char str[1025];
614  size_t data_len = betoh(cct.length);
615  DPRINTF(VNC, "String length %d\n", data_len);
616  while (data_len > 0) {
617  size_t bytes_to_read = data_len > 1024 ? 1024 : data_len;
618  if (!read((uint8_t *)&str, bytes_to_read))
619  return;
620  str[bytes_to_read] = 0;
621  data_len -= bytes_to_read;
622  DPRINTF(VNC, "Buffer: %s\n", str);
623  }
624 
625 }
626 
627 
628 void
630 {
631 
632  if (dataFd <= 0 || curState != NormalPhase || !sendUpdate) {
633  DPRINTF(VNC, "NOT sending framebuffer update\n");
634  return;
635  }
636 
637  // The client will request data constantly, unless we throttle it
638  sendUpdate = false;
639 
640  DPRINTF(VNC, "Sending framebuffer update\n");
641 
642  FrameBufferUpdate fbu;
643  FrameBufferRect fbr;
644 
646  fbu.num_rects = 1;
647  fbr.x = 0;
648  fbr.y = 0;
649  fbr.width = videoWidth();
650  fbr.height = videoHeight();
651  fbr.encoding = EncodingRaw;
652 
653  // fix up endian
654  fbu.num_rects = htobe(fbu.num_rects);
655  fbr.x = htobe(fbr.x);
656  fbr.y = htobe(fbr.y);
657  fbr.width = htobe(fbr.width);
658  fbr.height = htobe(fbr.height);
659  fbr.encoding = htobe(fbr.encoding);
660 
661  // send headers to client
662  if (!write(&fbu) || !write(&fbr))
663  return;
664 
665  assert(fb);
666 
668  for (int y = 0; y < fb->height(); ++y) {
669  // Convert and send a line at a time
670  uint8_t *raw_pixel(line_buffer.data());
671  for (unsigned x = 0; x < fb->width(); ++x) {
672  pixelConverter.fromPixel(raw_pixel, fb->pixel(x, y));
673  raw_pixel += pixelConverter.length;
674  }
675 
676  if (!write(line_buffer.data(), line_buffer.size()))
677  return;
678  }
679 }
680 
681 void
683 {
684  assert(fb && dataFd > 0 && curState == NormalPhase);
685  DPRINTF(VNC, "Sending framebuffer resize\n");
686 
687  FrameBufferUpdate fbu;
688  FrameBufferRect fbr;
689 
691  fbu.num_rects = 1;
692  fbr.x = 0;
693  fbr.y = 0;
694  fbr.width = videoWidth();
695  fbr.height = videoHeight();
697 
698  // fix up endian
699  fbu.num_rects = htobe(fbu.num_rects);
700  fbr.x = htobe(fbr.x);
701  fbr.y = htobe(fbr.y);
702  fbr.width = htobe(fbr.width);
703  fbr.height = htobe(fbr.height);
704  fbr.encoding = htobe(fbr.encoding);
705 
706  // send headers to client
707  if (!write(&fbu))
708  return;
709  write(&fbr);
710 
711  // No actual data is sent in this message
712 }
713 
714 void
716 {
718 
719  sendUpdate = true;
721 }
722 
723 void
725 {
726  if (dataFd > 0 && curState == NormalPhase) {
727  if (supportsResizeEnc)
729  else
730  // The frame buffer changed size and we can't update the client
731  detach();
732  }
733 }
734 
735 } // namespace gem5
gem5::VncServer::ListenEvent::ListenEvent
ListenEvent(VncServer *vs, int fd, int e)
Poll event for the listen socket.
Definition: vncserver.cc:87
gem5::VncServer::ServerInitMsg
Definition: vncserver.hh:117
gem5::VncServer::dataEvent
DataEvent * dataEvent
Definition: vncserver.hh:178
gem5::VncServer::curState
ConnectionState curState
The rfb prototol state the connection is in.
Definition: vncserver.hh:199
vncserver.hh
gem5::VncServer::ServerInitMsg::fbWidth
uint16_t fbWidth
Definition: vncserver.hh:119
socket.hh
gem5::PixelConverter::Channel::offset
unsigned offset
Offset in bits.
Definition: pixel.hh:122
gem5::ArmISA::len
Bitfield< 18, 16 > len
Definition: misc_types.hh:444
gem5::VncServer::AuthNone
const static uint32_t AuthNone
Definition: vncserver.hh:72
warn
#define warn(...)
Definition: logging.hh:245
gem5::VncInput::PixelEncodingsMessage::num_encodings
uint16_t num_encodings
Definition: vncinput.hh:130
gem5::PixelConverter::ch_b
Channel ch_b
Blue channel conversion helper.
Definition: pixel.hh:199
gem5::VncServer::FrameBufferRect::y
uint16_t y
Definition: vncserver.hh:136
gem5::VncServer::DataEvent
friend class DataEvent
Definition: vncserver.hh:177
gem5::VncServer::WaitForSecurityResponse
@ WaitForSecurityResponse
Definition: vncserver.hh:111
gem5::EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:1010
gem5::VncServer::sendFrameBufferUpdate
void sendFrameBufferUpdate()
Send a updated frame buffer to the client.
Definition: vncserver.cc:629
gem5::VncServer::accept
void accept()
Definition: vncserver.cc:183
gem5::VncServer::WaitForProtocolVersion
@ WaitForProtocolVersion
Definition: vncserver.hh:110
gem5::ArmISA::fd
Bitfield< 14, 12 > fd
Definition: types.hh:150
atomicio.hh
gem5::VncServer::setPixelFormat
void setPixelFormat()
Receive pixel foramt message from client and process it.
Definition: vncserver.cc:483
gem5::VncServer::ServerInitMsg::fbHeight
uint16_t fbHeight
Definition: vncserver.hh:120
warn_once
#define warn_once(...)
Definition: logging.hh:249
gem5::VncServer::ServerInitMsg::namelen
uint32_t namelen
Definition: vncserver.hh:122
gem5::VncKeyboard::keyPress
virtual void keyPress(uint32_t key, bool down)=0
Called when the vnc server receives a key press event from the client.
gem5::pollQueue
PollQueue pollQueue
Definition: pollevent.cc:55
gem5::VncServer::sendFrameBufferResized
void sendFrameBufferResized()
Tell the client that the frame buffer resized.
Definition: vncserver.cc:682
gem5::VncServer::FrameBufferRect::width
uint16_t width
Definition: vncserver.hh:137
gem5::ArmISA::err
Bitfield< 6 > err
Definition: misc_types.hh:750
gem5::PixelConverter::Channel::mask
unsigned mask
Bit mask (after shifting)
Definition: pixel.hh:124
gem5::PixelConverter::fromPixel
uint32_t fromPixel(const Pixel &pixel) const
Convert a Pixel into a color word.
Definition: pixel.hh:150
gem5::VncInput::PixelFormat::bigendian
uint8_t bigendian
Definition: vncinput.hh:108
gem5::FrameBuffer::width
unsigned width() const
Frame buffer width in pixels.
Definition: framebuffer.hh:99
gem5::ArmISA::e
Bitfield< 9 > e
Definition: misc_types.hh:64
gem5::PollEvent::queued
bool queued()
Definition: pollevent.hh:72
gem5::VncInput::fb
const FrameBuffer * fb
pointer to the actual data that is stored in the frame buffer device
Definition: vncinput.hh:218
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:775
gem5::betoh
T betoh(T value)
Definition: byteswap.hh:175
gem5::VncInput::videoWidth
uint16_t videoWidth() const
What is the width of the screen we're displaying.
Definition: vncinput.hh:193
gem5::VncInput::PixelFormat::bpp
uint8_t bpp
Definition: vncinput.hh:106
gem5::VncInput::PixelFormat::redmax
uint16_t redmax
Definition: vncinput.hh:110
gem5::VncInput::PointerEventMessage
Definition: vncinput.hh:151
gem5::VncServer::setEncodings
void setEncodings()
Receive encodings message from client and process it.
Definition: vncserver.cc:515
std::vector< uint8_t >
gem5::VncServer::ListenEvent
friend class ListenEvent
Definition: vncserver.hh:163
gem5::VncInput::PixelFormatMessage
Definition: vncinput.hh:119
gem5::VncServer::NormalPhase
@ NormalPhase
Definition: vncserver.hh:114
gem5::ArmISA::encoding
Bitfield< 27, 25 > encoding
Definition: types.hh:90
gem5::htobe
T htobe(T value)
Definition: byteswap.hh:174
gem5::VncServer::FrameBufferUpdate
Definition: vncserver.hh:126
gem5::PollEvent
Definition: pollevent.hh:43
gem5::VncServer
Definition: vncserver.hh:62
gem5::VncServer::listenEvent
ListenEvent * listenEvent
Definition: vncserver.hh:164
output.hh
gem5::PollQueue::remove
void remove(PollEvent *event)
Definition: pollevent.cc:139
gem5::VncServer::vncVersion
const char * vncVersion() const
Definition: vncserver.hh:103
gem5::VncServer::number
int number
Definition: vncserver.hh:180
gem5::ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
gem5::FrameBuffer::height
unsigned height() const
Frame buffer height in pixels.
Definition: framebuffer.hh:101
gem5::VncServer::recvCutText
void recvCutText()
Receive message from client that there is text in it's paste buffer.
Definition: vncserver.cc:605
gem5::VncInput::mouse
VncMouse * mouse
The device to notify when we get mouse events.
Definition: vncinput.hh:215
gem5::VncServer::data
void data()
Definition: vncserver.cc:220
gem5::VncInput::FrameBufferUpdateReq::x
uint16_t x
Definition: vncinput.hh:137
gem5::VncInput::PixelFormat::truecolor
uint8_t truecolor
Definition: vncinput.hh:109
gem5::VncServer::FrameBufferRect::encoding
int32_t encoding
Definition: vncserver.hh:139
gem5::VncInput::ClientCutText
@ ClientCutText
Definition: vncinput.hh:101
gem5::VncServer::FrameBufferRect::height
uint16_t height
Definition: vncserver.hh:138
gem5::VncServer::supportsRawEnc
bool supportsRawEnc
If the vnc client supports receiving raw data.
Definition: vncserver.hh:209
gem5::VncInput::PixelFormat::padding
uint8_t padding[3]
Definition: vncinput.hh:116
gem5::PixelConverter::length
unsigned length
Bytes per pixel when stored in memory (including padding)
Definition: pixel.hh:184
gem5::VncServer::VncOK
const static uint32_t VncOK
Error conditions.
Definition: vncserver.hh:75
gem5::VncServer::ServerInitMsg::name
char name[2]
Definition: vncserver.hh:123
gem5::VncServer::recvKeyboardInput
void recvKeyboardInput()
Receive message from client providing new keyboard input.
Definition: vncserver.cc:571
gem5::VncServer::ServerFrameBufferUpdate
@ ServerFrameBufferUpdate
Definition: vncserver.hh:80
gem5::VncInput::ClientKeyEvent
@ ClientKeyEvent
Definition: vncinput.hh:99
gem5::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...
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::PixelConverter::byte_order
ByteOrder byte_order
Byte order when stored to memory.
Definition: pixel.hh:192
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
gem5::VncInput::FrameBufferUpdateReq
Definition: vncinput.hh:133
gem5::VncServer::recvPointerInput
void recvPointerInput()
Recv message from client providing new mouse movement or button click.
Definition: vncserver.cc:587
gem5::VncServer::FrameBufferUpdate::type
uint8_t type
Definition: vncserver.hh:128
gem5::VncServer::DataEvent::DataEvent
DataEvent(VncServer *vs, int fd, int e)
Poll event for the data socket.
Definition: vncserver.cc:101
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::FrameBuffer::pixel
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
Definition: framebuffer.hh:160
gem5::VncServer::FrameBufferUpdate::num_rects
uint16_t num_rects
Definition: vncserver.hh:130
gem5::ListenSocket::listen
virtual bool listen(int port, bool reuse=true)
Definition: socket.cc:100
gem5::VncServer::ListenEvent::process
void process(int revent)
Definition: vncserver.cc:93
gem5::VncServer::sendUpdate
bool sendUpdate
An update needs to be sent to the client.
Definition: vncserver.hh:203
gem5::ListenSocket::getfd
int getfd() const
Definition: socket.hh:75
gem5::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:93
gem5::EventQueue::ScopedMigration
Definition: eventq.hh:672
gem5::VncServer::EncodingDesktopSize
@ EncodingDesktopSize
Definition: vncserver.hh:92
gem5::VncServer::listener
ListenSocket listener
Definition: vncserver.hh:183
gem5::VncServer::FrameBufferRect::x
uint16_t x
Definition: vncserver.hh:135
gem5::PollQueue::schedule
void schedule(PollEvent *event)
Definition: pollevent.cc:159
gem5::VncInput::PixelFormat::greenshift
uint8_t greenshift
Definition: vncinput.hh:114
gem5::ListenSocket::allDisabled
static bool allDisabled()
Definition: socket.cc:71
gem5::atomic_write
ssize_t atomic_write(int fd, const void *s, size_t n)
Definition: atomicio.cc:67
gem5::VncInput::ClientCutTextMessage
Definition: vncinput.hh:159
gem5::VncServer::listen
void listen(int port)
Definition: vncserver.cc:160
gem5::VncServer::dataFd
int dataFd
Definition: vncserver.hh:181
gem5::VncServer::EncodingRaw
@ EncodingRaw
Definition: vncserver.hh:89
gem5::VncServer::AuthInvalid
const static uint32_t AuthInvalid
Authentication modes.
Definition: vncserver.hh:71
gem5::VncServer::checkProtocolVersion
void checkProtocolVersion()
Check the client's protocol verion for compatibility and send the security types we support.
Definition: vncserver.cc:377
gem5::VncServer::requestFbUpdate
void requestFbUpdate()
Receive message from client asking for updated frame buffer.
Definition: vncserver.cc:551
gem5::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:715
gem5::VncInput::ClientPointerEvent
@ ClientPointerEvent
Definition: vncinput.hh:100
gem5::VncServer::write
bool write(const uint8_t *buf, size_t len)
Write a buffer to the client.
Definition: vncserver.cc:317
gem5::VncInput::ClientSetEncodings
@ ClientSetEncodings
Definition: vncinput.hh:97
gem5::PixelConverter::ch_r
Channel ch_r
Red channel conversion helper.
Definition: pixel.hh:195
gem5::VncServer::FrameBufferRect
Definition: vncserver.hh:133
gem5::RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:73
inform
#define inform(...)
Definition: logging.hh:246
gem5::VncServer::read
bool read(uint8_t *buf, size_t len)
Read some data from the client.
Definition: vncserver.cc:281
gem5::VncInput::Params
VncInputParams Params
Definition: vncinput.hh:166
gem5::VncServer::ServerInitMsg::px
PixelFormat px
Definition: vncserver.hh:121
gem5::VncServer::WaitForClientInit
@ WaitForClientInit
Definition: vncserver.hh:112
gem5::VncInput::PixelFormat::bluemax
uint16_t bluemax
Definition: vncinput.hh:112
gem5::VncServer::detach
void detach()
Definition: vncserver.cc:348
gem5::VncServer::sendServerInit
void sendServerInit()
Send client our idea about what the frame buffer looks like.
Definition: vncserver.cc:453
gem5::VncInput
Definition: vncinput.hh:89
gem5::VncInput::ClientFrameBufferUpdate
@ ClientFrameBufferUpdate
Definition: vncinput.hh:98
gem5::PixelConverter::depth
unsigned depth
Number of bits used to represent one pixel value (excluding padding).
Definition: pixel.hh:190
gem5::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
logging.hh
gem5::VncServer::sendError
void sendError(const char *error_msg)
vnc client Interface
Definition: vncserver.cc:368
gem5::ArmISA::vs
Bitfield< 19 > vs
Definition: misc_types.hh:569
gem5::VncServer::frameBufferResized
void frameBufferResized() override
Definition: vncserver.cc:724
gem5::VncInput::KeyEventMessage
Definition: vncinput.hh:143
gem5::VncInput::keyboard
VncKeyboard * keyboard
The device to notify when we get key events.
Definition: vncinput.hh:209
gem5::VncServer::supportsResizeEnc
bool supportsResizeEnc
If the vnc client supports the desktop resize command.
Definition: vncserver.hh:212
trace.hh
gem5::VncServer::VncServer
VncServer(const Params &p)
VncServer.
Definition: vncserver.cc:118
gem5::VncServer::~VncServer
~VncServer()
Definition: vncserver.cc:145
gem5::VncInput::videoHeight
uint16_t videoHeight() const
What is the height of the screen we're displaying.
Definition: vncinput.hh:200
gem5::ListenSocket::accept
virtual int accept(bool nodelay=false)
Definition: socket.cc:149
gem5::VncInput::KeyEventMessage::key
uint32_t key
Definition: vncinput.hh:148
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::VncServer::pixelConverter
static const PixelConverter pixelConverter
Definition: vncserver.hh:315
gem5::ListenSocket::islistening
bool islistening() const
Definition: socket.hh:76
gem5::PixelConverter::ch_g
Channel ch_g
Green channel conversion helper.
Definition: pixel.hh:197
gem5::VncInput::PixelFormat::depth
uint8_t depth
Definition: vncinput.hh:107
gem5::VncInput::PointerEventMessage::x
uint16_t x
Definition: vncinput.hh:155
gem5::VncInput::PixelFormat::redshift
uint8_t redshift
Definition: vncinput.hh:113
gem5::VncServer::DataEvent::process
void process(int revent)
Definition: vncserver.cc:107
gem5::VncInput::PixelFormat::blueshift
uint8_t blueshift
Definition: vncinput.hh:115
gem5::VncServer::pixelFormat
PixelFormat pixelFormat
The one and only pixel format we support.
Definition: vncserver.hh:206
byteswap.hh
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::VncInput::PixelEncodingsMessage
Definition: vncinput.hh:126
gem5::VncInput::PixelFormat::greenmax
uint16_t greenmax
Definition: vncinput.hh:111
gem5::VncServer::checkSecurity
void checkSecurity()
Check that the security exchange was successful.
Definition: vncserver.cc:431
gem5::VncInput::ClientSetPixelFormat
@ ClientSetPixelFormat
Definition: vncinput.hh:96

Generated on Tue Sep 21 2021 12:25:00 for gem5 by doxygen 1.8.17