William A. Kennington III | 7d6fa42 | 2021-02-08 17:04:02 -0800 | [diff] [blame^] | 1 | #include <ncsi_sockio.h> |
| 2 | #include <ncsi_state_machine.h> |
| 3 | #include <net_config.h> |
| 4 | |
| 5 | #include <iostream> |
| 6 | |
| 7 | int main(int argc, char* argv[]) |
| 8 | { |
| 9 | if (argc != 2) |
| 10 | { |
| 11 | std::cout << "Usage: " << argv[0] << " <interface_name>" << std::endl; |
| 12 | return -1; |
| 13 | } |
| 14 | |
| 15 | std::string iface_name(argv[1]); |
| 16 | |
| 17 | net::PhosphorConfig net_config(iface_name); |
| 18 | net::IFace eth(iface_name); |
| 19 | |
| 20 | ncsi::SockIO ncsi_sock; |
| 21 | ncsi_sock.init(); |
| 22 | ncsi_sock.bind_to_iface(eth); |
| 23 | ncsi_sock.filter_vlans(); |
| 24 | |
| 25 | ncsi::StateMachine ncsi_fsm; |
| 26 | ncsi_fsm.set_sockio(&ncsi_sock); |
| 27 | ncsi_fsm.set_net_config(&net_config); |
| 28 | |
| 29 | // If run ever returns -- it's an error. |
| 30 | ncsi_fsm.run(); |
| 31 | |
| 32 | return -1; |
| 33 | } |