Package javax.jmdns.impl

Examples of javax.jmdns.impl.DNSRecord$IPv4Address


    public static void main(String[] args) throws Exception {
        new ResolverCommand().execute(args);
    }

    public void execute() throws NetworkException {
        IPv4Address server = argDnsServer.getValue();
        PrintWriter out = getOutput().getPrintWriter();
        if (argAdd.isSet()) {
            // Add a DNS server
            ResolverImpl.addDnsServer(server);
        } else if (argDel.isSet()) {
View Full Code Here


            if (!argIPAddress.isSet()) {
                // Print IP address(es) for device
                out.format(fmt_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            } else {
                // Set IP address for device
                final IPv4Address ip = argIPAddress.getValue();
                final IPv4Address mask = argSubnetMask.getValue();
                final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
                cfg.configureDeviceStatic(dev, ip, mask, true);

                // FIXME ... this doesn't show the device's new address because the
                // IPv4 ConfigurationServiceImpl calls processor.apply with the
View Full Code Here

    }

    @Override
    protected IPv4Address doAccept(Token value, int flags) throws CommandSyntaxException {
        try {
            return new IPv4Address(value.text);
        } catch (IllegalArgumentException ex) {
            throw new CommandSyntaxException("invalid hostname or IPv4 address");
        }
    }
View Full Code Here

    }

    @Override
    protected IPv4Address doAccept(Token value, int flags) throws CommandSyntaxException {
        if (value.text.equals("default")) {
            return new IPv4Address(new byte[]{0, 0, 0, 0}, 0);
        }
        final StringTokenizer tok = new StringTokenizer(value.text, ".");
        if (tok.countTokens() != 4) {
            throw new CommandSyntaxException("wrong number of components for an IPv4 address");
        }
        try {
            final byte b1 = parseUnsignedByte(tok.nextToken());
            final byte b2 = parseUnsignedByte(tok.nextToken());
            final byte b3 = parseUnsignedByte(tok.nextToken());
            final byte b4 = parseUnsignedByte(tok.nextToken());
            return new IPv4Address(new byte[]{b1, b2, b3, b4}, 0);
        } catch (NumberFormatException ex) {
            throw new CommandSyntaxException("invalid component in IPv4 address");
        }
    }
View Full Code Here

        try {
            cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
        } catch (NameNotFoundException ex) {
            throw new NetworkException(ex);
        }
        cfg.configureDeviceStatic(device, new IPv4Address(hdr.getYourIPAddress()), null, false);

        final IPv4Address serverAddr = new IPv4Address(hdr.getServerIPAddress());
        final IPv4Address networkAddress = serverAddr.and(serverAddr.getDefaultSubnetmask());

        if (hdr.getGatewayIPAddress().isAnyLocalAddress()) {
            cfg.addRoute(serverAddr, null, device, false);
            cfg.addRoute(networkAddress, null, device, false);
        } else {
            cfg.addRoute(networkAddress, new IPv4Address(hdr.getGatewayIPAddress()), device, false);
        }
    }
View Full Code Here

        super(skbuf);
        final ICMPType type = getType();
        if ((type != ICMPType.ICMP_ADDRESS) && (type != ICMPType.ICMP_ADDRESSREPLY)) {
            throw new IllegalArgumentException("Invalid type " + type);
        }
        this.subnetMask = new IPv4Address(skbuf, 8);
    }
View Full Code Here

            return;
        }

        final int tos = 0;
        final int ttl = 0xFF;
        final IPv4Address dstAddr = origIpHdr.getSource();

        // Build the response ICMP header
        final ICMPHeader icmpHdr = new ICMPUnreachableHeader(code);
        // Build the response IP header
        final IPv4Header ipHdr = new IPv4Header(tos, ttl, IPv4Constants.IPPROTO_ICMP, dstAddr, 0);
View Full Code Here

TOP

Related Classes of javax.jmdns.impl.DNSRecord$IPv4Address

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.