[前][次][番号順一覧][スレッド一覧]

ruby-changes:32585

From: akr <ko1@a...>
Date: Tue, 21 Jan 2014 00:43:51 +0900 (JST)
Subject: [ruby-changes:32585] akr:r44664 (trunk): * ext/socket/option.c: Use "byte" as default argument for

akr	2014-01-21 00:43:47 +0900 (Tue, 21 Jan 2014)

  New Revision: 44664

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44664

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/option.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44663)
+++ ChangeLog	(revision 44664)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jan 21 00:39:15 2014  Tanaka Akira  <akr@f...>
+
+	* 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.
+
 Mon Jan 20 20:20:27 2014  Tanaka Akira  <akr@f...>
 
 	* ext/socket/option.c: Use preprocessor macros to avoid repeated
Index: ext/socket/option.c
===================================================================
--- ext/socket/option.c	(revision 44663)
+++ ext/socket/option.c	(revision 44664)
@@ -7,13 +7,13 @@ VALUE rb_cSockOpt; https://github.com/ruby/ruby/blob/trunk/ext/socket/option.c#L7
 #define CAT(x,y) x##y
 #define XCAT(x,y) CAT(x,y)
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__linux__) || defined(__FreeBSD__)
+# define TYPE_IP_MULTICAST_LOOP int
+# define TYPE_IP_MULTICAST_TTL int
+#else
 # define TYPE_IP_MULTICAST_LOOP byte
 # define TYPE_IP_MULTICAST_TTL byte
 # define USE_INSPECT_BYTE 1
-#else
-# define TYPE_IP_MULTICAST_LOOP int
-# define TYPE_IP_MULTICAST_TTL int
 #endif
 
 static VALUE
@@ -590,6 +590,15 @@ inspect_timeval_as_interval(int level, i https://github.com/ruby/ruby/blob/trunk/ext/socket/option.c#L590
  *   (MULTICAST 1.2 Release)
  *   http://www.kohala.com/start/mcast.api.txt
  *
+ * There are 2 socket options which takes a u_char (unsigned char).
+ *
+ *   IP_MULTICAST_TTL
+ *   IP_MULTICAST_LOOP
+ *
+ * However Linux and FreeBSD setsockname accepts int argument
+ * as well as u_char.
+ * Thier getsockname returns int.
+ *
  * There are 3 socket options which takes a struct.
  *
  *   IP_MULTICAST_IF: struct in_addr

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]