mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/constants.c (level_arg): use unknown_level_to_int for
non internet protocol. (optname_arg): use only so_optname_to_int for non internet protocol. (cmsg_type_arg): use only scm_optname_to_int for non internet protocol. * ext/socket/mkconstants.rb: generate unknown_level_to_int. rename iplevel_to_int to ip_level_to_int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2dd3fa9f3e
commit
810dd43a20
4 changed files with 74 additions and 37 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Mon Feb 9 23:21:29 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/constants.c (level_arg): use unknown_level_to_int for
|
||||||
|
non internet protocol.
|
||||||
|
(optname_arg): use only so_optname_to_int for non internet protocol.
|
||||||
|
(cmsg_type_arg): use only scm_optname_to_int for non internet
|
||||||
|
protocol.
|
||||||
|
|
||||||
|
* ext/socket/mkconstants.rb: generate unknown_level_to_int.
|
||||||
|
rename iplevel_to_int to ip_level_to_int.
|
||||||
|
|
||||||
Mon Feb 9 23:04:27 2009 Tanaka Akira <akr@fsij.org>
|
Mon Feb 9 23:04:27 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/mkconstants.rb: rename level_to_int to iplevel_to_int.
|
* ext/socket/mkconstants.rb: rename level_to_int to iplevel_to_int.
|
||||||
|
|
|
@ -61,12 +61,18 @@ int
|
||||||
level_arg(int family, VALUE level)
|
level_arg(int family, VALUE level)
|
||||||
{
|
{
|
||||||
/* convert SOL_SOCKET, IPPROTO_TCP, etc. */
|
/* convert SOL_SOCKET, IPPROTO_TCP, etc. */
|
||||||
return constant_arg(level, iplevel_to_int, "unknown protocol level");
|
if (IS_IP_FAMILY(family)) {
|
||||||
|
return constant_arg(level, ip_level_to_int, "unknown protocol level");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return constant_arg(level, unknown_level_to_int, "unknown protocol level");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
optname_arg(int family, int level, VALUE optname)
|
optname_arg(int family, int level, VALUE optname)
|
||||||
{
|
{
|
||||||
|
if (IS_IP_FAMILY(family)) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case SOL_SOCKET:
|
case SOL_SOCKET:
|
||||||
return constant_arg(optname, so_optname_to_int, "unknown socket level option name");
|
return constant_arg(optname, so_optname_to_int, "unknown socket level option name");
|
||||||
|
@ -83,18 +89,21 @@ optname_arg(int family, int level, VALUE optname)
|
||||||
default:
|
default:
|
||||||
return NUM2INT(optname);
|
return NUM2INT(optname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
int
|
switch (level) {
|
||||||
shutdown_how_arg(VALUE how)
|
case SOL_SOCKET:
|
||||||
{
|
return constant_arg(optname, so_optname_to_int, "unknown socket level option name");
|
||||||
/* convert SHUT_RD, SHUT_WR, SHUT_RDWR. */
|
default:
|
||||||
return constant_arg(how, shutdown_how_to_int, "unknown shutdown argument");
|
return NUM2INT(optname);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmsg_type_arg(int family, int level, VALUE type)
|
cmsg_type_arg(int family, int level, VALUE type)
|
||||||
{
|
{
|
||||||
|
if (IS_IP_FAMILY(family)) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case SOL_SOCKET:
|
case SOL_SOCKET:
|
||||||
return constant_arg(type, scm_optname_to_int, "unknown UNIX control message");
|
return constant_arg(type, scm_optname_to_int, "unknown UNIX control message");
|
||||||
|
@ -111,6 +120,22 @@ cmsg_type_arg(int family, int level, VALUE type)
|
||||||
default:
|
default:
|
||||||
return NUM2INT(type);
|
return NUM2INT(type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (level) {
|
||||||
|
case SOL_SOCKET:
|
||||||
|
return constant_arg(type, scm_optname_to_int, "unknown UNIX control message");
|
||||||
|
default:
|
||||||
|
return NUM2INT(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
shutdown_how_arg(VALUE how)
|
||||||
|
{
|
||||||
|
/* convert SHUT_RD, SHUT_WR, SHUT_RDWR. */
|
||||||
|
return constant_arg(how, shutdown_how_to_int, "unknown shutdown argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -242,7 +242,8 @@ end
|
||||||
def_name_to_int("family_to_int", /\A(AF_|PF_)/, "AF_")
|
def_name_to_int("family_to_int", /\A(AF_|PF_)/, "AF_")
|
||||||
def_name_to_int("socktype_to_int", /\ASOCK_/, "SOCK_")
|
def_name_to_int("socktype_to_int", /\ASOCK_/, "SOCK_")
|
||||||
def_name_to_int("ipproto_to_int", /\AIPPROTO_/, "IPPROTO_")
|
def_name_to_int("ipproto_to_int", /\AIPPROTO_/, "IPPROTO_")
|
||||||
def_name_to_int("iplevel_to_int", /\A(SOL_SOCKET\z|IPPROTO_)/, /\A(SOL_|IPPROTO_)/)
|
def_name_to_int("unknown_level_to_int", /\ASOL_SOCKET\z/, "SOL_")
|
||||||
|
def_name_to_int("ip_level_to_int", /\A(SOL_SOCKET\z|IPPROTO_)/, /\A(SOL_|IPPROTO_)/)
|
||||||
def_name_to_int("so_optname_to_int", /\ASO_/, "SO_")
|
def_name_to_int("so_optname_to_int", /\ASO_/, "SO_")
|
||||||
def_name_to_int("ip_optname_to_int", /\AIP_/, "IP_")
|
def_name_to_int("ip_optname_to_int", /\AIP_/, "IP_")
|
||||||
def_name_to_int("ipv6_optname_to_int", /\AIPV6_/, "IPV6_", "IPPROTO_IPV6")
|
def_name_to_int("ipv6_optname_to_int", /\AIPV6_/, "IPV6_", "IPPROTO_IPV6")
|
||||||
|
|
|
@ -196,8 +196,8 @@ int family_arg(VALUE domain);
|
||||||
int socktype_arg(VALUE type);
|
int socktype_arg(VALUE type);
|
||||||
int level_arg(int family, VALUE level);
|
int level_arg(int family, VALUE level);
|
||||||
int optname_arg(int family, int level, VALUE optname);
|
int optname_arg(int family, int level, VALUE optname);
|
||||||
int shutdown_how_arg(VALUE how);
|
|
||||||
int cmsg_type_arg(int family, int level, VALUE type);
|
int cmsg_type_arg(int family, int level, VALUE type);
|
||||||
|
int shutdown_how_arg(VALUE how);
|
||||||
|
|
||||||
int rb_sock_getfamily(int sockfd);
|
int rb_sock_getfamily(int sockfd);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue