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 * The value for an Contract
43 typedef struct gbp_contract_value_t_
50 * lookup context and acl index
57 } gbp_contract_value_t;
60 * A Group Based Policy Contract.
61 * Determines the ACL that applies to traffic pass between two endpoint groups
63 typedef struct gbp_contract_t_
66 * source and destination EPGs
68 gbp_contract_key_t gc_key;
71 * The ACL to apply for packets from the source to the destination EPG
73 gbp_contract_value_t gc_value;
77 * EPG src,dst pair to ACL mapping table, aka contract DB
79 typedef struct gbp_contract_db_t_
82 * We can form a u64 key from the pair, so use a simple hash table
87 extern void gbp_contract_update (epg_id_t src_epg,
88 epg_id_t dst_epg, u32 acl_index);
89 extern void gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg);
91 typedef int (*gbp_contract_cb_t) (gbp_contract_t * gbpe, void *ctx);
92 extern void gbp_contract_walk (gbp_contract_cb_t bgpe, void *ctx);
96 * DP functions and databases
98 extern gbp_contract_db_t gbp_contract_db;
101 gbp_acl_lookup (gbp_contract_key_t * key)
105 p = hash_get (gbp_contract_db.gc_hash, key->as_u32);
116 * fd.io coding-style-patch-verification: ON
119 * eval: (c-set-style "gnu")