diff options
author | chai <chaifix@163.com> | 2021-11-08 01:17:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-08 01:17:11 +0800 |
commit | efce5b6bd5c9d4f8214a71e0f7a7c35751710a4c (patch) | |
tree | 0789475ded5c377667165a3ddb047ca6703bcf33 /ThirdParty/tolua_runtime/luasocket/inet.h | |
parent | ed78df90944bbe6b7de7308bda2bf3a7f1bc3de6 (diff) |
+ tolua
+ lpeg
Diffstat (limited to 'ThirdParty/tolua_runtime/luasocket/inet.h')
-rw-r--r-- | ThirdParty/tolua_runtime/luasocket/inet.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ThirdParty/tolua_runtime/luasocket/inet.h b/ThirdParty/tolua_runtime/luasocket/inet.h new file mode 100644 index 0000000..d060175 --- /dev/null +++ b/ThirdParty/tolua_runtime/luasocket/inet.h @@ -0,0 +1,54 @@ +#ifndef INET_H +#define INET_H +/*=========================================================================*\ +* Internet domain functions +* LuaSocket toolkit +* +* This module implements the creation and connection of internet domain +* sockets, on top of the socket.h interface, and the interface of with the +* resolver. +* +* The function inet_aton is provided for the platforms where it is not +* available. The module also implements the interface of the internet +* getpeername and getsockname functions as seen by Lua programs. +* +* The Lua functions toip and tohostname are also implemented here. +\*=========================================================================*/ +#include "lua.h" +#include "socket.h" +#include "timeout.h" + +#ifdef _WIN32 +#define LUASOCKET_INET_ATON +#endif + +#ifdef __MINGW32__ +#define LUASOCKET_INET_PTON +#endif + +int inet_open(lua_State *L); + +const char *inet_trycreate(p_socket ps, int family, int type, int protocol); +const char *inet_tryconnect(p_socket ps, int *family, const char *address, + const char *serv, p_timeout tm, struct addrinfo *connecthints); +const char *inet_trybind(p_socket ps, int *family, const char *address, + const char *serv, struct addrinfo *bindhints); +const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm); +const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm); + +int inet_meth_getpeername(lua_State *L, p_socket ps, int family); +int inet_meth_getsockname(lua_State *L, p_socket ps, int family); + +int inet_optfamily(lua_State* L, int narg, const char* def); +int inet_optsocktype(lua_State* L, int narg, const char* def); + +#ifdef LUASOCKET_INET_ATON +int inet_aton(const char *cp, struct in_addr *inp); +#endif + +#ifdef LUASOCKET_INET_PTON +const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); +int inet_pton(int af, const char *src, void *dst); +#endif + +#endif /* INET_H */ |