End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Socket::AncillaryData#cmsg_is?
ancillarydata.cmsg_is?(level, type) => true or false
ext/socket/ancdata.c
View on GitHub ↗
static VALUE
ancillary_cmsg_is_p(VALUE self, VALUE vlevel, VALUE vtype)
{
int family = ancillary_family(self);
int level = rsock_level_arg(family, vlevel);
int type = rsock_cmsg_type_arg(family, level, vtype);
if (ancillary_level(self) == level &&
ancillary_type(self) == type)
return Qtrue;
else
return Qfalse;
}
tests the level and type of ancillarydata.
Example
ancdata = Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "") ancdata.cmsg_is?(Socket::IPPROTO_IPV6, Socket::IPV6_PKTINFO) #=> true ancdata.cmsg_is?(:IPV6, :PKTINFO) #=> true ancdata.cmsg_is?(:IP, :PKTINFO) #=> false ancdata.cmsg_is?(:SOCKET, :RIGHTS) #=> false