@@ -0,0 +1,1888 @@
+package es.tid.bgp.bgp4.update.fields.pathAttributes;%0D%0A%0D%0Aimport es.tid.bgp.bgp4.update.fields.PathAttribute;%0D%0A%0D%0A%0D%0A/**%0D%0A * LOCAL_PREF is a well known attribute that is a four-octet unsigned integer.%0D%0A * A BGP speaker uses it to inform its other internal peers of the advertising%0D%0A * speaker's degree of preference for an advertised route.%0D%0A   %0D%0A%0D%0A                            %0D%0A * @author Andrea and Ajmal%0D%0A *%0D%0A */%0D%0Apublic class LOCAL_PREF_Attribute extends PathAttribute%7B%0D%0A%0D%0A%09int preference_value;%0D%0A%0D%0A%09public LOCAL_PREF_Attribute()%7B%0D%0A%09%09super();%0D%0A%09%09this.typeCode = PathAttributesTypeCode.PATH_ATTRIBUTE_TYPECODE_LOCAL_PREF;%0D%0A%09%09this.optionalBit = true;%0D%0A%09%09this.transitiveBit=false;%0D%0A%09%09this.partialBit=false;%0D%0A%09%09this.extendedLengthBit=false;%0D%0A%09%7D%0D%0A%09public LOCAL_PREF_Attribute(byte %5B%5Dbytes, int offset)%7B%0D%0A%09%09super(bytes, offset);%0D%0A%09%09decode(bytes,offset+mandatoryLength);%09%09%0D%0A%09%7D%0D%0A%09@Override%0D%0A%09public void encode() %7B%0D%0A%09%09pathAttributeLength = 4; //Length of LOCAL PREF%0D%0A%09%09this.length=pathAttributeLength+mandatoryLength;%0D%0A%09%09this.bytes=new byte%5Bthis.length%5D;%0D%0A%09%09encodeHeader();%0D%0A%09%09this.bytes%5B3%5D=(byte)(preference_value%3E%3E%3E24 & 0xFF);%0D%0A%09%09this.bytes%5B4%5D=(byte)(preference_value %3E%3E%3E 16 & 0xFF);%0D%0A%09%09this.bytes%5B5%5D=(byte)(preference_value %3E%3E%3E8 & 0xFF);%0D%0A%09%09this.bytes%5B6%5D=(byte)(preference_value & 0xFF);%0D%0A%0D%0A%09%7D%0D%0A%09public void decode(byte %5B%5Dbytes, int offset)%7B%0D%0A%09%09preference_value=((bytes%5Boffset%5D&0xFF)%3C%3C0) %7C  ((bytes%5Boffset+1%5D&0xFF)%3C%3C8) %7C  ((bytes%5Boffset+2%5D&0xFF)%3C%3C16)%7C  ((bytes%5Boffset+3%5D&0xFF)%3C%3C24);%0D%0A%0D%0A%0D%0A%09%7D%0D%0A%09public int getValue() %7B%0D%0A%09%09log.info(%22Decoded local preference= %22+ preference_value);%0D%0A%09%09return preference_value;%0D%0A%09%7D%0D%0A%09public void setValue(int value) %7B%0D%0A%09%09log.info(%22Encoded local preference= %22+ value);%0D%0A%0D%0A%09%09this.preference_value = value;%0D%0A%09%7D%0D%0A%09%0D%0A%09@Override%0D%0A%09public String toString() %7B%0D%0A%09%09//String sb = super.toString();%0D%0A%09%09return %22Local Preference %5BValue=%22 + preference_value+ %22%5D%22;%0D%0A%09%7D%0D%0A%09%0D%0A%0D%0A%0D%0A%7D%0D%0A

Add LOCAL_PREF_Attribute