diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-12 09:39:09 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-12 09:39:09 +0900 |
commit | 9c3e5b159c6c9cc2f42302045006af721e33e2e9 (patch) | |
tree | 1162f97a33fd4dd67cd06f087bac29c81348d7b4 /packet/bgp/bgp.go | |
parent | 8daa5116576b3e3582e6c8e05ae1b64f56197ec6 (diff) |
packet: create bmp package
move bmp stuff from bgp to bmp package.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/bgp/bgp.go')
-rw-r--r-- | packet/bgp/bgp.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 2de2af63..8bfea717 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -6785,3 +6785,23 @@ func (msg *BGPMessage) Serialize() ([]byte, error) { } return append(h, b...), nil } + +type MessageError struct { + TypeCode uint8 + SubTypeCode uint8 + Data []byte + Message string +} + +func NewMessageError(typeCode, subTypeCode uint8, data []byte, msg string) error { + return &MessageError{ + TypeCode: typeCode, + SubTypeCode: subTypeCode, + Data: data, + Message: msg, + } +} + +func (e *MessageError) Error() string { + return e.Message +} |