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

83 Коммитов

Автор SHA1 Сообщение Дата
nobu 97e05dad7f UNREACHABLE_RETURN
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
  of non-void functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 05:38:07 +00:00
hsbt 4043565023 * ext/socket/*.c: Add proper require for example to work.
[fix GH-1378][ci skip] Patch by @schneems

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05 03:57:32 +00:00
nobu 0cc169d1de fid typos [ci skip]
* fix typos, "a" before "Integer" to "an".  [Fix GH-1438]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-24 02:28:25 +00:00
nobu aa8e9c63ad socket/option.c: inet_ntop
* ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share
  the fallback definition.  [ruby-core:76646] [Bug #12645]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-02 03:37:02 +00:00
nobu 551f6b3a18 socket/option.c: accurate condition
* ext/socket/option.c (inspect_tcpi_msec): more accurate condition
  for TCPI msec member inspection function.
  [ruby-core:74388] [Bug #12185]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 02:36:28 +00:00
nobu 0bc5341690 option.c: single byte boolean
* ext/socket/option.c (sockopt_bool): relax boolean size to be one
  too not only sizeof(int).  Winsock getsockopt() returns a single
  byte as a boolean socket option.  [ruby-core:72730] [Bug #11958]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-17 06:31:36 +00:00
nobu b25ad0daaa option.c: make error messages consistent
* ext/socket/option.c (check_size): extract a macro to check
  binary data size, with a consistent message.
* ext/socket/option.c (sockopt_byte): fix error message,
  sizeof(int) differs from sizeof(unsigned char) in general.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-17 05:41:01 +00:00
nobu b5a5cd605b use rb_sym2str
* ext/openssl/ossl_ssl.c (ossl_sslctx_set_ssl_version): use
  rb_sym2str to get rid of inadvertent ID creations.

* ext/socket/ancdata.c (ancillary_inspect): ditto.

* ext/socket/option.c (sockopt_inspect): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-15 04:32:15 +00:00
naruse 4e8fbe1778 * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state,
but it is a dummy.

* ext/socket/option.c: Solaris 11 doesn't have u_intN_t.

* ext/socket/option.c: Solaris 11 needs inspect_tcpi_msec.

* ext/socket/raddrinfo.c: Solaris 11 has AF_PACKET but doesn't have
  related macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-25 08:10:14 +00:00
nobu c2fb27ac4a socket/option.c: fix inet_ntop link error on mswin
* ext/socket/option.c (inet_ntop): link aliased inet_ntop in
  libruby on mswin not rb_w32_inet_ntop which fails to link for
  unknown reason.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-05 08:09:12 +00:00
nobu 10cd530e40 socket/option.c: use rb_w32_inet_ntop
* ext/socket/option.c (inet_ntop): the fallback implementaion is
  always available on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-04 17:09:52 +00:00
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