summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
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/socket/mkconstants.rb
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/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb261
1 files changed, 261 insertions, 0 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
new file mode 100644
index 0000000..20029c3
--- /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_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PPORT_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
+