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