/usr/include/skstream-0.3/skstream/skaddress.h is in libskstream-0.3-dev 0.3.9-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /**************************************************************************
FreeSockets - Portable C++ classes for IP(sockets) applications. (v0.3)
Copyright (C) 2012 Alistair Riddoch
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**************************************************************************/
/**
* This software package has been extensively modified by members of the
* Worldforge Project. See the file ChangeLog for details.
*
* $Id$
*
*/
#ifndef RGJ_FREE_ADDRESS_H_
#define RGJ_FREE_ADDRESS_H_
#include <skstream/sksocket.h>
#include <string>
struct addrinfo;
// I am making this inherit from basic_socket, even though it does not
// at this time appear to be a socket. This is so that it can ensure
// basic_socket::startup is called in the standard way, and so that if in
// future we need a custom, non blocking resolver, we can have one.
class basic_address : public basic_socket {
protected:
struct addrinfo * _addrlist;
int _type;
int _protocol;
basic_address(int, int);
int resolve(int, const char *, const char *);
// FIXME some data structures for non-getaddrinfo legacy systems
public:
struct addrinfo * takeAddressInfo() {
struct addrinfo * t = _addrlist;
_addrlist = 0;
return t;
}
virtual ~basic_address();
/// Check if an address has been resolved
bool isReady() const {
return _addrlist != 0;
}
int resolveListener(const std::string & service);
int resolveConnector(const std::string & host, const std::string & service);
// FIXME - perhaps we could do this like an iterator, c++11 style
/// Check the number of network address resolved
std::size_t size() const;
class const_iterator;
const_iterator begin() const;
const_iterator end() const;
/// Get one of the resolved address info records
struct addrinfo * getAddrinfo(std::size_t c) const;
virtual SOCKET_TYPE getSocket() const;
};
class basic_address::const_iterator {
private:
friend class basic_address;
struct addrinfo * _info;
explicit const_iterator(struct addrinfo * i) : _info(i) {
}
public:
// FIXME Add move stuff (c++11)
const_iterator() : _info(0) {
}
const_iterator(const const_iterator & rhs) : _info(rhs._info) {
}
bool operator==(const const_iterator& rhs) {
return _info == rhs._info;
}
bool operator!=(const const_iterator& rhs) {
return !this->operator==(rhs);
}
const_iterator& operator=(const const_iterator& rhs) {
_info = rhs._info;
return *this;
}
struct addrinfo * operator*() const {
return _info;
}
const_iterator& operator++();
};
inline basic_address::const_iterator basic_address::begin() const
{
return basic_address::const_iterator(_addrlist);
}
inline basic_address::const_iterator basic_address::end() const
{
return basic_address::const_iterator(0);
}
class tcp_address : public basic_address {
public:
tcp_address();
};
class ip_datagram_address : public basic_address {
public:
ip_datagram_address();
};
#endif // RGJ_FREE_SOCKET_H_
|