2015-08-23 00:52:01 +02:00
|
|
|
#ifndef INET_H
|
|
|
|
#define INET_H
|
2002-07-03 21:06:54 +02:00
|
|
|
/*=========================================================================*\
|
2003-05-25 03:54:13 +02:00
|
|
|
* Internet domain functions
|
2003-06-26 20:47:49 +02: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
|
2015-08-23 00:52:01 +02:00
|
|
|
* resolver.
|
2003-06-26 20:47:49 +02:00
|
|
|
*
|
|
|
|
* 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 21:06:54 +02:00
|
|
|
\*=========================================================================*/
|
2019-02-28 04:57:14 +01:00
|
|
|
#include "luasocket.h"
|
2003-06-09 20:23:40 +02:00
|
|
|
#include "socket.h"
|
2004-01-18 01:04:20 +01:00
|
|
|
#include "timeout.h"
|
2002-07-03 21:06:54 +02:00
|
|
|
|
2004-06-17 02:18:48 +02:00
|
|
|
#ifdef _WIN32
|
2013-05-27 14:30:06 +02:00
|
|
|
#define LUASOCKET_INET_ATON
|
2004-01-17 01:17:46 +01:00
|
|
|
#endif
|
|
|
|
|
2019-03-01 00:32:07 +01:00
|
|
|
#ifndef _WIN32
|
2019-02-28 04:57:14 +01:00
|
|
|
#pragma GCC visibility push(hidden)
|
2019-03-01 00:32:07 +01:00
|
|
|
#endif
|
2019-02-28 04:57:14 +01:00
|
|
|
|
2004-02-04 15:29:11 +01:00
|
|
|
int inet_open(lua_State *L);
|
2004-01-18 01:04:20 +01:00
|
|
|
|
2019-02-28 04:57:14 +01:00
|
|
|
int inet_optfamily(lua_State* L, int narg, const char* def);
|
|
|
|
int inet_optsocktype(lua_State* L, int narg, const char* def);
|
2004-01-18 01:04:20 +01:00
|
|
|
|
2012-04-23 18:47:30 +02: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 21:06:54 +02:00
|
|
|
|
2019-02-28 04:57:14 +01:00
|
|
|
const char *inet_trycreate(p_socket ps, int family, int type, int protocol);
|
|
|
|
const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm);
|
|
|
|
const char *inet_tryconnect(p_socket ps, int *family, const char *address, const char *serv, p_timeout tm, struct addrinfo *connecthints);
|
|
|
|
const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm);
|
|
|
|
const char *inet_trybind(p_socket ps, int *family, const char *address, const char *serv, struct addrinfo *bindhints);
|
2012-05-10 23:14:22 +02:00
|
|
|
|
2013-05-27 14:30:06 +02:00
|
|
|
#ifdef LUASOCKET_INET_ATON
|
2003-06-11 03:42:18 +02:00
|
|
|
int inet_aton(const char *cp, struct in_addr *inp);
|
|
|
|
#endif
|
|
|
|
|
2013-05-27 14:30:06 +02:00
|
|
|
#ifdef LUASOCKET_INET_PTON
|
2013-04-07 21:39:56 +02:00
|
|
|
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
|
|
|
|
|
2019-03-01 00:32:07 +01:00
|
|
|
#ifndef _WIN32
|
2019-02-28 04:57:14 +01:00
|
|
|
#pragma GCC visibility pop
|
2019-03-01 00:32:07 +01:00
|
|
|
#endif
|
2019-02-28 04:57:14 +01:00
|
|
|
|
2003-06-26 20:47:49 +02:00
|
|
|
#endif /* INET_H */
|