diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-03-30 17:57:56 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-31 11:38:17 +0900 |
commit | 051621bf3aecbe0fd6292a3b4ee41ab42169eea1 (patch) | |
tree | dafa1b882570e059d57692c14e8a9537ff8c6f07 /packet/constant.go | |
parent | 63788325a04d2c1956f79713fabcb00d68782f37 (diff) |
*: support draft-ietf-idr-flowspec-l2vpn-03
$ gobgp g ri add -a l2vpn-flowspec match destination-mac 01:01:01:01:01:01 ether-type ipv4 vid 10 cos 20
$ gobgp g ri add -a l2vpn-flowspec match source-mac 01:01:01:01:01:01 ether-type arp inner-vid 20 inner-cos 20
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/constant.go')
-rw-r--r-- | packet/constant.go | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/packet/constant.go b/packet/constant.go index ac270cad..aa9b17b9 100644 --- a/packet/constant.go +++ b/packet/constant.go @@ -131,3 +131,64 @@ func (f TCPFlag) String() string { } return strings.Join(ss, "|") } + +type EthernetType int + +const ( + IPv4 EthernetType = 0x0800 + ARP EthernetType = 0x0806 + RARP EthernetType = 0x8035 + VMTP EthernetType = 0x805B + APPLE_TALK EthernetType = 0x809B + AARP EthernetType = 0x80F3 + IPX EthernetType = 0x8137 + SNMP EthernetType = 0x814C + NET_BIOS EthernetType = 0x8191 + XTP EthernetType = 0x817D + IPv6 EthernetType = 0x86DD + PPPoE_DISCOVERY EthernetType = 0x8863 + PPPoE_SESSION EthernetType = 0x8864 + LOOPBACK EthernetType = 0x9000 +) + +var EthernetTypeNameMap = map[EthernetType]string{ + IPv4: "ipv4", + ARP: "arp", + RARP: "rarp", + VMTP: "vmtp", + APPLE_TALK: "apple-talk", + AARP: "aarp", + IPX: "ipx", + SNMP: "snmp", + NET_BIOS: "net-bios", + XTP: "xtp", + IPv6: "ipv6", + PPPoE_DISCOVERY: "pppoe-discovery", + PPPoE_SESSION: "pppoe-session", + LOOPBACK: "loopback", +} + +var EthernetTypeValueMap = map[string]EthernetType{ + EthernetTypeNameMap[IPv4]: IPv4, + EthernetTypeNameMap[ARP]: ARP, + EthernetTypeNameMap[RARP]: RARP, + EthernetTypeNameMap[VMTP]: VMTP, + EthernetTypeNameMap[APPLE_TALK]: APPLE_TALK, + EthernetTypeNameMap[AARP]: AARP, + EthernetTypeNameMap[IPX]: IPX, + EthernetTypeNameMap[SNMP]: SNMP, + EthernetTypeNameMap[NET_BIOS]: NET_BIOS, + EthernetTypeNameMap[XTP]: XTP, + EthernetTypeNameMap[IPv6]: IPv6, + EthernetTypeNameMap[PPPoE_DISCOVERY]: PPPoE_DISCOVERY, + EthernetTypeNameMap[PPPoE_SESSION]: PPPoE_SESSION, + EthernetTypeNameMap[LOOPBACK]: LOOPBACK, +} + +func (t EthernetType) String() string { + n, ok := EthernetTypeNameMap[t] + if !ok { + return fmt.Sprintf("%d", t) + } + return n +} |