diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-01-31 23:16:31 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-13 00:17:57 +0100 |
commit | 88f43944c915be3cb824a8ffa4f2995666b73486 (patch) | |
tree | f38d9c2b7fede5ec46e8df042afa36ce66819110 /src/main/java/com/lumaserv/bgp/protocol/attribute | |
parent | 9f35136d97673b825fb51c2e1c7067881a3d6820 (diff) |
Implent outgoing BGPUpdate and some attributes
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/attribute')
3 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java b/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java index b39e473..170acf8 100644 --- a/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java +++ b/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java @@ -1,5 +1,6 @@ package com.lumaserv.bgp.protocol.attribute; +import lombok.NoArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -7,6 +8,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; +@NoArgsConstructor @Getter @Setter public class ASPathAttribute implements PathAttribute { @@ -30,6 +32,13 @@ public class ASPathAttribute implements PathAttribute { } public void build(ByteBuffer b) { + for (Segment segment: segments) { + b.put(segment.getType()); + b.put((byte)segment.getAsns().size()); + for (Integer asn: segment.getAsns()) { + b.putShort(asn.shortValue()); + } + } } @Getter diff --git a/src/main/java/com/lumaserv/bgp/protocol/attribute/NextHopAttribute.java b/src/main/java/com/lumaserv/bgp/protocol/attribute/NextHopAttribute.java index c579295..1bf72e4 100644 --- a/src/main/java/com/lumaserv/bgp/protocol/attribute/NextHopAttribute.java +++ b/src/main/java/com/lumaserv/bgp/protocol/attribute/NextHopAttribute.java @@ -3,11 +3,13 @@ package com.lumaserv.bgp.protocol.attribute; import java.net.InetAddress; import java.net.UnknownHostException; +import lombok.NoArgsConstructor; import lombok.Getter; import lombok.Setter; import java.nio.ByteBuffer; +@NoArgsConstructor @Getter @Setter public class NextHopAttribute implements PathAttribute { diff --git a/src/main/java/com/lumaserv/bgp/protocol/attribute/OriginAttribute.java b/src/main/java/com/lumaserv/bgp/protocol/attribute/OriginAttribute.java index b8c996d..8cc3474 100644 --- a/src/main/java/com/lumaserv/bgp/protocol/attribute/OriginAttribute.java +++ b/src/main/java/com/lumaserv/bgp/protocol/attribute/OriginAttribute.java @@ -2,11 +2,14 @@ package com.lumaserv.bgp.protocol.attribute; import java.nio.ByteBuffer; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import java.util.EnumSet; + +@AllArgsConstructor @Getter @Setter public class OriginAttribute implements PathAttribute { |