blob: 793a782ed148d5c3641709cec9bc204c1eee23f6 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include "net/base/net_export.h"
namespace net {
enum {
kDafsaNotFound = -1, // key is not in set
kDafsaFound = 0, // key is in set
// The following return values are used by the implementation of
// GetDomainAndRegistry() and are probably not generally useful.
kDafsaExceptionRule = 1, // key excluded from set via exception
kDafsaWildcardRule = 2, // key matched a wildcard rule
kDafsaPrivateRule = 4, // key matched a private rule
// Looks up the string |key| with length |key_length| in a fixed set of
// strings. The set of strings must be known at compile time. It is converted to
// a graph structure named a DAFSA (Deterministic Acyclic Finite State
// Automaton) by the script during compilation. This permits
// efficient (in time and space) lookup. The graph generated by
// takes the form of a constant byte array which should be supplied via the
// |graph| and |length| parameters. The return value is kDafsaNotFound,
// kDafsaFound, or a bitmap consisting of one or more of kDafsaExceptionRule,
// kDafsaWildcardRule and kDafsaPrivateRule ORed together.
NET_EXPORT int LookupStringInFixedSet(const unsigned char* graph,
size_t length,
const char* key,
size_t key_length);
} // namespace net