2 *------------------------------------------------------------------
4 * Contains macros and definitions that are common to both syslog and nfv9
5 * Copyright (c) 2011-2012 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
20 #ifndef __CNAT_LOG_COMMON_H__
21 #define __CNAT_LOG_COMMON_H__
24 #include <vlib/vlib.h>
25 #include <vnet/vnet.h>
29 #include "spp_timers.h"
33 * This corresponds to the length of the IMETRO SHIM Header for RODDICK
34 * For non-roddick cases, introduce an Ethernet header as well
37 #if defined(TARGET_RODDICK)
38 #define CNAT_NFV9_SHIM_HDR_OFFSET 8
39 #define CNAT_NFV9_L2_ENCAPS_OFFSET 0
41 #define CNAT_NFV9_SHIM_HDR_OFFSET 0
42 #define CNAT_NFV9_L2_ENCAPS_OFFSET 16
46 #define CNAT_NFV9_IP_HDR_OFFSET 0
48 #define CNAT_NFV9_UDP_HDR_OFFSET \
49 (CNAT_NFV9_IP_HDR_OFFSET + sizeof(ipv4_header))
51 #define CNAT_NFV9_HDR_OFFSET \
52 (CNAT_NFV9_UDP_HDR_OFFSET + sizeof(udp_hdr_type_t))
54 u32 cnat_get_sys_up_time_in_ms(void);
55 u32 cnat_get_unix_time_in_seconds(void);
56 void cnat_dump_time_change_logs(void);
57 void cnat_handle_sys_time_change (time_t current_unix_time);
59 * Maximum number of time log changes we maintain
62 #define MAX_TIME_CHANGE_LOGS (8)
66 * A timer structure to periodically send NFv9 & syslog logging packets
67 * that have been waiting to be full for a long time. This will
68 * ensure add/delete events don't get delayed too much before they
69 * are sent to the collector.
71 spp_timer_t log_timer;
74 * Whether we have initialized the NFv9 information
76 u8 cnat_log_init_done;
77 } cnat_log_global_info_t;
79 #endif /* __CNAT_LOG_COMMON_H__ */