2 * Copyright (c) 2018 Cisco and/or its affiliates.
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 __GBP_CONTRACT_H__
17 #define __GBP_CONTRACT_H__
19 #include <plugins/gbp/gbp_types.h>
22 * The key for an Contract
24 typedef struct gbp_contract_key_t_
31 * source and destination EPGs for which the ACL applies
41 * A Group Based Policy Contract.
42 * Determines the ACL that applies to traffic pass between two endpoint groups
44 typedef struct gbp_contract_t_
47 * source and destination EPGs
49 gbp_contract_key_t gc_key;
52 * The ACL to apply for packets from the source to the destination EPG
58 * EPG src,dst pair to ACL mapping table, aka contract DB
60 typedef struct gbp_contract_db_t_
63 * We can form a u64 key from the pair, so use a simple hash table
68 extern void gbp_contract_update (epg_id_t src_epg,
69 epg_id_t dst_epg, u32 acl_index);
70 extern void gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg);
72 typedef int (*gbp_contract_cb_t) (gbp_contract_t * gbpe, void *ctx);
73 extern void gbp_contract_walk (gbp_contract_cb_t bgpe, void *ctx);
77 * DP functions and databases
79 extern gbp_contract_db_t gbp_contract_db;
82 gbp_acl_lookup (gbp_contract_key_t * key)
86 p = hash_get (gbp_contract_db.gc_hash, key->as_u64);
97 * fd.io coding-style-patch-verification: ON
100 * eval: (c-set-style "gnu")