Ingres CL ID
From Ingres Community Wiki
|
Ingres Compatability Library |
Compatibility Library Specification - ID
Abstract
This is the specification of the ID facility provided by the compatibility library.
Revision: 1.3, 07-Dec-1998
Document History
- Revision 1.3, 07-Dec-1998
- Added UUID functions
- Revision 1.2, 11-Nov-1997
- Added IDsetsys.
- Converted to HTML.
- Removed IDhost. (GChostname is what is used everywhere).
- Revision 1.1, 29-Jul-94
- IDhost added (21-may-93).
- Revision 1.0, 14-Aug-90
- Modified subsequent to the 6.3/02 spec to say that IDname needs to truncate trailing whitespace.
- Revision 1.0, last modified 29-Aug-91
- Added note that it should return the real, rather than effective user.
- Typo/editorial changes.
Specification
Introduction
ID is used to get operating system user identifiers.
Library
CL
Header File <id.h>
The header file <id.h> must be included before using any of the functions provided. The following data structures and constants are defined for use.
UUID / GUID / uuid_t
typedef struct _GUID {
u_i4 Data1;
u_i2 Data2;
u_i2 Data3;
u_char Data4[8];
} GUID;
typedef GUID uuid_t;
Executable Interface
The following functions are provided.
IDname -- what user is executing this process
Set the passed in argument name to contain the name of the user who is executing this process. Name is a pointer to an array large enough to hold the user name.
On systems where relevant, this should return the real rather than effective user.
Inputs:
| None |
Outputs:
| Name | the name in lowercase, with any trailing whitespace deleted, and NULL-terminated. |
Returns:
| None |
Definition:
VOID IDname(name) char **name;
IDsetsys - Set up generic system identifiers.
Override system defaults for:
| Variable | Default value |
|---|---|
| SystemLocationVariable | ("II_SYSTEM") |
| SystemLocationSubdirectory | ("ingres") |
| SystemProductName | ("Ingres") |
| SystemDBMSName | ("Ingres") |
| SystemVarPrefix | ("II") |
| SystemCfgPrefix | ("ii") |
| SystemCatPrefix | ("ii") |
| SystemAdminUser | ("ingres") |
| SystemSyscatOwner | ("$ingres") |
Defaults are defined in gl.h.
Inputs:
| SystemLocationVariable |
| SystemLocationSubdirectory |
| SystemProductName |
| SystemDBMSName |
| SystemVarPrefix |
| SystemCfgPrefix |
| SystemCatPrefix |
| SystemAdminUser |
| SystemSyscatOwner |
Returns:
| None |
Definition:
VOID
IDsetsys(
char *SysLocationVariable,
char *SysLocationSubdirectory,
char *SysProductName,
char *SysDBMSName,
char *SysVarPrefix,
char *SysCfgPrefix,
char *SysCatPrefix,
char *SysAdminUser,
char *SysSyscatOwner
)
IDuuid_create - Create a new 128-bit UUID.
Create a new 128-bit UUID.
This is part of the implementation of three simple functions for creating, formatting and comparing UUIDs (Universally Unique IDentifiers), also known as GUIDs (Globally Unique IDentifiers) in DCE parlance.
As described by Paul J. Leach (Microsoft) and Rich Salz (Certco) in the Internet-Draft dated February 4, 1998, entitled UUIDs and GUIDs:
A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs. To be precise, the UUID consists of a finite bit space. Thus the time value used for constructing a UUID is limited and will roll over in the future (approximately at A.D. 3400, based on the specified algorithm). A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network.
The basic format of the 128-bit UUID is:
| Field | Data type | Octet # | Note |
|---|---|---|---|
| time_low | unsigned 32- bit integer | 0-3 | The low field of the timestamp. |
| time_mid | unsigned 16-bit integer | 4-5 | The middle field of the timestamp. |
| time_hi_and_version | unsigned 16-bit integer | 6-7 | The high field of the timestamp multiplexed with the version number. |
| clock_seq_hi_and_reserved | unsigned 8-bit integer | 8 | The high field of the clock sequence multiplexed with the variant. |
| clock_seq_low | unsigned 8-bit integer | 9 | The low field of the clock sequence. |
| node | unsigned 48-bit integer | 10-15 | The spatially unique node identifier. |
Note that for the purposes of the CL functions, the internal members of a UUID structure are given the names used by Microsoft, not the ones used by Leach and Salz. See UUID above.
Inputs:
| None |
Outputs:
| uuid | The new 128-bit UUID. |
Returns:
| OK | The UUID was created successfully |
| RPC_S_UUID_LOCAL_ONLY | A network card could not be located on this computer. The UUID was successfully generated, but is only guaranteed to be unique on the creating computer. |
| Other specific failure code. |
Definition:
STATUS IDuuid_create( UUID *uuid );
IDuuid_compare - Lexically compare two UUIDs.
Perform a lexical comparison of two UUIDs.
Inputs:
| uuid1 | first UUID for comparison |
| uuid2 | second UUID for comparison |
Outputs:
| None. |
Returns:
| 0 | The two UUIDs are identical. |
| -1 | The first UUID comes before the second. |
| 1 | The first UUID comes after the second. |
Definition:
i4 IDuuid_compare( UUID *uuid1, UUID *uuid2 )
IDuuid_from_string - Create a UUID from string.
Convert a string into a UUID, where the string is of the format:
- "aaaaaaaa-bbbb-cccc-dddd-eeeeeeee"
| aaaaaaaa | time_low |
| bbbb | time_mid |
| cccc | time_hi_and_version |
| dddd | clock_seq_hi_and_reserved |
| eeeeeeee | clock_seq_low (2) + node (6) |
See IDuuid_create for more information on the format of a UUID.
Inputs:
| string |
Outputs:
| uuid |
Returns:
| OK | Successfully converted |
| FAIL | String was not in the right format. |
Description:
STATUS IDuuid_from_string( char *string, UUID *uuid )
IDuuid_to_string - Translate a 128-bit UUID into readable form.
Format a UUID into a string:
- "aaaaaaaa-bbbb-cccc-dddd-eeeeeeee"
| aaaaaaaa | time_low |
| bbbb | time_mid |
| cccc | time_hi_and_version |
| dddd | clock_seq_hi_and_reserved |
| eeeeeeee | clock_seq_low (2) + node (6) |
See IDuuid_create for more information on the format of a UUID.
Inputs:
| uuid |
Outputs:
| string |
Returns:
| OK | Successfully converted |
Description:
STATUS IDuuid_to_string( UUID *uuid, char *string )
|
Ingres Compatability Library |
