Package org.jnode.net.ipv4.tftp

Examples of org.jnode.net.ipv4.tftp.TFTPClient


            // Drop this segment with a RST reply
            sendRST();
            drop(ipHdr, hdr, "unexpected ACK segment");
        } else if (syn) {
            // Drop if broadcast or multicast
            final IPv4Address dst = ipHdr.getDestination();
            if (dst.isBroadcast() || dst.isMulticast()) {
                // Drop this segment
                drop(ipHdr, hdr, "broadcast or multicast destination");
            } else {
                // Process the SYN request
                final TCPControlBlock copy =
View Full Code Here


            throw new IOException("Already bound");
        }
        if (host.isAnyLocalAddress()) {
            host = InetAddress.getLocalHost();
        }
        controlBlock = protocol.bind(new IPv4Address(host), port);
    }
View Full Code Here

            throw new UnresolvedAddressException();
        }
        if (controlBlock == null) {
            bind(InetAddress.getLocalHost(), 0);
        }
        controlBlock.appConnect(new IPv4Address(sa.getAddress()), sa.getPort());
    }
View Full Code Here

            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) {
            for (int i = 0; i < dnsValue.length; i += 4) {
                final IPv4Address dnsIP = new IPv4Address(dnsValue, i);
               
                log.info("Got Dns IP address    : " + dnsIP);
                try {
                    ResolverImpl.addDnsServer(dnsIP);
                } catch (Throwable ex) {
View Full Code Here

     */
    public static void main(String[] args) throws Exception {
        final ARPNetworkLayer arp =
                (ARPNetworkLayer) NetUtils.getNLM().getNetworkLayer(EthernetConstants.ETH_P_ARP);
        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
        final IPv4Address addr = new IPv4Address(args[0]);
        final IPv4Address myAddr = new IPv4Address(args[1]);
        final Device dev = dm.getDevice(args[2]);
        final long timeout = 5000;

        final HardwareAddress hwAddr;
        hwAddr = arp.getHardwareAddress(addr, myAddr, dev, timeout);
View Full Code Here

            System.out.println("SendBufferSize=" + socket.getSendBufferSize());
            final byte[] buf = new byte[size];
            final DatagramPacket dp = new DatagramPacket(buf, buf.length);

            dp.setPort(2237);
            dp.setAddress(new IPv4Address(args[0]).toInetAddress());

            System.out.println("Sending packet of size " + dp.getLength());
            socket.send(dp);
        } finally {
            socket.close();
View Full Code Here

    }

    public void execute() throws NoSuchProtocolException, NetworkException, NameNotFoundException {
        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);
View Full Code Here

        hardwareAddressSize = skbuf.get(4);
        protocolAddressSize = skbuf.get(5);
        operation = ARPOperation.getType(skbuf.get16(6));
        if ((hardwareType == 1) && (protocolType == EthernetConstants.ETH_P_IP)) {
            sourceHardwareAddress = new EthernetAddress(skbuf, 8);
            sourceProtocolAddress = new IPv4Address(skbuf, 14);
            destinationHardwareAddress = new EthernetAddress(skbuf, 18);
            destinationProtocolAddress = new IPv4Address(skbuf, 24);
        } else {
            throw new SocketException("Unknown hw,ptype: " + hardwareType + ',' + protocolType);
        }
    }
View Full Code Here

        new PingCommand().execute(args);
    }
   
    public void execute() throws SocketException, InterruptedException {
        try {
            this.dst = new IPv4Address(argHost.getAsInetAddress());
        } catch (UnknownHostException ex) {
            getError().getPrintWriter().format(fmt_unknown_host, ex.getLocalizedMessage());
            exit(1);
        }
        final PrintWriter out = getOutput().getPrintWriter();
View Full Code Here

                            protocolAddresses = new ProtocolAddress[recordCount];

                            for (int i = 0; i < recordCount; i++) {
                                final Record record = records[i];
                                protocolAddresses[i] = new IPv4Address(record.rdataToString());
                            }
                        } else {
                            throw new UnknownHostException(lookup.getErrorString());
                        }
View Full Code Here

TOP

Related Classes of org.jnode.net.ipv4.tftp.TFTPClient

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.