Граф коммитов

72 Коммитов

Автор SHA1 Сообщение Дата
akr 5b629a7b8a * ext/socket/option.c: Fix complation error on Android.
Bionic doesn't define TCP state constants.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-21 03:22:18 +00:00
akr b9a178e56c * ext/socket/option.c (inspect_tcp_info): Permit longer data. (glibc
2.7 adds tcpi_rcv_rtt, tcpi_rcv_space and tcpi_total_retrans to
  struct tcp_info.)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-19 14:28:26 +00:00
akr 3aacf88500 * ext/socket/option.c (inspect_tcp_info): New function to inspect struct tcp_info.
(sockopt_inspect): Use inspect_tcp_info.

* ext/socket/extconf.rb: Check tcp_info related things.

* ext/socket/rubysocket.h: Include netinet/tcp_fsm.h if available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-19 11:52:03 +00:00
akr 3ffc7535ba Several more OS information for TYPE_IP_MULTICAST_LOOP and
TYPE_IP_MULTICAST_TTL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21 13:39:08 +00:00
nobu 6cfa67afe7 ext/socket/option.c: fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 22:52:17 +00:00
akr 8b5694d5e8 * ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
IP_MULTICAST_TTL on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 19:35:11 +00:00
akr 779a630aee * ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
IP_MULTICAST_TTL on Mac OS X.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 19:32:03 +00:00
akr 3682c6a327 * ext/socket/option.c: Use "byte" as default argument for
IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket option to follow
  the original multicast implementation.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 15:43:47 +00:00
akr 3b8bcf42a7 * ext/socket/option.c: Use preprocessor macros to avoid repeated
conditionals.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 13:48:42 +00:00
nobu 5ecbe189af socket/option.c: helper functions
* ext/socket/option.c (sockopt_pack_byte, sockopt_pack_int):
  extract helper functions to pack integers in a String.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 14:56:05 +00:00
nobu 5c179cd66c socket/option.c: revert r44647
* ext/socket/option.c (NUM2SOCKOPT, sockopt_value): revert because
  these names are confusing.  [ruby-dev:47903]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 13:04:53 +00:00
nobu 6282b3b5c3 socket/option.c: socket option variations
* ext/socket/option.c (NUM2SOCKOPT, sockopt_value): extract to wrap
  socket option variations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 01:11:01 +00:00
akr 7efaa4f5d0 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 12:44:36 +00:00
akr 57b2190d55 * ext/socket/option.c: IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket
option takes a byte on OpenBSD.
  Fixed by Jeremy Evans.  [ruby-core:59496] [Bug #9350]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 12:31:57 +00:00
naruse e2582ca28d * ext/socket/option.c: rename functions introduced in r41009
s/ip/ipv4/g because they are ipv4 functions.
  (there's a policy that the name "ip" is for methods which supports
   both ipv4 and ipv6)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 14:24:34 +00:00
nobu 488f478d24 * ext/socket/option.c (inspect_byte): used only on NetBSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 22:53:58 +00:00
naruse a78e45b5fe * ext/socket/option.c (sockopt_s_byte): constructor of the sockopt
whose value's is byte.

* ext/socket/option.c (sockopt_byte): getter for above.

* ext/socket/option.c (inspect_byte): inspect for above.

* ext/socket/option.c (sockopt_s_ip_multicast_loop): constructor of
  the sockopt whose optname is IP_MULTICAST_LOOP.

* ext/socket/option.c (sockopt_ip_multicast_loop): getter for above.

* ext/socket/option.c (sockopt_s_ip_multicast_ttl): constructor of
  the sockopt whose optname is IP_MULTICAST_TTL.

* ext/socket/option.c (sockopt_ip_multicast_ttl): getter for above.

* ext/socket/option.c (sockopt_inspect): use above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 17:37:55 +00:00
zzak 3a7a773aeb * ext/socket/option.c: Document synonymous methods, by windwiny [GH-277]
* ext/stringio/stringio.c: ditto
* ext/io/wait/wait.c: ditto
* ext/gdbm/gdbm.c: ditto
* ext/dl/cfunc.c: ditto
* ext/zlib/zlib.c: ditto
* ext/win32ole/win32ole.c: ditto
* ext/dbm/dbm.c: ditto
* ext/json/generator/generator.c: ditto
* ext/date/date_core.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-16 03:25:50 +00:00
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