Package jnr.constants.platform

Examples of jnr.constants.platform.AddressFamily


    public static void validateSockaddr(Ruby runtime, ByteList val) {
        int high = val.get(0) & 0xff;
        int low = val.get(1) & 0xff;

        AddressFamily af = AddressFamily.valueOf((high << 8) + low);

        if (af != AddressFamily.AF_INET &&
                af != AddressFamily.AF_INET6) {
            throw runtime.newArgumentError("can't resolve socket address of wrong type");
        }
View Full Code Here


        soType = sockType;
    }

    private void initDomain(Ruby runtime, IRubyObject domain) {
        AddressFamily family = SocketUtils.addressFamilyFromArg(domain);

        if (family == null) {
            throw SocketUtils.sockerr(runtime, "unknown socket domain " + domain);
        }
View Full Code Here

    }

    public static IRubyObject pack_sockaddr_un(ThreadContext context, IRubyObject filename) {
        ByteList str = filename.convertToString().getByteList();

        AddressFamily af = AddressFamily.AF_UNIX;
        int high = (af.intValue() & 0xff00) >> 8;
        int low = af.intValue() & 0xff;

        ByteList bl = new ByteList();
        bl.append((byte)high);
        bl.append((byte)low);
        bl.append(str);
View Full Code Here

    private static final byte[] INADDR_BROADCAST = new byte[] {-1,-1,-1,-1}; // 255.255.255.255
    private static final String ANY = "<any>";
    private static final byte[] INADDR_ANY = new byte[] {0,0,0,0}; // 0.0.0.0

    static AddressFamily addressFamilyFromArg(IRubyObject domain) {
        AddressFamily addressFamily = null;

        if(domain instanceof RubyString || domain instanceof RubySymbol) {
            String domainString = domain.toString();
            addressFamily = AddressFamily.valueOf("AF_" + domainString);
        } else {
View Full Code Here

    }

    public static IRubyObject pack_sockaddr_un(ThreadContext context, IRubyObject filename) {
        ByteList str = filename.convertToString().getByteList();

        AddressFamily af = AddressFamily.AF_UNIX;
        int high = (af.intValue() & 0xff00) >> 8;
        int low = af.intValue() & 0xff;

        ByteList bl = new ByteList();
        bl.append((byte)high);
        bl.append((byte)low);
        bl.append(str);
View Full Code Here

            IRubyObject family = args.length > 2 ? args[2] : context.nil;
            IRubyObject socktype = args.length > 3 ? args[3] : context.nil;
            //IRubyObject protocol = args[4];
            IRubyObject flags = args.length > 5 ? args[5] : context.nil;

            AddressFamily addressFamily = AF_INET;
            if (!family.isNil()) {
                addressFamily = addressFamilyFromArg(family);
            }
            boolean is_ipv6 = addressFamily == AddressFamily.AF_INET6;
            boolean sock_stream = true;
View Full Code Here

    private static final byte[] INADDR_BROADCAST = new byte[] {-1,-1,-1,-1}; // 255.255.255.255
    private static final String ANY = "<any>";
    private static final byte[] INADDR_ANY = new byte[] {0,0,0,0}; // 0.0.0.0

    static AddressFamily addressFamilyFromArg(IRubyObject domain) {
        AddressFamily addressFamily = null;

        if(domain instanceof RubyString || domain instanceof RubySymbol) {
            String domainString = domain.toString();
            if (!domainString.startsWith("AF_")) domainString = "AF_" + domainString;
            addressFamily = AddressFamily.valueOf(domainString);
View Full Code Here

        soType = sockType;
    }

    private void initDomain(Ruby runtime, IRubyObject domain) {
        AddressFamily family = SocketUtils.addressFamilyFromArg(domain);

        if (family == null) {
            throw SocketUtils.sockerr(runtime, "unknown socket domain " + domain);
        }
View Full Code Here

    public static void validateSockaddr(Ruby runtime, ByteList val) {
        int high = val.get(0) & 0xff;
        int low = val.get(1) & 0xff;

        AddressFamily af = AddressFamily.valueOf((high << 8) + low);

        if (af != AddressFamily.AF_INET &&
                af != AddressFamily.AF_INET6) {
            throw runtime.newArgumentError("can't resolve socket address of wrong type");
        }
View Full Code Here

TOP

Related Classes of jnr.constants.platform.AddressFamily

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.