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_ENDPOINT_H__
17 #define __GBP_ENDPOINT_H__
19 #include <plugins/gbp/gbp_types.h>
20 #include <vnet/ip/ip.h>
23 * The key for an Endpoint
25 typedef struct gbp_endpoint_key_t_
28 * The interface on which the EP is connected
33 * The IP[46] address of the endpoint
35 ip46_address_t gek_ip;
39 * A Group Based Policy Endpoint.
40 * This is typcially a VM on the local compute node for which policy must be
43 typedef struct gbp_endpoint_t_
46 * The endpoint's interface and IP address
48 gbp_endpoint_key_t *ge_key;
51 * The endpoint's designated EPG
57 * Result of a interface to EPG mapping.
58 * multiple Endpoints can occur on the same interface, so this
59 * mapping needs to be reference counted.
61 typedef struct gbp_itf_t_
68 * Interface to source EPG DB - a per-interface vector
70 typedef struct gbp_itf_to_epg_db_t_
73 } gbp_itf_to_epg_db_t;
75 extern int gbp_endpoint_update (u32 sw_if_index,
76 const ip46_address_t * ip, epg_id_t epg_id);
77 extern void gbp_endpoint_delete (u32 sw_if_index, const ip46_address_t * ip);
79 typedef int (*gbp_endpoint_cb_t) (gbp_endpoint_t * gbpe, void *ctx);
80 extern void gbp_endpoint_walk (gbp_endpoint_cb_t cb, void *ctx);
83 * Port to EPG mapping management
85 extern void gbp_itf_epg_update (u32 sw_if_index, epg_id_t src_epg,
87 extern void gbp_itf_epg_delete (u32 sw_if_index);
90 * DP functions and databases
92 extern gbp_itf_to_epg_db_t gbp_itf_to_epg_db;
95 * Get the source EPG for a port/interface
98 gbp_port_to_epg (u32 sw_if_index)
100 return (gbp_itf_to_epg_db.gte_vec[sw_if_index].gi_epg);
106 * fd.io coding-style-patch-verification: ON
109 * eval: (c-set-style "gnu")