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/UT_StringHolder.h>
23 #include <UT/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  {
36  SYSTEM
37  };
38 
39  /// This is the location where the .sesi_preferences file is kept.
40  static void getUserLicenseFile(UT_WorkBuffer& filename);
41  // Location of the cookie store
42  SYS_NO_DISCARD_RESULT static UT_WorkBuffer cookieStorePath(
43  AppType app_type,
44  const UT_StringRef& name = UT_StringRef());
45 
46  // Delimeters for different config types
47  static const char* redundantToken() { return ","; }
48  static const char* multiConnectToken() { return ";"; }
49 
50  static bool parseHostString(const char *host_str, UT_StringArray &hosts);
51  static void packHostString(const UT_StringArray &hosts,
52  UT_String &host_str, bool is_redundant = true);
53 
54  // Compare two host lists together. Check if each host matches up to the
55  // period of end-of-string, and make sure they differ only in nonalpha
56  // characters.
57  // The idea is that "boston", "boston-2", "boston.local", "boston-2.local"
58  // "boston:3080", "boston.local:3080" all match each other
59  //
60  // NOTE:
61  // The reason "boston" and boston-2" are considered matching hostnames
62  // is that on OSX when a Mac joins a network and there is some residual
63  // host name on that network a -1, -2, -3, ... suffix is added to
64  // disambiguate the machines.
65  static bool areHostNamesEqual(UT_String host1, UT_String host2);
66  static bool areHostNamesEqual(const UT_StringArray& hosts1,
67  const UT_StringArray& hosts2);
68  // This tests strictly the hostname (no port or other information can be
69  // located in the two strings
70  static bool testHostnames(const char* host1, const char* host2);
71 
72  // Get the users full name using the current uid
73  static bool userFullName(UT_StringHolder& name);
74  // Get the fully qualified domain name
75  static bool fullyQualifiedDomainName(UT_StringHolder &hostname);
76 };
77 
78 #endif
GT_API const UT_StringHolder filename
#define UT_API
Definition: UT_API.h:14
GLuint const GLchar * name
Definition: glcorearb.h:786
static const char * multiConnectToken()
Definition: UT_LMHost.h:48
#define SYS_NO_DISCARD_RESULT
Definition: SYS_Compiler.h:93
static const char * redundantToken()
Definition: UT_LMHost.h:47