summaryrefslogtreecommitdiffstats
path: root/net.cpp
blob: 9de190f2b36c42a9c3739a3020aa51f0fb420c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "utils.hpp"

#include <map>
#include <string>

// Not sure if this should live in utils.  Because it's really a per-system
// configuration, instead of just hard-coding channel 1 to be eth0, one could
// conceivably configure it however they pleased.
//
// In this design, channel 0 is the in-band host channel.

namespace ipmi
{
namespace network
{

extern const ipmi::network::ChannelEthMap ethdevices;

// Given a channel number, return a matching ethernet device, or empty string
// if there is no match.
std::string ChanneltoEthernet(int channel)
{
    auto dev = ethdevices.find(channel);
    if (dev == ethdevices.end())
    {
        return "";
    }

    return dev->second;
}

} // namespace network
} // namespace ipmi
OpenPOWER on IntegriCloud