Credential attribute types
[NetIDMgr Credentials Database]


Data Structures

struct  tag_kcdb_type
 A data type descriptor. More...

Conversion functions

KHMEXP void KHMAPI TimetToFileTime (time_t t, LPFILETIME pft)
 Convert a time_t value to FILETIME.
KHMEXP void KHMAPI TimetToFileTimeInterval (time_t t, LPFILETIME pft)
 Convert a time_t interval to a FILETIME interval.
KHMEXP long KHMAPI FtIntervalToSeconds (LPFILETIME pft)
 Convert a FILETIME interval to seconds.
KHMEXP long KHMAPI FtIntervalToMilliseconds (LPFILETIME pft)
 Convert a FILETIME interval to milliseconds.
KHMEXP long KHMAPI FtCompare (LPFILETIME pft1, LPFILETIME pft2)
 Compare two FILETIME values.
KHMEXP khm_int64 KHMAPI FtToInt (LPFILETIME pft)
 Convert a FILETIME to a 64 bit int.
KHMEXP FILETIME KHMAPI IntToFt (khm_int64 i)
 Convert a 64 bit int to a FILETIME.
KHMEXP FILETIME KHMAPI FtSub (LPFILETIME ft1, LPFILETIME ft2)
 Calculate the difference between two FILETIMEs.
KHMEXP FILETIME KHMAPI FtAdd (LPFILETIME ft1, LPFILETIME ft2)
 Calculate the sum of two FILETIMEs.
KHMEXP khm_int32 KHMAPI FtIntervalToString (LPFILETIME data, wchar_t *buffer, khm_size *cb_buf)
 Convert a FILETIME inverval to a string.
KHMEXP khm_int32 KHMAPI IntervalStringToFt (FILETIME *pft, wchar_t *str)
 Parse a string representing an interval into a FILETIME interval.
KHMEXP long KHMAPI FtIntervalMsToRepChange (LPFILETIME pft)
 Return number of milliseconds till next representation change.
KHMEXP int KHMAPI AnsiStrToUnicode (wchar_t *wstr, size_t cbwstr, const char *astr)
 Convert a safe ANSI string to a Unicode string.
KHMEXP int KHMAPI UnicodeStrToAnsi (char *dest, size_t cbdest, const wchar_t *src)
 Convert a Unicode string to ANSI.

Flags for kcdb_type::toString

#define KCDB_TS_SHORT   1
 Specify that the short form of the string representation should be returned.
#define KCDB_TS_LONG   0
 Specify that the long form of the string representation should be returned.

Flags for kcdb_type

#define KCDB_TYPE_FLAG_CB_AUTO   16
 The type supports KCDB_CBSIZE_AUTO.
#define KCDB_TYPE_FLAG_CB_MIN   128
 The cb_min member is valid.
#define KCDB_TYPE_FLAG_CB_MAX   256
 The cb_max member is valid.
#define KCDB_TYPE_FLAG_CB_FIXED   (KCDB_TYPE_FLAG_CB_AUTO|KCDB_TYPE_FLAG_CB_MIN|KCDB_TYPE_FLAG_CB_MAX)
 Denotes that objects of this type have a fixed size.

Standard type identifiers and names

#define KCDB_TYPE_MAX_ID   255
#define KCDB_TYPE_INVALID   (-1)
 Invalid type.
#define KCDB_TYPE_ALL   KCDB_TYPE_INVALID
 All types.
#define KCDB_TYPE_VOID   0
 Void.
#define KCDB_TYPE_STRING   1
 String.
#define KCDB_TYPE_DATE   2
 Data.
#define KCDB_TYPE_INTERVAL   3
 Interval.
#define KCDB_TYPE_INT32   4
 32-bit integer
#define KCDB_TYPE_INT64   5
 64-bit integer
#define KCDB_TYPE_DATA   6
 Raw data.
#define KCDB_TYPENAME_VOID   L"Void"
#define KCDB_TYPENAME_STRING   L"String"
#define KCDB_TYPENAME_DATE   L"Date"
#define KCDB_TYPENAME_INTERVAL   L"Interval"
#define KCDB_TYPENAME_INT32   L"Int32"
#define KCDB_TYPENAME_INT64   L"Int64"
#define KCDB_TYPENAME_DATA   L"Data"

Defines

#define KCDB_TYPE_MAXCB   16384
 The maximum number of bytes allowed for a value of any type.

Typedefs

typedef khm_int32(KHMAPI *) kcdb_dtf_toString (const void *data, khm_size cb_data, wchar_t *s_buf, khm_size *pcb_s_buf, khm_int32 flags)
 Convert a field to a string.
typedef khm_boolean(KHMAPI *) kcdb_dtf_isValid (const void *data, khm_size cb_data)
 Verifies whetehr the given buffer contains valid data.
typedef khm_int32(KHMAPI *) kcdb_dtf_comp (const void *data_l, khm_size cb_data_l, const void *data_r, khm_size cb_data_r)
 Compare two fields.
typedef khm_int32(KHMAPI *) kcdb_dtf_dup (const void *data_src, khm_size cb_data_src, void *data_dst, khm_size *pcb_data_dst)
 Duplicate a data field.
typedef tag_kcdb_type kcdb_type
 A data type descriptor.

Functions

KHMEXP khm_int32 KHMAPI kcdb_type_get_id (const wchar_t *name, khm_int32 *id)
KHMEXP khm_int32 KHMAPI kcdb_type_get_info (khm_int32 id, kcdb_type **info)
 Return the type descriptor for a given type id.
KHMEXP khm_int32 KHMAPI kcdb_type_release_info (kcdb_type *info)
 Release a reference to a type info structure.
KHMEXP khm_int32 KHMAPI kcdb_type_get_name (khm_int32 id, wchar_t *buffer, khm_size *cbbuf)
 Get the name of a type.
KHMEXP khm_int32 KHMAPI kcdb_type_register (const kcdb_type *type, khm_int32 *new_id)
 Register a credentials attribute type.
KHMEXP khm_int32 KHMAPI kcdb_type_unregister (khm_int32 id)
 Unregister a credential attribute type.
KHMEXP khm_int32 KHMAPI kcdb_type_get_next_free (khm_int32 *id)


Define Documentation

#define KCDB_TS_LONG   0

Specify that the long form of the string representation should be returned.

Flags for kcdb_type::toString. The flag specifies how long the string representation should be. The specific length of a short or long description is not restricted and it is up to the implementation to choose how to interpret the flags.

#define KCDB_TS_SHORT   1

Specify that the short form of the string representation should be returned.

Flags for kcdb_type::toString. The flag specifies how long the string representation should be. The specific length of a short or long description is not restricted and it is up to the implementation to choose how to interpret the flags.

Usually, KCDB_TS_SHORT is specified when the amount of space that is available to display the string is very restricted. It may be the case that the string is truncated to facilitate displaying in a constrainted space.

#define KCDB_TYPE_ALL   KCDB_TYPE_INVALID

All types.

Used by filters to indicate that all types are allowed.

#define KCDB_TYPE_DATA   6

Raw data.

A raw data buffer.

#define KCDB_TYPE_DATE   2

Data.

A date/time represented in FILETIME format.

#define KCDB_TYPE_FLAG_CB_AUTO   16

The type supports KCDB_CBSIZE_AUTO.

Used for types where the size of the object can be determined through context or by the object content. Such as for objects that have a fixed size or unicode strings that have a terminator.

This implies that ALL the object manipulation callbacks that are defined in this type definition support the KCDB_CBSIZE_AUTO value.

#define KCDB_TYPE_FLAG_CB_FIXED   (KCDB_TYPE_FLAG_CB_AUTO|KCDB_TYPE_FLAG_CB_MIN|KCDB_TYPE_FLAG_CB_MAX)

Denotes that objects of this type have a fixed size.

If this flags is specified, then the type definition must also specify cb_min and cb_max, which must both be the same value.

Note:
Implies KCDB_TYPE_FLAG_CB_AUTO, KCDB_TYPE_FLAG_CB_MIN and KCDB_TYPE_FLAG_CB_MAX. Pay special attention to the implication of KCDB_TYPE_FLAG_AUTO.

#define KCDB_TYPE_FLAG_CB_MAX   256

The cb_max member is valid.

The cb_max member defines the maximum number of bytes that an object of this type will consume.

Note:
If this flag is used in conjunction with KCDB_TYPE_FLAG_CB_MIN then, cb_min must be less than or equal to cb_max.

#define KCDB_TYPE_FLAG_CB_MIN   128

The cb_min member is valid.

The cb_min member defines the minimum number of bytes that an object of this type will consume.

Note:
If this flag is used in conjunction with KCDB_TYPE_FLAG_CB_MAX then, cb_min must be less than or equal to cb_max.

#define KCDB_TYPE_INT32   4

32-bit integer

A 32-bit signed integer.

#define KCDB_TYPE_INT64   5

64-bit integer

A 64-bit integer.

#define KCDB_TYPE_INTERVAL   3

Interval.

An interval of time represented as the difference between two FILETIME values.

#define KCDB_TYPE_INVALID   (-1)

Invalid type.

Used by functions that return a type identifier to indicate that the returned type identifier is invalid. Also used to indicate that a type identifier is not available

#define KCDB_TYPE_MAX_ID   255

Maximum identifier number

#define KCDB_TYPE_STRING   1

String.

NULL terminated Unicode string. The byte count for a string attribute always includes the terminating NULL.

#define KCDB_TYPE_VOID   0

Void.

No data. This is not an actual data type.


Typedef Documentation

typedef khm_int32(KHMAPI *) kcdb_dtf_comp(const void *data_l, khm_size cb_data_l, const void *data_r, khm_size cb_data_r)

Compare two fields.

Compare the two data fields and return a value indicating their relative ordering. The return value follows the same specification as strcmp().

Both data buffers that are passed in can be assumed to be valid.

None of the data buffers should be modified in any way.

Parameters:
[in] data_l Valid pointer to first data buffer
[in] cb_data_l Number of bytes in data_l. If the data type flags has KCDB_TYPE_FLAG_CB_AUTO, then this parameter could be set to KCDB_CBSIZE_AUTO. In this case, the function should compute the size of the input buffer assuming that the input buffer is valid.
[in] data_r Valid pointer to second data buffer
[in] cb_data_r Number of bytes in data_r. If the data type flags has KCDB_TYPE_FLAG_CB_AUTO, then this parameter could be set to KCDB_CBSIZE_AUTO. In this case, the function should compute the size of the input buffer assuming that the input buffer is valid.
Returns:
The return value should be
  • Less than zero if data_l < data_r
  • Equal to zero if data_l == data_r or if this data type can not be compared
  • Greater than zero if data_l > data_r
Note:
This documents the expected behavior of this prototype function
See also:
kcdb_type

typedef khm_int32(KHMAPI *) kcdb_dtf_dup(const void *data_src, khm_size cb_data_src, void *data_dst, khm_size *pcb_data_dst)

Duplicate a data field.

Duplicates a data field. The buffer pointed to by data_src contains a valid field. The function should copy the field with appropriate adjustments to data_dst.

The data_dst parameter can be NULL if only the required size of the buffer is needed. In this case, teh function should set pcb_data_dst to the number of bytes required and then return KHM_ERROR_TOO_LONG.

Parameters:
[in] data_src Pointer to a valid data buffer
[in] cb_data_src Number of bytes in data_src. If the data type flags has KCDB_TYPE_FLAG_CB_AUTO, then this parameter could be set to KCDB_CBSIZE_AUTO. In this case, the function should compute the size of the input buffer assuming that the input buffer is valid.
[out] data_dst Poitner to destination buffer. Could be NULL if only the required size of the destination buffer is to be returned.
[in,out] pcb_data_dst On entry specifies the number of bytes in data_dst, and on exit should contain the number of bytes copied.
Return values:
KHM_ERROR_SUCCESS The data was successfully copied. The number of bytes copied is in pcb_data_dst
KHM_ERROR_INVALID_PARAM One or more parameters is incorrect.
KHM_ERROR_TOO_LONG Either data_dst was NULL or the size of the buffer was insufficient. The required size is in pcb_data_dst
Note:
This documents the expected behavior of this prototype function
See also:
kcdb_type

typedef khm_boolean(KHMAPI *) kcdb_dtf_isValid(const void *data, khm_size cb_data)

Verifies whetehr the given buffer contains valid data.

The function should examine the buffer and the size of the buffer and determine whether or not the buffer contains valid data for this data type.

The data field pointed to by data should not be modified in any way.

Parameters:
[in] data A pointer to a data buffer
[in] cb_data The number of bytes in the data buffer. If the data type flags has KCDB_TYPE_FLAG_CB_AUTO, then this parameter could be set to KCDB_CBSIZE_AUTO. In this case, the function should compute the size of the input buffer assuming that the input buffer is valid.
Returns:
TRUE if the data is valid, FALSE otherwise.
Note:
This documents the expected behavior of this prototype function
See also:
kcdb_type

typedef khm_int32(KHMAPI *) kcdb_dtf_toString(const void *data, khm_size cb_data, wchar_t *s_buf, khm_size *pcb_s_buf, khm_int32 flags)

Convert a field to a string.

Provides a string representation of a field in a credential. The data buffer can be assumed to be valid.

On entry, s_buf can be NULL if only the required size of the buffer is to be returned. pcb_s_buf should be non-NULL and should point to a valid variable of type khm_size that will, on entry, contain the size of the buffer pointed to by s_buf if s_buf is not NULL, and on exit will contain the number of bytes consumed in s_buf, or the required size of the buffer if s_buf was NULL or the size of the buffer was insufficient.

The implementation should verify the parameters that are passed in to the function.

The data pointed to by data should not be modified in any way.

Parameters:
[in] data Valid pointer to a block of data
[in] cb_data Number of bytes in data block pointed to by data
[out] s_buf Buffer to receive the string representation of data. If the data type flags has KCDB_TYPE_FLAG_CB_AUTO, then this parameter could be set to KCDB_CBSIZE_AUTO. In this case, the function should compute the size of the input buffer assuming that the input buffer is valid.
[in,out] pcb_s_buf On entry, contains the size of the buffer pointed to by s_buf, and on exit, contains the number of bytes used by the string representation of the data including the NULL terminator
[in] flags Flags for formatting the string
Return values:
KHM_ERROR_SUCCESS The string representation of the data field was successfully copied to s_buf and the size of the buffer used was copied to pcb_s_buf.
KHM_ERROR_INVALID_PARAM One or more parameters were invalid
KHM_ERROR_TOO_LONG Either s_buf was NULL or the size indicated by pcb_s_buf was too small to contain the string representation of the value. The required size of the buffer is in pcb_s_buf.
Note:
This documents the expected behavior of this prototype function
See also:
kcdb_type

typedef struct tag_kcdb_type kcdb_type

A data type descriptor.

Handles basic operation for a specific data type.

See also:
Data types in Network Identity Manager


Function Documentation

KHMEXP int KHMAPI AnsiStrToUnicode ( wchar_t *  wstr,
size_t  cbwstr,
const char *  astr 
)

Convert a safe ANSI string to a Unicode string.

The resulting string is guaranteed to be NULL terminated and within the size limit set by cbwstr.

If the whole string cannot be converted, wstr is set to an empty string.

Returns:
the number of characters converted. This is always either the length of the string astr or 0.

KHMEXP FILETIME KHMAPI FtAdd ( LPFILETIME  ft1,
LPFILETIME  ft2 
)

Calculate the sum of two FILETIMEs.

Return the value of ft1 + ft2

KHMEXP long KHMAPI FtCompare ( LPFILETIME  pft1,
LPFILETIME  pft2 
)

Compare two FILETIME values.

The return value is similar to the return value of strcmp(), based on the comparison of the two FILETIME values.

KHMEXP long KHMAPI FtIntervalMsToRepChange ( LPFILETIME  pft  ) 

Return number of milliseconds till next representation change.

Returns the number of milliseconds that must elapse away from the interval specified in pft for the representation of pft to change from whatever it is right now.

Returns 0 if the representation is not expected to change.

KHMEXP FILETIME KHMAPI FtSub ( LPFILETIME  ft1,
LPFILETIME  ft2 
)

Calculate the difference between two FILETIMEs.

Returns the value of ft1 - ft2

KHMEXP khm_int32 KHMAPI IntervalStringToFt ( FILETIME *  pft,
wchar_t *  str 
)

Parse a string representing an interval into a FILETIME interval.

The string is a localized string which should look like the following:

    [number unit] [number unit]...

where number is an integer while unit is a localized (possibly abbreviated) unit specification. The value of the described interval is calculated as the sum of each number in units. For example :

    1 hour 36 minutes

would result in an interval specification that's equivalent to 1 hour and 36 minutes. Of course there is no restriction on the order in which the number unit specifications are given and the same unit may be repeated multiple times.

Return values:
KHM_ERROR_INVALID_PARAM The given string was invalid or had a token that could not be parsed. It can also mean that pft was NULL or str was NULL.
KHM_ERROR_SUCCESS The string was successfully parsed and the result was placed in pft.

KHMEXP khm_int32 KHMAPI kcdb_type_get_info ( khm_int32  id,
kcdb_type **  info 
)

Return the type descriptor for a given type id.

Parameters:
[out] info Receives a held reference to a type descriptor. Use kcdb_type_release_info() to release the handle. If the info parameter is NULL, the function returns KHM_ERROR_SUCCESS if id is a valid type id, and returns KHM_ERROR_NOT_FOUND otherwise.
See also:
kcdb_type_release_info()

KHMEXP khm_int32 KHMAPI kcdb_type_get_name ( khm_int32  id,
wchar_t *  buffer,
khm_size cbbuf 
)

Get the name of a type.

Retrieves the non-localized name of the specified type.

KHMEXP khm_int32 KHMAPI kcdb_type_register ( const kcdb_type type,
khm_int32 new_id 
)

Register a credentials attribute type.

The credentials type record pointed to by type defines a new credential attribute type. The id member of type may be set to KCDB_TYPE_INVALID to indicate that an attribute ID is to be generated automatically.

Parameters:
[in] type The type descriptor
[out] new_id Receives the identifier for the credential attribute type.

KHMEXP khm_int32 KHMAPI kcdb_type_release_info ( kcdb_type info  ) 

Release a reference to a type info structure.

Releases the reference to the type information obtained with a prior call to kcdb_type_get_info().

KHMEXP khm_int32 KHMAPI kcdb_type_unregister ( khm_int32  id  ) 

Unregister a credential attribute type.

Removes the registration for the specified credentials attribute type.

KHMEXP int KHMAPI UnicodeStrToAnsi ( char *  dest,
size_t  cbdest,
const wchar_t *  src 
)

Convert a Unicode string to ANSI.

The resulting string is guaranteed to be NULL terminated and within the size limit set by cbdest.

Returns:
the number of characters converted. This is always either the length of the string src or 0.


Generated on Fri Aug 3 08:27:14 2007 for Network Identity Manager by Doxygen 1.5.2
© 2004-2007 Massachusetts Institute of Technology.
© 2005-2007 Secure Endpoints Inc.
Contact khimaira@mit.edu