HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_LMHost.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Action (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UT_LMHost_h__
13 #define __UT_LMHost_h__
14 
15 #include "UT_API.h"
16 
17 #define UT_SESI_LMHOST_REGISTRY_VALUE \
18  "LicenseServer"
19 #define UT_SESI_LMHOST_ENVVAR \
20  "SESI_LMHOST"
21 
22 #include "UT_StringHolder.h"
23 #include "UT_WorkBuffer.h"
24 
25 #include <SYS/SYS_Compiler.h>
26 
27 class UT_String;
28 class UT_StringArray;
29 
31 {
32 public:
33  enum AppType
34  {
37  };
38 
39  /// Override the default location for the user license file.
40  static void overrideUserLicenseFile(const UT_StringHolder& path);
41  /// This is the location where the .sesi_preferences file is kept.
42  static void getUserLicenseFile(UT_WorkBuffer& filename);
43  // Location of the cookie store
44  SYS_NO_DISCARD_RESULT static UT_WorkBuffer databaseFile(
45  AppType app_type,
46  const UT_StringRef& name);
47  // Location of the application folder
48  SYS_NO_DISCARD_RESULT static UT_WorkBuffer applicationFolder(
49  AppType app_type);
50 
51  // Delimeters for different config types
52  static const char* redundantToken() { return ","; }
53  static const char* multiConnectToken() { return ";"; }
54 
55  static bool parseHostString(const char *host_str, UT_StringArray &hosts);
56  static void packHostString(const UT_StringArray &hosts,
57  UT_String &host_str, bool is_redundant = true);
58 
59  // Compare two host lists together. Check if each host matches up to the
60  // period of end-of-string, and make sure they differ only in nonalpha
61  // characters.
62  // The idea is that "boston", "boston-2", "boston.local", "boston-2.local"
63  // "boston:3080", "boston.local:3080" all match each other
64  //
65  // NOTE:
66  // The reason "boston" and boston-2" are considered matching hostnames
67  // is that on OSX when a Mac joins a network and there is some residual
68  // host name on that network a -1, -2, -3, ... suffix is added to
69  // disambiguate the machines.
70  static bool areHostNamesEqual(UT_String host1, UT_String host2);
71  static bool areHostNamesEqual(const UT_StringArray& hosts1,
72  const UT_StringArray& hosts2);
73  // This tests strictly the hostname (no port or other information can be
74  // located in the two strings
75  static bool testHostnames(const char* host1, const char* host2);
76 
77  // Get the users full name using the current uid
78  static bool userFullName(UT_StringHolder& name);
79  // Get the fully qualified domain name
80  static bool fullyQualifiedDomainName(UT_StringHolder &hostname);
81 };
82 
83 #endif
GT_API const UT_StringHolder filename
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
#define UT_API
Definition: UT_API.h:14
static const char * multiConnectToken()
Definition: UT_LMHost.h:53
#define SYS_NO_DISCARD_RESULT
Definition: SYS_Compiler.h:93
GLuint const GLchar * name
Definition: glcorearb.h:786
static const char * redundantToken()
Definition: UT_LMHost.h:52