Examples of IPv4Address


Examples of com.subgraph.orchid.data.IPv4Address

      final int routerAddress = router.getAddress().getAddressData();
      return (routerAddress & mask) == network;
    }
   
    public String toString() {
      IPv4Address a = new IPv4Address(network);
      return a.toString() + "/" + bits;
     
    }
View Full Code Here

Examples of com.subgraph.orchid.data.IPv4Address

    int addressValue = 0;
    for(byte b: addressData) {
      addressValue <<= 8;
      addressValue |= (b & 0xFF);
    }
    address = new IPv4Address(addressValue);
  }
View Full Code Here

Examples of de.innovationgate.utils.net.IPv4Address

        return designFileValidator;
    }

    public boolean isClientPermitted(WGDatabase db, HttpServletRequest request) {
        if (db.getAttribute(DBATTRIB_CLIENTRESTRICTIONS) != null) {
            IPv4Address ip;
            try {
                ip = new IPv4Address(request.getRemoteAddr());
                if (!ip.validate()) {
                    log.info("Client ip '" + request.getRemoteAddr() + "' from last request is invalid. Client is not permitted to access db '" + db.getDbReference() + "'.");
                    return false;
                }
            }
            catch (Exception e) {
View Full Code Here

Examples of grnoc.net.util.ipaddress.IPv4Address

        ofMatch.setNetworkProtocol(Byte.parseByte(cliArguments
            .get(argKey)));
        wildCard = wildCard ^ OFMatch.OFPFW_NW_PROTO;
       
      } else if (argKey.equals("nw_src")) {
        IPv4Address ipv4Address = new IPv4Address(
            cliArguments.get(argKey));
        ofMatch.setNetworkSource(ipv4Address.getIPv4AddressInt());
        wildCard = wildCard ^ OFMatch.OFPFW_NW_SRC_ALL ^
        ((31 << OFMatch.OFPFW_NW_SRC_SHIFT));
       
      } else if (argKey.equals("nw_dst")) {
        IPv4Address ipv4Address = new IPv4Address(
            cliArguments.get(argKey));
        ofMatch.setNetworkDestination(ipv4Address.getIPv4AddressInt());
        wildCard = wildCard ^ OFMatch.OFPFW_NW_DST_ALL ^
        ((31 << OFMatch.OFPFW_NW_DST_SHIFT));
      } else if (argKey.equals("tp_src")) {
        ofMatch.setTransportSource(Short.parseShort(cliArguments
            .get(argKey)));
View Full Code Here

Examples of grnoc.net.util.ipaddress.IPv4Address

            matcher.group(1), matcher.group(2));

          } catch (IndexOutOfBoundsException ioe) {
            break;
          }
          IPv4Address ipv4Address = new IPv4Address(ipAndSubnet[0]);
          ipv4Address.setSubnet(Integer.parseInt(ipAndSubnet[1]));
          int ipAddressInt = ipv4Address.getIPv4AddressInt();

          IPAddress ipAddress = new IPAddress();
          ipAddress.setIpAddressValue(ipAddressInt);
          ipAddress.setSubnet(Integer.parseInt(ipAndSubnet[1]));

          short maskingBits = (short) (ipAddress.getSubnet());
          int wildCardSource = OFMatch.OFPFW_ALL
              ^ OFMatch.OFPFW_DL_TYPE
              ^ OFMatch.OFPFW_NW_SRC_ALL
              ^ (((maskingBits) - 1) << OFMatch.OFPFW_NW_SRC_SHIFT);

          OFMatch ofMatchSource = new OFMatch();
          ofMatchSource.setDataLayerType((short) 0x0800);

          ofMatchSource.setNetworkSource(ipAddress
              .getIpAddressValue());

          ofMatchSource.setWildcards(wildCardSource);
          ofMatch = ofMatchSource;
          OFFlowMod flowModRule = new OFFlowMod();
          flowModRule.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
          flowModRule.setPriority(changedFlow.getPriority());
          flowModRule.setHardTimeout((short) 0);
          flowModRule.setIdleTimeout((short) 0);
         
          flowModRule.setBufferId(-1);
          flowModRule.setMatch(ofMatch);
     

         
          OFActionOutput ofAction = new OFActionOutput();
          ofAction.setPort(increasedPort);
          ArrayList<OFAction> actions = new ArrayList<OFAction>();
          actions.add(ofAction);
          if (mirroredPorts.get(increasedPort) != null) {
            OFActionOutput ofActionMirror = new OFActionOutput();
            ofActionMirror
                .setPort(mirroredPorts.get(increasedPort));
            actions.add(ofActionMirror);
          }

          flowModRule.setActions(actions);

 

          flowMods.add(flowModRule);

          OFMatch ofMatchDest = new OFMatch();
          ofMatchDest.setDataLayerType((short) 0x0800);
          ofMatchDest.setNetworkDestination(ipAddress
              .getIpAddressValue());

          int wildCardDest = OFMatch.OFPFW_ALL
              ^ OFMatch.OFPFW_DL_TYPE
              ^ OFMatch.OFPFW_NW_DST_ALL
              ^ (((maskingBits) - 1) << OFMatch.OFPFW_NW_DST_SHIFT);

          ofMatchDest.setWildcards(wildCardDest);

          OFFlowMod flowModRule1 = new OFFlowMod();
          flowModRule1.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
          flowModRule1.setPriority(changedFlow.getPriority());
          flowModRule1.setHardTimeout((short) 0);
          flowModRule1.setIdleTimeout((short) 0);
          flowModRule1.setBufferId(-1);
          flowModRule1.setMatch(ofMatchDest);

          flowModRule1.setActions(actions);

       

          flowMods.add(flowModRule1);

        }

        pattern = Pattern
            .compile("nw_dst=([0-9]+.[0-9]+.[0-9]+.[0-9]+)/([0-9]*)");

        matcher = pattern.matcher(changedFlow.getFlowString());

        while (matcher.find()) {

          try {
            logger.debug("ip address is {} and subnet is {}",

            matcher.group(1), matcher.group(2));

          } catch (IndexOutOfBoundsException ioe) {
            break;
          }
          IPv4Address ipv4Address = new IPv4Address(matcher.group(1));
          ipv4Address.setSubnet(Integer.parseInt(matcher.group(2)));
          int ipAddressInt = ipv4Address.getIPv4AddressInt();

          IPAddress ipAddress = new IPAddress();
          ipAddress.setIpAddressValue(ipAddressInt);
          ipAddress.setSubnet(Integer.parseInt(matcher.group(2)));

View Full Code Here

Examples of grnoc.net.util.ipaddress.IPv4Address

    if (originalNumberOfFlows < numberOfValues) {
      numberOfValues = originalNumberOfFlows;

    }

    IPv4Address ipv4Address = new IPv4Address(ipAndSubnet[0]);
    ipv4Address.setSubnet(Integer.parseInt(ipAndSubnet[1]));
    int ipAddressInt = ipv4Address.getIPv4AddressInt();

    IPAddress ipAddress = new IPAddress();
    ipAddress.setIpAddressValue(ipAddressInt);
    ipAddress.setSubnet(newSubnetValue);
    ipAddressValues.add(ipAddress);
View Full Code Here

Examples of org.jnode.net.ipv4.IPv4Address

            // 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

Examples of org.jnode.net.ipv4.IPv4Address

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

Examples of org.jnode.net.ipv4.IPv4Address

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

Examples of org.jnode.net.ipv4.IPv4Address

            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
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.