nobu
99ad10df32
option.c: fix macro name
...
* ext/socket/option.c (optname_to_sym): fix macro name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 17:40:58 +00:00
nari
c3a46d6aca
* include/ruby/ruby.h: add C APIs.
...
VALUE rb_newobj_of(VALUE klass, VALUE flags)
#define NEWOBJ_OF(obj,type,klass,flags)
These allow to change a allocation strategy depending on klass
or flags.
* gc.c: ditto
* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
[Feature #7177 ][Feature #7047 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
nobu
240dd36ffb
option.c: mingw64 only
...
* ext/socket/option.c (inet_ntop): something weird only on mingw64.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-29 15:25:29 +00:00
nobu
dc40114781
option.c: use rb_w32_inet_ntop
...
* ext/socket/option.c (inet_ntop): use rb_w32_inet_ntop, instead of
inet_ntop directly, which is unavailable on older version Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-29 14:57:30 +00:00
nobu
f9368f65b1
win32.c: rb_w32_inet_ntop should be const
...
* win32/win32.c (rb_w32_inet_ntop): type should be const.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-29 14:56:52 +00:00
nobu
485181e4f7
ext/socket: suppress warnings on mingw64
...
* ext/socket/ancdata.c (nogvl_sendmsg_func): explicitly cast via VALUE
to suppress a warning on mingw64.
* ext/socket/option.c: declare inet_ntop() for mingw64 which has the
function but lacks arpa/inet.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-28 02:14:23 +00:00
drbrain
1297942451
* ext/socket: Make Socket documentation appear. Add documentation for
...
Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert.
[Ruby 1.9 - Feature #5182 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-15 23:08:39 +00:00
nobu
3a47cf3395
* remove trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
akr
9694fa9517
fix a typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 10:43:53 +00:00
akr
6446be302b
* ext/socket/option.c: define IFNAMSIZ if not available.
...
fix compilation error on mingw32. reported by nobu.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 10:38:44 +00:00
akr
bcd39a0851
update comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 04:26:10 +00:00
akr
326ec51f4e
* ext/socket/option.c (rb_if_indextoname): new function to abstract
...
environments without if_indextoname.
(inspect_ipv6_multicast_if): new function to inspect
IPV6_MULTICAST_IF.
Socket::Option.new(:INET6, :IPV6, :MULTICAST_IF,
[2].pack("I!")).inspect is
"#<Socket::Option: INET6 IPV6 MULTICAST_IF eth0>".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 00:25:14 +00:00
naruse
acc69509cb
This ifdef should be useless after r30374.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 17:37:36 +00:00
usa
7c9fbd226b
* ext/socket/extconf.rb: check the existence of if_indextoname().
...
* ext/socket/option.c: yesterday's akr's commits destroyed the build of
some unrelated platforms (such as Windows).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 16:41:13 +00:00
akr
01da08a29c
* ext/socket/option.c (inspect_ipv4_add_drop_membership): new function
...
to inspect struct ip_mreq and struct ip_mreqn for
IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
Socket::Option.new(:INET, :IP, :ADD_MEMBERSHIP,
[239,255,99,81, 0,0,0,0].pack("CCCCCCCC")).inspect is now
"#<Socket::Option: INET IP ADD_MEMBERSHIP 239.255.99.81 0.0.0.0>".
(inspect_ipv4_multicast_if): new function to inspect struct in_addr
and struct ip_mreqn for IP_MULTICAST_IF.
Socket::Option.new(:INET, :IP, :MULTICAST_IF,
[192,168,0,7].pack("CCCC")).inspect is now
"#<Socket::Option: INET IP MULTICAST_IF 192.168.0.7>".
* ext/socket/extconf.rb: check struct ip_mreq and struct ip_mreqn.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 14:35:28 +00:00
akr
1b40391d3d
* ext/socket/option.c (inspect_ipv6_mreq): new function to inspect
...
struct ipv6_mreq for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
Socket::Option.new(:INET6, :IPV6, :JOIN_GROUP,
[0xff12,0,0,0,0,0,0,1, 2].pack("nnnnnnnnI!")).inspect is now:
"#<Socket::Option: INET6 IPV6 JOIN_GROUP ff12::1 eth0>"
* ext/socket/extconf.rb: check struct ipv6_mreq.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 09:29:24 +00:00
akr
a75a467102
* ext/socket/option.c (inspect_peercred): support OpenBSD-current.
...
patch by Jeremy Evans. [ruby-core:32240]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-09 17:19:52 +00:00
akr
622f45fccb
* ext/socket/option.c (sockopt_inspect): use rb_str_cat2 and
...
rb_str_append.
* ext/socket/ancdata.c (ancillary_inspect): refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 03:39:36 +00:00
nobu
977267c2e0
* ext/**/*.[ch]: removed trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 08:04:13 +00:00
akr
a4fa54a10a
* ext/socket: use rsock_ prefix for internal initialization functions.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 16:15:21 +00:00
akr
652484598d
update doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 09:45:57 +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
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
e6f0b1de89
* ext/socket/option.c (sockopt_level): extracted from sockopt_level_m.
...
(sockopt_optname): extracted from sockopt_optname_m.
(sockopt_data): apply StringValue.
(sockopt_s_linger): new method.
(sockopt_linger): new method.
(inspect_linger): show onoff value if it is neither 0 nor 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 15:26:25 +00:00
akr
0c95958c2d
* ext/socket/option.c (inspect_timeval_as_interval): renamed from
...
inspect_timeval.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 17:27:15 +00:00
akr
cdca4e19d0
* ext/socket/option.c (inspect_timeval): fix the size test.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 17:10:47 +00:00
akr
80d230c394
* ext/socket/option.c (inspect_linger): message refined.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 11:09:55 +00:00
akr
c160c6e59e
* ext/socket/option.c (inspect_errno): new function.
...
(sockopt_inspect): use inspect_errno for SO_ERROR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 09:40:42 +00:00
nobu
da97071549
* ext/socket/option.c: suppress warnings.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 18:14:20 +00:00
akr
9bd0ecd917
add comments for rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 16:29:43 +00:00
akr
f871e8cf0d
update rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 04:29:12 +00:00
akr
98d3eca7fc
* ext/socket/option.c (sockopt_s_bool): new method.
...
(sockopt_bool): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 12:09:57 +00:00
akr
939efe7d4c
* ext/socket/option.c (sockopt_family_m): renamed from sockopt_family.
...
(sockopt_level_m): renamed from sockopt_level.
(sockopt_optname_m): renamed from sockopt_optname.
(inspect_local_peercred): follow the renaming.
(Init_sockopt): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 11:59:04 +00:00
nobu
160c230f94
* ext/socket/option.c (inspect_local_peercred): constfied.
...
* ext/socket/ancdata.c (anc_inspect_socket_creds): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 03:57:23 +00:00
akr
2acc18ad99
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 00:18:53 +00:00
akr
b877fc2f15
* ext/socket/option.c (sockopt_inspect): refactored.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 16:23:36 +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
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
f5da7031b9
* ext/socket/rubysocket.h (level_arg): add family argument.
...
(optname_arg): ditto.
(cmsg_type_arg): ditto.
(rb_sock_getfamily): declared.
* ext/socket/constants.c (level_arg): add family argument.
(optname_arg): ditto.
(cmsg_type_arg): ditto.
* ext/socket/init.c (rb_sock_getfamily): defined.
* ext/socket/option.c (sockopt_initialize): give family for level_arg
and optname_arg.
(sockopt_s_int): ditto.
* ext/socket/basicsocket.c (bsock_setsockopt): ditto.
(bsock_getsockopt): ditto.
* ext/socket/ancdata.c (ancillary_initialize): ditto.
(ancillary_s_int): ditto.
(ancillary_cmsg_is_p): ditto.
(bsock_sendmsg_internal): ditto.
(bsock_recvmsg_internal): use rb_sock_getfamily.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 13:56:43 +00:00
akr
2092fbcc3a
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 12:52:11 +00:00
akr
7ad3567934
* ext/socket/option.c (inspect_int): return 1/0 on success/failure.
...
(inspect_uint): ditto.
(inspect_linger): ditto.
(inspect_socktype): ditto.
(inspect_timeval): ditto.
(inspect_peercred): ditto.
(inspect_local_peercred): ditto.
(sockopt_inspect): refactored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 11:04:51 +00:00
akr
48de4753d1
* ext/socket/option.c (sockopt_initialize): argument conversion
...
reordered.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 10:52:55 +00:00
akr
70f7660196
* ext/socket/option.c (inspect_local_peercred): check version.
...
(sockopt_inspect): suppress warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 00:06:41 +00:00
akr
64f12a46d5
* ext/socket/option.c (inspect_peercred): struct ucred contains
...
effective uid/gid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 17:04:40 +00:00
akr
2992642245
LOCAL_PEERCRED is also available on MacOS X.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 15:49:35 +00:00
akr
d0454a211e
* ext/socket/option.c (sockopt_inspect): add ifdef guard for
...
LOCAL_PEERCRED.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 15:45:15 +00:00
akr
f11d2b55f7
* ext/socket/option.c (inspect_local_peercred): cr_uid is a effective
...
uid, not a real uid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 15:42:17 +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
c02ce88762
* ext/socket/rubysocket.h (sockopt_new): add family argument.
...
* ext/socket/option.c (sockopt_initialize): add vfamily argument.
(sockopt_new): add family argument and record it in the object.
(sockopt_family): new method.
(sockopt_s_int): add vfamily argument.
(sockopt_inspect): show family.
* ext/socket/basicsocket.c (bsock_getsockopt): check address family
using getsockname.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 15:12:27 +00:00
akr
8f9d6d1863
* ext/socket/option.c (inspect_peercred): new function to show
...
SO_PEERCRED socket option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 14:23:16 +00:00