// Return a MatchField for mpls Bos matching
322296
func NewMplsBosField(mplsBos uint8) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_MPLS_BOS
	f.HasMask = false

	mplsBosField := new(MplsBosField)
	mplsBosField.MplsBos = mplsBos
	f.Value = mplsBosField
	f.Length = uint8(mplsBosField.Len())
	return f
}
1194321
func NewIpv4DstField(ipDst net.IP, ipDstMask *net.IP) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_IPV4_DST
	f.HasMask = false

	ipDstField := new(Ipv4DstField)
	ipDstField.Ipv4Dst = ipDst
	f.Value = ipDstField
	f.Length = uint8(ipDstField.Len())

	// Add the mask
	if ipDstMask != nil {
		mask := new(Ipv4DstField)
		mask.Ipv4Dst = *ipDstMask
		f.Mask = mask
		f.HasMask = true
		f.Length += uint8(mask.Len())
	}

	return f
}
693227
func NewIpv4SrcField(ipSrc net.IP, ipSrcMask *net.IP) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_IPV4_SRC
	f.HasMask = false

	ipSrcField := new(Ipv4SrcField)
	ipSrcField.Ipv4Src = ipSrc
	f.Value = ipSrcField
	f.Length = uint8(ipSrcField.Len())

	// Add the mask
	if ipSrcMask != nil {
		mask := new(Ipv4SrcField)
		mask.Ipv4Src = *ipSrcMask
		f.Mask = mask
		f.HasMask = true
		f.Length += uint8(mask.Len())
	}

	return f
}
1326110
func validateMatchClient(value string) bool {
	match_client := [5]string{"MAC_ADDRESS", "CLIENT_ID", "RESERVED", "CIRCUIT_ID", "REMOTE_ID"}

	for _, val := range match_client {
		if val == value {
			return true
		}
	}
	return false
}
399917
func (c *MatchingCache) GetMatchingObject(labelObj objectWithMeta) (controller interface{}, exists bool) {
	key := keyFunc(labelObj)
	// NOTE: we use Lock() instead of RLock() here because lru's Get() method also modifies state(
	// it need update the least recently usage information). So we can not call it concurrently.
	c.mutex.Lock()
	defer c.mutex.Unlock()
	return c.cache.Get(key)
}
232927
func matchFind(ctx *findContext, fileContent contentMessage) (match bool) {
	match = true
	prefixPath := ctx.targetURL
	// Add separator only if targetURL doesn't already have separator.
	if !strings.HasPrefix(prefixPath, string(ctx.clnt.GetURL().Separator)) {
		prefixPath = ctx.targetURL + string(ctx.clnt.GetURL().Separator)
	}
	// Trim the prefix such that we will apply file path matching techniques
	// on path excluding the starting prefix.
	path := strings.TrimPrefix(fileContent.Key, prefixPath)
	if match && ctx.ignorePattern != "" {
		match = !pathMatch(ctx.ignorePattern, path)
	}
	if match && ctx.namePattern != "" {
		match = nameMatch(ctx.namePattern, path)
	}
	if match && ctx.pathPattern != "" {
		match = pathMatch(ctx.pathPattern, path)
	}
	if match && ctx.regexPattern != "" {
		match = regexMatch(ctx.regexPattern, path)
	}
	if match && ctx.olderThan != "" {
		match = !isOlder(fileContent.Time, ctx.olderThan)
	}
	if match && ctx.newerThan != "" {
		match = !isNewer(fileContent.Time, ctx.newerThan)
	}
	if match && ctx.largerSize > 0 {
		match = int64(ctx.largerSize) < fileContent.Size
	}
	if match && ctx.smallerSize > 0 {
		match = int64(ctx.smallerSize) > fileContent.Size
	}
	return match
}
1025972
func (route *Route) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
	rss, _, err := vcursor.ResolveDestinations(route.Keyspace.Name, nil, []key.Destination{key.DestinationAnyShard{}})
	if err != nil {
		return nil, err
	}
	if len(rss) != 1 {
		// This code is unreachable. It's just a sanity check.
		return nil, fmt.Errorf("no shards for keyspace: %s", route.Keyspace.Name)
	}
	qr, err := execShard(vcursor, route.FieldQuery, bindVars, rss[0], false /* isDML */, false /* canAutocommit */)
	if err != nil {
		return nil, err
	}
	return qr.Truncate(route.TruncateColumnCount), nil
}
167043
func NewIpProtoField(protocol uint8) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_IP_PROTO
	f.HasMask = false

	ipProtoField := new(IpProtoField)
	ipProtoField.protocol = protocol
	f.Value = ipProtoField
	f.Length = uint8(ipProtoField.Len())

	return f
}
8066
func matchLevel(l *level, toks []string, results *SublistResult) {
	var pwc, n *node
	for i, t := range toks {
		if l == nil {
			return
		}
		if l.fwc != nil {
			addNodeToResults(l.fwc, results)
		}
		if pwc = l.pwc; pwc != nil {
			matchLevel(pwc.next, toks[i+1:], results)
		}
		n = l.nodes[t]
		if n != nil {
			l = n.next
		} else {
			l = nil
		}
	}
	if n != nil {
		addNodeToResults(n, results)
	}
	if pwc != nil {
		addNodeToResults(pwc, results)
	}
}
540484
func NewInPortField(inPort uint32) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_IN_PORT
	f.HasMask = false

	inPortField := new(InPortField)
	inPortField.InPort = inPort
	f.Value = inPortField
	f.Length = uint8(inPortField.Len())

	return f
}
41445
func (v *GuessProtocolStruct) GetMapField() (o map[string]string) {
	if v != nil && v.MapField != nil {
		return v.MapField
	}

	return
}
268068
func matchLevel(l *level, toks []string, results *[]interface{}) {
	var pwc, n *node
	for i, t := range toks {
		if l == nil {
			return
		}
		if l.fwc != nil {
			*results = append(*results, l.fwc.elements...)
		}
		if pwc = l.pwc; pwc != nil {
			matchLevel(pwc.next, toks[i+1:], results)
		}
		n = l.nodes[t]
		if n != nil {
			l = n.next
		} else {
			l = nil
		}
	}
	if pwc != nil {
		*results = append(*results, pwc.elements...)
	}
	if n != nil {
		*results = append(*results, n.elements...)
	}
}
53462
func (q *SimpleQueryStringQuery) MinimumShouldMatch(minimumShouldMatch string) *SimpleQueryStringQuery {
	q.minimumShouldMatch = minimumShouldMatch
	return q
}
524201
func Lte(field string, v interface{}) Matcher {
	return NewFieldMatcher(field, &cmp{value: v, token: token.LEQ})
}
641938
func MatchInPort(port ofp.PortNo) ofp.XM {
	return basic(ofp.XMTypeInPort, bytesOf(port), nil)
}
1017847
func NewField2FieldMatcher(field1, field2 string, tok token.Token) Matcher {
	return field2fieldMatcherDelegate{Field1: field1, Field2: field2, Tok: tok}
}
581723
func (r *SimpleRouter) Match(ctx context.Context, match *RouteMatch) (bool, context.Context) {
	for _, route := range r.routes {
		var matched bool
		if matched, ctx = route.Match(ctx, match); matched {
			return true, ctx
		}
	}

	return false, ctx
}