Skip to content

Commit

Permalink
Created ClientDataSocket look-alike APIClient.
Browse files Browse the repository at this point in the history
  • Loading branch information
GamePad64 committed Feb 10, 2014
1 parent 9204092 commit eab1b52
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/library/impl/daemon_comm/ClientDataSocket.cpp
@@ -0,0 +1,29 @@
/*
* You may redistribute this program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ClientDataSocket.h"

namespace p2pnet {
namespace impl {

ClientDataSocket::ClientDataSocket() {
// TODO Auto-generated constructor stub

}

ClientDataSocket::~ClientDataSocket() {
// TODO Auto-generated destructor stub
}

} /* namespace impl */
} /* namespace p2pnet */
39 changes: 39 additions & 0 deletions src/library/impl/daemon_comm/ClientDataSocket.h
@@ -0,0 +1,39 @@
/*
* You may redistribute this program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLIENTDATASOCKET_H_
#define CLIENTDATASOCKET_H_

namespace p2pnet {
namespace impl {

class ClientDataSocket {
protected:
typedef std::function<void(int)> SendHandler;
typedef std::function<void(api::APIMessage, int)> ReceiveHandler;

ClientDataSocket();
public:
virtual ~ClientDataSocket();

virtual void send(api::APIMessage data, int& error_code) = 0;
virtual api::APIMessage receive(int& error_code) = 0;

virtual void asyncSend(api::APIMessage data, SendHandler send_handler) = 0;
virtual void asyncReceive(ReceiveHandler receive_handler) = 0;
};

} /* namespace impl */
} /* namespace p2pnet */

#endif /* CLIENTDATASOCKET_H_ */

0 comments on commit eab1b52

Please sign in to comment.