nidas v1.2.3
Inet4NetworkInterface.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2009, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef NIDAS_UTIL_INET4NETWORKINTERFACE_H
28#define NIDAS_UTIL_INET4NETWORKINTERFACE_H
29
30#include "Inet4Address.h"
31#include "IOException.h"
32
33namespace nidas { namespace util {
34
36{
37public:
39 _baddr(INADDR_BROADCAST),_netmask(INADDR_BROADCAST),_mtu(0),_flags(0) {}
40
41 Inet4NetworkInterface(const std::string& name,Inet4Address addr, Inet4Address brdcastAddr, Inet4Address netmask,int mtu,int index,short flags):
42 _name(name),_index(index),_addr(addr),_baddr(brdcastAddr),_netmask(netmask),_mtu(mtu),_flags(flags) {}
43
47 const std::string& getName() const { return _name; }
48
52 int getIndex() const { return _index; }
53
57 Inet4Address getAddress() const { return _addr; }
58
63
67 Inet4Address getNetMask() const { return _netmask; }
68
72 int getMTU() const { return _mtu; }
73
79 short getFlags() const { return _flags; }
80
93
94private:
95 std::string _name;
96 int _index;
100 int _mtu;
101 short _flags;
102};
103
104}} // namespace nidas namespace util
105
106#endif
Support for IP version 4 host address.
Definition Inet4Address.h:46
Definition Inet4NetworkInterface.h:36
int getMTU() const
The mtu of the interface.
Definition Inet4NetworkInterface.h:72
Inet4Address _baddr
Definition Inet4NetworkInterface.h:98
Inet4Address getNetMask() const
The IPV4 network mask of the interface.
Definition Inet4NetworkInterface.h:67
int _mtu
Definition Inet4NetworkInterface.h:100
Inet4Address getAddress() const
The IPV4 address of the interface.
Definition Inet4NetworkInterface.h:57
Inet4Address getBroadcastAddress() const
The IPV4 broadcast address of the interface.
Definition Inet4NetworkInterface.h:62
int getIndex() const
The index of the interface.
Definition Inet4NetworkInterface.h:52
std::string _name
Definition Inet4NetworkInterface.h:95
const std::string & getName() const
The name of the interface: like "lo", "eth0", etc.
Definition Inet4NetworkInterface.h:47
Inet4NetworkInterface()
Definition Inet4NetworkInterface.h:38
short _flags
Definition Inet4NetworkInterface.h:101
Inet4NetworkInterface(const std::string &name, Inet4Address addr, Inet4Address brdcastAddr, Inet4Address netmask, int mtu, int index, short flags)
Definition Inet4NetworkInterface.h:41
static Inet4NetworkInterface getInterface(const Inet4Address &addr)
Return an Inet4NetworkInterface corresponding to the given address.
Definition Inet4NetworkInterface.cc:37
Inet4Address _netmask
Definition Inet4NetworkInterface.h:99
short getFlags() const
The interface flags.
Definition Inet4NetworkInterface.h:79
Inet4Address _addr
Definition Inet4NetworkInterface.h:97
int _index
Definition Inet4NetworkInterface.h:96
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31