| 1 | #ifndef TCP_H |
| 2 | #define TCP_H |
| 3 | /*=========================================================================*\ |
| 4 | * TCP object |
| 5 | * LuaSocket toolkit |
| 6 | * |
| 7 | * The tcp.h module is basicly a glue that puts together modules buffer.h, |
| 8 | * timeout.h socket.h and inet.h to provide the LuaSocket TCP (AF_INET, |
| 9 | * SOCK_STREAM) support. |
| 10 | * |
| 11 | * Three classes are defined: master, client and server. The master class is |
| 12 | * a newly created tcp object, that has not been bound or connected. Server |
| 13 | * objects are tcp objects bound to some local address. Client objects are |
| 14 | * tcp objects either connected to some address or returned by the accept |
| 15 | * method of a server object. |
| 16 | \*=========================================================================*/ |
| 17 | #include "lua.h" |
| 18 | |
| 19 | #include "buffer.h" |
| 20 | #include "timeout.h" |
| 21 | #include "socket.h" |
| 22 | |
| 23 | typedef struct t_tcp_ { |
| 24 | t_socket sock; |
| 25 | t_io io; |
| 26 | t_buffer buf; |
| 27 | t_timeout tm; |
| 28 | int family; |
| 29 | } t_tcp; |
| 30 | |
| 31 | typedef t_tcp *p_tcp; |
| 32 | |
| 33 | int tcp_open(lua_State *L); |
| 34 | |
| 35 | #endif /* TCP_H */ |
| 36 | |