From 9c3e5b159c6c9cc2f42302045006af721e33e2e9 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 12 Apr 2016 09:39:09 +0900 Subject: packet: create bmp package move bmp stuff from bgp to bmp package. Signed-off-by: FUJITA Tomonori --- packet/bgp/bgp.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'packet/bgp/bgp.go') 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 +} -- cgit v1.2.3