This file is indexed.

/usr/include/sipxtapi/os/OsUtil.h is in libsipxtapi-dev 3.3.0~test17-2.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
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
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


#ifndef _OsUtil_h_
#define _OsUtil_h_

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <utl/UtlString.h>

#include "os/OsStatus.h"
#include "os/OsTime.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS

//:Miscellaneous useful static methods
class OsUtil
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

   enum OsPlatformType
   {
      PLATFORM_UNKNOWN=-1,
      PLATFORM_BRUTUS=0,
      PLATFORM_TCAS1=1,
      PLATFORM_TCAS2=2,
      PLATFORM_TCAS3=3,
      PLATFORM_TCAS4=4,
      PLATFORM_TCAS5=5,
      PLATFORM_TCAS6=6,
      PLATFORM_TCAS7=7,
      PLATFORM_TCAS8=8,
      PLATFORM_MACOSX=97,
      PLATFORM_SOLARIS=98,
      PLATFORM_LINUX=99,
      PLATFORM_WIN32=100,
      PLATFORM_ANDROID=101
   };

   enum OsProductType
   {
      PRODUCT_UNKNOWN=-1,
      PRODUCT_XPRESSA=0,
      PRODUCT_INSTANT_XPRESSA=2
   };

   static const UtlString NULL_OS_STRING;

   //! Search a buffer for first occurance of another buffer. binary or ascii
   static char *memscan(const char *lookIn,
                        int lookInLen,
                        const char *lookFor,
                        int lookForLen);

/* ============================ Name Database ============================= */

   static OsStatus insertKeyValue(const UtlString& rPrefix,
                                  const UtlString& rName,
                                  const intptr_t value,
                                  UtlBoolean exceptOnErr=TRUE);
     //:Insert a key-value pair into the name database
     // The key is constructed by concatenating rPrefix and rName.
     // If exceptOnErr is TRUE, then upon encountering an error, this method
     // will throw an exception. This is sometimes useful for indicating an
     // error from within an object constructor.

   static OsStatus deleteKeyValue(const UtlString& rPrefix,
                                  const UtlString& rName,
                                  intptr_t* pValue=NULL);
     //:Remove the indicated key-value pair from the name database
     // The key is constructed by concatenating rPrefix and rName.
     // If pValue is non-NULL, the value for the key-value pair is returned
     // via pValue.
     // Return OS_SUCCESS if the lookup is successful, return
     // OS_NOT_FOUND if there is no match for the specified key.

   static OsStatus lookupKeyValue(const UtlString& rPrefix,
                                  const UtlString& rName,
                                  intptr_t* pValue=NULL);
     //:Retrieve the value associated with the specified key
     // The key is constructed by concatenating rPrefix and rName.
     // If pValue is non-NULL, the value is returned via pValue.
     // Return OS_SUCCESS if the lookup is successful, return
     // OS_NOT_FOUND if there is no match for the specified key.

   static OsStatus convertUtlStringToInt(const UtlString& rStr, int& rInt);
     //:Convert the value in rStr to an integer.
     // Uses strtol() with base==0 to perform the conversion.
     // Return OS_SUCCESS if the conversion was successful and set rInt to
     // the converted value in rInt.  If the conversion failed, return
     // OS_FAILED and set rInt to -1.


        static OsStatus checkIpAddress(const char* addr) ;
     // :Check the designated ip address for validity:
         //   1) 4 octets separated by '.'
         //      2) Each octet is between 0 and 255
         //   3) Address is not 0.0.0.0 or 255.255.255.255
         // Return OS_SUCCESS if the addr is valid, otherwise return OS_INVALID


        static OsStatus checkNetmask(const char* netmask) ;
         // :Check the designated netmask for validity:
         //   1) Between 255.0.0.0 and 255.255.255.254
         // Return OS_SUCCESS if the addr is valid, otherwise return OS_INVALID


        static UtlBoolean isSameNetwork(const char* destIpAddr,
                                                                   const char* myIpAddr,
                                                                   const char* myNetMask) ;
         // :Return TRUE if the destIpAddress is on the same logical network as
         //    myIpAddr given netmask myNetMask.  Returns FALSE otherwise.


        //returns OS_SUCCESS if the host repsonds within timeout
        OsStatus checkDnsAvailability(char *dnsServer, OsTime timeout);


        //returns OS_SUCCESS if the host repsonds within timeout
        OsStatus checkResponsiveDest(char *destHost, OsTime timeout);


/* ============================ MANIPULATORS ============================== */

/* ============================ ACCESSORS ================================= */

   static void getCurDate(UtlString& dateStr,
                          const struct tm* pCurTime, int maxLen);
     //:Return the current date
     // An example showing the date format is: "Wed Oct 7 1998".

   static void getCurTime(UtlString& timeStr,
                          const struct tm* pCurTime, int maxLen);
     //:Return the current time
     // An example showing the time format is: "8:03 PM".

   static int getPlatformType(void);
     //:Return the type of platform we are running on (e.g., PLATFORM_TCAS2)

   static int getProductType(void);
     //:Return the type of platform we are running on (e.g., PRODUCT_XPRESSA)

/* ============================ INQUIRY =================================== */


/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

   OsUtil();
     //:Default constructor (not implemented for this class)
     // We identify this as a protected method so that gcc doesn't complain
     // that the class only defines a private constructor and has no friends.

   virtual
   ~OsUtil();
     //:Destructor (not implemented for this class)
     // We identify this as a protected method so that gcc doesn't complain
     // that the class only defines a private destructor and has no friends.

   static UtlBoolean convertIpAddressToOctets(const char* ipAddr, unsigned char octets[]) ;
         // :Convert a nnn.nnn.nnn.nnn ip address into an array of 4 unsigned chars.
         // Returns FALSE on error otherwise TRUE



/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:

   OsUtil(const OsUtil& rOsUtil);
     //:Copy constructor (not implemented for this class)

   OsUtil& operator=(const OsUtil& rhs);
     //:Assignment operator (not implemented for this class)

};

/* ============================ INLINE METHODS ============================ */

#endif  // _OsUtil_h_