package com.lumaserv.bgp.protocol.attribute; import lombok.Getter; import lombok.Setter; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; @Getter @Setter public class ASPathAttribute implements PathAttribute { List segments = new ArrayList<>(); public ASPathAttribute(byte typeCode, byte[] data) { int offset = 0; while (offset < data.length) { Segment segment = new Segment().setType(data[offset]); byte length = data[offset + 1]; for(int i=0; i asns = new ArrayList<>(); public String toString() { StringBuffer buf = new StringBuffer(); buf.append("("); for(Integer asn : asns) { if (buf.length() > 1) buf.append(" "); buf.append(asn); } buf.append(")"); return buf.toString(); } } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("["); for(Segment segment : segments) { if (buf.length() > 1) buf.append(", "); buf.append(segment); } buf.append("]"); return buf.toString(); } }