Package javax.jmdns.impl

Examples of javax.jmdns.impl.DNSRecord$IPv4Address


        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

    private final IPv4Address loadAddress(Preferences prefs, String key) {
        final String addrStr = prefs.get(key, null);
        if (addrStr == null) {
            return null;
        } else {
            return new IPv4Address(addrStr);
        }
    }
View Full Code Here

        if (myAddrInfo == null) {
            stat.nodevaddr.inc();
        }

        // Should I process this packet, or is it for somebody else?
        final IPv4Address dstAddr = hdr.getDestination();
        final boolean shouldProcess;
        if (myAddrInfo != null) {
            shouldProcess = myAddrInfo.contains(dstAddr);
        } else {
            // I don't have an IP address yet, if the linklayer says
View Full Code Here

            try {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                final IPv4ProtocolAddressInfo addrInfo =
                        (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
                if (addrInfo != null) {
                    final IPv4Address addr = (IPv4Address) addrInfo.getDefaultAddress();
                    if (addr != null) {
                        return addr;
                    }
                }
            } catch (ApiNotFoundException ex) {
View Full Code Here

    /**
     * @see java.net.DatagramSocketImpl#send(java.net.DatagramPacket)
     */
    protected void send(DatagramPacket p) throws IOException {

        final IPv4Address dstAddress = new IPv4Address(p.getAddress());
        final IPv4Header ipHdr;
        ipHdr = new IPv4Header(getTos(), getTimeToLive(), IPPROTO_UDP, dstAddress, p.getLength() + UDP_HLEN);
        if (!getLocalAddress().isAnyLocalAddress() || (getDevice() != null)) {
            ipHdr.setSource(new IPv4Address(getLocalAddress()));
        }
        final UDPHeader udpHdr;
        final int srcPort = getLocalPort();
        // final int srcPort = p.getPort(); // or getLocalPort???? TODO Fix
        // srcPort issue
View Full Code Here

     * @param skbuf
     * @return
     * @throws NoRouteToHostException
     */
    private IPv4Route findRoute(IPv4Header hdr, SocketBuffer skbuf) throws NoRouteToHostException {
        final IPv4Address destination = hdr.getDestination();
        return rt.search(destination);
    }
View Full Code Here

     * @return
     */
    private HardwareAddress findDstHWAddress(IPv4Route route, IPv4Header hdr, SocketBuffer skbuf)
        throws NetworkException {
        final ARPNetworkLayer arp = getARP();
        final IPv4Address dstAddr;
        if (hdr.getDestination().isBroadcast()) {
            return null;
        } else if (route.isGateway()) {
            dstAddr = route.getGateway();
        } else {
View Full Code Here

            try {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                final IPv4ProtocolAddressInfo addrInfo;
                addrInfo = (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
                if (addrInfo != null) {
                    final IPv4Address devAddr = (IPv4Address) addrInfo.getDefaultAddress();
                    if (devAddr.matches(target, mask)) {
                        return dev;
                    }
                }
            } catch (ApiNotFoundException ex) {
                // Should not happen, but if it happens anyway, just ignore it.
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.