1*1285115cSWilliam A. Kennington III // Copyright 2021 Google LLC 2*1285115cSWilliam A. Kennington III // 3*1285115cSWilliam A. Kennington III // Licensed under the Apache License, Version 2.0 (the "License"); 4*1285115cSWilliam A. Kennington III // you may not use this file except in compliance with the License. 5*1285115cSWilliam A. Kennington III // You may obtain a copy of the License at 6*1285115cSWilliam A. Kennington III // 7*1285115cSWilliam A. Kennington III // http://www.apache.org/licenses/LICENSE-2.0 8*1285115cSWilliam A. Kennington III // 9*1285115cSWilliam A. Kennington III // Unless required by applicable law or agreed to in writing, software 10*1285115cSWilliam A. Kennington III // distributed under the License is distributed on an "AS IS" BASIS, 11*1285115cSWilliam A. Kennington III // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*1285115cSWilliam A. Kennington III // See the License for the specific language governing permissions and 13*1285115cSWilliam A. Kennington III // limitations under the License. 14*1285115cSWilliam A. Kennington III 15*1285115cSWilliam A. Kennington III #include <ncsi_sockio.h> 16*1285115cSWilliam A. Kennington III #include <ncsi_state_machine.h> 17*1285115cSWilliam A. Kennington III #include <net_config.h> 18*1285115cSWilliam A. Kennington III 19*1285115cSWilliam A. Kennington III #include <iostream> 20*1285115cSWilliam A. Kennington III main(int argc,char * argv[])21*1285115cSWilliam A. Kennington IIIint main(int argc, char* argv[]) 22*1285115cSWilliam A. Kennington III { 23*1285115cSWilliam A. Kennington III if (argc != 2) 24*1285115cSWilliam A. Kennington III { 25*1285115cSWilliam A. Kennington III std::cout << "Usage: " << argv[0] << " <interface_name>" << std::endl; 26*1285115cSWilliam A. Kennington III return -1; 27*1285115cSWilliam A. Kennington III } 28*1285115cSWilliam A. Kennington III 29*1285115cSWilliam A. Kennington III std::string iface_name(argv[1]); 30*1285115cSWilliam A. Kennington III 31*1285115cSWilliam A. Kennington III net::PhosphorConfig net_config(iface_name); 32*1285115cSWilliam A. Kennington III net::IFace eth(iface_name); 33*1285115cSWilliam A. Kennington III 34*1285115cSWilliam A. Kennington III ncsi::SockIO ncsi_sock; 35*1285115cSWilliam A. Kennington III ncsi_sock.init(); 36*1285115cSWilliam A. Kennington III ncsi_sock.bind_to_iface(eth); 37*1285115cSWilliam A. Kennington III ncsi_sock.filter_vlans(); 38*1285115cSWilliam A. Kennington III 39*1285115cSWilliam A. Kennington III ncsi::StateMachine ncsi_fsm; 40*1285115cSWilliam A. Kennington III ncsi_fsm.set_sockio(&ncsi_sock); 41*1285115cSWilliam A. Kennington III ncsi_fsm.set_net_config(&net_config); 42*1285115cSWilliam A. Kennington III 43*1285115cSWilliam A. Kennington III // If run ever returns -- it's an error. 44*1285115cSWilliam A. Kennington III ncsi_fsm.run(); 45*1285115cSWilliam A. Kennington III 46*1285115cSWilliam A. Kennington III return -1; 47*1285115cSWilliam A. Kennington III } 48