summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/protocol/attribute/MPUnreachableNLRIAttribute.java
blob: 43dc8d54ab57661c7be383f8185577edb1b12d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.lumaserv.bgp.protocol.attribute;

import lombok.Getter;
import lombok.Setter;

import com.lumaserv.bgp.protocol.AFI;
import com.lumaserv.bgp.protocol.SAFI;

import java.nio.ByteBuffer;

@Getter
@Setter
public class MPUnreachableNLRIAttribute implements PathAttribute {

    AFI afi;
    SAFI safi;
    int nlriLen;

    public MPUnreachableNLRIAttribute(byte typeCode, byte[] data) {
        afi = AFI.fromInteger((data[0] << 8) | data[1]);
        safi = SAFI.fromInteger(data[2]);
        nlriLen = data.length - 3;
    }

    public byte getTypeCode() {
        return 15;
    }

    public void build(ByteBuffer b) {
        // FIXME
    }

    public String toString() {
        return "AFI:" + afi + " SAFI:" + safi + " NLRIs:" + nlriLen;
    }
}