X-Git-Url: http://git.maemo.org/git/?p=lordsawar;a=blobdiff_plain;f=src%2Fnetwork-server.h;fp=src%2Fnetwork-server.h;h=1a371dd4a7289a0a896e48b2b8e103d1b6474faa;hp=0000000000000000000000000000000000000000;hb=9eda00ff73353c55ecef6f82131166d5d4a85e29;hpb=3d34d4aa85a929f912464f71158396a388274f27 diff --git a/src/network-server.h b/src/network-server.h new file mode 100644 index 0000000..1a371dd --- /dev/null +++ b/src/network-server.h @@ -0,0 +1,58 @@ +// Copyright (C) 2008 Ole Laursen +// Copyright (C) 2008 Ben Asselstine +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. + +#ifndef NETWORK_SERVER_H +#define NETWORK_SERVER_H + +#include "config.h" + +#include +#include +#include + +#include "network-common.h" + +class _GServer; +class _GConn; +class NetworkConnection; + +class NetworkServer +{ +public: + NetworkServer(); + ~NetworkServer(); + + bool isListening(); + void startListening(int port); + void send(void *conn, MessageType type, const std::string &payload); + + sigc::signal got_message; + sigc::signal connection_made; + sigc::signal connection_lost; + + // private callback + void gotClientConnection(_GConn* conn); + +private: + void onConnectionLost(NetworkConnection *conn); + + _GServer *server; + std::list connections; +}; + +#endif