package com.lumaserv.bgp.protocol.attribute; import lombok.Getter; import lombok.Setter; @Getter @Setter public class ExtendedCommuntiesAttribute implements PathAttribute { byte type; byte subType; int as; int an; public ExtendedCommuntiesAttribute(byte typeCode, byte[] data) { type = data[0]; subType = data[1]; as = ((data[2] & 0xFF) << 24) | ((data[3] & 0xFF) << 16) | ((data[4] & 0xFF) << 8) | (data[5] & 0xFF); an = ((data[6] & 0xFF) << 8) | (data[7] & 0xFF); } public byte getTypeCode() { return 16; } public byte[] build() { return new byte[0]; } public String toString() { if (type == 0x03 && subType == 0x0b) { // Color extended community return String.format("color:%d", an); } return String.format("%d,%d,%d,%d", type, subType, as, an); } }