aboutsummaryrefslogtreecommitdiff
path: root/src/lua/net/lua_net_Socket.h
blob: e02fb5b468fa2a004e9ee52a02ac5d7944d15b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __JIN_LUA_NET_SOCKET_H
#define __JIN_LUA_NET_SOCKET_H
#include "libjin/jin.h"
#include "../luaopen_types.h"

namespace jin
{
namespace lua
{
namespace net
{

    class Socket : public jin::net::Socket
                 , public Object
    {
    public:
        typedef jin::net::SocketInformation SocketInformation;
        typedef jin::net::SocketType SocketType;

        Socket(jin::net::Socket base)
            : jin::net::Socket(base)
        {
        }

        Socket(const SocketInformation& socketInformation)
            : jin::net::Socket(socketInformation)
        {
        }

        Socket(SocketType type, unsigned short port)
            : jin::net::Socket(type, port)
        {
        }

        Socket(SocketType type, unsigned int address, unsigned short port)
            : jin::net::Socket(type, address)
        {
        }

        Socket(SocketType type, const char* address, unsigned short port)
            : jin::net::Socket(type, address, port)
        {
        }

        Socket * accept()
        {
            jin::net::Socket* base = jin::net::Socket::accept();
            Socket* socket = new Socket(*base);
            delete base;
            return socket;
        }

    private:
        ~Socket()
        {
        }

    };

}
}
}

#endif