diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-07-01 06:09:29 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-07-01 06:09:29 +0000 |
| commit | 63807d647624df155a81a2b323f370e2c36192f6 (patch) | |
| tree | 28d53540d166cc01eb0a3302e4f0dc5d2cc6c809 /src/tcp.c | |
| parent | 2562738e2db9d7654c48c10247e683215e09b4a5 (diff) | |
| download | luasocket-63807d647624df155a81a2b323f370e2c36192f6.tar.gz luasocket-63807d647624df155a81a2b323f370e2c36192f6.tar.bz2 luasocket-63807d647624df155a81a2b323f370e2c36192f6.zip | |
Added getstats.
Diffstat (limited to 'src/tcp.c')
| -rw-r--r-- | src/tcp.c | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -23,6 +23,7 @@ static int meth_connect(lua_State *L); | |||
| 23 | static int meth_listen(lua_State *L); | 23 | static int meth_listen(lua_State *L); |
| 24 | static int meth_bind(lua_State *L); | 24 | static int meth_bind(lua_State *L); |
| 25 | static int meth_send(lua_State *L); | 25 | static int meth_send(lua_State *L); |
| 26 | static int meth_getstats(lua_State *L); | ||
| 26 | static int meth_getsockname(lua_State *L); | 27 | static int meth_getsockname(lua_State *L); |
| 27 | static int meth_getpeername(lua_State *L); | 28 | static int meth_getpeername(lua_State *L); |
| 28 | static int meth_shutdown(lua_State *L); | 29 | static int meth_shutdown(lua_State *L); |
| @@ -47,6 +48,7 @@ static luaL_reg tcp[] = { | |||
| 47 | {"getfd", meth_getfd}, | 48 | {"getfd", meth_getfd}, |
| 48 | {"getpeername", meth_getpeername}, | 49 | {"getpeername", meth_getpeername}, |
| 49 | {"getsockname", meth_getsockname}, | 50 | {"getsockname", meth_getsockname}, |
| 51 | {"getstats", meth_getstats}, | ||
| 50 | {"listen", meth_listen}, | 52 | {"listen", meth_listen}, |
| 51 | {"receive", meth_receive}, | 53 | {"receive", meth_receive}, |
| 52 | {"send", meth_send}, | 54 | {"send", meth_send}, |
| @@ -100,18 +102,21 @@ int tcp_open(lua_State *L) | |||
| 100 | /*-------------------------------------------------------------------------*\ | 102 | /*-------------------------------------------------------------------------*\ |
| 101 | * Just call buffered IO methods | 103 | * Just call buffered IO methods |
| 102 | \*-------------------------------------------------------------------------*/ | 104 | \*-------------------------------------------------------------------------*/ |
| 103 | static int meth_send(lua_State *L) | 105 | static int meth_send(lua_State *L) { |
| 104 | { | ||
| 105 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); | 106 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); |
| 106 | return buf_meth_send(L, &tcp->buf); | 107 | return buf_meth_send(L, &tcp->buf); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | static int meth_receive(lua_State *L) | 110 | static int meth_receive(lua_State *L) { |
| 110 | { | ||
| 111 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); | 111 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); |
| 112 | return buf_meth_receive(L, &tcp->buf); | 112 | return buf_meth_receive(L, &tcp->buf); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | static int meth_getstats(lua_State *L) { | ||
| 116 | p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1); | ||
| 117 | return buf_meth_getstats(L, &tcp->buf); | ||
| 118 | } | ||
| 119 | |||
| 115 | /*-------------------------------------------------------------------------*\ | 120 | /*-------------------------------------------------------------------------*\ |
| 116 | * Just call option handler | 121 | * Just call option handler |
| 117 | \*-------------------------------------------------------------------------*/ | 122 | \*-------------------------------------------------------------------------*/ |
