akr
01cd3467fb
* ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants.
...
* ext/socket/mkconstants.rb: define macros for enum.
[ruby-dev:38849]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-11 14:10:34 +00:00
nobu
4822d20cc5
* ext/socket: fixed types.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 08:14:13 +00:00
akr
062780c834
update doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 00:48:51 +00:00
akr
daa739876f
* ext/socket: make sources rdoc friendly.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 10:50:52 +00:00
usa
82041cfdec
* ext/socket/mkconstants.rb: define IPV6_* constants only when INET6
...
is defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 10:32:51 +00:00
nobu
287a34ae0d
* {ext,lib,test}/**/*.rb: removed trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
akr
c49f05dd79
* ext/socket: add rsock_prefix.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-01 06:30:41 +00:00
akr
2276b2f904
* ext/socket/mkconstants.rb: more MSG_* constants.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 16:35:05 +00:00
akr
7e20506eae
reordered.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 12:08:23 +00:00
akr
23e286f3fb
* ext/socket/ancdata.c (inspect_bintime_as_abstime): new function to
...
show struct bintime.
(ancillary_inspect): use it for SCM_BINTIME on FreeBSD.
* ext/socket/mkconstants.rb: define SCM_BINTIME.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 11:32:43 +00:00
akr
97ef9728d5
* ext/socket/mkconstants.rb: define SO_TIMESTAMPNS and SCM_TIMESTAMPNS
...
if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 18:20:11 +00:00
akr
d9bb9b3255
* ext/socket/mkconstants.rb: generate rb_define_const directly for
...
rdoc.
* ext/.document: add socket/constdefs.c.
* ext/socket/constants.c (sock_define_const): removed.
(sock_define_uconst): ditto.
(rb_mSockConst): new static variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-16 16:55:33 +00:00
akr
3a7c7e2d06
add a constant: IFNAMSIZ.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 14:49:40 +00:00
akr
97ba0d4aa7
* ext/socket/mkconstants.rb: generate intern_family_noprefix.
...
* ext/socket/option.c (sockopt_inspect): use intern_family_noprefix
not to show AF_ prefix.
* ext/socket/ancdata.c (ancillary_inspect): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 16:03:08 +00:00
akr
810dd43a20
* ext/socket/constants.c (level_arg): use unknown_level_to_int for
...
non internet protocol.
(optname_arg): use only so_optname_to_int for non internet protocol.
(cmsg_type_arg): use only scm_optname_to_int for non internet
protocol.
* ext/socket/mkconstants.rb: generate unknown_level_to_int.
rename iplevel_to_int to ip_level_to_int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 14:23:53 +00:00
akr
2dd3fa9f3e
* ext/socket/mkconstants.rb: rename level_to_int to iplevel_to_int.
...
rename intern_level to intern_iplevel.
* ext/socket/constants.c: follow the renaming.
* ext/socket/option.c: ditto.
* ext/socket/ancdata.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 14:05:37 +00:00
akr
bee960d4e9
* ext/socket/mkconstants.rb: more constants for Solaris.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 11:00:45 +00:00
akr
9e45748143
* ext/socket/extconf.rb: check sys/param.h and sys/ucred.h.
...
* ext/socket/rubysocket.h: include sys/param.h and sys/ucred.h.
* ext/socket/option.c (inspect_local_peercred): new function to show
LOCAL_PEERCRED socket option on FreeBSD.
(sockopt_inspect): show as LOCAL_* socket option if AF_UNIX and level
is 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 15:37:55 +00:00
akr
aa28707309
more constants.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 10:24:51 +00:00
akr
61fc0c6cf4
* ext/socket/rubysocket.h (cmsg_type_arg): declared.
...
(Init_ancdata): ditto.
* ext/socket/init.c (Init_socket_init): call Init_ancdata.
* ext/socket/constants.c (cmsg_type_arg): defined.
* ext/socket/depend: add dependency for ancdata.o.
* ext/socket/mkconstants.rb: generate scm_optname_to_int.
more constants.
* ext/socket/extconf.rb: add ancdata.o.
* ext/socket/ancdata.c: new file. new method
BasicSocket#{sendmsg,sendmsg_nonblock,recvmsg,recvmsg_nonblock}
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 02:51:02 +00:00
akr
ef9206bbea
* ext/socket/rubysocket.h (rb_cSockOpt): declared.
...
(sockopt_new): ditto.
(Init_sockopt): ditto.
* ext/socket/init.c (Init_socket_init): call Init_sockopt.
* ext/socket/depend: add dependency for option.o
* ext/socket/mkconstants.rb: generate intern_level, intern_so_optname,
intern_ip_optname, intern_ipv6_optname, intern_tcp_optname,
intern_udp_optname and intern_scm_optname.
* ext/socket/extconf.rb: add option.o.
* ext/socket/basicsocket.c (bsock_setsockopt): accept Socket::Option
object.
(bsock_getsockopt): return Socket::Option object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 01:53:02 +00:00
akr
9ffca4659b
* ext/socket/rubysocket.h (pseudo_AF_FTIP): moved from mkconstants.rb.
...
* ext/socket/mkconstants.rb: prepend header if -H is not given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-20 11:06:22 +00:00
akr
6d39bc3189
* ext/socket/mkconstants.rb (SOMAXCONN): defined.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 16:16:05 +00:00
akr
b1956f058f
* ext/socket/mkconstants.rb: use erb for generating code.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 13:32:31 +00:00
usa
80980a98b1
* ext/socket/raddrinfo.c (addrinfo_mdump, addrinfo_mload): support
...
UNIX socket only on platforms which support it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 00:23:48 +00:00
akr
86aa5043d8
* ext/socket/raddrinfo.c (addrinfo_mdump): new method.
...
(addrinfo_mload): new method.
(Init_addrinfo): define the method above.
* ext/socket/constants.c (constant_arg): str_to_int's first argument
constified.
* ext/socket/mkconstants.rb (gen_name_to_int_decl): generated
function's first argument constified.
(gen_name_to_int_func_in_guard): ditto.
(ipproto_to_int): generated.
* ext/socket/rubysocket.h (IS_IP_FAMILY): moved from raddrinfo.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-17 18:14:34 +00:00
akr
28028fc2b9
* ext/socket/mkconstants.rb: generate a header file for generated
...
functions.
* ext/socket/rubysocket.h: include constdefs.h. don't declare
generated functions.
* ext/socket/constants.c: include constdefs.c instead of constants.h.
* ext/socket/depend: dependency updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-17 10:19:03 +00:00
akr
32bbcc6d52
* ext/socket/mkconstants.rb: don't cause an error for duplicate names.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-17 05:53:05 +00:00
akr
97cbab78dc
* ext/socket: split files for each class.
...
* ext/socket/rubysocket.h: common header.
* ext/socket/basicsocket.c: new file for BasicSocket.
* ext/socket/ipsocket.c: new file for IPSocket.
* ext/socket/tcpsocket.c: new file for TCPSocket.
* ext/socket/tcpserver.c: new file for TCPServer.
* ext/socket/sockssocket.c: new file for SOCKSSocket.
* ext/socket/udpsocket.c: new file for UDPSocket.
* ext/socket/unixsocket.c: new file for UNIXSocket.
* ext/socket/unixserver.c: new file for UNIXServer.
* ext/socket/socket.c: now for Socket.
* ext/socket/raddrinfo.c: new file for AddrInfo and name resolution.
* ext/socket/constants.c: new file for constants.
* ext/socket/init.c: new file for utilities.
* ext/socket/mkconstants.rb: export *_to_int.
* ext/socket/extconf.rb: add new object files.
* ext/socket/depend: add dependencies for new files.
* ext/.document: add new files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-17 04:11:27 +00:00
akr
5c94a67eca
* ext/socket/mkconstants.rb: don't use bytesize because 1.9 dependent.
...
[ruby-core:21266]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-12 03:34:48 +00:00
nobu
f914b5a7c2
* ext/socket/mkconstants.rb (c_str): get rid of a 1.9 feature for
...
cross compile. [ruby-core:21243]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-11 00:53:03 +00:00
akr
b802f1bb02
add constants.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-10 18:06:39 +00:00
akr
7f52fa08b1
* ext/socket/mkconstants.rb: don't generate unintended newlines.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-10 12:18:26 +00:00
akr
8a1261995e
* ext/socket/mkconstants.rb: refactored to nest properly in statically
...
and dynamically.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-10 11:52:06 +00:00
usa
f73dca932c
* ext/socket/mkconstants.rb: define macro if default_value is passed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-09 06:41:07 +00:00
akr
80618e75aa
* ext/socket/socket.c (bsock_shutdown): accept symbol/string as how.
...
(shutdown_how_arg): new function.
* ext/socket/mkconstants.rb: generate shutdown_how_to_int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-08 14:20:47 +00:00
akr
2f31ea3c86
* ext/socket/mkconstants.rb (gen_name_to_int_func): generate
...
name_to_int functions, not only body.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-08 14:00:34 +00:00
akr
55b2bf4dec
* ext/socket/socket.c (rb_cAddrInfo): new class AddrInfo.
...
(s_recvfrom): return AddrInfo as address.
(s_recvfrom_nonblock): ditto.
(sock_accept): ditto.
(sock_accept_nonblock): ditto.
(sock_sysaccept): ditto.
(bsock_send): accept AddrInfo as address argument.
(sock_connect): ditto.
(sock_connect_nonblock): ditto.
(sock_bind): ditto.
(sock_s_unpack_sockaddr_in): ditto.
(sock_s_unpack_sockaddr_un): ditto.
(bsock_local_address): new method BasicSocket#local_address.
(bsock_remote_address): new method BasicSocket#remote_address.
(addrinfo_initialize): new method AddrInfo#initialize.
(addrinfo_inspect): new method AddrInfo#inspect.
(addrinfo_afamily): new method AddrInfo#afamily.
(addrinfo_pfamily): new method AddrInfo#pfamily.
(addrinfo_socktype): new method AddrInfo#socktype.
(addrinfo_protocol): new method AddrInfo#protocol.
(addrinfo_to_sockaddr): new method AddrInfo#to_sockaddr.
(addrinfo_canonname): new method AddrInfo#canonname.
(addrinfo_ip_p): new method AddrInfo#ip?.
(addrinfo_ipv4_p): new method AddrInfo#ipv4?.
(addrinfo_ipv6_p): new method AddrInfo#ipv6?.
(addrinfo_unix_p): new method AddrInfo#unix?.
(addrinfo_getnameinfo): new method AddrInfo#getnameinfo.
(addrinfo_s_getaddrinfo): new method AddrInfo.getaddrinfo.
(addrinfo_s_tcp): new method AddrInfo.tcp.
(addrinfo_s_udp): new method AddrInfo.udp.
(addrinfo_s_unix): new method AddrInfo.unix.
(Init_socket): define new class and methods.
(sock_getaddrinfo): apply socktype hack regardless of ai_flags.
(addrinfo_new): defined.
(get_afamily): ditto.
(fd_socket_addrinfo): ditto.
(io_socket_addrinfo): ditto.
(SockAddrStringValue): ditto.
(SockAddrStringValuePtr): ditto.
(sockaddr_string_value): ditto.
(sockaddr_string_value_ptr): ditto.
(rb_addrinfo_t): ditto.
(addrinfo_mark): ditto.
(addrinfo_free): ditto.
(addrinfo_s_allocate): ditto.
(IS_ADDRINFO): ditto.
(check_addrinfo): ditto.
(get_addrinfo): ditto.
(alloc_addrinfo): ditto.
(init_addrinfo): ditto.
(addrinfo_new): ditto.
(call_getaddrinfo): ditto.
(init_addrinfo_getaddrinfo): ditto.
(make_inspectname): ditto.
(addrinfo_firstonly_new): ditto.
(addrinfo_list_new): ditto.
(init_unix_addrinfo): ditto.
(ai_get_afamily): ditto.
* ext/socket/mkconstants.rb: generate intern_protocol_family,
intern_socktype and intern_ipproto.
[ruby-dev:37692]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-07 14:20:15 +00:00
nobu
9ac6838183
* ext/socket/socket.c (constant_arg): constified.
...
* ext/socket/socket.c (optname_arg): cygwin does not have
IPPROTO_IPV6.
* ext/socket/mkconstants.rb (ipv6_optname_to_int): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 00:27:43 +00:00
akr
e4b7c0e8a3
* ext/socket/mkconstants.rb: rename family_to_str to intern_family.
...
it returns ID now.
* ext/socket/socket.c (ipaddr): use intern_family.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 08:46:26 +00:00
akr
b5aebd12c0
* ext/socket/mkconstants.rb: use ID in the values of
...
family_to_str_hash. family_to_str returns a VALUE.
* ext/socket/socket.c (ipaddr): follow family_to_str change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 08:22:36 +00:00
akr
9ce8d4e3b9
* ext/socket/mkconstants.rb: refactored to gather stringizer
...
description.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 08:02:36 +00:00
akr
775d5d8f03
* ext/socket/mkconstants.rb: make common prefix optional.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 06:33:24 +00:00
akr
d68b60741c
* ext/socket/mkconstants.rb: use hash for family_to_str to avoid
...
linear search. lenp argument removed.
* ext/socket/socket.c (ipaddr): call family_to_str without lenp
argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 06:01:57 +00:00
akr
270f2034a7
* ext/socket/mkconstants.rb (gen_int_to_name): don't compare constants
...
in preprocessor because the constants may be enum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 05:33:56 +00:00
akr
90a65796e7
* ext/socket/mkconstants.rb (gen_int_to_name): add lenp argument.
...
* ext/socket/socket.c (ipaddr): follow argument change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 05:12:14 +00:00
akr
28c2711230
* ext/socket/mkconstants.rb: check duplicates.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-01 19:43:49 +00:00
akr
aa0ae0d3b6
* ext/socket/socket.c (optname_arg): defined.
...
(bsock_setsockopt): use optname_arg.
(bsock_getsockopt): ditto.
* ext/socket/mkconstants.rb: generate so_optname_to_int,
ip_optname_to_int, ipv6_optname_to_int, tcp_optname_to_int and
udp_optname_to_int.
more constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-01 17:40:41 +00:00
akr
59556a0849
* ext/socket/socket.c (level_arg): defined.
...
(bsock_setsockopt): use level_arg.
(bsock_getsockopt): ditto.
* ext/socket/mkconstants.rb: generate level_to_int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-01 16:16:08 +00:00
akr
85d13f6165
* ext/socket/mkconstants.rb: check all alias possibility.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-01 12:09:34 +00:00