luasocket/src/usocket.h

60 lines
1.6 KiB
C
Raw Normal View History

#ifndef USOCKET_H
#define USOCKET_H
2003-03-28 13:08:50 -08:00
/*=========================================================================*\
2003-05-24 18:54:13 -07:00
* Socket compatibilization module for Unix
* LuaSocket toolkit
2003-03-28 13:08:50 -08:00
\*=========================================================================*/
2002-07-08 13:14:09 -07:00
/*=========================================================================*\
* BSD include files
\*=========================================================================*/
/* error codes */
#include <errno.h>
/* close function */
#include <unistd.h>
/* fnctnl function and associated constants */
#include <fcntl.h>
/* struct sockaddr */
#include <sys/types.h>
/* socket function */
#include <sys/socket.h>
2004-06-30 20:32:09 -07:00
/* struct timeval */
#include <sys/time.h>
2002-07-08 13:14:09 -07:00
/* gethostbyname and gethostbyaddr functions */
#include <netdb.h>
/* sigpipe handling */
#include <signal.h>
2003-03-20 17:07:23 -08:00
/* IP stuff*/
2002-07-08 13:14:09 -07:00
#include <netinet/in.h>
#include <arpa/inet.h>
/* TCP options (nagle algorithm disable) */
#include <netinet/tcp.h>
#include <net/if.h>
2002-07-08 13:14:09 -07:00
2009-05-27 02:31:38 -07:00
#ifndef SO_REUSEPORT
#define SO_REUSEPORT SO_REUSEADDR
#endif
/* Some platforms use IPV6_JOIN_GROUP instead if
* IPV6_ADD_MEMBERSHIP. The semantics are same, though. */
#ifndef IPV6_ADD_MEMBERSHIP
#ifdef IPV6_JOIN_GROUP
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#endif /* IPV6_JOIN_GROUP */
#endif /* !IPV6_ADD_MEMBERSHIP */
/* Same with IPV6_DROP_MEMBERSHIP / IPV6_LEAVE_GROUP. */
#ifndef IPV6_DROP_MEMBERSHIP
#ifdef IPV6_LEAVE_GROUP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
#endif /* IPV6_LEAVE_GROUP */
#endif /* !IPV6_DROP_MEMBERSHIP */
2005-10-06 21:40:59 -07:00
typedef int t_socket;
typedef t_socket *p_socket;
typedef struct sockaddr_storage t_sockaddr_storage;
2002-07-08 13:14:09 -07:00
2005-10-06 21:40:59 -07:00
#define SOCKET_INVALID (-1)
2002-07-08 13:14:09 -07:00
#endif /* USOCKET_H */