private void initProtocol(Ruby runtime, IRubyObject protocol) { ProtocolFamily protocolFamily = SocketUtils.protocolFamilyFromArg(protocol); if (protocolFamily == null) { return; // no protocol specified, ignore it } soProtocol = protocolFamily; }
private void initProtocol(Ruby runtime, IRubyObject protocol) { ProtocolFamily protocolFamily = SocketUtils.protocolFamilyFromArg(protocol); if (protocolFamily == null) { return; // no protocol specified, ignore it } soProtocol = protocolFamily; }
@JRubyMethod(name = {"socketpair", "pair"}, meta = true) public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type, IRubyObject protocol) { ProtocolFamily pf = SocketUtils.protocolFamilyFromArg(protocol); if (pf == null ) pf = ProtocolFamily.PF_UNIX; if (pf != ProtocolFamily.PF_UNIX && pf.ordinal() != 0) { throw context.runtime.newErrnoEOPNOTSUPPError("Socket.socketpair only supports streaming UNIX sockets"); } return socketpair(context, recv, domain, type); }
@JRubyMethod(name = {"socketpair", "pair"}, meta = true) public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type, IRubyObject protocol) { ProtocolFamily pf = SocketUtils.protocolFamilyFromArg(protocol); if (pf == null ) pf = ProtocolFamily.PF_UNIX; if (pf != ProtocolFamily.PF_UNIX && pf.ordinal() != 0) { throw context.runtime.newErrnoEOPNOTSUPPError("Socket.socketpair only supports streaming UNIX sockets"); } return socketpair(context, recv, domain, type); }
@JRubyMethod(required = 4, visibility = Visibility.PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { family = SocketUtils.protocolFamilyFromArg(args[0]); level = SocketUtils.levelFromArg(args[1]); option = SocketUtils.optionFromArg(args[2]); data = args[3].convertToString().getByteList(); return this; }
@JRubyMethod(required = 4, visibility = Visibility.PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { family = SocketUtils.protocolFamilyFromArg(args[0]); level = SocketUtils.levelFromArg(args[1]); option = SocketUtils.optionFromArg(args[2]); data = args[3].convertToString().getByteList(); return this; }
@JRubyMethod(required = 4, meta = true) public static IRubyObject bool(ThreadContext context, IRubyObject self, IRubyObject[] args) { ProtocolFamily family = SocketUtils.protocolFamilyFromArg(args[0]); SocketLevel level = SocketUtils.levelFromArg(args[1]); SocketOption option = SocketUtils.optionFromArg(args[2]); ByteList data = packInt(args[3].isTrue() ? 1 : 0); return new Option(context.getRuntime(), family, level, option, data); }
@JRubyMethod(name = "int", required = 4, meta = true) public static IRubyObject rb_int(ThreadContext context, IRubyObject self, IRubyObject[] args) { ProtocolFamily family = SocketUtils.protocolFamilyFromArg(args[0]); SocketLevel level = SocketUtils.levelFromArg(args[1]); SocketOption option = SocketUtils.optionFromArg(args[2]); ByteList data = packInt(RubyNumeric.fix2int(args[3])); return new Option(context.getRuntime(), family, level, option, data); }
@JRubyMethod(required = 4, meta = true) public static IRubyObject bool(ThreadContext context, IRubyObject self, IRubyObject[] args) { ProtocolFamily family = SocketUtils.protocolFamilyFromArg(args[0]); SocketLevel level = SocketUtils.levelFromArg(args[1]); SocketOption option = SocketUtils.optionFromArg(args[2]); ByteList data = packInt(args[3].isTrue() ? 1 : 0); return new Option(context.getRuntime(), family, level, option, data); }
@JRubyMethod(name = "int", required = 4, meta = true) public static IRubyObject rb_int(ThreadContext context, IRubyObject self, IRubyObject[] args) { ProtocolFamily family = SocketUtils.protocolFamilyFromArg(args[0]); SocketLevel level = SocketUtils.levelFromArg(args[1]); SocketOption option = SocketUtils.optionFromArg(args[2]); ByteList data = packInt(RubyNumeric.fix2int(args[3])); return new Option(context.getRuntime(), family, level, option, data); }
ProtocolFamily pf = af != null ? null : SocketUtils.protocolFamilyFromArg(family);
ProtocolFamily pf = af != null ? null : SocketUtils.protocolFamilyFromArg(family);
this.socketType = SocketType.SOCKET; } else { this.pfamily = SocketUtils.protocolFamilyFromArg(family);
this.socketType = SocketType.SOCKET; } else { this.pfamily = SocketUtils.protocolFamilyFromArg(family);