gem5
|
#include <vncserver.hh>
Classes | |
class | DataEvent |
DataEvent to read data from vnc. More... | |
struct | FrameBufferRect |
struct | FrameBufferUpdate |
class | ListenEvent |
ListenEvent to accept a vnc client connection. More... | |
struct | ServerCutText |
struct | ServerInitMsg |
Public Types | |
enum | ServerMessages { ServerFrameBufferUpdate = 0, ServerSetColorMapEntries = 1, ServerBell = 2, ServerCutText = 3 } |
Server -> Client message IDs. More... | |
enum | EncodingTypes { EncodingRaw = 0, EncodingCopyRect = 1, EncodingHextile = 5, EncodingDesktopSize = -223 } |
Encoding types. More... | |
enum | MouseEvents { MouseLeftButton = 0x1, MouseRightButton = 0x2, MouseMiddleButton = 0x4 } |
keyboard/mouse support More... | |
enum | ConnectionState { WaitForProtocolVersion, WaitForSecurityResponse, WaitForClientInit, InitializationPhase, NormalPhase } |
typedef VncServerParams | Params |
Public Types inherited from VncInput | |
enum | ClientMessages { ClientSetPixelFormat = 0, ClientSetEncodings = 2, ClientFrameBufferUpdate = 3, ClientKeyEvent = 4, ClientPointerEvent = 5, ClientCutText = 6 } |
Client -> Server message IDs. More... | |
typedef VncInputParams | Params |
Public Types inherited from SimObject | |
typedef SimObjectParams | Params |
Public Member Functions | |
const char * | vncVersion () const |
VncServer (const Params *p) | |
VncServer. More... | |
~VncServer () | |
void | setDirty () override |
The frame buffer uses this call to notify the vnc server that the frame buffer has been updated and a new image needs to be sent to the client. More... | |
void | frameBufferResized () override |
Public Member Functions inherited from VncInput | |
VncInput (const Params *p) | |
virtual void | setFrameBuffer (const FrameBuffer *rfb) |
Set the address of the frame buffer we are going to show. More... | |
void | setKeyboard (VncKeyboard *_keyboard) |
Set up the device that would like to receive notifications when keys are pressed in the vnc client keyboard. More... | |
void | setMouse (VncMouse *_mouse) |
Setup the device that would like to receive notifications when mouse movements or button presses are received from the vnc client. More... | |
uint16_t | videoWidth () const |
What is the width of the screen we're displaying. More... | |
uint16_t | videoHeight () const |
What is the height of the screen we're displaying. More... | |
Public Member Functions inherited from SimObject | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regStats () |
Register statistics for this object. More... | |
virtual void | resetStats () |
Reset statistics associated with this object. More... | |
virtual void | regProbePoints () |
Register probe points for this object. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
virtual void | startup () |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from EventManager | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick)-1) |
void | setCurTick (Tick newVal) |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
Public Attributes | |
struct VncServer::ServerInitMsg | M5_ATTR_PACKED |
struct VncServer::FrameBufferUpdate | M5_ATTR_PACKED |
struct VncServer::FrameBufferRect | M5_ATTR_PACKED |
struct VncServer::ServerCutText | M5_ATTR_PACKED |
Public Attributes inherited from VncInput | |
struct VncInput::PixelFormat | M5_ATTR_PACKED |
struct VncInput::PixelFormatMessage | M5_ATTR_PACKED |
struct VncInput::PixelEncodingsMessage | M5_ATTR_PACKED |
struct VncInput::FrameBufferUpdateReq | M5_ATTR_PACKED |
struct VncInput::KeyEventMessage | M5_ATTR_PACKED |
struct VncInput::PointerEventMessage | M5_ATTR_PACKED |
struct VncInput::ClientCutTextMessage | M5_ATTR_PACKED |
Static Public Attributes | |
static const uint32_t | AuthInvalid = 0 |
Authentication modes. More... | |
static const uint32_t | AuthNone = 1 |
static const uint32_t | VncOK = 0 |
Error conditions. More... | |
Static Public Attributes inherited from Serializable | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
Protected Member Functions | |
void | listen (int port) |
void | accept () |
void | data () |
void | detach () |
void | sendError (const char *error_msg) |
vnc client Interface More... | |
bool | read (uint8_t *buf, size_t len) |
Read some data from the client. More... | |
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. More... | |
template<typename T > | |
bool | read (T *val) |
Templated version of the read function above to read simple data to the client. More... | |
bool | write (const uint8_t *buf, size_t len) |
Write a buffer to the client. More... | |
template<typename T > | |
bool | write (T *val) |
Templated version of the write function above to write simple data to the client. More... | |
bool | write (const char *str) |
Send a string to the client. More... | |
void | checkProtocolVersion () |
Check the client's protocol verion for compatibility and send the security types we support. More... | |
void | checkSecurity () |
Check that the security exchange was successful. More... | |
void | sendServerInit () |
Send client our idea about what the frame buffer looks like. More... | |
void | sendError (std::string error_msg) |
Send an error message to the client when something goes wrong. More... | |
void | sendFrameBufferUpdate () |
Send a updated frame buffer to the client. More... | |
void | setPixelFormat () |
Receive pixel foramt message from client and process it. More... | |
void | setEncodings () |
Receive encodings message from client and process it. More... | |
void | requestFbUpdate () |
Receive message from client asking for updated frame buffer. More... | |
void | recvKeyboardInput () |
Receive message from client providing new keyboard input. More... | |
void | recvPointerInput () |
Recv message from client providing new mouse movement or button click. More... | |
void | recvCutText () |
Receive message from client that there is text in it's paste buffer. More... | |
void | sendFrameBufferResized () |
Tell the client that the frame buffer resized. More... | |
Protected Member Functions inherited from VncInput | |
void | captureFrameBuffer () |
Captures the current frame buffer to a file. More... | |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Protected Attributes | |
ListenEvent * | listenEvent |
DataEvent * | dataEvent |
int | number |
int | dataFd |
ListenSocket | listener |
ConnectionState | curState |
The rfb prototol state the connection is in. More... | |
bool | sendUpdate |
An update needs to be sent to the client. More... | |
PixelFormat | pixelFormat |
The one and only pixel format we support. More... | |
bool | supportsRawEnc |
If the vnc client supports receiving raw data. More... | |
bool | supportsResizeEnc |
If the vnc client supports the desktop resize command. More... | |
Protected Attributes inherited from VncInput | |
VncKeyboard * | keyboard |
The device to notify when we get key events. More... | |
VncMouse * | mouse |
The device to notify when we get mouse events. More... | |
const FrameBuffer * | fb |
pointer to the actual data that is stored in the frame buffer device More... | |
uint16_t | _videoWidth |
the width of the frame buffer we are sending to the client More... | |
uint16_t | _videoHeight |
the height of the frame buffer we are sending to the client More... | |
bool | captureEnabled |
Flag indicating whether to capture snapshots of frame buffer or not. More... | |
int | captureCurrentFrame |
Current frame number being captured to a file. More... | |
OutputDirectory * | captureOutputDirectory |
Directory to store captured frames to. More... | |
uint64_t | captureLastHash |
Computed hash of the last captured frame. More... | |
std::unique_ptr< Bitmap > | captureBitmap |
Cached bitmap object for writing out frame buffers to file. More... | |
Protected Attributes inherited from SimObject | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Static Protected Attributes | |
static const PixelConverter | pixelConverter |
Friends | |
class | ListenEvent |
class | DataEvent |
Additional Inherited Members | |
Static Public Member Functions inherited from SimObject | |
static void | serializeAll (CheckpointOut &cp) |
Serialize all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
Definition at line 62 of file vncserver.hh.
typedef VncServerParams VncServer::Params |
Definition at line 183 of file vncserver.hh.
VncServer::VncServer | ( | const Params * | p | ) |
Definition at line 122 of file vncserver.cc.
References VncInput::PixelFormat::bigendian, BigEndianByteOrder, VncInput::PixelFormat::bluemax, VncInput::PixelFormat::blueshift, VncInput::PixelFormat::bpp, PixelConverter::byte_order, PixelConverter::ch_b, PixelConverter::ch_g, PixelConverter::ch_r, curState, VncInput::PixelFormat::depth, PixelConverter::depth, DPRINTF, VncInput::PixelFormat::greenmax, VncInput::PixelFormat::greenshift, PixelConverter::length, listen(), PixelConverter::Channel::mask, PixelConverter::Channel::offset, pixelConverter, pixelFormat, VncInput::PixelFormat::redmax, VncInput::PixelFormat::redshift, VncInput::PixelFormat::truecolor, and WaitForProtocolVersion.
VncServer::~VncServer | ( | ) |
Definition at line 149 of file vncserver.cc.
References dataEvent, dataFd, and listenEvent.
|
protected |
Definition at line 190 of file vncserver.cc.
References ListenSocket::accept(), atomic_write(), DataEvent, dataEvent, dataFd, EventManager::eventQueue(), ArmISA::fd, inform, ListenSocket::islistening(), listener, SimObject::name(), panic, pollQueue, PollQueue::schedule(), vncVersion(), warn, and write().
|
protected |
Check the client's protocol verion for compatibility and send the security types we support.
Definition at line 384 of file vncserver.cc.
References AuthInvalid, AuthNone, curState, detach(), DPRINTF, htobe(), ArmISA::len, M5_VAR_USED, read(), sendError(), WaitForProtocolVersion, WaitForSecurityResponse, warn, and write().
Referenced by data().
|
protected |
Check that the security exchange was successful.
Definition at line 436 of file vncserver.cc.
References AuthNone, curState, DPRINTF, htobe(), read(), sendError(), VncOK, WaitForClientInit, WaitForSecurityResponse, warn, and write().
Referenced by data().
|
protected |
Definition at line 227 of file vncserver.cc.
References checkProtocolVersion(), checkSecurity(), VncInput::ClientCutText, VncInput::ClientFrameBufferUpdate, VncInput::ClientKeyEvent, VncInput::ClientPointerEvent, VncInput::ClientSetEncodings, VncInput::ClientSetPixelFormat, curState, detach(), DPRINTF, NormalPhase, panic, read(), recvCutText(), recvKeyboardInput(), recvPointerInput(), requestFbUpdate(), sendServerInit(), setEncodings(), setPixelFormat(), WaitForClientInit, WaitForProtocolVersion, WaitForSecurityResponse, and warn.
|
protected |
Definition at line 355 of file vncserver.cc.
References curState, dataEvent, dataFd, DPRINTF, inform, number, pollQueue, PollEvent::queued(), PollQueue::remove(), and WaitForProtocolVersion.
Referenced by checkProtocolVersion(), data(), frameBufferResized(), read(), setEncodings(), setPixelFormat(), and write().
|
overridevirtual |
Reimplemented from VncInput.
Definition at line 729 of file vncserver.cc.
References curState, dataFd, detach(), NormalPhase, sendFrameBufferResized(), and supportsResizeEnc.
|
protected |
Definition at line 164 of file vncserver.cc.
References ListenSocket::allDisabled(), ccprintf(), DPRINTF, ListenSocket::getfd(), ListenSocket::listen(), listener, ListenEvent, listenEvent, SimObject::name(), pollQueue, PollQueue::schedule(), and warn_once.
Referenced by VncServer().
|
protected |
Read some data from the client.
buf | the data to read |
len | the amount of data to read |
Definition at line 288 of file vncserver.cc.
References dataFd, detach(), DPRINTF, and panic.
Referenced by checkProtocolVersion(), checkSecurity(), data(), read(), read1(), recvCutText(), and setEncodings().
|
protected |
Templated version of the read function above to read simple data to the client.
val | data to recv from the client |
Definition at line 317 of file vncserver.cc.
References read().
|
protected |
Read len -1 bytes from the client into the buffer provided + 1 assert that we read enough bytes.
This function exists to handle reading all of the protocol structs above when we've already read the first byte which describes which one we're reading
buf | the address of the buffer to add one to and read data into |
len | the amount of data + 1 to read |
Definition at line 309 of file vncserver.cc.
References read().
Referenced by recvCutText(), recvKeyboardInput(), recvPointerInput(), requestFbUpdate(), setEncodings(), and setPixelFormat().
|
protected |
Receive message from client that there is text in it's paste buffer.
This is a no-op at the moment, but perhaps we would want to be able to paste it at some point.
Definition at line 610 of file vncserver.cc.
References betoh(), DPRINTF, VncInput::ClientCutTextMessage::length, read(), and read1().
Referenced by data().
|
protected |
Receive message from client providing new keyboard input.
Definition at line 576 of file vncserver.cc.
References betoh(), VncInput::KeyEventMessage::down_flag, DPRINTF, VncInput::KeyEventMessage::key, VncInput::keyboard, VncKeyboard::keyPress(), and read1().
Referenced by data().
|
protected |
Recv message from client providing new mouse movement or button click.
Definition at line 592 of file vncserver.cc.
References betoh(), VncInput::PointerEventMessage::button_mask, DPRINTF, VncInput::mouse, VncMouse::mouseAt(), read1(), VncInput::PointerEventMessage::x, and VncInput::PointerEventMessage::y.
Referenced by data().
|
protected |
Receive message from client asking for updated frame buffer.
Definition at line 556 of file vncserver.cc.
References betoh(), DPRINTF, VncInput::FrameBufferUpdateReq::height, read1(), sendFrameBufferUpdate(), VncInput::FrameBufferUpdateReq::width, VncInput::FrameBufferUpdateReq::x, and VncInput::FrameBufferUpdateReq::y.
Referenced by data().
|
protected |
vnc client Interface
Send an error message to the client
error_msg | text to send describing the error |
Definition at line 375 of file vncserver.cc.
References ArmISA::len, and write().
Referenced by checkProtocolVersion(), and checkSecurity().
|
protected |
Send an error message to the client when something goes wrong.
error_msg | error to send |
|
protected |
Tell the client that the frame buffer resized.
This happens when the simulated system changes video modes (E.g. X11 starts).
Definition at line 687 of file vncserver.cc.
References curState, dataFd, DPRINTF, VncServer::FrameBufferRect::encoding, EncodingDesktopSize, VncInput::fb, VncServer::FrameBufferRect::height, htobe(), NormalPhase, VncServer::FrameBufferUpdate::num_rects, ServerFrameBufferUpdate, VncServer::FrameBufferUpdate::type, VncInput::videoHeight(), VncInput::videoWidth(), VncServer::FrameBufferRect::width, write(), VncServer::FrameBufferRect::x, and VncServer::FrameBufferRect::y.
Referenced by frameBufferResized().
|
protected |
Send a updated frame buffer to the client.
Definition at line 634 of file vncserver.cc.
References curState, dataFd, DPRINTF, VncServer::FrameBufferRect::encoding, EncodingRaw, VncInput::fb, PixelConverter::fromPixel(), VncServer::FrameBufferRect::height, FrameBuffer::height(), htobe(), PixelConverter::length, NormalPhase, VncServer::FrameBufferUpdate::num_rects, FrameBuffer::pixel(), pixelConverter, sendUpdate, ServerFrameBufferUpdate, VncServer::FrameBufferUpdate::type, VncInput::videoHeight(), VncInput::videoWidth(), VncServer::FrameBufferRect::width, FrameBuffer::width(), write(), X86ISA::x, VncServer::FrameBufferRect::x, and VncServer::FrameBufferRect::y.
Referenced by requestFbUpdate(), and setDirty().
|
protected |
Send client our idea about what the frame buffer looks like.
Definition at line 458 of file vncserver.cc.
References VncInput::PixelFormat::bigendian, VncInput::PixelFormat::bluemax, VncInput::PixelFormat::blueshift, VncInput::PixelFormat::bpp, curState, VncInput::PixelFormat::depth, DPRINTF, VncServer::ServerInitMsg::fbHeight, VncServer::ServerInitMsg::fbWidth, VncInput::PixelFormat::greenmax, VncInput::PixelFormat::greenshift, htobe(), VncServer::ServerInitMsg::name, VncServer::ServerInitMsg::namelen, NormalPhase, VncInput::PixelFormat::padding, pixelFormat, VncServer::ServerInitMsg::px, VncInput::PixelFormat::redmax, VncInput::PixelFormat::redshift, VncInput::PixelFormat::truecolor, VncInput::videoHeight(), VncInput::videoWidth(), and write().
Referenced by data().
|
overridevirtual |
The frame buffer uses this call to notify the vnc server that the frame buffer has been updated and a new image needs to be sent to the client.
Reimplemented from VncInput.
Definition at line 720 of file vncserver.cc.
References sendFrameBufferUpdate(), sendUpdate, and VncInput::setDirty().
|
protected |
Receive encodings message from client and process it.
Definition at line 520 of file vncserver.cc.
References betoh(), detach(), DPRINTF, ArmISA::encoding, EncodingDesktopSize, EncodingRaw, VncInput::PixelEncodingsMessage::num_encodings, read(), read1(), supportsRawEnc, supportsResizeEnc, warn, and X86ISA::x.
Referenced by data().
|
protected |
Receive pixel foramt message from client and process it.
Definition at line 488 of file vncserver.cc.
References betoh(), VncInput::PixelFormat::bigendian, VncInput::PixelFormat::bluemax, VncInput::PixelFormat::blueshift, VncInput::PixelFormat::bpp, VncInput::PixelFormat::depth, detach(), DPRINTF, VncInput::PixelFormat::greenmax, VncInput::PixelFormat::greenshift, pixelFormat, VncInput::PixelFormatMessage::px, read1(), VncInput::PixelFormat::redmax, VncInput::PixelFormat::redshift, VncInput::PixelFormat::truecolor, and warn.
Referenced by data().
|
protected |
Write a buffer to the client.
buf | buffer to send |
len | length of the buffer |
Definition at line 324 of file vncserver.cc.
References atomic_write(), dataFd, detach(), DPRINTF, and panic.
Referenced by accept(), checkProtocolVersion(), checkSecurity(), sendError(), sendFrameBufferResized(), sendFrameBufferUpdate(), sendServerInit(), and write().
|
protected |
Templated version of the write function above to write simple data to the client.
val | data to send to the client |
Definition at line 342 of file vncserver.cc.
References write().
|
protected |
Send a string to the client.
str | string to transmit |
Definition at line 348 of file vncserver.cc.
References write().
|
friend |
Definition at line 169 of file vncserver.hh.
Referenced by accept().
|
friend |
Definition at line 155 of file vncserver.hh.
Referenced by listen().
|
protected |
The rfb prototol state the connection is in.
Definition at line 191 of file vncserver.hh.
Referenced by checkProtocolVersion(), checkSecurity(), data(), detach(), frameBufferResized(), sendFrameBufferResized(), sendFrameBufferUpdate(), sendServerInit(), and VncServer().
|
protected |
Definition at line 170 of file vncserver.hh.
Referenced by accept(), detach(), and ~VncServer().
|
protected |
Definition at line 173 of file vncserver.hh.
Referenced by accept(), detach(), frameBufferResized(), read(), sendFrameBufferResized(), sendFrameBufferUpdate(), write(), and ~VncServer().
|
protected |
Definition at line 175 of file vncserver.hh.
|
protected |
Definition at line 156 of file vncserver.hh.
Referenced by listen(), and ~VncServer().
|
protected |
Definition at line 172 of file vncserver.hh.
Referenced by detach().
|
staticprotected |
Definition at line 307 of file vncserver.hh.
Referenced by sendFrameBufferUpdate(), and VncServer().
|
protected |
The one and only pixel format we support.
Definition at line 198 of file vncserver.hh.
Referenced by sendServerInit(), setPixelFormat(), and VncServer().
|
protected |
An update needs to be sent to the client.
Without doing this the client will constantly request data that is pointless
Definition at line 195 of file vncserver.hh.
Referenced by sendFrameBufferUpdate(), and setDirty().
|
protected |
If the vnc client supports receiving raw data.
It always should
Definition at line 201 of file vncserver.hh.
Referenced by setEncodings().
|
protected |
If the vnc client supports the desktop resize command.
Definition at line 204 of file vncserver.hh.
Referenced by frameBufferResized(), and setEncodings().