1 /* Copyright (c) 2015, 2016 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.
24 struct sbrec_datapath_binding;
26 /* Logical port and multicast group indexes
27 * ========================================
29 * This data structure holds multiple indexes over logical ports, to allow for
30 * efficient searching for logical ports by name or number.
39 void lport_index_reset(void);
40 void lport_index_init(struct lport_index *);
41 void lport_index_fill(struct lport_index *, struct ovsdb_idl *);
42 void lport_index_remove(struct lport_index *, const struct uuid *);
43 void lport_index_clear(struct lport_index *);
44 void lport_index_destroy(struct lport_index *);
46 const struct sbrec_port_binding *lport_lookup_by_name(
47 const struct lport_index *, const char *name);
48 const struct sbrec_port_binding *lport_lookup_by_key(
49 const struct lport_index *, uint32_t dp_key, uint16_t port_key);
51 const struct lport *lport_lookup_by_uuid(
52 const struct lport_index *, const struct uuid *uuid);
55 /* Multicast group index
56 * =====================
58 * This is separate from the logical port index because of namespace issues:
59 * logical port names are globally unique, but multicast group names are only
60 * unique within the scope of a logical datapath.
62 * Multicast groups could be indexed by number also, but so far the clients do
63 * not need this index. */
65 struct mcgroup_index {
66 struct hmap by_dp_name;
70 void mcgroup_index_reset(void);
71 void mcgroup_index_init(struct mcgroup_index *);
72 void mcgroup_index_fill(struct mcgroup_index *, struct ovsdb_idl *);
73 void mcgroup_index_remove(struct mcgroup_index *, const struct uuid *);
74 void mcgroup_index_clear(struct mcgroup_index *);
75 void mcgroup_index_destroy(struct mcgroup_index *);
77 const struct sbrec_multicast_group *mcgroup_lookup_by_dp_name(
78 const struct mcgroup_index *,
79 const struct sbrec_datapath_binding *,
82 const struct mcgroup *mcgroup_lookup_by_uuid(
83 const struct mcgroup_index *, const struct uuid *uuid);
85 #endif /* ovn/lport.h */