diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-03-06 11:04:00 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-03-06 11:23:46 +0900 |
commit | 5a74b0c454c8f54535ab6cb7386f8bb52973f66d (patch) | |
tree | 96336c449cb3265dc185117c5877023f0624f9c1 | |
parent | adcb9ac2dce2ddc3d3ff0868058fb45efa58f607 (diff) |
zebra/zapi: Implement String() method to Body interface
For the convenience when logging, this patch implements String() method
to Body interface which is the interface of Zebra message body.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r-- | zebra/zapi.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/zebra/zapi.go b/zebra/zapi.go index d43362bb..74d17f28 100644 --- a/zebra/zapi.go +++ b/zebra/zapi.go @@ -514,6 +514,7 @@ func (h *Header) DecodeFromBytes(data []byte) error { type Body interface { DecodeFromBytes([]byte, uint8) error Serialize() ([]byte, error) + String() string } type HelloBody struct { @@ -529,6 +530,10 @@ func (b *HelloBody) Serialize() ([]byte, error) { return []byte{uint8(b.RedistDefault)}, nil } +func (b *HelloBody) String() string { + return fmt.Sprintf("route_type: %d", b.RedistDefault) +} + type RedistributeBody struct { Redist ROUTE_TYPE } @@ -542,6 +547,10 @@ func (b *RedistributeBody) Serialize() ([]byte, error) { return []byte{uint8(b.Redist)}, nil } +func (b *RedistributeBody) String() string { + return fmt.Sprintf("route_type: %d", b.Redist) +} + type InterfaceUpdateBody struct { Name string Index uint32 |