var ip = new IPv4("192.168.0.100"); var subnet = new Subnet("/24"); var ipnet = new IPv4Network(ip,subnet); var network = ipnet.network(); //IPv4("192.168.0.0") var broadcast = ipnet.broadcast(); //IPv4("192.168.255.255"); var stopIP = new IPv4("192.168.0.10"); range_ips = []; ipnet.iter(function(ip,index) { range_ips.push(ip); if(ip.equals(stopIP)) return false; }); //check IPs are in a network var is_contained = ipnet.contains(ip) //true; var total = ipnet.count(); //254
checkInput(data, offset, length, HEADER_LENGTH); IPv4 ipv4 = new IPv4();
@Override public void sendPacketIn(PccId pccId) { TCP tcp = new TCP(); // Set the well known PCEP port. To be used to decide to process/discard the packet while processing. tcp.setDestinationPort(PCEP_PORT); IPv4 ipv4 = new IPv4(); ipv4.setProtocol(IPv4.PROTOCOL_TCP); ipv4.setPayload(tcp); Ethernet eth = new Ethernet(); eth.setEtherType(Ethernet.TYPE_IPV4); eth.setDestinationMACAddress(MacAddress.NONE); eth.setPayload(ipv4); // Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID. String lsrId = String.valueOf(pccId.ipAddress()); DeviceId pccDeviceId = DeviceId.deviceId(lsrId); InboundPacket inPkt = new DefaultInboundPacket(new ConnectPoint(pccDeviceId, PortNumber.portNumber(PCEP_PORT)), eth, null); packetProviderService.processPacket(new PcepPacketContext(inPkt, null)); } }
IPv4 ipReply = new IPv4();