summaryrefslogtreecommitdiff
path: root/ext/socket/constants.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-02 02:51:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-02 02:51:02 +0000
commit61fc0c6cf4de377a14a0ec0d64aea067e72fa755 (patch)
treeeedfd75ca1d04ff4c409b91cfcfae1768ee7e0b0 /ext/socket/constants.c
parentc618d018d8660055f63e3582e1ac245b96d40662 (diff)
* 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
Diffstat (limited to 'ext/socket/constants.c')
-rw-r--r--ext/socket/constants.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/socket/constants.c b/ext/socket/constants.c
index 3242cdd..ea1e0f1 100644
--- a/ext/socket/constants.c
+++ b/ext/socket/constants.c
@@ -92,6 +92,25 @@ shutdown_how_arg(VALUE how)
return constant_arg(how, shutdown_how_to_int, "unknown shutdown argument");
}
+int
+cmsg_type_arg(int level, VALUE optname)
+{
+ switch (level) {
+ case SOL_SOCKET:
+ return constant_arg(optname, scm_optname_to_int, "unknown UNIX control message");
+ case IPPROTO_IP:
+ return constant_arg(optname, ip_optname_to_int, "unknown IP control message");
+ case IPPROTO_IPV6:
+ return constant_arg(optname, ipv6_optname_to_int, "unknown IPv6 control message");
+ case IPPROTO_TCP:
+ return constant_arg(optname, tcp_optname_to_int, "unknown TCP control message");
+ case IPPROTO_UDP:
+ return constant_arg(optname, udp_optname_to_int, "unknown UDP control message");
+ default:
+ return NUM2INT(optname);
+ }
+}
+
static void
sock_define_const(const char *name, int value, VALUE mConst)
{