Subversion Repositories HomeAutomation

Rev

Rev 1959 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1651 runge 1
/*
2
 *
3
 *  Copyright (C) 2010  Mattias Runge
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License along
16
 *  with this program; if not, write to the Free Software Foundation, Inc.,
17
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 */
20
 
21
#ifndef VM_PLUGIN_SOCKET_H
22
#define VM_PLUGIN_SOCKET_H
23
 
24
#include <set>
25
 
26
#include <boost/shared_ptr.hpp>
27
 
28
#include "vm/Plugin.h"
29
#include "logging/Logger.h"
30
#include "net/types.h"
31
#include "common/Byteset.h"
32
 
33
namespace atom {
34
namespace vm {
35
namespace plugin {
36
 
37
class Socket : public Plugin
38
{
39
public:
40
    typedef boost::shared_ptr<Socket> Pointer;
41
 
42
    Socket(boost::asio::io_service& io_service);
43
    virtual ~Socket();
44
 
45
    void InitializeDone();
46
    void CallOutput(unsigned int request_id, std::string output);
47
 
48
private:
1986 runge 49
    void SlotOnNewState(net::SocketId id, net::ClientState client_state);
50
    void SlotOnNewClient(net::SocketId id, net::SocketId server_id);
51
    void SlotOnNewData(net::SocketId id, common::Byteset data);
1651 runge 52
 
1986 runge 53
    void SlotOnNewStateHandler(net::SocketId id, net::ClientState client_state);
54
    void SlotOnNewClientHandler(net::SocketId id, net::SocketId server_id);
55
    void SlotOnNewDataHandler(net::SocketId id, common::Byteset data);
56
 
1959 runge 57
    static Value Export_StartServer(const v8::Arguments& args);
1651 runge 58
    static Value Export_Connect(const v8::Arguments& args);
1959 runge 59
    static Value Export_StopServer(const v8::Arguments& args);
1651 runge 60
    static Value Export_Disconnect(const v8::Arguments& args);
61
    static Value Export_Send(const v8::Arguments& args);
62
};
63
 
64
}; // namespace plugin
65
}; // namespace vm
66
}; // namespace atom
67
 
68
#endif // VM_PLUGIN_SOCKET_H
1940 runge 69