FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
gbp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 /**
17  * Group Base Policy (GBP) defines:
18  * - endpoints: typically a VM or container that is connected to the
19  * virtual switch/router (i.e. to VPP)
20  * - endpoint-group: (EPG) a collection of endpoints
21  * - policy: rules determining which traffic can pass between EPGs a.k.a
22  * a 'contract'
23  *
24  * Here, policy is implemented via an ACL.
25  * EPG classification for transit packets is determined by:
26  * - source EPG: from the packet's input interface
27  * - destination EPG: from the packet's destination IP address.
28  *
29  */
30 
31 #ifndef included_vnet_gbp_h
32 #define included_vnet_gbp_h
33 
34 #include <vlib/vlib.h>
35 #include <vnet/vnet.h>
36 #include <vnet/ip/ip.h>
37 
38 typedef u32 epg_id_t;
39 #define EPG_INVALID (~0)
40 
41 /**
42  * The key for an Endpoint
43  */
44 typedef struct gbp_endpoint_key_t_
45 {
46  /**
47  * The interface on which the EP is connected
48  */
50 
51  /**
52  * The IP[46] address of the endpoint
53  */
54  ip46_address_t gek_ip;
56 
57 /**
58  * A Group Based Policy Endpoint.
59  * This is typcially a VM on the local compute node for which policy must be
60  * locally applied
61  */
62 typedef struct gbp_endpoint_t_
63 {
64  /**
65  * The endpoint's interface and IP address
66  */
68 
69  /**
70  * The endpoint's designated EPG
71  */
74 
75 extern void 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);
78 
79 typedef int (*gbp_endpoint_cb_t) (gbp_endpoint_t * gbpe, void *ctx);
80 extern void gbp_endpoint_walk (gbp_endpoint_cb_t bgpe, void *ctx);
81 
82 
83 /**
84  * The key for an Contract
85  */
86 typedef struct gbp_contract_key_t_
87 {
88  union
89  {
90  struct
91  {
92  /**
93  * source and destination EPGs for which the ACL applies
94  */
97  };
99  };
101 
102 /**
103  * A Group Based Policy Contract.
104  * Determines the ACL that applies to traffic pass between two endpoint groups
105  */
106 typedef struct gbp_contract_t_
107 {
108  /**
109  * source and destination EPGs
110  */
112 
113  /**
114  * The ACL to apply for packets from the source to the destination EPG
115  */
118 
119 
120 extern void gbp_contract_update (epg_id_t src_epg,
121  epg_id_t dst_epg, u32 acl_index);
122 extern void gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg);
123 
124 typedef int (*gbp_contract_cb_t) (gbp_contract_t * gbpe, void *ctx);
125 extern void gbp_contract_walk (gbp_contract_cb_t bgpe, void *ctx);
126 
127 #endif
128 
129 /*
130  * fd.io coding-style-patch-verification: ON
131  *
132  * Local Variables:
133  * eval: (c-set-style "gnu")
134  * End:
135  */
A Group Based Policy Endpoint.
Definition: gbp.h:62
gbp_contract_key_t gc_key
source and destination EPGs
Definition: gbp.h:111
int(* gbp_endpoint_cb_t)(gbp_endpoint_t *gbpe, void *ctx)
Definition: gbp.h:79
void gbp_contract_delete(epg_id_t src_epg, epg_id_t dst_epg)
Definition: gbp.c:249
The key for an Contract.
Definition: gbp.h:86
void gbp_endpoint_delete(u32 sw_if_index, const ip46_address_t *ip)
Definition: gbp.c:197
gbp_endpoint_key_t * ge_key
The endpoint&#39;s interface and IP address.
Definition: gbp.h:67
u32 gek_sw_if_index
The interface on which the EP is connected.
Definition: gbp.h:49
struct gbp_contract_t_ gbp_contract_t
A Group Based Policy Contract.
unsigned long u64
Definition: types.h:89
void gbp_contract_update(epg_id_t src_epg, epg_id_t dst_epg, u32 acl_index)
Definition: gbp.c:238
void gbp_endpoint_update(u32 sw_if_index, const ip46_address_t *ip, epg_id_t epg_id)
Definition: gbp.c:164
struct gbp_endpoint_key_t_ gbp_endpoint_key_t
The key for an Endpoint.
void gbp_contract_walk(gbp_contract_cb_t bgpe, void *ctx)
Definition: gbp.c:260
ip46_address_t gek_ip
The IP[46] address of the endpoint.
Definition: gbp.h:54
struct gbp_endpoint_t_ gbp_endpoint_t
A Group Based Policy Endpoint.
epg_id_t gck_src
source and destination EPGs for which the ACL applies
Definition: gbp.h:95
The key for an Endpoint.
Definition: gbp.h:44
unsigned int u32
Definition: types.h:88
long ctx[MAX_CONNS]
Definition: main.c:126
epg_id_t ge_epg_id
The endpoint&#39;s designated EPG.
Definition: gbp.h:72
u32 epg_id_t
Group Base Policy (GBP) defines:
Definition: gbp.h:38
u32 gc_acl_index
The ACL to apply for packets from the source to the destination EPG.
Definition: gbp.h:116
int(* gbp_contract_cb_t)(gbp_contract_t *gbpe, void *ctx)
Definition: gbp.h:124
void gbp_endpoint_walk(gbp_endpoint_cb_t bgpe, void *ctx)
Definition: gbp.c:224
struct gbp_contract_key_t_ gbp_contract_key_t
The key for an Contract.
epg_id_t gck_dst
Definition: gbp.h:96
A Group Based Policy Contract.
Definition: gbp.h:106