2003-06-26 18:47:49 +00:00
|
|
|
#ifndef INET_H
|
|
|
|
#define INET_H
|
2002-07-03 19:06:54 +00:00
|
|
|
/*=========================================================================*\
|
2003-05-25 01:54:13 +00:00
|
|
|
* Internet domain functions
|
2003-06-26 18:47:49 +00:00
|
|
|
* 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.
|
2002-07-03 19:06:54 +00:00
|
|
|
\*=========================================================================*/
|
2005-09-29 06:11:42 +00:00
|
|
|
#include "lua.h"
|
2003-06-09 18:23:40 +00:00
|
|
|
#include "socket.h"
|
2004-01-18 00:04:20 +00:00
|
|
|
#include "timeout.h"
|
2002-07-03 19:06:54 +00:00
|
|
|
|
2004-06-17 00:18:48 +00:00
|
|
|
#ifdef _WIN32
|
2004-01-17 00:17:46 +00:00
|
|
|
#define INET_ATON
|
2013-04-07 12:39:56 -07:00
|
|
|
#define INET_PTON
|
2004-01-17 00:17:46 +00:00
|
|
|
#endif
|
|
|
|
|
2004-02-04 14:29:11 +00:00
|
|
|
int inet_open(lua_State *L);
|
2004-01-18 00:04:20 +00:00
|
|
|
|
2012-04-24 00:47:30 +08:00
|
|
|
const char *inet_trycreate(p_socket ps, int family, int type);
|
2011-06-15 00:51:02 +02:00
|
|
|
const char *inet_tryconnect(p_socket ps, const char *address,
|
|
|
|
const char *serv, p_timeout tm, struct addrinfo *connecthints);
|
2011-06-14 01:17:07 +02:00
|
|
|
const char *inet_trybind(p_socket ps, const char *address, const char *serv,
|
|
|
|
struct addrinfo *bindhints);
|
2012-08-23 19:31:15 -03:00
|
|
|
const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm);
|
2012-12-11 16:35:27 -02:00
|
|
|
const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm);
|
2004-01-18 00:04:20 +00:00
|
|
|
|
2012-04-24 00:47:30 +08:00
|
|
|
int inet_meth_getpeername(lua_State *L, p_socket ps, int family);
|
|
|
|
int inet_meth_getsockname(lua_State *L, p_socket ps, int family);
|
2002-07-03 19:06:54 +00:00
|
|
|
|
2012-05-10 14:14:22 -07:00
|
|
|
int inet_optfamily(lua_State* L, int narg, const char* def);
|
|
|
|
int inet_optsocktype(lua_State* L, int narg, const char* def);
|
|
|
|
|
2003-06-11 01:42:18 +00:00
|
|
|
#ifdef INET_ATON
|
|
|
|
int inet_aton(const char *cp, struct in_addr *inp);
|
|
|
|
#endif
|
|
|
|
|
2013-04-07 12:39:56 -07:00
|
|
|
#ifdef 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
|
|
|
|
|
2003-06-26 18:47:49 +00:00
|
|
|
#endif /* INET_H */
|