package nom

import (
	"encoding/gob"
	"time"
)

// NodeQuery queries the information of a node.
type NodeQuery struct {
	Node UID
}

// NodeQueryResult is the result for NodeQuery.
type NodeQueryResult struct {
	Err  error
	Node Node
}

// PortQuery queries the information of a port.
type PortQuery struct {
	Port UID
}

// PortQueryResult is the result for a PortQuery.
type PortQueryResult struct {
	Err  error
	Port Port
}

// FlowStatQuery queries the flows that would match the query. If Exact is
// false, it removes all flow entries that are subsumed by the given match.
type FlowStatQuery struct {
	Match Match
	Exact bool
}

// FlowStatQueryResult is the result for a FlowStatQuery
type FlowStatQueryResult struct {
	Flow     FlowEntry
	Duration time.Duration
	PktCount uint64
	Bytes    uint64
}

func init() {
	gob.Register(FlowStatQuery{})
	gob.Register(FlowStatQueryResult{})
	gob.Register(NodeQuery{})
	gob.Register(NodeQueryResult{})
	gob.Register(PortQuery{})
	gob.Register(PortQueryResult{})
}

package nom

import (
	"encoding/gob"
	"time"
)

// NodeQuery queries the information of a node.
type NodeQuery struct {
	Node UID
}

// NodeQueryResult is the result for NodeQuery.
type NodeQueryResult struct {
	Err  error
	Node Node
}

// PortQuery queries the information of a port.
type PortQuery struct {
	Port UID
}

// PortQueryResult is the result for a PortQuery.
type PortQueryResult struct {
	Err  error
	Port Port
}

// FlowStatsQuery queries the flows that would match the query. If Exact is
// false, it removes all flow entries that are subsumed by the given match.
type FlowStatsQuery struct {
	Node  UID
	Match Match
	Exact bool
}

// FlowStatsQueryResult is the result for a FlowStatQuery
type FlowStatsQueryResult struct {
	Node  UID
	Stats []FlowStats
}

// FlowStats is the statistics of flow
type FlowStats struct {
	Match    Match
	Duration time.Duration
	Packets  uint64
	Bytes    uint64
}

func init() {
	gob.Register(FlowStatsQuery{})
	gob.Register(FlowStatsQueryResult{})
	gob.Register(NodeQuery{})
	gob.Register(NodeQueryResult{})
	gob.Register(PortQuery{})
	gob.Register(PortQueryResult{})
}

Change flow stat reply to include multiple stats
Change flow stat reply to include multiple stats
