# Constants

## Enumerations

- enum {
  ccapi_version_2 = 2, ccapi_version_3 = 3, ccapi_version_4 = 4, ccapi_version_5 = 5,
  ccapi_version_6 = 6, ccapi_version_7 = 7, ccapi_version_max = ccapi_version_7
  }
- enum {
  ccNoError = 0, ccIteratorEnd = 201, ccErrBadParam, ccErrNoMem,
  ccErrInvalidContext, ccErrInvalidCCache, ccErrInvalidString, ccErrInvalidCredentials,
  ccErrInvalidCCacheIterator, ccErrInvalidCredentialsIterator, ccErrInvalidLock, ccErrBadName,
  ccErrBadCredentialsVersion, ccErrBadAPIVersion, ccErrContextLocked, ccErrContextUnlocked,
  ccErrCCacheLocked, ccErrCCacheUnlocked, ccErrBadLockType, ccErrNeverDefault,
  ccErrCredentialsNotFound, ccErrCCacheNotFound, ccErrContextNotFound, ccErrServerUnavailable,
  ccErrServerInsecure, ccErrServerCantBecomeUID, ccErrTimeOffsetNotSet, ccErrBadInternalMessage,
  ccErrNotImplemented, ccErrClientNotFound
  }
- enum cc_credential_versions { cc_credentials_v4 = 1, cc_credentials_v5 = 2, cc_credentials_v4_v5 = 3 }
- enum cc_lock_types { cc_lock_read = 0, cc_lock_write = 1, cc_lock_upgrade = 2, cc_lock_downgrade = 3 }
- enum cc_lock_modes { cc_lock_noblock = 0, cc_lock_block = 1 }
- enum {
  cc_v4_name_size = 40, cc_v4_instance_size = 40, cc_v4_realm_size = 40, cc_v4_ticket_size = 1254,
  cc_v4_key_size = 8
  }
- enum cc_string_to_key_type {
  cc_v4_stk_afs = 0, cc_v4_stk_des = 1, cc_v4_stk_columbia_special = 2, cc_v4_stk_krb5 = 3,
  cc_v4_stk_unknown = 4
  }

## Enumeration Type Documentation

anonymous enum

API version numbers

These constants are passed into cc_initialize() to indicate the version of the API the caller wants to use.

CCAPI v1 and v2 are deprecated and should not be used.

Enumerator:

  ccapi_version_2 |
  ccapi_version_3 |
  ccapi_version_4 |
  ccapi_version_5 |
  ccapi_version_6 |
  ccapi_version_7 |
  ccapi_version_max |

anonymous enum

Error codes

Enumerator:

  ccNoError | Success.
  ccIteratorEnd | Iterator is done iterating.
  ccErrBadParam | Bad parameter (NULL or invalid pointer where valid pointer expected).
  ccErrNoMem | Not enough memory to complete the operation.
  ccErrInvalidContext | Context is invalid (e.g., it was released).
  ccErrInvalidCCache | CCache is invalid (e.g., it was released or destroyed).
  ccErrInvalidString | String is invalid (e.g., it was released).
  ccErrInvalidCredentials | Credentials are invalid (e.g., they were released), or they have a bad version.
  ccErrInvalidCCacheIterator | CCache iterator is invalid (e.g., it was released).
  ccErrInvalidCredentialsIterator | Credentials iterator is invalid (e.g., it was released).
  ccErrInvalidLock | Lock is invalid (e.g., it was released).
  ccErrBadName | Bad credential cache name format.
  ccErrBadCredentialsVersion | Credentials version is invalid.
  ccErrBadAPIVersion | Unsupported API version.
  ccErrContextLocked | Context is already locked.
  ccErrContextUnlocked | Context is not locked by the caller.
  ccErrCCacheLocked | CCache is already locked.
  ccErrCCacheUnlocked | CCache is not locked by the caller.
  ccErrBadLockType | Bad lock type.
  ccErrNeverDefault | CCache was never default.
  ccErrCredentialsNotFound | Matching credentials not found in the ccache.
  ccErrCCacheNotFound | Matching ccache not found in the collection.
  ccErrContextNotFound | Matching cache collection not found.
  ccErrServerUnavailable | CCacheServer is unavailable.
  ccErrServerInsecure | CCacheServer has detected that it is running as the wrong user.
  ccErrServerCantBecomeUID | CCacheServer failed to start running as the user.
  ccErrTimeOffsetNotSet | KDC time offset not set for this ccache.
  ccErrBadInternalMessage | The client and CCacheServer can't communicate (e.g., a version mismatch).
  ccErrNotImplemented | API function not supported by this implementation.
  ccErrClientNotFound | CCacheServer has no record of the caller's process (e.g., the server crashed).

enum cc_credential_versions

Credentials versions

These constants are used in several places in the API to discern between Kerberos v4 and Kerberos v5. Not all values are valid inputs and outputs for all functions; function specifications below detail the allowed values.

Kerberos version constants will always be a bit-field, and can be tested as such; for example the following test will tell you if a ccacheVersion includes v5 credentials:

if ((ccacheVersion & cc_credentials_v5) != 0)

Enumerator:

  cc_credentials_v4 |
  cc_credentials_v5 |
  cc_credentials_v4_v5 |

enum cc_lock_types

Lock types

These constants are used in the locking functions to describe the type of lock requested. Note that all CCAPI locks are advisory so only callers using the lock calls will be blocked by each other. This is because locking functions were introduced after the CCAPI came into common use and we did not want to break existing callers.

Enumerator:

  cc_lock_read |
  cc_lock_write |
  cc_lock_upgrade |
  cc_lock_downgrade |

enum cc_lock_modes

Locking Modes

These constants are used in the advisory locking functions to describe whether or not the lock function should block waiting for a lock or return an error immediately. For example, attempting to acquire a lock with a non-blocking call will result in an error if the lock cannot be acquired; otherwise, the call will block until the lock can be acquired.

Enumerator:

  cc_lock_noblock |
  cc_lock_block |

anonymous enum

Sizes of fields in cc_credentials_v4_t.

Enumerator:

  cc_v4_name_size |
  cc_v4_instance_size |
  cc_v4_realm_size |
  cc_v4_ticket_size |
  cc_v4_key_size |

enum cc_string_to_key_type

String to key type (Kerberos v4 only)

Enumerator:

  cc_v4_stk_afs |
  cc_v4_stk_des |
  cc_v4_stk_columbia_special |
  cc_v4_stk_krb5 |
  cc_v4_stk_unknown |