Core definitions


Detailed Description

Key type definitions used throughout NetIDMgr.


Data Structures

struct  tag_khm_version
 Generic version type. More...

Defines

#define VALID_INT_BITS   INT_MAX
#define VALID_UINT_BITS   UINT_MAX
#define KHM_UINT32_MAX   4294967295
#define KHM_INT32_MAX   2147483647
#define KHM_INT32_MIN   (-KHM_INT32_MAX-1)
#define KHM_UINT16_MAX   65535
#define KHM_INT16_MAX   32767
#define KHM_INT16_MIN   (-KHM_INT16_MAX-1)
#define KHM_INVALID_HANDLE   ((khm_handle) NULL)
 The invalid handle.
#define _SSIZE_T_DEFINED
#define KHMAPI   __stdcall
 Calling convention for NetIDMgr exported functions.
#define KHMEXP   KHMEXP_IMP
 Export prefix for NetIDMgr exported functions.
#define KHMEXP_EXP   __declspec(dllexport)
#define KHMEXP_IMP   __declspec(dllimport)
#define KHM_PERM_READ   0x100
 Generic read permission or request.
#define KHM_PERM_WRITE   0x200
 Generic write permission or request.
#define KHM_FLAG_CREATE   0x1000
 Generic create request.
#define UBOUND32(d)   ((((d)-1)&~3) + 4)
 Wrap to DWORD boundary.
#define BYTEOFFSET(p, off)   ((void *)(((char *) (p)) + (off)))
 Offset a pointer by a number of bytes.
#define IS_POW2(d)   ((d)>=0 && !((d) & ((d) - 1)))
 Check for powers of 2.
#define UBOUNDSS(v, start, step)   (((v)<=(start))?(start):(start)+((((v)-((start)+1))/(step))+1)*(step))
 Wrap to upper bound based on start and step size.
#define ARRAYLENGTH(x)   (sizeof(x)/sizeof(x[0]))

Typedefs

typedef unsigned __int8 khm_octet
 A byte (8 bit unsigned).
typedef __int16 khm_int16
 A signed 16 bit quantity.
typedef unsigned __int16 khm_ui_2
 An unsigned 16 bit quantity.
typedef __int32 khm_int32
 A signed 32 bit quantity.
typedef unsigned __int32 khm_ui_4
 An unsigned 32 bit quantity.
typedef __int64 khm_int64
 A signed 64 bit quantity.
typedef unsigned __int64 khm_ui_8
 An unsigned 64 bit quantity.
typedef void * khm_handle
 Generic handle type.
typedef khm_int32 khm_boolean
 Boolean.
typedef size_t khm_size
 A size.
typedef _W64 int ssize_t
 Signed size specifier.
typedef ssize_t khm_ssize
typedef unsigned __int32 khm_wparm
typedef unsigned __int64 khm_lparm
typedef tag_khm_version khm_version
 Generic version type.


Define Documentation

#define BYTEOFFSET ( p,
off   )     ((void *)(((char *) (p)) + (off)))

Offset a pointer by a number of bytes.

Given a pointer, returns a void pointer that is a given number of bytes offset from the pointer.

#define IS_POW2 (  )     ((d)>=0 && !((d) & ((d) - 1)))

Check for powers of 2.

Return TRUE if the operand is a positive power of 2 or 0

#define KHM_FLAG_CREATE   0x1000

Generic create request.

For most lookup functions, specifying this flag indicates that if the requested object is not found it should be created.

#define KHM_INVALID_HANDLE   ((khm_handle) NULL)

The invalid handle.

Just used to indicate that this handle does not point to anything useful. Usually returned by a function that returns a handle as a signal that the operation failed.

#define KHMAPI   __stdcall

Calling convention for NetIDMgr exported functions.

The caling convention for all NetIDMgr exported functions is __stdcall , unless otherwise noted.

#define KHMEXP   KHMEXP_IMP

Export prefix for NetIDMgr exported functions.

When compiling source that exports functions, those exported function declarations will be done as follows:

   __declspec(dllexport) khm_int32 __stdcall function_name(arguments...);

This eliminates the need for a separate exports definition file. However, it doesn't preserve ordinals, but we aren't guaranteeing that anyway.

On the other hand, if a particular function is going to be imported from a DLL, it should declared as follows:

   __declspec(dllimport) khm_int32 __stdcall function_name(arguments...);

This allows the compiler to properly instrument the import. If the function is not declared this way, there will be a stub function generated that will just jump to the proper import, generating redundant instructions and wasting execution time.

This macro encapsulates the proper declaration specifier.

#define UBOUND32 (  )     ((((d)-1)&~3) + 4)

Wrap to DWORD boundary.

Returns the smallest integer greater than or equal to the parameter that is a multiple of 4.

Note:
Only use with positive integers.

#define UBOUNDSS ( v,
start,
step   )     (((v)<=(start))?(start):(start)+((((v)-((start)+1))/(step))+1)*(step))

Wrap to upper bound based on start and step size.

Return the smallest element in the series s, s+t, s+2*t, s+3*t, ... that is greater than or equal to v.


Typedef Documentation

typedef void* khm_handle

Generic handle type.

Handles in NetIDMgr are generic pointers.

ssize_t

Signed size specifier.

Just a signed version of size_t


Generated on Fri Aug 3 08:27:13 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