summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-28 06:29:52 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-28 06:29:52 +0000
commit845cfb281bbd5e6a9b597cc9a0b291c02ad9a8ce (patch)
tree519c4739f01dbaf27df3c495b31340f39270daba /ext
parentff5186ea4e97ad142e982c90ebe716188fb9b9b7 (diff)
* ext/socket/socket.c (Init_socket): ported more Socket::Constants
from ruby_1_8, and made it easy to add new constants. [ruby-dev:25771] * ext/socket/depend: ditto. * ext/socket/mkconstants.rb: ditto. (added) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/depend8
-rw-r--r--ext/socket/mkconstants.rb261
-rw-r--r--ext/socket/socket.c442
3 files changed, 269 insertions, 442 deletions
diff --git a/ext/socket/depend b/ext/socket/depend
index cca6d4e62a..eab099b0c0 100644
--- a/ext/socket/depend
+++ b/ext/socket/depend
@@ -1,3 +1,9 @@
-socket.o : socket.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h sockport.h
+DISTCLEANFILES = $(srcdir)/constants.h
+
+socket.o: socket.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h sockport.h constants.h
getnameinfo.o: getnameinfo.c $(topdir)/config.h addrinfo.h sockport.h
getaddrinfo.o: getaddrinfo.c $(topdir)/config.h addrinfo.h sockport.h
+
+constants.h: $(srcdir)/mkconstants.rb
+ @echo "generating constants.h"
+ @$(RUBY) $(srcdir)/mkconstants.rb > $@
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
new file mode 100644
index 0000000000..20029c31a4
--- /dev/null
+++ b/ext/socket/mkconstants.rb
@@ -0,0 +1,261 @@
+$out ||= $stdout
+
+# skip empty lines and comment lines
+DATA.each_line do |s|
+ name, value = s.scan(/\S+/)
+ if name && name[0] != ?#
+ $out.puts("#ifdef #{name}")
+ $out.puts(" sock_define_const(\"#{name}\", #{name});")
+ if value
+ $out.puts("#else")
+ $out.puts(" sock_define_const(\"#{name}\", #{value});")
+ end
+ $out.puts("#endif")
+ $out.puts
+ end
+end
+
+__END__
+
+SOCK_STREAM
+SOCK_DGRAM
+SOCK_RAW
+SOCK_RDM
+SOCK_SEQPACKET
+SOCK_PACKET
+
+AF_INET
+PF_INET
+AF_UNIX
+PF_UNIX
+AF_AX25
+PF_AX25
+AF_IPX
+PF_IPX
+AF_APPLETALK
+PF_APPLETALK
+AF_UNSPEC
+PF_UNSPEC
+AF_INET6
+PF_INET6
+AF_LOCAL
+PF_LOCAL
+AF_IMPLINK
+PF_IMPLINK
+AF_PUP
+PF_PUP
+AF_CHAOS
+PF_CHAOS
+AF_NS
+PF_NS
+AF_ISO
+PF_ISO
+AF_OSI
+PF_OSI
+AF_ECMA
+PF_ECMA
+AF_DATAKIT
+PF_DATAKIT
+AF_CCITT
+PF_CCITT
+AF_SNA
+PF_SNA
+AF_DEC
+PF_DEC
+AF_DLI
+PF_DLI
+AF_LAT
+PF_LAT
+AF_HYLINK
+PF_HYLINK
+AF_ROUTE
+PF_ROUTE
+AF_LINK
+PF_LINK
+AF_COIP
+PF_COIP
+AF_CNT
+PF_CNT
+AF_SIP
+PF_SIP
+AF_NDRV
+PF_NDRV
+AF_ISDN
+PF_ISDN
+AF_NATM
+PF_NATM
+AF_SYSTEM
+PF_SYSTEM
+AF_NETBIOS
+PF_NETBIOS
+AF_PPP
+PF_PPP
+AF_ATM
+PF_ATM
+AF_NETGRAPH
+PF_NETGRAPH
+AF_MAX
+PF_MAX
+
+AF_E164
+PF_XTP
+PF_RTIP
+PF_PIP
+PF_KEY
+
+MSG_OOB
+MSG_PEEK
+MSG_DONTROUTE
+MSG_EOR
+MSG_TRUNC
+MSG_CTRUNC
+MSG_WAITALL
+MSG_DONTWAIT
+MSG_EOF
+MSG_FLUSH
+MSG_HOLD
+MSG_SEND
+MSG_HAVEMORE
+MSG_RCVMORE
+MSG_COMPAT
+
+SOL_SOCKET
+SOL_IP
+SOL_IPX
+SOL_AX25
+SOL_ATALK
+SOL_TCP
+SOL_UDP
+
+IPPROTO_IP 0
+IPPROTO_ICMP 1
+IPPROTO_IGMP
+IPPROTO_GGP
+IPPROTO_TCP 6
+IPPROTO_EGP
+IPPROTO_PUP
+IPPROTO_UDP 17
+IPPROTO_IDP
+IPPROTO_HELLO
+IPPROTO_ND
+IPPROTO_TP
+IPPROTO_XTP
+IPPROTO_EON
+IPPROTO_BIP
+
+IPPROTO_RAW 255
+IPPROTO_MAX
+
+# Some port configuration
+IPPORT_RESERVED 1024
+IPPORT_USERRESERVED 5000
+
+# Some reserved IP v.4 addresses
+INADDR_ANY 0x00000000
+INADDR_BROADCAST 0xffffffff
+INADDR_LOOPBACK 0x7F000001
+INADDR_UNSPEC_GROUP 0xe0000000
+INADDR_ALLHOSTS_GROUP 0xe0000001
+INADDR_MAX_LOCAL_GROUP 0xe00000ff
+INADDR_NONE 0xffffffff
+
+# IP [gs]etsockopt options
+IP_OPTIONS
+IP_HDRINCL
+IP_TOS
+IP_TTL
+IP_RECVOPTS
+IP_RECVRETOPTS
+IP_RECVDSTADDR
+IP_RETOPTS
+IP_MULTICAST_IF
+IP_MULTICAST_TTL
+IP_MULTICAST_LOOP
+IP_ADD_MEMBERSHIP
+IP_DROP_MEMBERSHIP
+IP_DEFAULT_MULTICAST_TTL
+IP_DEFAULT_MULTICAST_LOOP
+IP_MAX_MEMBERSHIPS
+SO_DEBUG
+SO_REUSEADDR
+SO_REUSEPORT
+SO_TYPE
+SO_ERROR
+SO_DONTROUTE
+SO_BROADCAST
+SO_SNDBUF
+SO_RCVBUF
+SO_KEEPALIVE
+SO_OOBINLINE
+SO_NO_CHECK
+SO_PRIORITY
+SO_LINGER
+SO_PASSCRED
+SO_PEERCRED
+SO_RCVLOWAT
+SO_SNDLOWAT
+SO_RCVTIMEO
+SO_SNDTIMEO
+SO_ACCEPTCONN
+SO_USELOOPBACK
+SO_ACCEPTFILTER
+SO_DONTTRUNC
+SO_WANTMORE
+SO_WANTOOBFLAG
+SO_NREAD
+SO_NKE
+SO_NOSIGPIPE
+
+SO_SECURITY_AUTHENTICATION
+SO_SECURITY_ENCRYPTION_TRANSPORT
+SO_SECURITY_ENCRYPTION_NETWORK
+
+SO_BINDTODEVICE
+SO_ATTACH_FILTER
+SO_DETACH_FILTER
+SO_PEERNAME
+SO_TIMESTAMP
+
+SOPRI_INTERACTIVE
+SOPRI_NORMAL
+SOPRI_BACKGROUND
+
+IPX_TYPE
+
+TCP_NODELAY
+TCP_MAXSEG
+
+EAI_ADDRFAMILY
+EAI_AGAIN
+EAI_BADFLAGS
+EAI_FAIL
+EAI_FAMILY
+EAI_MEMORY
+EAI_NODATA
+EAI_NONAME
+EAI_SERVICE
+EAI_SOCKTYPE
+EAI_SYSTEM
+EAI_BADHINTS
+EAI_PROTOCOL
+EAI_MAX
+AI_PASSIVE
+AI_CANONNAME
+AI_NUMERICHOST
+AI_MASK
+AI_ALL
+AI_V4MAPPED_CFG
+AI_ADDRCONFIG
+AI_V4MAPPED
+AI_DEFAULT
+NI_MAXHOST
+NI_MAXSERV
+NI_NOFQDN
+NI_NUMERICHOST
+NI_NAMEREQD
+NI_NUMERICSERV
+NI_DGRAM
+SHUT_RD 0
+SHUT_WR 1
+SHUT_RDWR 2
+
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 53d4506b79..16442b444b 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2643,445 +2643,5 @@ Init_socket()
/* constants */
mConst = rb_define_module_under(rb_cSocket, "Constants");
- sock_define_const("SOCK_STREAM", SOCK_STREAM);
- sock_define_const("SOCK_DGRAM", SOCK_DGRAM);
-#ifdef SOCK_RAW
- sock_define_const("SOCK_RAW", SOCK_RAW);
-#endif
-#ifdef SOCK_RDM
- sock_define_const("SOCK_RDM", SOCK_RDM);
-#endif
-#ifdef SOCK_SEQPACKET
- sock_define_const("SOCK_SEQPACKET", SOCK_SEQPACKET);
-#endif
-#ifdef SOCK_PACKET
- sock_define_const("SOCK_PACKET", SOCK_PACKET);
-#endif
-
- sock_define_const("AF_INET", AF_INET);
-#ifdef PF_INET
- sock_define_const("PF_INET", PF_INET);
-#endif
-#ifdef AF_UNIX
- sock_define_const("AF_UNIX", AF_UNIX);
- sock_define_const("PF_UNIX", PF_UNIX);
-#endif
-#ifdef AF_AX25
- sock_define_const("AF_AX25", AF_AX25);
- sock_define_const("PF_AX25", PF_AX25);
-#endif
-#ifdef AF_IPX
- sock_define_const("AF_IPX", AF_IPX);
- sock_define_const("PF_IPX", PF_IPX);
-#endif
-#ifdef AF_APPLETALK
- sock_define_const("AF_APPLETALK", AF_APPLETALK);
- sock_define_const("PF_APPLETALK", PF_APPLETALK);
-#endif
-#ifdef AF_UNSPEC
- sock_define_const("AF_UNSPEC", AF_UNSPEC);
- sock_define_const("PF_UNSPEC", PF_UNSPEC);
-#endif
-#ifdef INET6
- sock_define_const("AF_INET6", AF_INET6);
-#endif
-#ifdef INET6
- sock_define_const("PF_INET6", PF_INET6);
-#endif
-
- sock_define_const("MSG_OOB", MSG_OOB);
-#ifdef MSG_PEEK
- sock_define_const("MSG_PEEK", MSG_PEEK);
-#endif
-#ifdef MSG_DONTROUTE
- sock_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
-#endif
-
- sock_define_const("SOL_SOCKET", SOL_SOCKET);
-#ifdef SOL_IP
- sock_define_const("SOL_IP", SOL_IP);
-#endif
-#ifdef SOL_IPX
- sock_define_const("SOL_IPX", SOL_IPX);
-#endif
-#ifdef SOL_AX25
- sock_define_const("SOL_AX25", SOL_AX25);
-#endif
-#ifdef SOL_ATALK
- sock_define_const("SOL_ATALK", SOL_ATALK);
-#endif
-#ifdef SOL_TCP
- sock_define_const("SOL_TCP", SOL_TCP);
-#endif
-#ifdef SOL_UDP
- sock_define_const("SOL_UDP", SOL_UDP);
-#endif
-
-#ifdef IPPROTO_IP
- sock_define_const("IPPROTO_IP", IPPROTO_IP);
-#else
- sock_define_const("IPPROTO_IP", 0);
-#endif
-#ifdef IPPROTO_ICMP
- sock_define_const("IPPROTO_ICMP", IPPROTO_ICMP);
-#else
- sock_define_const("IPPROTO_ICMP", 1);
-#endif
-#ifdef IPPROTO_IGMP
- sock_define_const("IPPROTO_IGMP", IPPROTO_IGMP);
-#endif
-#ifdef IPPROTO_GGP
- sock_define_const("IPPROTO_GGP", IPPROTO_GGP);
-#endif
-#ifdef IPPROTO_TCP
- sock_define_const("IPPROTO_TCP", IPPROTO_TCP);
-#else
- sock_define_const("IPPROTO_TCP", 6);
-#endif
-#ifdef IPPROTO_EGP
- sock_define_const("IPPROTO_EGP", IPPROTO_EGP);
-#endif
-#ifdef IPPROTO_PUP
- sock_define_const("IPPROTO_PUP", IPPROTO_PUP);
-#endif
-#ifdef IPPROTO_UDP
- sock_define_const("IPPROTO_UDP", IPPROTO_UDP);
-#else
- sock_define_const("IPPROTO_UDP", 17);
-#endif
-#ifdef IPPROTO_IDP
- sock_define_const("IPPROTO_IDP", IPPROTO_IDP);
-#endif
-#ifdef IPPROTO_HELLO
- sock_define_const("IPPROTO_HELLO", IPPROTO_HELLO);
-#endif
-#ifdef IPPROTO_ND
- sock_define_const("IPPROTO_ND", IPPROTO_ND);
-#endif
-#ifdef IPPROTO_TP
- sock_define_const("IPPROTO_TP", IPPROTO_TP);
-#endif
-#ifdef IPPROTO_XTP
- sock_define_const("IPPROTO_XTP", IPPROTO_XTP);
-#endif
-#ifdef IPPROTO_EON
- sock_define_const("IPPROTO_EON", IPPROTO_EON);
-#endif
-#ifdef IPPROTO_BIP
- sock_define_const("IPPROTO_BIP", IPPROTO_BIP);
-#endif
-/**/
-#ifdef IPPROTO_RAW
- sock_define_const("IPPROTO_RAW", IPPROTO_RAW);
-#else
- sock_define_const("IPPROTO_RAW", 255);
-#endif
-#ifdef IPPROTO_MAX
- sock_define_const("IPPROTO_MAX", IPPROTO_MAX);
-#endif
-
- /* Some port configuration */
-#ifdef IPPORT_RESERVED
- sock_define_const("IPPORT_RESERVED", IPPORT_RESERVED);
-#else
- sock_define_const("IPPORT_RESERVED", 1024);
-#endif
-#ifdef IPPORT_USERRESERVED
- sock_define_const("IPPORT_USERRESERVED", IPPORT_USERRESERVED);
-#else
- sock_define_const("IPPORT_USERRESERVED", 5000);
-#endif
- /* Some reserved IP v.4 addresses */
-#ifdef INADDR_ANY
- sock_define_const("INADDR_ANY", INADDR_ANY);
-#else
- sock_define_const("INADDR_ANY", 0x00000000);
-#endif
-#ifdef INADDR_BROADCAST
- sock_define_const("INADDR_BROADCAST", INADDR_BROADCAST);
-#else
- sock_define_const("INADDR_BROADCAST", 0xffffffff);
-#endif
-#ifdef INADDR_LOOPBACK
- sock_define_const("INADDR_LOOPBACK", INADDR_LOOPBACK);
-#else
- sock_define_const("INADDR_LOOPBACK", 0x7F000001);
-#endif
-#ifdef INADDR_UNSPEC_GROUP
- sock_define_const("INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP);
-#else
- sock_define_const("INADDR_UNSPEC_GROUP", 0xe0000000);
-#endif
-#ifdef INADDR_ALLHOSTS_GROUP
- sock_define_const("INADDR_ALLHOSTS_GROUP", INADDR_ALLHOSTS_GROUP);
-#else
- sock_define_const("INADDR_ALLHOSTS_GROUP", 0xe0000001);
-#endif
-#ifdef INADDR_MAX_LOCAL_GROUP
- sock_define_const("INADDR_MAX_LOCAL_GROUP", INADDR_MAX_LOCAL_GROUP);
-#else
- sock_define_const("INADDR_MAX_LOCAL_GROUP", 0xe00000ff);
-#endif
-#ifdef INADDR_NONE
- sock_define_const("INADDR_NONE", INADDR_NONE);
-#else
- sock_define_const("INADDR_NONE", 0xffffffff);
-#endif
- /* IP [gs]etsockopt options */
-#ifdef IP_OPTIONS
- sock_define_const("IP_OPTIONS", IP_OPTIONS);
-#endif
-#ifdef IP_HDRINCL
- sock_define_const("IP_HDRINCL", IP_HDRINCL);
-#endif
-#ifdef IP_TOS
- sock_define_const("IP_TOS", IP_TOS);
-#endif
-#ifdef IP_TTL
- sock_define_const("IP_TTL", IP_TTL);
-#endif
-#ifdef IP_RECVOPTS
- sock_define_const("IP_RECVOPTS", IP_RECVOPTS);
-#endif
-#ifdef IP_RECVRETOPTS
- sock_define_const("IP_RECVRETOPTS", IP_RECVRETOPTS);
-#endif
-#ifdef IP_RECVDSTADDR
- sock_define_const("IP_RECVDSTADDR", IP_RECVDSTADDR);
-#endif
-#ifdef IP_RETOPTS
- sock_define_const("IP_RETOPTS", IP_RETOPTS);
-#endif
-#ifdef IP_MULTICAST_IF
- sock_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
-#endif
-#ifdef IP_MULTICAST_TTL
- sock_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
-#endif
-#ifdef IP_MULTICAST_LOOP
- sock_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
-#endif
-#ifdef IP_ADD_MEMBERSHIP
- sock_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
-#endif
-#ifdef IP_DROP_MEMBERSHIP
- sock_define_const("IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP);
-#endif
-#ifdef IP_DEFAULT_MULTICAST_TTL
- sock_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
-#endif
-#ifdef IP_DEFAULT_MULTICAST_LOOP
- sock_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
-#endif
-#ifdef IP_MAX_MEMBERSHIPS
- sock_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
-#endif
-#ifdef SO_DEBUG
- sock_define_const("SO_DEBUG", SO_DEBUG);
-#endif
- sock_define_const("SO_REUSEADDR", SO_REUSEADDR);
-#ifdef SO_TYPE
- sock_define_const("SO_TYPE", SO_TYPE);
-#endif
-#ifdef SO_ERROR
- sock_define_const("SO_ERROR", SO_ERROR);
-#endif
-#ifdef SO_DONTROUTE
- sock_define_const("SO_DONTROUTE", SO_DONTROUTE);
-#endif
-#ifdef SO_BROADCAST
- sock_define_const("SO_BROADCAST", SO_BROADCAST);
-#endif
-#ifdef SO_SNDBUF
- sock_define_const("SO_SNDBUF", SO_SNDBUF);
-#endif
-#ifdef SO_RCVBUF
- sock_define_const("SO_RCVBUF", SO_RCVBUF);
-#endif
-#ifdef SO_KEEPALIVE
- sock_define_const("SO_KEEPALIVE", SO_KEEPALIVE);
-#endif
-#ifdef SO_OOBINLINE
- sock_define_const("SO_OOBINLINE", SO_OOBINLINE);
-#endif
-#ifdef SO_NO_CHECK
- sock_define_const("SO_NO_CHECK", SO_NO_CHECK);
-#endif
-#ifdef SO_PRIORITY
- sock_define_const("SO_PRIORITY", SO_PRIORITY);
-#endif
-#ifdef SO_LINGER
- sock_define_const("SO_LINGER", SO_LINGER);
-#endif
-#ifdef SO_PASSCRED
- sock_define_const("SO_PASSCRED", SO_PASSCRED);
-#endif
-#ifdef SO_PEERCRED
- sock_define_const("SO_PEERCRED", SO_PEERCRED);
-#endif
-#ifdef SO_RCVLOWAT
- sock_define_const("SO_RCVLOWAT", SO_RCVLOWAT);
-#endif
-#ifdef SO_SNDLOWAT
- sock_define_const("SO_SNDLOWAT", SO_SNDLOWAT);
-#endif
-#ifdef SO_RCVTIMEO
- sock_define_const("SO_RCVTIMEO", SO_RCVTIMEO);
-#endif
-#ifdef SO_SNDTIMEO
- sock_define_const("SO_SNDTIMEO", SO_SNDTIMEO);
-#endif
-
-#ifdef SO_SECURITY_AUTHENTICATION
- sock_define_const("SO_SECURITY_AUTHENTICATION", SO_SECURITY_AUTHENTICATION);
-#endif
-#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
- sock_define_const("SO_SECURITY_ENCRYPTION_TRANSPORT", SO_SECURITY_ENCRYPTION_TRANSPORT);
-#endif
-#ifdef SO_SECURITY_ENCRYPTION_NETWORK
- sock_define_const("SO_SECURITY_ENCRYPTION_NETWORK", SO_SECURITY_ENCRYPTION_NETWORK);
-#endif
-
-#ifdef SO_BINDTODEVICE
- sock_define_const("SO_BINDTODEVICE", SO_BINDTODEVICE);
-#endif
-#ifdef SO_ATTACH_FILTER
- sock_define_const("SO_ATTACH_FILTER", SO_ATTACH_FILTER);
-#endif
-#ifdef SO_DETACH_FILTER
- sock_define_const("SO_DETACH_FILTER", SO_DETACH_FILTER);
-#endif
-#ifdef SO_PEERNAME
- sock_define_const("SO_PEERNAME", SO_PEERNAME);
-#endif
-#ifdef SO_TIMESTAMP
- sock_define_const("SO_TIMESTAMP", SO_TIMESTAMP);
-#endif
-
-#ifdef SOPRI_INTERACTIVE
- sock_define_const("SOPRI_INTERACTIVE", SOPRI_INTERACTIVE);
-#endif
-#ifdef SOPRI_NORMAL
- sock_define_const("SOPRI_NORMAL", SOPRI_NORMAL);
-#endif
-#ifdef SOPRI_BACKGROUND
- sock_define_const("SOPRI_BACKGROUND", SOPRI_BACKGROUND);
-#endif
-
-#ifdef IPX_TYPE
- sock_define_const("IPX_TYPE", IPX_TYPE);
-#endif
-
-#ifdef TCP_NODELAY
- sock_define_const("TCP_NODELAY", TCP_NODELAY);
-#endif
-#ifdef TCP_MAXSEG
- sock_define_const("TCP_MAXSEG", TCP_MAXSEG);
-#endif
-
-#ifdef EAI_ADDRFAMILY
- sock_define_const("EAI_ADDRFAMILY", EAI_ADDRFAMILY);
-#endif
-#ifdef EAI_AGAIN
- sock_define_const("EAI_AGAIN", EAI_AGAIN);
-#endif
-#ifdef EAI_BADFLAGS
- sock_define_const("EAI_BADFLAGS", EAI_BADFLAGS);
-#endif
-#ifdef EAI_FAIL
- sock_define_const("EAI_FAIL", EAI_FAIL);
-#endif
-#ifdef EAI_FAMILY
- sock_define_const("EAI_FAMILY", EAI_FAMILY);
-#endif
-#ifdef EAI_MEMORY
- sock_define_const("EAI_MEMORY", EAI_MEMORY);
-#endif
-#ifdef EAI_NODATA
- sock_define_const("EAI_NODATA", EAI_NODATA);
-#endif
-#ifdef EAI_NONAME
- sock_define_const("EAI_NONAME", EAI_NONAME);
-#endif
-#ifdef EAI_SERVICE
- sock_define_const("EAI_SERVICE", EAI_SERVICE);
-#endif
-#ifdef EAI_SOCKTYPE
- sock_define_const("EAI_SOCKTYPE", EAI_SOCKTYPE);
-#endif
-#ifdef EAI_SYSTEM
- sock_define_const("EAI_SYSTEM", EAI_SYSTEM);
-#endif
-#ifdef EAI_BADHINTS
- sock_define_const("EAI_BADHINTS", EAI_BADHINTS);
-#endif
-#ifdef EAI_PROTOCOL
- sock_define_const("EAI_PROTOCOL", EAI_PROTOCOL);
-#endif
-#ifdef EAI_MAX
- sock_define_const("EAI_MAX", EAI_MAX);
-#endif
-#ifdef AI_PASSIVE
- sock_define_const("AI_PASSIVE", AI_PASSIVE);
-#endif
-#ifdef AI_CANONNAME
- sock_define_const("AI_CANONNAME", AI_CANONNAME);
-#endif
-#ifdef AI_NUMERICHOST
- sock_define_const("AI_NUMERICHOST", AI_NUMERICHOST);
-#endif
-#ifdef AI_MASK
- sock_define_const("AI_MASK", AI_MASK);
-#endif
-#ifdef AI_ALL
- sock_define_const("AI_ALL", AI_ALL);
-#endif
-#ifdef AI_V4MAPPED_CFG
- sock_define_const("AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
-#endif
-#ifdef AI_ADDRCONFIG
- sock_define_const("AI_ADDRCONFIG", AI_ADDRCONFIG);
-#endif
-#ifdef AI_V4MAPPED
- sock_define_const("AI_V4MAPPED", AI_V4MAPPED);
-#endif
-#ifdef AI_DEFAULT
- sock_define_const("AI_DEFAULT", AI_DEFAULT);
-#endif
-#ifdef NI_MAXHOST
- sock_define_const("NI_MAXHOST", NI_MAXHOST);
-#endif
-#ifdef NI_MAXSERV
- sock_define_const("NI_MAXSERV", NI_MAXSERV);
-#endif
-#ifdef NI_NOFQDN
- sock_define_const("NI_NOFQDN", NI_NOFQDN);
-#endif
-#ifdef NI_NUMERICHOST
- sock_define_const("NI_NUMERICHOST", NI_NUMERICHOST);
-#endif
-#ifdef NI_NAMEREQD
- sock_define_const("NI_NAMEREQD", NI_NAMEREQD);
-#endif
-#ifdef NI_NUMERICSERV
- sock_define_const("NI_NUMERICSERV", NI_NUMERICSERV);
-#endif
-#ifdef NI_DGRAM
- sock_define_const("NI_DGRAM", NI_DGRAM);
-#endif
-#ifdef SHUT_RD
- sock_define_const("SHUT_RD", SHUT_RD);
-#else
- sock_define_const("SHUT_RD", 0);
-#endif
-#ifdef SHUT_WR
- sock_define_const("SHUT_WR", SHUT_WR);
-#else
- sock_define_const("SHUT_WR", 1);
-#endif
-#ifdef SHUT_RDWR
- sock_define_const("SHUT_RDWR", SHUT_RDWR);
-#else
- sock_define_const("SHUT_RDWR", 2);
-#endif
+ #include "constants.h"
}