FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
gbp_endpoint.h
Go to the documentation of this file.
1 /*
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:
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 #ifndef __GBP_ENDPOINT_H__
17 #define __GBP_ENDPOINT_H__
18 
19 #include <plugins/gbp/gbp_types.h>
20 #include <vnet/ip/ip.h>
21 
22 /**
23  * The key for an Endpoint
24  */
25 typedef struct gbp_endpoint_key_t_
26 {
27  /**
28  * The interface on which the EP is connected
29  */
31 
32  /**
33  * The IP[46] address of the endpoint
34  */
35  ip46_address_t gek_ip;
37 
38 /**
39  * A Group Based Policy Endpoint.
40  * This is typcially a VM on the local compute node for which policy must be
41  * locally applied
42  */
43 typedef struct gbp_endpoint_t_
44 {
45  /**
46  * The endpoint's interface and IP address
47  */
49 
50  /**
51  * The endpoint's designated EPG
52  */
55 
56 /**
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.
60  */
61 typedef struct gbp_itf_t_
62 {
65 } gbp_itf_t;
66 
67 /**
68  * Interface to source EPG DB - a per-interface vector
69  */
70 typedef struct gbp_itf_to_epg_db_t_
71 {
74 
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);
78 
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);
81 
82 /**
83  * Port to EPG mapping management
84  */
85 extern void gbp_itf_epg_update (u32 sw_if_index, epg_id_t src_epg,
86  u8 do_policy);
87 extern void gbp_itf_epg_delete (u32 sw_if_index);
88 
89 /**
90  * DP functions and databases
91  */
93 
94 /**
95  * Get the source EPG for a port/interface
96  */
98 gbp_port_to_epg (u32 sw_if_index)
99 {
100  return (gbp_itf_to_epg_db.gte_vec[sw_if_index].gi_epg);
101 }
102 
103 #endif
104 
105 /*
106  * fd.io coding-style-patch-verification: ON
107  *
108  * Local Variables:
109  * eval: (c-set-style "gnu")
110  * End:
111  */
gbp_itf_to_epg_db_t gbp_itf_to_epg_db
DP functions and databases.
Definition: gbp_endpoint.c:55
A Group Based Policy Endpoint.
Definition: gbp_endpoint.h:43
void gbp_itf_epg_delete(u32 sw_if_index)
Definition: gbp_endpoint.c:117
Interface to source EPG DB - a per-interface vector.
Definition: gbp_endpoint.h:70
gbp_endpoint_key_t * ge_key
The endpoint&#39;s interface and IP address.
Definition: gbp_endpoint.h:48
unsigned char u8
Definition: types.h:56
struct gbp_endpoint_key_t_ gbp_endpoint_key_t
The key for an Endpoint.
#define always_inline
Definition: clib.h:92
struct gbp_itf_t_ gbp_itf_t
Result of a interface to EPG mapping.
u32 gek_sw_if_index
The interface on which the EP is connected.
Definition: gbp_endpoint.h:30
struct gbp_itf_to_epg_db_t_ gbp_itf_to_epg_db_t
Interface to source EPG DB - a per-interface vector.
u32 epg_id_t
Definition: gbp_types.h:21
unsigned int u32
Definition: types.h:88
epg_id_t gi_epg
Definition: gbp_endpoint.h:63
static u32 gbp_port_to_epg(u32 sw_if_index)
Get the source EPG for a port/interface.
Definition: gbp_endpoint.h:98
ip46_address_t gek_ip
The IP[46] address of the endpoint.
Definition: gbp_endpoint.h:35
Result of a interface to EPG mapping.
Definition: gbp_endpoint.h:61
gbp_itf_t * gte_vec
Definition: gbp_endpoint.h:72
The key for an Endpoint.
Definition: gbp_endpoint.h:25
struct gbp_endpoint_t_ gbp_endpoint_t
A Group Based Policy Endpoint.
void gbp_itf_epg_update(u32 sw_if_index, epg_id_t src_epg, u8 do_policy)
Port to EPG mapping management.
Definition: gbp_endpoint.c:98
long ctx[MAX_CONNS]
Definition: main.c:126
int(* gbp_endpoint_cb_t)(gbp_endpoint_t *gbpe, void *ctx)
Definition: gbp_endpoint.h:79
void gbp_endpoint_delete(u32 sw_if_index, const ip46_address_t *ip)
Definition: gbp_endpoint.c:192
void gbp_endpoint_walk(gbp_endpoint_cb_t cb, void *ctx)
Definition: gbp_endpoint.c:220
epg_id_t ge_epg_id
The endpoint&#39;s designated EPG.
Definition: gbp_endpoint.h:53
u32 gi_ref_count
Definition: gbp_endpoint.h:64
int gbp_endpoint_update(u32 sw_if_index, const ip46_address_t *ip, epg_id_t epg_id)
Definition: gbp_endpoint.c:135