]>
git.proxmox.com Git - mirror_ovs.git/blob - ovsdb/condition.h
1 /* Copyright (c) 2009, 2010 Nicira, Inc.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef OVSDB_CONDITION_H
17 #define OVSDB_CONDITION_H 1
21 #include "ovsdb-data.h"
24 struct ovsdb_table_schema
;
27 /* These list is ordered in ascending order of the fraction of tables row that
28 * they are (heuristically) expected to leave in query results. */
29 #define OVSDB_FUNCTIONS \
30 OVSDB_FUNCTION(OVSDB_F_EQ, "==") \
31 OVSDB_FUNCTION(OVSDB_F_INCLUDES, "includes") \
32 OVSDB_FUNCTION(OVSDB_F_LE, "<=") \
33 OVSDB_FUNCTION(OVSDB_F_LT, "<") \
34 OVSDB_FUNCTION(OVSDB_F_GE, ">=") \
35 OVSDB_FUNCTION(OVSDB_F_GT, ">") \
36 OVSDB_FUNCTION(OVSDB_F_EXCLUDES, "excludes") \
37 OVSDB_FUNCTION(OVSDB_F_NE, "!=")
40 #define OVSDB_FUNCTION(ENUM, NAME) ENUM,
45 struct ovsdb_error
*ovsdb_function_from_string(const char *,
46 enum ovsdb_function
*)
48 const char *ovsdb_function_to_string(enum ovsdb_function
);
51 enum ovsdb_function function
;
52 const struct ovsdb_column
*column
;
53 struct ovsdb_datum arg
;
56 struct ovsdb_condition
{
57 struct ovsdb_clause
*clauses
;
61 #define OVSDB_CONDITION_INITIALIZER { NULL, 0 }
63 struct ovsdb_error
*ovsdb_condition_from_json(
64 const struct ovsdb_table_schema
*,
65 const struct json
*, struct ovsdb_symbol_table
*,
66 struct ovsdb_condition
*) WARN_UNUSED_RESULT
;
67 struct json
*ovsdb_condition_to_json(const struct ovsdb_condition
*);
68 void ovsdb_condition_destroy(struct ovsdb_condition
*);
69 bool ovsdb_condition_evaluate(const struct ovsdb_row
*,
70 const struct ovsdb_condition
*);
72 #endif /* ovsdb/condition.h */