@Test public void testReadHelloBody() throws Exception { helloPacket.getHelloBodyAsByteArray(); assertThat(helloPacket, is(notNullValue())); }
public byte[] getHelloBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); bodyLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.helloInterval()))); bodyLst.add((byte) this.options()); bodyLst.add((byte) this.routerPriority()); bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.routerDeadInterval()))); bodyLst.addAll(Bytes.asList(this.dr().toOctets())); bodyLst.addAll(Bytes.asList(this.bdr().toOctets())); for (Ip4Address neighbour : neighborAddress) { bodyLst.addAll(Bytes.asList(neighbour.toOctets())); } } catch (Exception e) { log.debug("Error::getHelloBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); }
HelloPacket extends OspfPacketHeader { public byte[] getHelloBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); bodyLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.helloInterval()))); bodyLst.add((byte) this.options()); bodyLst.add((byte) this.routerPriority()); bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.routerDeadInterval()))); bodyLst.addAll(Bytes.asList(this.dr().toOctets())); bodyLst.addAll(Bytes.asList(this.bdr().toOctets())); for (Ip4Address neighbour : neighborAddress) { bodyLst.addAll(Bytes.asList(neighbour.toOctets())); } } catch (Exception e) { log.debug("Error::getHelloBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } }
HelloPacket extends OspfPacketHeader { public byte[] getHelloBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); bodyLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.helloInterval()))); bodyLst.add((byte) this.options()); bodyLst.add((byte) this.routerPriority()); bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.routerDeadInterval()))); bodyLst.addAll(Bytes.asList(this.dr().toOctets())); bodyLst.addAll(Bytes.asList(this.bdr().toOctets())); for (Ip4Address neighbour : neighborAddress) { bodyLst.addAll(Bytes.asList(neighbour.toOctets())); } } catch (Exception e) { log.debug("Error::getHelloBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } HelloPacket();  HelloPacket(OspfPacketHeader ospfHeader); }
HelloPacket extends OspfPacketHeader { public byte[] getHelloBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); bodyLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.helloInterval()))); bodyLst.add((byte) this.options()); bodyLst.add((byte) this.routerPriority()); bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.routerDeadInterval()))); bodyLst.addAll(Bytes.asList(this.dr().toOctets())); bodyLst.addAll(Bytes.asList(this.bdr().toOctets())); for (Ip4Address neighbour : neighborAddress) { bodyLst.addAll(Bytes.asList(neighbour.toOctets())); } } catch (Exception e) { log.debug("Error::getHelloBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } HelloPacket();  HelloPacket(OspfPacketHeader ospfHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); Ip4Address bdr(); void setBdr(Ip4Address bdr); Ip4Address dr(); void setDr(Ip4Address dr); void addNeighbor(Ip4Address neighborID); boolean containsNeighbour(Ip4Address neighborID); int options(); void setOptions(int options); int routerPriority(); void setRouterPriority(int routerPriority); int helloInterval(); void setHelloInterval(int helloInterval); int routerDeadInterval(); void setRouterDeadInterval(int routerDeadInterval); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getHelloHeaderAsByteArray(); byte[] getHelloBodyAsByteArray(); @Override String toString(); }
HelloPacket extends OspfPacketHeader { public byte[] getHelloBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); bodyLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.helloInterval()))); bodyLst.add((byte) this.options()); bodyLst.add((byte) this.routerPriority()); bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.routerDeadInterval()))); bodyLst.addAll(Bytes.asList(this.dr().toOctets())); bodyLst.addAll(Bytes.asList(this.bdr().toOctets())); for (Ip4Address neighbour : neighborAddress) { bodyLst.addAll(Bytes.asList(neighbour.toOctets())); } } catch (Exception e) { log.debug("Error::getHelloBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } HelloPacket();  HelloPacket(OspfPacketHeader ospfHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); Ip4Address bdr(); void setBdr(Ip4Address bdr); Ip4Address dr(); void setDr(Ip4Address dr); void addNeighbor(Ip4Address neighborID); boolean containsNeighbour(Ip4Address neighborID); int options(); void setOptions(int options); int routerPriority(); void setRouterPriority(int routerPriority); int helloInterval(); void setHelloInterval(int helloInterval); int routerDeadInterval(); void setRouterDeadInterval(int routerDeadInterval); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getHelloHeaderAsByteArray(); byte[] getHelloBodyAsByteArray(); @Override String toString();  }