Example #1
0
func (self *bucket) UnmarshalBinary(data []byte) error {
	msg := ofp4.Bucket(data)
	self.weight = msg.Weight()
	self.watchPort = msg.WatchPort()
	self.watchGroup = msg.WatchGroup()
	self.actionSet = makeActionSet()

	if err := self.actionSet.UnmarshalBinary(msg.Actions()); err != nil {
		return err
	}
	return nil
}
Example #2
0
func (self *bucketList) UnmarshalBinary(data []byte) error {
	var buckets []bucket
	for cur := 0; cur < len(data); {
		msg := ofp4.Bucket(data[cur:])
		var b bucket
		if err := b.UnmarshalBinary(msg); err != nil {
			return err
		}
		buckets = append(buckets, b)
		cur += msg.Len()
	}
	*self = buckets
	return nil
}