This file is indexed.

/usr/include/net6/host.hpp is in libnet6-1.3-dev 1:1.3.14-1.

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
/* net6 - Library providing IPv4/IPv6 network access
 * Copyright (C) 2005 Armin Burgmeier / 0x539 dev group
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _NET6_HOST_HPP_
#define _NET6_HOST_HPP_

#include "local.hpp"
#include "server.hpp"

namespace net6
{

/** High-level TCP host object that is used as a server with a local user.
 */

template<typename selector_type = net6::selector>
class basic_host
 : virtual public basic_local<selector_type>,
   virtual public basic_server<selector_type>
{
public:
	/** Creates a new basic_host object.
	 * @param username user name to use for the local user.
	 * @param ipv6 Whether to use IPv6 when no parameter is given to
	 * reopen.
	 */
	basic_host(const std::string& username, bool ipv6 = true);

	/** Creates a new basic_host object which will accept incoming
	 * connections on port <em>port</em> and use the user name
	 * <em>username</em> for the local user.
	 */
	basic_host(unsigned int port, const std::string& username,
	           bool ipv6 = true);

	/** Sends a packet to all users.
	 */
	virtual void send(const packet& pack);

	/** Sends a packet to a single user. The request is ignored if
	 * <em>to</em> is the local user.
	 */
	virtual void send(const packet& pack, const user& to);

	/** @brief Requests encryption to the given user.
	 *
	 * Throws an error if <em>to</em> is the local user.
	 */
	virtual void request_encryption(const user& to);

	/** Returns the local user.
	 */
	virtual user& get_self();

	/** Returns the local user.
	 */
	virtual const user& get_self() const;

protected:
	user* self;
};

typedef basic_host<selector> host;

template<typename selector_type>
basic_host<selector_type>::basic_host(const std::string& username, bool ipv6)
 : basic_object<selector_type>(),
   basic_local<selector_type>(),
   basic_server<selector_type>(ipv6),
   self(new user(1, NULL) )
{
	self->login(username);
	basic_object<selector_type>::user_add(self);
}

template<typename selector_type>
basic_host<selector_type>::
	basic_host(unsigned int port, const std::string& username, bool ipv6)
 : basic_object<selector_type>(),
   basic_local<selector_type>(),
   basic_server<selector_type>(port, ipv6),
   self(new user(1, NULL) )
{
	self->login(username);
	basic_object<selector_type>::user_add(self);
}

template<typename selector_type>
void basic_host<selector_type>::send(const packet& pack)
{
	basic_server<selector_type>::send(pack);
}

template<typename selector_type>
void basic_host<selector_type>::send(const packet& pack, const user& to)
{
	if(&to != self) basic_server<selector_type>::send(pack, to);
}

template<typename selector_type>
void basic_host<selector_type>::request_encryption(const user& to)
{
	if(&to == self)
	{
		throw std::logic_error(
			"net6::basic_host::request_encryption:\n"
			"Cannot request encryption to local client"
		);
	}

	basic_server<selector_type>::request_encryption(to);
}

template<typename selector_type>
user& basic_host<selector_type>::get_self()
{
	return *self;
}

template<typename selector_type>
const user& basic_host<selector_type>::get_self() const
{
	return *self;
}

} // namespace net6

#endif // _NET6_HOST_HPP_