blob: d02171abfd1a4205846ec0b81bbd9b655ac13547 [file] [log] [blame]
Davide Pesavento248d6bd2014-03-09 10:24:08 +01001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_CORE_NETWORK_INTERFACE_HPP
8#define NFD_CORE_NETWORK_INTERFACE_HPP
9
10#include "common.hpp"
11#include "face/ethernet.hpp"
12
13#include <net/if.h>
14
15namespace nfd {
16
17class NetworkInterfaceInfo
18{
19public:
20 int index;
21 std::string name;
22 ethernet::Address etherAddress;
23 std::vector<boost::asio::ip::address_v4> ipv4Addresses;
24 std::vector<boost::asio::ip::address_v6> ipv6Addresses;
25 unsigned int flags;
26
27 bool
28 isLoopback() const;
29
30 bool
31 isMulticastCapable() const;
32
33 bool
34 isUp() const;
35};
36
37inline bool
38NetworkInterfaceInfo::isLoopback() const
39{
40 return (flags & IFF_LOOPBACK) != 0;
41}
42
43inline bool
44NetworkInterfaceInfo::isMulticastCapable() const
45{
46 return (flags & IFF_MULTICAST) != 0;
47}
48
49inline bool
50NetworkInterfaceInfo::isUp() const
51{
52 return (flags & IFF_UP) != 0;
53}
54
55std::list< shared_ptr<NetworkInterfaceInfo> >
56listNetworkInterfaces();
57
58} // namespace nfd
59
60#endif // NFD_CORE_NETWORK_INTERFACE_HPP