Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
network.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2010 Christian Prochnow <cproch@seculogix.de>
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // Common C++. If you copy code from other releases into a copy of GNU
28 // Common C++, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU Common C++, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37 
44 #ifndef CCXX_NETWORK_H_
45 #define CCXX_NETWORK_H_
46 
47 #ifndef CCXX_MISSING_H_
48 #include <cc++/missing.h>
49 #endif
50 
51 #ifndef CCXX_SOCKET_H_
52 #include <cc++/socket.h>
53 #endif
54 
55 #ifndef CCXX_STRING_H_
56 #include <cc++/string.h>
57 #endif
58 
59 #include <vector>
60 
61 #ifdef CCXX_NAMESPACES
62 namespace ost {
63 #endif
64 
65 
67 
73 {
74 private:
79  int _mtu;
80 
81 protected:
82  NetworkDeviceInfo(const String& name, const InetHostAddress& addr,
83  const BroadcastAddress& broadcast,
84  const InetMaskAddress& netmask, int mtu);
85 
86 public:
89 
91  inline const String& name() const
92  { return _name; }
93 
95  inline const InetHostAddress& address() const
96  { return _addr; }
97 
99  inline const BroadcastAddress& broadcast() const
100  { return _broadcast; }
101 
103  inline const InetMaskAddress& netmask() const
104  { return _netmask; }
105 
107  inline const int mtu() const
108  { return _mtu; }
109 
111  friend __EXPORT bool enumNetworkDevices(std::vector<NetworkDeviceInfo>& devs);
112 };
113 
114 #ifdef CCXX_NAMESPACES
115 }
116 #endif
117 
118 #endif
119 
const InetMaskAddress & netmask() const
Returns the Netmask of the network device.
Definition: network.h:103
Common C++ generic string class.
#define BroadcastAddress
Definition: address.h:81
substitute functions which may be missing in target platform libc.
const BroadcastAddress & broadcast() const
Returns the Broadcast address of the network device.
Definition: network.h:99
This is a generic and portable string class.
Definition: string.h:77
#define InetHostAddress
Definition: address.h:76
Network device information class.
Definition: network.h:72
const InetHostAddress & address() const
Returns the Address of the network device.
Definition: network.h:95
#define InetMaskAddress
Definition: address.h:77
BroadcastAddress _broadcast
Definition: network.h:77
#define __EXPORT
Definition: audio2.h:51
const String & name() const
Returns the Name of the network device.
Definition: network.h:91
const int mtu() const
Returns the MTU.
Definition: network.h:107
InetMaskAddress _netmask
Definition: network.h:78
Network addresses and sockets related classes.
String _name
Definition: network.h:75
InetHostAddress _addr
Definition: network.h:76