2 * gbp.h : Group Based Policy
4 * Copyright (c) 2018 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.
18 #include <plugins/gbp/gbp_scanner.h>
19 #include <plugins/gbp/gbp_endpoint.h>
20 #include <plugins/gbp/gbp_vxlan.h>
22 vlib_log_class_t gs_logger;
24 #define GBP_SCANNER_DBG(...) \
25 vlib_log_debug (gs_logger, __VA_ARGS__);
28 gbp_scanner (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
30 uword event_type, *event_data = 0;
31 bool enabled = 0, do_scan = 0;
39 /* scan every 'inactive threshold' seconds */
40 vlib_process_wait_for_event_or_clock (vm,
41 gbp_endpoint_scan_threshold
45 vlib_process_wait_for_event (vm);
47 event_type = vlib_process_get_events (vm, &event_data);
48 vec_reset_length (event_data);
57 case GBP_ENDPOINT_SCAN_START:
61 case GBP_ENDPOINT_SCAN_STOP:
71 GBP_SCANNER_DBG ("start");
72 gbp_endpoint_scan (vm);
73 GBP_SCANNER_DBG ("stop");
80 VLIB_REGISTER_NODE (gbp_scanner_node) = {
81 .function = gbp_scanner,
82 .type = VLIB_NODE_TYPE_PROCESS,
83 .name = "gbp-scanner",
89 gbp_scanner_init (vlib_main_t * vm)
91 gs_logger = vlib_log_register_class ("gbp", "scan");
96 VLIB_INIT_FUNCTION (gbp_scanner_init);
99 * fd.io coding-style-patch-verification: ON
102 * eval: (c-set-style "gnu")