blob: f9db1eef3bb7b53f4ac7c9f06bb030b851d3e241 [file] [log] [blame]
Brandon Kimdab96f12021-02-18 11:21:37 -08001// Copyright 2021 Google LLC
2//
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
William A. Kennington III7d6fa422021-02-08 17:04:02 -080015#include <ncsi_sockio.h>
16#include <ncsi_state_machine.h>
17#include <net_config.h>
18
19#include <iostream>
20
21int main(int argc, char* argv[])
22{
23 if (argc != 2)
24 {
25 std::cout << "Usage: " << argv[0] << " <interface_name>" << std::endl;
26 return -1;
27 }
28
29 std::string iface_name(argv[1]);
30
31 net::PhosphorConfig net_config(iface_name);
32 net::IFace eth(iface_name);
33
34 ncsi::SockIO ncsi_sock;
35 ncsi_sock.init();
36 ncsi_sock.bind_to_iface(eth);
37 ncsi_sock.filter_vlans();
38
39 ncsi::StateMachine ncsi_fsm;
40 ncsi_fsm.set_sockio(&ncsi_sock);
41 ncsi_fsm.set_net_config(&net_config);
42
43 // If run ever returns -- it's an error.
44 ncsi_fsm.run();
45
46 return -1;
47}