xref: /openbmc/google-ipmi-sys/handler.cpp (revision f085d91d)
1*f085d91dSPatrick Venture /*
2*f085d91dSPatrick Venture  * Copyright 2019 Google Inc.
3*f085d91dSPatrick Venture  *
4*f085d91dSPatrick Venture  * Licensed under the Apache License, Version 2.0 (the "License");
5*f085d91dSPatrick Venture  * you may not use this file except in compliance with the License.
6*f085d91dSPatrick Venture  * You may obtain a copy of the License at
7*f085d91dSPatrick Venture  *
8*f085d91dSPatrick Venture  *     http://www.apache.org/licenses/LICENSE-2.0
9*f085d91dSPatrick Venture  *
10*f085d91dSPatrick Venture  * Unless required by applicable law or agreed to in writing, software
11*f085d91dSPatrick Venture  * distributed under the License is distributed on an "AS IS" BASIS,
12*f085d91dSPatrick Venture  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*f085d91dSPatrick Venture  * See the License for the specific language governing permissions and
14*f085d91dSPatrick Venture  * limitations under the License.
15*f085d91dSPatrick Venture  */
16*f085d91dSPatrick Venture 
17*f085d91dSPatrick Venture #include "handler.hpp"
18*f085d91dSPatrick Venture 
19*f085d91dSPatrick Venture // The phosphor-host-ipmi daemon requires a configuration that maps
20*f085d91dSPatrick Venture // the if_name to the IPMI LAN channel.  However, that doesn't strictly
21*f085d91dSPatrick Venture // define which is meant to be used for NCSI.
22*f085d91dSPatrick Venture #ifndef NCSI_IPMI_CHANNEL
23*f085d91dSPatrick Venture #define NCSI_IPMI_CHANNEL 1
24*f085d91dSPatrick Venture #endif
25*f085d91dSPatrick Venture 
26*f085d91dSPatrick Venture #ifndef NCSI_IF_NAME
27*f085d91dSPatrick Venture #define NCSI_IF_NAME eth0
28*f085d91dSPatrick Venture #endif
29*f085d91dSPatrick Venture 
30*f085d91dSPatrick Venture // To deal with receiving a string without quotes.
31*f085d91dSPatrick Venture #define QUOTE(name) #name
32*f085d91dSPatrick Venture #define STR(macro) QUOTE(macro)
33*f085d91dSPatrick Venture #define NCSI_IF_NAME_STR STR(NCSI_IF_NAME)
34*f085d91dSPatrick Venture 
35*f085d91dSPatrick Venture namespace google
36*f085d91dSPatrick Venture {
37*f085d91dSPatrick Venture namespace ipmi
38*f085d91dSPatrick Venture {
39*f085d91dSPatrick Venture 
40*f085d91dSPatrick Venture std::tuple<std::uint8_t, std::string> Handler::getEthDetails() const
41*f085d91dSPatrick Venture {
42*f085d91dSPatrick Venture     return std::make_tuple(NCSI_IPMI_CHANNEL, NCSI_IF_NAME_STR);
43*f085d91dSPatrick Venture }
44*f085d91dSPatrick Venture 
45*f085d91dSPatrick Venture Handler handlerImpl;
46*f085d91dSPatrick Venture 
47*f085d91dSPatrick Venture } // namespace ipmi
48*f085d91dSPatrick Venture } // namespace google
49