diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-30 20:50:27 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-09 22:51:23 +0900 |
commit | aff1c244ad0d88a814f2ce573800717ccd08b450 (patch) | |
tree | 711b432961c52c76a70cd76a980d00ad956c0d5b /server/watcher.go | |
parent | f4c07da88154dd4b21012576a4ceb205715f4b3e (diff) |
bmp: use watcher infra to implement bmp feature
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/watcher.go')
-rw-r--r-- | server/watcher.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server/watcher.go b/server/watcher.go index d186e9cf..6cf2abc8 100644 --- a/server/watcher.go +++ b/server/watcher.go @@ -51,6 +51,7 @@ const ( WATCHER_EVENT_UPDATE_MSG WATCHER_EVENT_STATE_CHANGE WATCHER_EVENT_BESTPATH_CHANGE + WATCHER_EVENT_POST_POLICY_UPDATE_MSG ) type watcherEvent interface { @@ -62,15 +63,32 @@ type watcherEventUpdateMsg struct { localAS uint32 peerAddress net.IP localAddress net.IP + peerID net.IP fourBytesAs bool timestamp time.Time payload []byte + postPolicy bool +} + +type watcherEventStateChangedMsg struct { + peerAS uint32 + localAS uint32 + peerAddress net.IP + localAddress net.IP + peerPort uint16 + localPort uint16 + peerID net.IP + sentOpen *bgp.BGPMessage + recvOpen *bgp.BGPMessage + state bgp.FSMState + timestamp time.Time } type watcher interface { notify(watcherEventType) chan watcherEvent restart(string) error stop() + watchingEventTypes() []watcherEventType } type mrtWatcherOp struct { @@ -173,6 +191,10 @@ func (w *mrtWatcher) loop() error { } } +func (w *mrtWatcher) watchingEventTypes() []watcherEventType { + return []watcherEventType{WATCHER_EVENT_UPDATE_MSG} +} + func mrtFileOpen(filename string) (*os.File, error) { file, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644) if err != nil { |