More changes: we now get some data printed though it's not helpful.
[barry.git] / src / m_vnc_server.cc
blobf0cc6e6b765648c0ddc6ca86bd744d6673861683
1 ///
2 /// \file m_vnc_server.cc
3 /// Mode class for the VNCServer mode
4 ///
6 /*
7 Copyright (C) 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "m_vnc_server.h"
23 #include "data.h"
24 #include "protocol.h"
25 #include "protostructs.h"
26 #include "packet.h"
27 #include "endian.h"
28 #include "error.h"
29 #include "usbwrap.h"
30 #include "controller.h"
31 #include <stdexcept>
32 #include <sstream>
34 #include "debug.h"
36 namespace Barry { namespace Mode {
38 static void HandleReceivedDataCallback(void* ctx, Data* data)
40 ((VNCServer*)ctx)->HandleReceivedData(*data);
43 ///////////////////////////////////////////////////////////////////////////////
44 // VNCServer Mode class
46 VNCServer::VNCServer(Controller &con, VNCServerDataCallback& callback)
47 : Mode(con, Controller::VNCServer),
48 Callback(callback)
52 VNCServer::~VNCServer()
56 void VNCServer::OnOpen()
58 std::cerr << "about to register interest\n";
59 m_socket->RegisterInterest(HandleReceivedDataCallback, this);
60 std::cerr << "registered interest\n";
63 ///////////////////////////////////////////////////////////////////////////////
64 // public API
66 void VNCServer::Send(Data& data)
68 m_socket->Send(data);
71 void VNCServer::HandleReceivedData(Data& data)
73 Callback.DataReceived(data);
76 }} // namespace Barry::Mode