Kea  1.9.9-git
io_endpoint.h
Go to the documentation of this file.
1 // Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef IO_ENDPOINT_H
8 #define IO_ENDPOINT_H 1
9 
10 // IMPORTANT NOTE: only very few ASIO headers files can be included in
11 // this file. In particular, asio.hpp should never be included here.
12 // See the description of the namespace below.
13 
14 #include <functional>
15 #include <string>
16 
17 #include <exceptions/exceptions.h>
18 #include <asiolink/io_address.h>
19 
20 # include <ostream>
21 
22 #include <unistd.h> // for some network system calls
23 
24 #include <sys/socket.h> // for sockaddr
25 
26 namespace isc {
27 namespace asiolink {
28 
38 class IOEndpoint {
44 
45 private:
46  IOEndpoint(const IOEndpoint& source);
47  IOEndpoint& operator=(const IOEndpoint& source);
48 protected:
54 public:
56  virtual ~IOEndpoint() {}
58 
79  virtual IOAddress getAddress() const = 0;
80 
82  virtual uint16_t getPort() const = 0;
83 
85  virtual short getProtocol() const = 0;
86 
88  virtual short getFamily() const = 0;
89 
126  virtual const struct sockaddr& getSockAddr() const = 0;
127 
128  bool operator==(const IOEndpoint& other) const;
129  bool operator!=(const IOEndpoint& other) const;
130 
151  static const IOEndpoint* create(const int protocol,
152  const IOAddress& address,
153  const unsigned short port);
154 };
155 
176 std::ostream& operator<<(std::ostream& os, const IOEndpoint& endpoint);
177 } // namespace asiolink
178 } // namespace isc
179 #endif // IO_ENDPOINT_H
180 
181 // Local Variables:
182 // mode: c++
183 // End:
Defines the logger used by the top-level component of kea-dhcp-ddns.