Skip to content
Snippets Groups Projects
Commit 044aec45 authored by Oliver Herms's avatar Oliver Herms
Browse files

Completing decode function

parent 423a5d10
No related branches found
No related tags found
No related merge requests found
......@@ -84,12 +84,17 @@ func Decode(msg []byte) (Msg, error) {
case TerminationMessageType:
tm, err := decodeTerminationMessage(buf, ch)
if err != nil {
return nil, fmt.Errorf("Unable to decide termination message: %v", err)
return nil, fmt.Errorf("Unable to decode termination message: %v", err)
}
return tm, nil
case RouteMirroringMessageType:
rm, err := decodeRouteMirroringMsg(buf, ch)
if err != nil {
return nil, fmt.Errorf("Unable to decode route mirroring message: %v", err)
}
return rm, nil
default:
return nil, fmt.Errorf("Unexpected message type: %d", ch.MsgType)
......
......@@ -12,6 +12,11 @@ type RouteMirroringMsg struct {
TLVs []*InformationTLV
}
// MsgType returns the type of this message
func (rm *RouteMirroringMsg) MsgType() uint8 {
return rm.CommonHeader.MsgType
}
func decodeRouteMirroringMsg(buf *bytes.Buffer, ch *CommonHeader) (*RouteMirroringMsg, error) {
rm := &RouteMirroringMsg{
CommonHeader: ch,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment