Examples of IPv4ConfigurationService


Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

     * settings in a DHCP message.
     */
    protected void doConfigure(DHCPMessage msg) throws IOException {
        super.doConfigure(msg);

        final IPv4ConfigurationService cfg;
        try {
            cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
        } catch (NameNotFoundException ex) {
            throw new NetworkException(ex);
        }
        BOOTPHeader hdr = msg.getHeader();
        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);
        }

        byte[] routerValue = msg.getOption(DHCPMessage.ROUTER_OPTION);
        if (routerValue != null && routerValue.length >= 4) {
            IPv4Address routerIP = new IPv4Address(routerValue, 0);
            log.info("Got Router IP address : " + routerIP);
            cfg.addRoute(IPv4Address.ANY, routerIP, device, false);
        }

        // find the dns servers and add to the resolver
        final byte[] dnsValue = msg.getOption(DHCPMessage.DNS_OPTION);
        if (dnsValue != null) {
View Full Code Here

Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

        final IPv4NetworkLayer ipNL =
                (IPv4NetworkLayer) NetUtils.getNLM().getNetworkLayer(ETH_P_IP);
        final IPv4Address target = argTarget.getValue();
        final IPv4Address gateway = argGateway.getValue();
        final Device device = argDevice.getValue();
        final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);

        if (argAdd.isSet()) {
            cfg.addRoute(target, gateway, device, true);
        } else if (argDel.isSet()) {
            cfg.deleteRoute(target, gateway, device);
        } else {
            PrintWriter out = getOutput().getPrintWriter();
            out.println(str_table);
            out.println(ipNL.getRoutingTable());
        }
View Full Code Here

Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

            exit(1);
        }

        // Now it should be safe to do the DHCP configuration.
        getOutput().getPrintWriter().format(fmt_config, dev.getId());
        final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
        cfg.configureDeviceDhcp(dev, true);
    }
View Full Code Here

Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

                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
                // waitUntilReady parameter == false.  (The comment in the code
                // talks about avoiding deadlocks.)
View Full Code Here

Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

    }

    public void execute() throws NameNotFoundException, NetworkException {
        final Device dev = argDevice.getValue();
        getOutput().getPrintWriter().format(fmt_config, dev.getId());
        final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
        cfg.configureDeviceBootp(dev, true);
    }
View Full Code Here

Examples of org.jnode.net.ipv4.config.IPv4ConfigurationService

     * settings in a BOOTP header.
     */
    protected void doConfigure(BOOTPHeader hdr) throws IOException {
        super.doConfigure(hdr);

        final IPv4ConfigurationService cfg;
        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
TOP
Copyright © 2018 www.massapi.com. 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.