This file is indexed.

/usr/include/svxlink/AsyncIpAddress.h is in libasynccore-dev 15.11-2.

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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/**
@file	 AsyncIpAddress.h
@brief   Platform independent representation of an IP address
@author  Tobias Blomberg
@date	 2003-04-12

Contains a class for representing an IP address in an OS independent way.
Rigt now it can only handle IPv4 addresses.

\verbatim
Async - A library for programming event driven applications
Copyright (C) 2003  Tobias Blomberg

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
\endverbatim
*/

#ifndef ASYNC_IP_ADDRESS_INCLUDED
#define ASYNC_IP_ADDRESS_INCLUDED


/****************************************************************************
 *
 * System Includes
 *
 ****************************************************************************/

#include <netinet/in.h>

#include <string>
#include <iostream>


/****************************************************************************
 *
 * Project Includes
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Local Includes
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Forward declarations
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Namespace
 *
 ****************************************************************************/

namespace Async
{

/****************************************************************************
 *
 * Defines & typedefs
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Exported Global Variables
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Class definitions
 *
 ****************************************************************************/

/**
 * @brief A class for representing an IP address in an OS independent way.
 */
class IpAddress
{
  public:
    /**
     * @brief The type for the OS specific representation of an IP address
     */
    typedef struct in_addr Ip4Addr;
    
    /**
     * @brief Default constructor for the IpAddress class.
     */
    IpAddress(void);
    
    /**
     * @brief Constructor for the IpAddress class.
     * @param addr The string representation of an IP address
     */
    IpAddress(const std::string& addr);
     
    /**
     * @brief Constructor for the IpAddress class.
     * @param addr The IP address in OS specific representation
     */
    IpAddress(const Ip4Addr& addr);
    
    /**
     * @brief Copy contructor
     * @param addr An IpAddress object to construct the new object from
     */
    IpAddress(const IpAddress& addr) { *this = addr; }
    
    /**
     * @brief Destructor
     */
    ~IpAddress(void) {}
    
    /**
     * @brief Return the IP address in OS specific representation
     * @return The IP address
     */
    Ip4Addr ip4Addr(void) const { return m_addr; }
    
    /**
     * @brief 	Check if this is a unicast IP address
     * @return	Return \em true if this is a unicast address or \em false
     *	      	if it is some other type.
     */
    bool isUnicast(void) const;
    
    /**
     * @brief 	Check if the IP address is within the given netmask
     * @param 	subnet	The subnet to use in the check. The subnet should
     *	      	      	be given on the form a.b.c.d/m (e.g. 192.168.1.0/24).
     * @return	Return \em true if within the given subnet or \em false
     *	      	if it is not.
     */
    bool isWithinSubet(const std::string& subnet) const;

    /**
     * @brief	Check if an invalid IP address has been assigned
     * @return	Return \em true if this is an invalid address or \em false
     *		if a valid address has been assigned.
     */
    bool isEmpty(void) const { return (m_addr.s_addr == INADDR_NONE); }

    /**
     * @brief	Invalidate the IP address value
     */    
    void clear(void) { m_addr.s_addr = INADDR_NONE; }
    
    /**
     * @brief 	Return the string representation of the IP address.
     * @return  The IP address string
     */
    std::string toString(void) const;
    
    /**
     * @brief   Set the IP address from a string
     * @param   str The string to parse (e.g. "192.168.0.1")
     * @return  Returns \em true on success or else \em false
     */
    bool setIpFromString(const std::string &str);

    /**
     * @brief 	Assignment operator.
     * @param 	rhs The address object to assign to this object
     * @return  Returns the new IP address
     */
    IpAddress& operator=(const IpAddress& rhs)
    {
      m_addr = rhs.m_addr;
      return *this;
    }
    
    /**
     * @brief 	Equality operator
     * @param 	rhs Right hand side expression
     * @return  Returns \em true if the right hand side object is
     *          equal to this object, or else returns \em false.
     */
    bool operator==(const IpAddress& rhs) const
    {
      return m_addr.s_addr == rhs.m_addr.s_addr;
    }
    
    /**
     * @brief 	Unequality operator
     * @param 	rhs Right hand side expression
     * @return  Returns \em true if the right hand side object is
     *          unequal to this object, or else returns \em false.
     */
    bool operator!=(const IpAddress& rhs) const
    {
      return !(*this == rhs);
    }
    
    /**
     * @brief 	Less than operator
     * @param 	rhs Right hand side expression
     * @return  Returns \em true if the right hand side object is
     *          less than this object, or else returns \em false.
     */
    bool operator<(const IpAddress& rhs) const
    {
      return m_addr.s_addr < rhs.m_addr.s_addr;
    }
    
    /**
     * @brief Output stream operator
     * @param os The stream to output data to
     * @param ip The IP address to output to the stream
     */
    friend std::ostream& operator<<(std::ostream& os,
	const Async::IpAddress& ip);
    
    /**
     * @brief Input stream operator
     * @param is The stream to input data from
     * @param ip The IP address object to store information in
     */
    friend std::istream& operator>>(std::istream& is,
	Async::IpAddress& ip);
    
  protected:
    
  private:
    Ip4Addr m_addr;
  
};  /* class IpAddress */


std::ostream& operator<<(std::ostream& os, const IpAddress& ip);
std::istream& operator>>(std::istream& is, IpAddress& ip);


} /* namespace */


#endif /* ASYNC_IP_ADDRESS_INCLUDED */



/*
 * This file has not been truncated
 */