FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ipfix_logging.h
Go to the documentation of this file.
1 /*
2  * ipfix_logging.h - NAT Events IPFIX logging
3  *
4  * Copyright (c) 2016 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __included_nat_lib_ipfix_logging_h__
18 #define __included_nat_lib_ipfix_logging_h__
19 
20 #include <vlib/buffer.h>
21 #include <vlib/node.h>
22 
23 #include <nat/lib/lib.h>
24 
25 typedef enum {
35 } nat_event_t;
36 
37 typedef enum {
42 
43 typedef struct {
44 
45  /** ipfix buffers under construction */
55 
56  /** frames containing ipfix buffers */
66 
67  /** next record offset */
77 
79 
80 typedef struct {
81  /** NAT plugin IPFIX logging enabled */
83 
84  /** Time reference pair */
87 
88  /* Per thread data */
90 
91  /** template IDs */
101 
102  /** stream index */
104 
105  /** vector of worker vlib mains */
107 
108  /** nat data callbacks call counter */
110 
112 
114 
116 
118 int nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port);
120  u32 nat_src_ip,
121  nat_protocol_t nat_proto,
122  u16 src_port, u16 nat_src_port,
123  u32 fib_index);
125  u32 nat_src_ip,
126  nat_protocol_t nat_proto,
127  u16 src_port, u16 nat_src_port,
128  u32 fib_index);
131  u32 limit, u32 src_ip);
135  ip6_address_t * src_ip,
136  ip4_address_t * nat_src_ip, u8 proto,
137  u16 src_port, u16 nat_src_port,
138  ip6_address_t * dst_ip,
139  ip4_address_t * nat_dst_ip,
140  u16 dst_port, u16 nat_dst_port,
141  u32 vrf_id, u8 is_create);
143  ip6_address_t * src_ip,
144  ip4_address_t * nat_src_ip, u8 proto,
145  u16 src_port, u16 nat_src_port,
146  u32 vrf_id, u8 is_create);
147 
148 #endif /* __included_nat_lib_ipfix_logging_h__ */
lib.h
NAT port/address allocation lib.
nat_ipfix_logging_main_t::call_counter
u16 call_counter
nat data callbacks call counter
Definition: ipfix_logging.h:109
nat_ipfix_per_thread_data_t::nat64_ses_frame
vlib_frame_t * nat64_ses_frame
Definition: ipfix_logging.h:65
NAT64_SESSION_CREATE
@ NAT64_SESSION_CREATE
Definition: ipfix_logging.h:29
nat_ipfix_per_thread_data_t::max_bibs_buffer
vlib_buffer_t * max_bibs_buffer
Definition: ipfix_logging.h:50
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:495
dst_port
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
nat_ipfix_logging_main_t::max_bibs_template_id
u16 max_bibs_template_id
Definition: ipfix_logging.h:96
QUOTA_EXCEEDED
@ QUOTA_EXCEEDED
Definition: ipfix_logging.h:34
buffer.h
nat_ipfix_logging_main_t::per_thread_data
nat_ipfix_per_thread_data_t * per_thread_data
Definition: ipfix_logging.h:89
nat_ipfix_logging_main_t::enabled
u8 enabled
NAT plugin IPFIX logging enabled.
Definition: ipfix_logging.h:82
nat_ipfix_per_thread_data_t::nat44_session_buffer
vlib_buffer_t * nat44_session_buffer
ipfix buffers under construction
Definition: ipfix_logging.h:46
nat_ipfix_logging_main_t::max_entries_per_user_template_id
u16 max_entries_per_user_template_id
Definition: ipfix_logging.h:94
nat_event_t
nat_event_t
Definition: ipfix_logging.h:25
nat_ipfix_logging_main_t::stream_index
u32 stream_index
stream index
Definition: ipfix_logging.h:103
nat_ipfix_per_thread_data_t::nat64_bib_buffer
vlib_buffer_t * nat64_bib_buffer
Definition: ipfix_logging.h:53
nat_protocol_t
nat_protocol_t
Definition: lib.h:63
nat_ipfix_logging_main_t::max_sessions_template_id
u16 max_sessions_template_id
Definition: ipfix_logging.h:95
nat_ipfix_logging_main_t::vlib_time_0
f64 vlib_time_0
Definition: ipfix_logging.h:86
nat_ipfix_logging_nat64_bib
void nat_ipfix_logging_nat64_bib(u32 thread_index, ip6_address_t *src_ip, ip4_address_t *nat_src_ip, u8 proto, u16 src_port, u16 nat_src_port, u32 vrf_id, u8 is_create)
Generate NAT64 BIB create and delete events.
Definition: ipfix_logging.c:1446
u16
unsigned short u16
Definition: types.h:57
nat_ipfix_per_thread_data_t::nat64_ses_next_record_offset
u32 nat64_ses_next_record_offset
Definition: ipfix_logging.h:76
nat_ipfix_per_thread_data_t::max_frags_ip4_next_record_offset
u32 max_frags_ip4_next_record_offset
Definition: ipfix_logging.h:73
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
nat_ipfix_logging_main_t::nat44_session_template_id
u16 nat44_session_template_id
template IDs
Definition: ipfix_logging.h:92
nat_ipfix_logging_nat44_ses_create
void nat_ipfix_logging_nat44_ses_create(u32 thread_index, u32 src_ip, u32 nat_src_ip, nat_protocol_t nat_proto, u16 src_port, u16 nat_src_port, u32 fib_index)
Generate NAT44 session create event.
Definition: ipfix_logging.c:1320
vlib_frame_t
Definition: node.h:372
MAX_BIB_ENTRIES
@ MAX_BIB_ENTRIES
Definition: ipfix_logging.h:39
NAT64_BIB_DELETE
@ NAT64_BIB_DELETE
Definition: ipfix_logging.h:32
nat_ipfix_per_thread_data_t::nat64_bib_next_record_offset
u32 nat64_bib_next_record_offset
Definition: ipfix_logging.h:75
NAT44_SESSION_CREATE
@ NAT44_SESSION_CREATE
Definition: ipfix_logging.h:27
nat_ipfix_logging_main_t::max_frags_ip6_template_id
u16 max_frags_ip6_template_id
Definition: ipfix_logging.h:98
nat_ipfix_logging_main_t::milisecond_time_0
u64 milisecond_time_0
Time reference pair.
Definition: ipfix_logging.h:85
nat_ipfix_per_thread_data_t::nat44_session_frame
vlib_frame_t * nat44_session_frame
frames containing ipfix buffers
Definition: ipfix_logging.h:57
nat_ipfix_logging_max_sessions
void nat_ipfix_logging_max_sessions(u32 thread_index, u32 limit)
Generate maximum session entries exceeded event.
Definition: ipfix_logging.c:1410
nat_ipfix_per_thread_data_t::max_bibs_frame
vlib_frame_t * max_bibs_frame
Definition: ipfix_logging.h:61
nat_ipfix_logging_main
nat_ipfix_logging_main_t nat_ipfix_logging_main
Definition: ipfix_logging.c:28
nat_ipfix_per_thread_data_t::max_frags_ip4_buffer
vlib_buffer_t * max_frags_ip4_buffer
Definition: ipfix_logging.h:51
nat_ipfix_logging_main_t::nat64_ses_template_id
u16 nat64_ses_template_id
Definition: ipfix_logging.h:100
nat_ipfix_logging_main_t::worker_vms
vlib_main_t ** worker_vms
vector of worker vlib mains
Definition: ipfix_logging.h:106
nat_ipfix_per_thread_data_t::nat44_session_next_record_offset
u32 nat44_session_next_record_offset
next record offset
Definition: ipfix_logging.h:68
nat_ipfix_logging_nat64_session
void nat_ipfix_logging_nat64_session(u32 thread_index, ip6_address_t *src_ip, ip4_address_t *nat_src_ip, u8 proto, u16 src_port, u16 nat_src_port, ip6_address_t *dst_ip, ip4_address_t *nat_dst_ip, u16 dst_port, u16 nat_dst_port, u32 vrf_id, u8 is_create)
Generate NAT64 session create and delete events.
Definition: ipfix_logging.c:1479
dst_ip
vl_api_address_t dst_ip
Definition: udp.api:44
nat_ipfix_logging_init
void nat_ipfix_logging_init(vlib_main_t *vm)
Initialize NAT plugin IPFIX logging.
Definition: ipfix_logging.c:1609
nat_ipfix_per_thread_data_t::max_sessions_buffer
vlib_buffer_t * max_sessions_buffer
Definition: ipfix_logging.h:49
nat_ipfix_logging_nat44_ses_delete
void nat_ipfix_logging_nat44_ses_delete(u32 thread_index, u32 src_ip, u32 nat_src_ip, nat_protocol_t nat_proto, u16 src_port, u16 nat_src_port, u32 fib_index)
Generate NAT44 session delete event.
Definition: ipfix_logging.c:1346
nat_ipfix_logging_main_t::nat64_bib_template_id
u16 nat64_bib_template_id
Definition: ipfix_logging.h:99
nat_ipfix_per_thread_data_t::max_entries_per_user_next_record_offset
u32 max_entries_per_user_next_record_offset
Definition: ipfix_logging.h:70
src_port
vl_api_ip_port_and_mask_t src_port
Definition: flow_types.api:91
f64
double f64
Definition: types.h:142
nat_ipfix_logging_max_bibs
void nat_ipfix_logging_max_bibs(u32 thread_index, u32 limit)
Generate maximum BIB entries exceeded event.
Definition: ipfix_logging.c:1425
ip4_address_t
Definition: ip4_packet.h:50
nat_ipfix_per_thread_data_t::max_frags_ip6_buffer
vlib_buffer_t * max_frags_ip6_buffer
Definition: ipfix_logging.h:52
MAX_ENTRIES_PER_USER
@ MAX_ENTRIES_PER_USER
Definition: ipfix_logging.h:40
nat_ipfix_per_thread_data_t::max_bibs_next_record_offset
u32 max_bibs_next_record_offset
Definition: ipfix_logging.h:72
NAT44_SESSION_DELETE
@ NAT44_SESSION_DELETE
Definition: ipfix_logging.h:28
nat_ipfix_logging_enabled
int nat_ipfix_logging_enabled()
Definition: ipfix_logging.c:1269
nat_ipfix_per_thread_data_t::max_entries_per_user_frame
vlib_frame_t * max_entries_per_user_frame
Definition: ipfix_logging.h:59
NAT_ADDRESSES_EXHAUTED
@ NAT_ADDRESSES_EXHAUTED
Definition: ipfix_logging.h:26
nat_ipfix_per_thread_data_t::nat64_ses_buffer
vlib_buffer_t * nat64_ses_buffer
Definition: ipfix_logging.h:54
nat_ipfix_per_thread_data_t::addr_exhausted_frame
vlib_frame_t * addr_exhausted_frame
Definition: ipfix_logging.h:58
u64
unsigned long u64
Definition: types.h:89
NAT64_SESSION_DELETE
@ NAT64_SESSION_DELETE
Definition: ipfix_logging.h:30
NAT_PORTS_EXHAUSTED
@ NAT_PORTS_EXHAUSTED
Definition: ipfix_logging.h:33
nat_ipfix_logging_main_t
Definition: ipfix_logging.h:80
nat_ipfix_per_thread_data_t
Definition: ipfix_logging.h:43
u32
unsigned int u32
Definition: types.h:88
nat_ipfix_per_thread_data_t::max_frags_ip6_next_record_offset
u32 max_frags_ip6_next_record_offset
Definition: ipfix_logging.h:74
nat_ipfix_per_thread_data_t::max_sessions_frame
vlib_frame_t * max_sessions_frame
Definition: ipfix_logging.h:60
nat_ipfix_per_thread_data_t::max_frags_ip4_frame
vlib_frame_t * max_frags_ip4_frame
Definition: ipfix_logging.h:62
src_ip
vl_api_address_t src_ip
Definition: wireguard.api:38
MAX_SESSION_ENTRIES
@ MAX_SESSION_ENTRIES
Definition: ipfix_logging.h:38
nat_ipfix_logging_enable_disable
int nat_ipfix_logging_enable_disable(int enable, u32 domain_id, u16 src_port)
Enable/disable NAT plugin IPFIX logging.
Definition: ipfix_logging.c:1524
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
nat_ipfix_per_thread_data_t::nat64_bib_frame
vlib_frame_t * nat64_bib_frame
Definition: ipfix_logging.h:64
vrf_id
u32 vrf_id
Definition: nat44_ed.api:1053
nat_ipfix_per_thread_data_t::addr_exhausted_buffer
vlib_buffer_t * addr_exhausted_buffer
Definition: ipfix_logging.h:47
nat_ipfix_logging_main_t::max_frags_ip4_template_id
u16 max_frags_ip4_template_id
Definition: ipfix_logging.h:97
nat_ipfix_logging_addresses_exhausted
void nat_ipfix_logging_addresses_exhausted(u32 thread_index, u32 pool_id)
Generate NAT addresses exhausted event.
Definition: ipfix_logging.c:1367
nat_ipfix_per_thread_data_t::addr_exhausted_next_record_offset
u32 addr_exhausted_next_record_offset
Definition: ipfix_logging.h:69
nat_ipfix_per_thread_data_t::max_frags_ip6_frame
vlib_frame_t * max_frags_ip6_frame
Definition: ipfix_logging.h:63
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
quota_exceed_event_t
quota_exceed_event_t
Definition: ipfix_logging.h:37
nat_ipfix_logging_main_t::addr_exhausted_template_id
u16 addr_exhausted_template_id
Definition: ipfix_logging.h:93
NAT64_BIB_CREATE
@ NAT64_BIB_CREATE
Definition: ipfix_logging.h:31
nat_ipfix_logging_max_entries_per_user
void nat_ipfix_logging_max_entries_per_user(u32 thread_index, u32 limit, u32 src_ip)
Generate maximum entries per user exceeded event.
Definition: ipfix_logging.c:1383
nat_ipfix_per_thread_data_t::max_sessions_next_record_offset
u32 max_sessions_next_record_offset
Definition: ipfix_logging.h:71
node.h
nat_ipfix_per_thread_data_t::max_entries_per_user_buffer
vlib_buffer_t * max_entries_per_user_buffer
Definition: ipfix_logging.h:48
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111