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