2 * snat_ipfix_logging.h - NAT Events IPFIX logging
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __included_snat_ipfix_logging_h__
18 #define __included_snat_ipfix_logging_h__
21 NAT_ADDRESSES_EXHAUTED = 3,
22 NAT44_SESSION_CREATE = 4,
23 NAT44_SESSION_DELETE = 5,
24 NAT_PORTS_EXHAUSTED = 12,
29 MAX_ENTRIES_PER_USER = 3,
30 } quota_exceed_event_t;
33 /** S-NAT IPFIX logging enabled */
36 /** ipfix buffers under construction */
37 vlib_buffer_t *nat44_session_buffer;
38 vlib_buffer_t *addr_exhausted_buffer;
39 vlib_buffer_t *max_entries_per_user_buffer;
41 /** frames containing ipfix buffers */
42 vlib_frame_t *nat44_session_frame;
43 vlib_frame_t *addr_exhausted_frame;
44 vlib_frame_t *max_entries_per_user_frame;
46 /** next record offset */
47 u32 nat44_session_next_record_offset;
48 u32 addr_exhausted_next_record_offset;
49 u32 max_entries_per_user_next_record_offset;
51 /** Time reference pair */
52 u64 milisecond_time_0;
56 u16 nat44_session_template_id;
57 u16 addr_exhausted_template_id;
58 u16 max_entries_per_user_template_id;
62 } snat_ipfix_logging_main_t;
64 extern snat_ipfix_logging_main_t snat_ipfix_logging_main;
66 void snat_ipfix_logging_init (vlib_main_t * vm);
67 int snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port);
68 void snat_ipfix_logging_nat44_ses_create (u32 src_ip, u32 nat_src_ip,
69 snat_protocol_t snat_proto,
70 u16 src_port, u16 nat_src_port,
72 void snat_ipfix_logging_nat44_ses_delete (u32 src_ip, u32 nat_src_ip,
73 snat_protocol_t snat_proto,
74 u16 src_port, u16 nat_src_port,
76 void snat_ipfix_logging_addresses_exhausted(u32 pool_id);
77 void snat_ipfix_logging_max_entries_per_user(u32 src_ip);
79 #endif /* __included_snat_ipfix_logging_h__ */