Path: blob/main/crypto/krb5/src/include/CredentialsCache.h
34878 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* include/CredentialsCache.h */2/*3* Copyright 1998-2006 Massachusetts Institute of Technology.4* All Rights Reserved.5*6* Export of this software from the United States of America may7* require a specific license from the United States Government.8* It is the responsibility of any person or organization contemplating9* export to obtain such a license before exporting.10*11* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and12* distribute this software and its documentation for any purpose and13* without fee is hereby granted, provided that the above copyright14* notice appear in all copies and that both that copyright notice and15* this permission notice appear in supporting documentation, and that16* the name of M.I.T. not be used in advertising or publicity pertaining17* to distribution of the software without specific, written prior18* permission. Furthermore if you modify this software you must label19* your software as modified software and not distribute it in such a20* fashion that it might be confused with the original M.I.T. software.21* M.I.T. makes no representations about the suitability of22* this software for any purpose. It is provided "as is" without express23* or implied warranty.24*/2526#ifndef __CREDENTIALSCACHE__27#define __CREDENTIALSCACHE__2829#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))30#include <TargetConditionals.h>3132/* Notifications which are sent when the ccache collection or a ccache change.33* Notifications are sent to the distributed notification center.34* The object for kCCAPICacheCollectionChangedNotification is NULL.35* The object for kCCAPICCacheChangedNotification is a CFString containing the36* name of the ccache.37*38* Note: Notifications are not sent if the CCacheServer crashes. */39#define kCCAPICacheCollectionChangedNotification CFSTR ("CCAPICacheCollectionChangedNotification")40#define kCCAPICCacheChangedNotification CFSTR ("CCAPICCacheChangedNotification")41#endif4243#if defined(_WIN32)44#include <winsock.h>45#include "win-mac.h"46#else47#include <stdint.h>48#endif4950#ifdef __cplusplus51extern "C" {52#endif /* __cplusplus */5354#if defined(__APPLE__) && (defined(__ppc__) || defined(__ppc64__) || defined(__i386__) || defined(__x86_64__))55#pragma pack(push,2)56#endif5758#if defined(_WIN32)59#define CCACHE_API __declspec(dllexport)6061#if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1500 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)62#if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR)63#error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform.64#endif /* _TIME_T_DEFINED */65#define _USE_32BIT_TIME_T66#endif67#else68#define CCACHE_API69#endif7071/*!72* \mainpage Credentials Cache API (CCAPI) Documentation73*74* \section toc Table of Contents75*76* \li \ref introduction77* \li \ref error_handling78* \li \ref synchronization_atomicity79* \li \ref memory_management80* \li \ref opaque_types81*82* \li \ref ccapi_constants_reference83* \li \ref ccapi_types_reference84*85* \li \ref cc_context_reference86* \li \ref cc_context_f "cc_context_t Functions"87*88* \li \ref cc_ccache_reference89* \li \ref cc_ccache_f "cc_ccache_t Functions"90*91* \li \ref cc_credentials_reference92* \li \ref cc_credentials_f "cc_credentials_t Functions"93*94* \li \ref cc_ccache_iterator_reference95* \li \ref cc_ccache_iterator_f "cc_ccache_iterator_t Functions"96*97* \li \ref cc_credentials_iterator_reference98* \li \ref cc_credentials_iterator_f "cc_credentials_iterator_t Functions"99*100* \li \ref cc_string_reference101* \li \ref cc_string_f "cc_string_t Functions"102*103* \section introduction Introduction104*105* This is the specification for an API which provides Credentials Cache106* services for Kerberos v5 (and previously v4). The idea behind this API is107* that multiple Kerberos implementations can share a single collection of108* credentials caches, mediated by this API specification. On the Mac OS and109* Microsoft Windows platforms this will allow single-login, even when more110* than one Kerberos shared library is in use on a particular system.111*112* Abstractly, a credentials cache collection contains one or more credentials113* caches, or ccaches. A ccache is uniquely identified by its name, which is114* a string internal to the API and not intended to be presented to users.115* The user presentable identifier of a ccache is its principal.116*117* Unlike the previous versions of the API, version 3 of the API could store118* credentials for multiple Kerberos versions in the same ccache.119*120* At any given time, one ccache is the "default" ccache. The exact meaning121* of a default ccache is OS-specific; refer to implementation requirements122* for details.123*124* \section error_handling Error Handling125*126* All functions of the API return some of the error constants listed FIXME;127* the exact list of error constants returned by any API function is provided128* in the function descriptions below.129*130* When returning an error constant other than ccNoError or ccIteratorEnd, API131* functions never modify any of the values passed in by reference.132*133* \section synchronization_atomicity Synchronization and Atomicity134*135* Every function in the API is atomic. In order to make a series of calls136* atomic, callers should lock the ccache or cache collection they are working137* with to advise other callers not to modify that container. Note that138* advisory locks are per container so even if you have a read lock on the cache139* collection other callers can obtain write locks on ccaches in that cache140* collection.141*142* Note that iterators do not iterate over ccaches and credentials atomically143* because locking ccaches and the cache collection over every iteration would144* degrade performance considerably under high load. However, iterators do145* guarantee a consistent view of items they are iterating over. Iterators146* will never return duplicate entries or skip entries when items are removed147* or added to the container they are iterating over.148*149* An application can always lock a ccache or the cache collection to guarantee150* that other callers participating in the advisory locking system do not151* modify the ccache or cache collection.152*153* Implementations should not use copy-on-write techniques to implement locks154* because those techniques imply that same parts of the ccache collection155* remain visible to some callers even though they are not present in the156* collection, which is a potential security risk. For example, a copy-on-write157* technique might make a copy of the entire collection when a read lock is158* acquired, so as to allow the owner of the lock to access the collection in159* an apparently unmodified state, while also allowing others to make160* modifications to the collection. However, this would also enable the owner161* of the lock to indefinitely (until the expiration time) use credentials that162* have actually been deleted from the collection.163*164* \section memory_management Object Memory Management165*166* The lifetime of an object returned by the API is until release() is called167* for it. Releasing one object has no effect on existence of any other object.168* For example, a ccache obtained within a context continue to exist when the169* context is released.170*171* Every object returned by the API (cc_context_t, cc_ccache_t, cc_ccache_iterator_t,172* cc_credentials_t, cc_credentials_iterator_t, cc_string_t) is owned by the173* caller of the API, and it is the responsibility of the caller to call release()174* for every object to prevent memory leaks.175*176* \section opaque_types Opaque Types177*178* All of the opaque high-level types in CCache API are implemented as structures179* of function pointers and private data. To perform some operation on a type, the180* caller of the API has to first obtain an instance of that type, and then call the181* appropriate function pointer from that instance. For example, to call182* get_change_time() on a cc_context_t, one would call cc_initialize() which creates183* a new cc_context_t and then call its get_change_time(), like this:184*185* \code186* cc_context_t context;187* cc_int32 err = cc_initialize (&context, ccapi_version_3, nil, nil);188* if (err == ccNoError)189* time = context->functions->get_change_time (context)190* \endcode191*192* All API functions also have convenience preprocessor macros, which make the API193* seem completely function-based. For example, cc_context_get_change_time194* (context, time) is equivalent to context->functions->get_change_time195* (context, time). The convenience macros follow the following naming convention:196*197* The API function some_function()198* \code199* cc_type_t an_object;200* result = an_object->functions->some_function (opaque_pointer, args)201* \endcode202*203* has an equivalent convenience macro of the form cc_type_some_function():204* \code205* cc_type_t an_object;206* result = cc_type_some_function (an_object, args)207* \endcode208*209* The specifications below include the names for both the functions and the210* convenience macros, in that order. For clarity, it is recommended that clients211* using the API use the convenience macros, but that is merely a stylistic choice.212*213* Implementing the API in this manner allows us to extend and change the interface214* in the future, while preserving compatibility with older clients.215*216* For example, consider the case when the signature or the semantics of a cc_ccache_t217* function is changed. The API version number is incremented. The library218* implementation contains both a function with the old signature and semantics and219* a function with the new signature and semantics. When a context is created, the API220* version number used in that context is stored in the context, and therefore it can221* be used whenever a ccache is created in that context. When a ccache is created in a222* context with the old API version number, the function pointer structure for the223* ccache is filled with pointers to functions implementing the old semantics; when a224* ccache is created in a context with the new API version number, the function pointer225* structure for the ccache is filled with poitners to functions implementing the new226* semantics.227*228* Similarly, if a function is added to the API, the version number in the context can229* be used to decide whether to include the implementation of the new function in the230* appropriate function pointer structure or not.231*/232233/*!234* \defgroup ccapi_constants_reference Constants235* @{236*/237238/*!239* API version numbers240*241* These constants are passed into cc_initialize() to indicate the version242* of the API the caller wants to use.243*244* CCAPI v1 and v2 are deprecated and should not be used.245*/246enum {247ccapi_version_2 = 2,248ccapi_version_3 = 3,249ccapi_version_4 = 4,250ccapi_version_5 = 5,251ccapi_version_6 = 6,252ccapi_version_7 = 7,253ccapi_version_max = ccapi_version_7254};255256/*!257* Error codes258*/259enum {260261ccNoError = 0, /*!< Success. */262263ccIteratorEnd = 201, /*!< Iterator is done iterating. */264ccErrBadParam, /*!< Bad parameter (NULL or invalid pointer where valid pointer expected). */265ccErrNoMem, /*!< Not enough memory to complete the operation. */266ccErrInvalidContext, /*!< Context is invalid (e.g., it was released). */267ccErrInvalidCCache, /*!< CCache is invalid (e.g., it was released or destroyed). */268269/* 206 */270ccErrInvalidString, /*!< String is invalid (e.g., it was released). */271ccErrInvalidCredentials, /*!< Credentials are invalid (e.g., they were released), or they have a bad version. */272ccErrInvalidCCacheIterator, /*!< CCache iterator is invalid (e.g., it was released). */273ccErrInvalidCredentialsIterator, /*!< Credentials iterator is invalid (e.g., it was released). */274ccErrInvalidLock, /*!< Lock is invalid (e.g., it was released). */275276/* 211 */277ccErrBadName, /*!< Bad credential cache name format. */278ccErrBadCredentialsVersion, /*!< Credentials version is invalid. */279ccErrBadAPIVersion, /*!< Unsupported API version. */280ccErrContextLocked, /*!< Context is already locked. */281ccErrContextUnlocked, /*!< Context is not locked by the caller. */282283/* 216 */284ccErrCCacheLocked, /*!< CCache is already locked. */285ccErrCCacheUnlocked, /*!< CCache is not locked by the caller. */286ccErrBadLockType, /*!< Bad lock type. */287ccErrNeverDefault, /*!< CCache was never default. */288ccErrCredentialsNotFound, /*!< Matching credentials not found in the ccache. */289290/* 221 */291ccErrCCacheNotFound, /*!< Matching ccache not found in the collection. */292ccErrContextNotFound, /*!< Matching cache collection not found. */293ccErrServerUnavailable, /*!< CCacheServer is unavailable. */294ccErrServerInsecure, /*!< CCacheServer has detected that it is running as the wrong user. */295ccErrServerCantBecomeUID, /*!< CCacheServer failed to start running as the user. */296297/* 226 */298ccErrTimeOffsetNotSet, /*!< KDC time offset not set for this ccache. */299ccErrBadInternalMessage, /*!< The client and CCacheServer can't communicate (e.g., a version mismatch). */300ccErrNotImplemented, /*!< API function not supported by this implementation. */301ccErrClientNotFound /*!< CCacheServer has no record of the caller's process (e.g., the server crashed). */302};303304/*!305* Credentials versions306*307* These constants are used in several places in the API to discern Kerberos308* versions. Not all values are valid inputs and outputs for all functions;309* function specifications below detail the allowed values.310*311* Kerberos version constants will always be a bit-field, and can be312* tested as such; for example the following test will tell you if313* a ccacheVersion includes v5 credentials:314*315* if ((ccacheVersion & cc_credentials_v5) != 0)316*/317enum cc_credential_versions {318/* cc_credentials_v4 = 1, */319cc_credentials_v5 = 2,320/* cc_credentials_v4_v5 = 3 */321};322323/*!324* Lock types325*326* These constants are used in the locking functions to describe the327* type of lock requested. Note that all CCAPI locks are advisory328* so only callers using the lock calls will be blocked by each other.329* This is because locking functions were introduced after the CCAPI330* came into common use and we did not want to break existing callers.331*/332enum cc_lock_types {333cc_lock_read = 0,334cc_lock_write = 1,335cc_lock_upgrade = 2,336cc_lock_downgrade = 3337};338339/*!340* Locking Modes341*342* These constants are used in the advisory locking functions to343* describe whether or not the lock function should block waiting for344* a lock or return an error immediately. For example, attempting to345* acquire a lock with a non-blocking call will result in an error if the346* lock cannot be acquired; otherwise, the call will block until the lock347* can be acquired.348*/349enum cc_lock_modes {350cc_lock_noblock = 0,351cc_lock_block = 1352};353354/*!@}*/355356/*!357* \defgroup ccapi_types_reference Basic Types358* @{359*/360361/*! Unsigned 32-bit integer type */362typedef uint32_t cc_uint32;363/*! Signed 32-bit integer type */364typedef int32_t cc_int32;365#if defined (WIN32)366typedef __int64 cc_int64;367typedef unsigned __int64 cc_uint64;368#else369/*! Unsigned 64-bit integer type */370typedef int64_t cc_int64;371/*! Signed 64-bit integer type */372typedef uint64_t cc_uint64;373#endif374/*!375* The cc_time_t type is used to represent a time in seconds. The time must376* be stored as the number of seconds since midnight GMT on January 1, 1970.377*/378typedef cc_uint32 cc_time_t;379380/*!@}*/381382/*!383* \defgroup cc_context_reference cc_context_t Overview384* @{385*386* The cc_context_t type gives the caller access to a ccache collection.387* Before being able to call any functions in the CCache API, the caller388* needs to acquire an instance of cc_context_t by calling cc_initialize().389*390* For API function documentation see \ref cc_context_f.391*/392struct cc_context_f;393typedef struct cc_context_f cc_context_f;394395struct cc_context_d {396const cc_context_f *functions;397#if TARGET_OS_MAC398const cc_context_f *vector_functions;399#endif400};401typedef struct cc_context_d cc_context_d;402typedef cc_context_d *cc_context_t;403404/*!@}*/405406/*!407* \defgroup cc_ccache_reference cc_ccache_t Overview408* @{409*410* The cc_ccache_t type represents a reference to a ccache.411* Callers can access a ccache and the credentials stored in it412* via a cc_ccache_t. A cc_ccache_t can be acquired via413* cc_context_open_ccache(), cc_context_open_default_ccache(), or414* cc_ccache_iterator_next().415*416* For API function documentation see \ref cc_ccache_f.417*/418struct cc_ccache_f;419typedef struct cc_ccache_f cc_ccache_f;420421struct cc_ccache_d {422const cc_ccache_f *functions;423#if TARGET_OS_MAC424const cc_ccache_f *vector_functions;425#endif426};427typedef struct cc_ccache_d cc_ccache_d;428typedef cc_ccache_d *cc_ccache_t;429430/*!@}*/431432/*!433* \defgroup cc_ccache_iterator_reference cc_ccache_iterator_t Overview434* @{435*436* The cc_ccache_iterator_t type represents an iterator that437* iterates over a set of ccaches and returns them in all in some438* order. A new instance of this type can be obtained by calling439* cc_context_new_ccache_iterator().440*441* For API function documentation see \ref cc_ccache_iterator_f.442*/443struct cc_ccache_iterator_f;444typedef struct cc_ccache_iterator_f cc_ccache_iterator_f;445446struct cc_ccache_iterator_d {447const cc_ccache_iterator_f *functions;448#if TARGET_OS_MAC449const cc_ccache_iterator_f *vector_functions;450#endif451};452typedef struct cc_ccache_iterator_d cc_ccache_iterator_d;453typedef cc_ccache_iterator_d *cc_ccache_iterator_t;454/*!@}*/455456/*!457* \defgroup cc_credentials_reference cc_credentials_t Overview458* @{459*460* The cc_credentials_t type is used to store a single set of credentials for461* Kerberos v5. In addition to its only function, release(), it contains a462* pointer to a cc_credentials_union structure. A cc_credentials_union463* structure contains an integer of the enumerator type464* cc_credentials_version, which is #cc_credentials_v5, and a pointer union,465* which contains a cc_credentials_v5_t pointer, depending on the value in466* version.467*468* Variables of the type cc_credentials_t are allocated by the CCAPI469* implementation, and should be released with their release()470* function. API functions which receive credentials structures471* from the caller always accept cc_credentials_union, which is472* allocated by the caller, and accordingly disposed by the caller.473*474* For API functions see \ref cc_credentials_f.475*/476477/*!478* The CCAPI data structure. This structure is similar to a krb5_data structure.479* In a v5 credentials structure, cc_data structures are used480* to store tagged variable-length binary data. Specifically,481* for cc_credentials_v5.ticket and482* cc_credentials_v5.second_ticket, the cc_data.type field must483* be zero. For the cc_credentials_v5.addresses,484* cc_credentials_v5.authdata, and cc_credentials_v5.keyblock,485* the cc_data.type field should be the address type,486* authorization data type, and encryption type, as defined by487* the Kerberos v5 protocol definition.488*/489struct cc_data {490/*! The type of the data as defined by the krb5_data structure. */491cc_uint32 type;492/*! The length of \a data. */493cc_uint32 length;494/*! The data buffer. */495void* data;496};497typedef struct cc_data cc_data;498499/*!500* If a cc_credentials_t variable is used to store Kerberos v5 c501* redentials, and then credentials.credentials_v5 points to a502* v5 credentials structure. This structure is similar to a503* krb5_creds structure.504*/505struct cc_credentials_v5_t {506/*! A properly quoted string representation of the client principal. */507char* client;508/*! A properly quoted string representation of the service principal. */509char* server;510/*! Session encryption key info. */511cc_data keyblock;512/*! The time when the ticket was issued. */513cc_time_t authtime;514/*! The time when the ticket becomes valid. */515cc_time_t starttime;516/*! The time when the ticket expires. */517cc_time_t endtime;518/*! The time when the ticket becomes no longer renewable (if renewable). */519cc_time_t renew_till;520/*! 1 if the ticket is encrypted in another ticket's key, or 0 otherwise. */521cc_uint32 is_skey;522/*! Ticket flags, as defined by the Kerberos 5 API. */523cc_uint32 ticket_flags;524/*! The the list of network addresses of hosts that are allowed to authenticate525* using this ticket. */526cc_data** addresses;527/*! Ticket data. */528cc_data ticket;529/*! Second ticket data. */530cc_data second_ticket;531/*! Authorization data. */532cc_data** authdata;533};534typedef struct cc_credentials_v5_t cc_credentials_v5_t;535536struct cc_credentials_union {537/*! The credentials version of this credentials object. */538cc_uint32 version;539/*! The credentials. */540union {541/*! If \a version is #cc_credentials_v5, a pointer to a cc_credentials_v5_t. */542cc_credentials_v5_t* credentials_v5;543} credentials;544};545typedef struct cc_credentials_union cc_credentials_union;546547struct cc_credentials_f;548typedef struct cc_credentials_f cc_credentials_f;549550struct cc_credentials_d {551const cc_credentials_union *data;552const cc_credentials_f *functions;553#if TARGET_OS_MAC554const cc_credentials_f *otherFunctions;555#endif556};557typedef struct cc_credentials_d cc_credentials_d;558typedef cc_credentials_d *cc_credentials_t;559/*!@}*/560561/*!562* \defgroup cc_credentials_iterator_reference cc_credentials_iterator_t563* @{564* The cc_credentials_iterator_t type represents an iterator that565* iterates over a set of credentials. A new instance of this type566* can be obtained by calling cc_ccache_new_credentials_iterator().567*568* For API function documentation see \ref cc_credentials_iterator_f.569*/570struct cc_credentials_iterator_f;571typedef struct cc_credentials_iterator_f cc_credentials_iterator_f;572573struct cc_credentials_iterator_d {574const cc_credentials_iterator_f *functions;575#if TARGET_OS_MAC576const cc_credentials_iterator_f *vector_functions;577#endif578};579typedef struct cc_credentials_iterator_d cc_credentials_iterator_d;580typedef cc_credentials_iterator_d *cc_credentials_iterator_t;581/*!@}*/582583/*!584* \defgroup cc_string_reference cc_string_t Overview585* @{586* The cc_string_t represents a C string returned by the API.587* It has a pointer to the string data and a release() function.588* This type is used for both principal names and ccache names589* returned by the API. Principal names may contain UTF-8 encoded590* strings for internationalization purposes.591*592* For API function documentation see \ref cc_string_f.593*/594struct cc_string_f;595typedef struct cc_string_f cc_string_f;596597struct cc_string_d {598const char *data;599const cc_string_f *functions;600#if TARGET_OS_MAC601const cc_string_f *vector_functions;602#endif603};604typedef struct cc_string_d cc_string_d;605typedef cc_string_d *cc_string_t;606/*!@}*/607608/*!609* Function pointer table for cc_context_t. For more information see610* \ref cc_context_reference.611*/612struct cc_context_f {613/*!614* \param io_context the context object to free.615* \return On success, #ccNoError. On failure, an error code representing the failure.616* \brief \b cc_context_release(): Release memory associated with a cc_context_t.617*/618cc_int32 (*release) (cc_context_t io_context);619620/*!621* \param in_context the context object for the cache collection to examine.622* \param out_time on exit, the time of the most recent change for the entire ccache collection.623* \return On success, #ccNoError. On failure, an error code representing the failure.624* \brief \b cc_context_get_change_time(): Get the last time the cache collection changed.625*626* This function returns the time of the most recent change for the entire ccache collection.627* By maintaining a local copy the caller can deduce whether or not the ccache collection has628* been modified since the previous call to cc_context_get_change_time().629*630* The time returned by cc_context_get_changed_time() increases whenever:631*632* \li a ccache is created633* \li a ccache is destroyed634* \li a credential is stored635* \li a credential is removed636* \li a ccache principal is changed637* \li the default ccache is changed638*639* \note In order to be able to compare two values returned by cc_context_get_change_time(),640* the caller must use the same context to acquire them. Callers should maintain a single641* context in memory for cc_context_get_change_time() calls rather than creating a new642* context for every call.643*644* \sa wait_for_change645*/646cc_int32 (*get_change_time) (cc_context_t in_context,647cc_time_t *out_time);648649/*!650* \param in_context the context object for the cache collection.651* \param out_name on exit, the name of the default ccache.652* \return On success, #ccNoError. On failure, an error code representing the failure.653* \brief \b cc_context_get_default_ccache_name(): Get the name of the default ccache.654*655* This function returns the name of the default ccache. When the default ccache656* exists, its name is returned. If there are no ccaches in the collection, and657* thus there is no default ccache, the name that the default ccache should have658* is returned. The ccache with that name will be used as the default ccache by659* all processes which initialized Kerberos libraries before the ccache was created.660*661* If there is no default ccache, and the client is creating a new ccache, it662* should be created with the default name. If there already is a default ccache,663* and the client wants to create a new ccache (as opposed to reusing an existing664* ccache), it should be created with any unique name; #create_new_ccache()665* can be used to accomplish that more easily.666*667* If the first ccache is created with a name other than the default name, then668* the processes already running will not notice the credentials stored in the669* new ccache, which is normally undesirable.670*/671cc_int32 (*get_default_ccache_name) (cc_context_t in_context,672cc_string_t *out_name);673674/*!675* \param in_context the context object for the cache collection.676* \param in_name the name of the ccache to open.677* \param out_ccache on exit, a ccache object for the ccache678* \return On success, #ccNoError. If no ccache named \a in_name exists,679* #ccErrCCacheNotFound. On failure, an error code representing the failure.680* \brief \b cc_context_open_ccache(): Open a ccache.681*682* Opens an already existing ccache identified by its name. It returns a reference683* to the ccache in \a out_ccache.684*685* The list of all ccache names, principals, and credentials versions may be retrieved686* by calling cc_context_new_cache_iterator(), cc_ccache_get_name(),687* cc_ccache_get_principal(), and cc_ccache_get_cred_version().688*/689cc_int32 (*open_ccache) (cc_context_t in_context,690const char *in_name,691cc_ccache_t *out_ccache);692693/*!694* \param in_context the context object for the cache collection.695* \param out_ccache on exit, a ccache object for the default ccache696* \return On success, #ccNoError. If no default ccache exists,697* #ccErrCCacheNotFound. On failure, an error code representing the failure.698* \brief \b cc_context_open_default_ccache(): Open the default ccache.699*700* Opens the default ccache. It returns a reference to the ccache in *ccache.701*702* This function performs the same function as calling703* cc_context_get_default_ccache_name followed by cc_context_open_ccache,704* but it performs it atomically.705*/706cc_int32 (*open_default_ccache) (cc_context_t in_context,707cc_ccache_t *out_ccache);708709/*!710* \param in_context the context object for the cache collection.711* \param in_name the name of the new ccache to create712* \param in_cred_vers the version of the credentials the new ccache will hold713* \param in_principal the client principal of the credentials the new ccache will hold714* \param out_ccache on exit, a ccache object for the newly created ccache715* \return On success, #ccNoError. On failure, an error code representing the failure.716* \brief \b cc_context_create_ccache(): Create a new ccache.717*718* Create a new credentials cache. The ccache is uniquely identified by719* its name. The principal given is also associated with the ccache and720* the credentials version specified. A NULL name is not allowed (and721* ccErrBadName is returned if one is passed in). Only cc_credentials_v5722* can be an input value for cred_vers.723*724* If you want to create a new ccache (with a unique name), you should use725* cc_context_create_new_ccache() instead. If you want to create or reinitialize726* the default cache, you should use cc_context_create_default_ccache().727*728* If name is non-NULL and there is already a ccache named name:729*730* \li the credentials in the ccache whose version is cred_vers are removed731* \li the principal (of the existing ccache) associated with cred_vers is set to principal732* \li a handle for the existing ccache is returned and all existing handles for the ccache remain valid733*734* If no ccache named name already exists:735*736* \li a new empty ccache is created737* \li the principal of the new ccache associated with cred_vers is set to principal738* \li a handle for the new ccache is returned739*740* For a new ccache, the name should be any unique string. The name is not741* intended to be presented to users.742*743* If the created ccache is the first ccache in the collection, it is made744* the default ccache. Note that normally it is undesirable to create the first745* ccache with a name different from the default ccache name (as returned by746* cc_context_get_default_ccache_name()); see the description of747* cc_context_get_default_ccache_name() for details.748*749* The principal should be a C string containing an unparsed Kerberos750* principal in the format of the appropriate Kerberos version,751* i.e. \verbatim foo/bar/@BAZ \endverbatim for Kerberos v5.752*/753cc_int32 (*create_ccache) (cc_context_t in_context,754const char *in_name,755cc_uint32 in_cred_vers,756const char *in_principal,757cc_ccache_t *out_ccache);758759/*!760* \param in_context the context object for the cache collection.761* \param in_cred_vers the version of the credentials the new default ccache will hold762* \param in_principal the client principal of the credentials the new default ccache will hold763* \param out_ccache on exit, a ccache object for the newly created default ccache764* \return On success, #ccNoError. On failure, an error code representing the failure.765* \brief \b cc_context_create_default_ccache(): Create a new default ccache.766*767* Create the default credentials cache. The behavior of this function is768* similar to that of cc_create_ccache(). If there is a default ccache769* (which is always the case except when there are no ccaches at all in770* the collection), it is initialized with the specified credentials version771* and principal, as per cc_create_ccache(); otherwise, a new ccache is772* created, and its name is the name returned by773* cc_context_get_default_ccache_name().774*/775cc_int32 (*create_default_ccache) (cc_context_t in_context,776cc_uint32 in_cred_vers,777const char *in_principal,778cc_ccache_t *out_ccache);779780/*!781* \param in_context the context object for the cache collection.782* \param in_cred_vers the version of the credentials the new ccache will hold783* \param in_principal the client principal of the credentials the new ccache will hold784* \param out_ccache on exit, a ccache object for the newly created ccache785* \return On success, #ccNoError. On failure, an error code representing the failure.786* \brief \b cc_context_create_new_ccache(): Create a new uniquely named ccache.787*788* Create a new unique credentials cache. The behavior of this function789* is similar to that of cc_create_ccache(). If there are no ccaches, and790* therefore no default ccache, the new ccache is created with the default791* ccache name as would be returned by get_default_ccache_name(). If there792* are some ccaches, and therefore there is a default ccache, the new ccache793* is created with a new unique name. Clearly, this function never reinitializes794* a ccache, since it always uses a unique name.795*/796cc_int32 (*create_new_ccache) (cc_context_t in_context,797cc_uint32 in_cred_vers,798const char *in_principal,799cc_ccache_t *out_ccache);800801/*!802* \param in_context the context object for the cache collection.803* \param out_iterator on exit, a ccache iterator object for the ccache collection.804* \return On success, #ccNoError. On failure, an error code representing the failure.805* \brief \b cc_context_new_ccache_iterator(): Get an iterator for the cache collection.806*807* Used to allocate memory and initialize iterator. Successive calls to iterator's808* next() function will return ccaches in the collection.809*810* If changes are made to the collection while an iterator is being used811* on it, the iterator must return at least the intersection, and at most812* the union, of the set of ccaches that were present when the iteration813* began and the set of ccaches that are present when it ends.814*/815cc_int32 (*new_ccache_iterator) (cc_context_t in_context,816cc_ccache_iterator_t *out_iterator);817818/*!819* \param in_context the context object for the cache collection.820* \param in_lock_type the type of lock to obtain.821* \param in_block whether or not the function should block if the lock cannot be obtained immediately.822* \return On success, #ccNoError. On failure, an error code representing the failure.823* \brief \b cc_context_lock(): Lock the cache collection.824*825* Attempts to acquire an advisory lock for the ccache collection. Allowed values826* for lock_type are:827*828* \li cc_lock_read: a read lock.829* \li cc_lock_write: a write lock830* \li cc_lock_upgrade: upgrade an already-obtained read lock to a write lock831* \li cc_lock_downgrade: downgrade an already-obtained write lock to a read lock832*833* If block is cc_lock_block, lock() will not return until the lock is acquired.834* If block is cc_lock_noblock, lock() will return immediately, either acquiring835* the lock and returning ccNoError, or failing to acquire the lock and returning836* an error explaining why.837*838* Locks apply only to the list of ccaches, not the contents of those ccaches. To839* prevent callers participating in the advisory locking from changing the credentials840* in a cache you must also lock that ccache with cc_ccache_lock(). This is so841* that you can get the list of ccaches without preventing applications from842* simultaneously obtaining service tickets.843*844* To avoid having to deal with differences between thread semantics on different845* platforms, locks are granted per context, rather than per thread or per process.846* That means that different threads of execution have to acquire separate contexts847* in order to be able to synchronize with each other.848*849* The lock should be unlocked by using cc_context_unlock().850*851* \note All locks are advisory. For example, callers which do not call852* cc_context_lock() and cc_context_unlock() will not be prevented from writing853* to the cache collection when you have a read lock. This is because the CCAPI854* locking was added after the first release and thus adding mandatory locks would855* have changed the user experience and performance of existing applications.856*/857cc_int32 (*lock) (cc_context_t in_context,858cc_uint32 in_lock_type,859cc_uint32 in_block);860861/*!862* \param in_context the context object for the cache collection.863* \return On success, #ccNoError. On failure, an error code representing the failure.864* \brief \b cc_context_unlock(): Unlock the cache collection.865*/866cc_int32 (*unlock) (cc_context_t in_cc_context);867868/*!869* \param in_context a context object.870* \param in_compare_to_context a context object to compare with \a in_context.871* \param out_equal on exit, whether or not the two contexts refer to the same cache collection.872* \return On success, #ccNoError. On failure, an error code representing the failure.873* \brief \b cc_context_compare(): Compare two context objects.874*/875cc_int32 (*compare) (cc_context_t in_cc_context,876cc_context_t in_compare_to_context,877cc_uint32 *out_equal);878879/*!880* \param in_context a context object.881* \return On success, #ccNoError. On failure, an error code representing the failure.882* \brief \b cc_context_wait_for_change(): Wait for the next change in the cache collection.883*884* This function blocks until the next change is made to the cache collection885* ccache collection. By repeatedly calling cc_context_wait_for_change() from886* a worker thread the caller can effectively receive callbacks whenever the887* cache collection changes. This is considerably more efficient than polling888* with cc_context_get_change_time().889*890* cc_context_wait_for_change() will return whenever:891*892* \li a ccache is created893* \li a ccache is destroyed894* \li a credential is stored895* \li a credential is removed896* \li a ccache principal is changed897* \li the default ccache is changed898*899* \note In order to make sure that the caller doesn't miss any changes,900* cc_context_wait_for_change() always returns immediately after the first time it901* is called on a new context object. Callers must use the same context object902* for successive calls to cc_context_wait_for_change() rather than creating a new903* context for every call.904*905* \sa get_change_time906*/907cc_int32 (*wait_for_change) (cc_context_t in_cc_context);908};909910/*!911* Function pointer table for cc_ccache_t. For more information see912* \ref cc_ccache_reference.913*/914struct cc_ccache_f {915/*!916* \param io_ccache the ccache object to release.917* \return On success, #ccNoError. On failure, an error code representing the failure.918* \brief \b cc_ccache_release(): Release memory associated with a cc_ccache_t object.919* \note Does not modify the ccache. If you wish to remove the ccache see cc_ccache_destroy().920*/921cc_int32 (*release) (cc_ccache_t io_ccache);922923/*!924* \param io_ccache the ccache object to destroy and release.925* \return On success, #ccNoError. On failure, an error code representing the failure.926* \brief \b cc_ccache_destroy(): Destroy a ccache.927*928* Destroy the ccache referred to by \a io_ccache and releases memory associated with929* the \a io_ccache object. After this call \a io_ccache becomes invalid. If930* \a io_ccache was the default ccache, the next ccache in the cache collection (if any)931* becomes the new default.932*/933cc_int32 (*destroy) (cc_ccache_t io_ccache);934935/*!936* \param io_ccache a ccache object to make the new default ccache.937* \return On success, #ccNoError. On failure, an error code representing the failure.938* \brief \b cc_ccache_set_default(): Make a ccache the default ccache.939*/940cc_int32 (*set_default) (cc_ccache_t io_ccache);941942/*!943* \param in_ccache a ccache object.944* \param out_credentials_version on exit, the credentials version of \a in_ccache.945* \return On success, #ccNoError. On failure, an error code representing the failure.946* \brief \b cc_ccache_get_credentials_version(): Get the credentials version of a ccache.947*948* cc_ccache_get_credentials_version() returns one value of the enumerated949* type cc_credentials_vers. The return value is #cc_credentials_v5 (if950* ccache's v5 principal has been set). A ccache's principal is set with951* one of cc_context_create_ccache(), cc_context_create_new_ccache(),952* cc_context_create_default_ccache(), or cc_ccache_set_principal().953*/954cc_int32 (*get_credentials_version) (cc_ccache_t in_ccache,955cc_uint32 *out_credentials_version);956957/*!958* \param in_ccache a ccache object.959* \param out_name on exit, a cc_string_t representing the name of \a in_ccache.960* \a out_name must be released with cc_string_release().961* \return On success, #ccNoError. On failure, an error code representing the failure.962* \brief \b cc_ccache_get_name(): Get the name of a ccache.963*/964cc_int32 (*get_name) (cc_ccache_t in_ccache,965cc_string_t *out_name);966967/*!968* \param in_ccache a ccache object.969* \param in_credentials_version the credentials version to get the principal for.970* \param out_principal on exit, a cc_string_t representing the principal of \a in_ccache.971* \a out_principal must be released with cc_string_release().972* \return On success, #ccNoError. On failure, an error code representing the failure.973* \brief \b cc_ccache_get_principal(): Get the principal of a ccache.974*975* Return the principal for the ccache that was set via cc_context_create_ccache(),976* cc_context_create_default_ccache(), cc_context_create_new_ccache(), or977* cc_ccache_set_principal().978*/979cc_int32 (*get_principal) (cc_ccache_t in_ccache,980cc_uint32 in_credentials_version,981cc_string_t *out_principal);982983984/*!985* \param in_ccache a ccache object.986* \param in_credentials_version the credentials version to set the principal for.987* \param in_principal a C string representing the new principal of \a in_ccache.988* \return On success, #ccNoError. On failure, an error code representing the failure.989* \brief \b cc_ccache_set_principal(): Set the principal of a ccache.990*991* Set the a principal for ccache.992*/993cc_int32 (*set_principal) (cc_ccache_t io_ccache,994cc_uint32 in_credentials_version,995const char *in_principal);996997/*!998* \param io_ccache a ccache object.999* \param in_credentials_union the credentials to store in \a io_ccache.1000* \return On success, #ccNoError. On failure, an error code representing the failure.1001* \brief \b cc_ccache_store_credentials(): Store credentials in a ccache.1002*1003* Store a copy of credentials in the ccache.1004*1005* See the description of the credentials types for the meaning of1006* cc_credentials_union fields.1007*1008* Before credentials of a specific credential type can be stored in a1009* ccache, the corresponding principal version has to be set. That is,1010* before you can store Kerberos v5 credentials in a ccache, the Kerberos1011* v5 principal has to be set either by cc_context_create_ccache(),1012* cc_context_create_default_ccache(), cc_context_create_new_ccache(), or1013* cc_ccache_set_principal(); otherwise, ccErrBadCredentialsVersion is1014* returned.1015*/1016cc_int32 (*store_credentials) (cc_ccache_t io_ccache,1017const cc_credentials_union *in_credentials_union);10181019/*!1020* \param io_ccache a ccache object.1021* \param in_credentials the credentials to remove from \a io_ccache.1022* \return On success, #ccNoError. On failure, an error code representing the failure.1023* \brief \b cc_ccache_remove_credentials(): Remove credentials from a ccache.1024*1025* Removes credentials from a ccache. Note that credentials must be previously1026* acquired from the CCache API; only exactly matching credentials will be1027* removed. (This places the burden of determining exactly which credentials1028* to remove on the caller, but ensures there is no ambigity about which1029* credentials will be removed.) cc_credentials_t objects can be obtained by1030* iterating over the ccache's credentials with cc_ccache_new_credentials_iterator().1031*1032* If found, the credentials are removed from the ccache. The credentials1033* parameter is not modified and should be freed by the caller. It is1034* legitimate to call this function while an iterator is traversing the1035* ccache, and the deletion of a credential already returned by1036* cc_credentials_iterator_next() will not disturb sequence of credentials1037* returned by cc_credentials_iterator_next().1038*/1039cc_int32 (*remove_credentials) (cc_ccache_t io_ccache,1040cc_credentials_t in_credentials);10411042/*!1043* \param in_ccache a ccache object.1044* \param out_credentials_iterator a credentials iterator for \a io_ccache.1045* \return On success, #ccNoError. On failure, an error code representing the failure.1046* \brief \b cc_ccache_new_credentials_iterator(): Iterate over credentials in a ccache.1047*1048* Allocates memory for iterator and initializes it. Successive calls to1049* cc_credentials_iterator_next() will return credentials from the ccache.1050*1051* If changes are made to the ccache while an iterator is being used on it,1052* the iterator must return at least the intersection, and at most the union,1053* of the set of credentials that were in the ccache when the iteration began1054* and the set of credentials that are in the ccache when it ends.1055*/1056cc_int32 (*new_credentials_iterator) (cc_ccache_t in_ccache,1057cc_credentials_iterator_t *out_credentials_iterator);10581059/*!1060* \param io_source_ccache a ccache object to move.1061* \param io_destination_ccache a ccache object replace with the contents of \a io_source_ccache.1062* \return On success, #ccNoError. On failure, an error code representing the failure.1063* \brief \b cc_ccache_move(): Move the contents of one ccache into another, destroying the source.1064*1065* cc_ccache_move() atomically copies the credentials, credential versions and principals1066* from one ccache to another. On successful completion \a io_source_ccache will be1067* released and the ccache it points to will be destroyed. Any credentials previously1068* in \a io_destination_ccache will be replaced with credentials from \a io_source_ccache.1069* The only part of \a io_destination_ccache which remains constant is the name. Any other1070* callers referring to \a io_destination_ccache will suddenly see new data in it.1071*1072* Typically cc_ccache_move() is used when the caller wishes to safely overwrite the1073* contents of a ccache with new data which requires several steps to generate.1074* cc_ccache_move() allows the caller to create a temporary ccache1075* (which can be destroyed if any intermediate step fails) and the atomically copy1076* the temporary cache into the destination.1077*/1078cc_int32 (*move) (cc_ccache_t io_source_ccache,1079cc_ccache_t io_destination_ccache);10801081/*!1082* \param io_ccache the ccache object for the ccache you wish to lock.1083* \param in_lock_type the type of lock to obtain.1084* \param in_block whether or not the function should block if the lock cannot be obtained immediately.1085* \return On success, #ccNoError. On failure, an error code representing the failure.1086* \brief \b cc_ccache_lock(): Lock a ccache.1087*1088* Attempts to acquire an advisory lock for a ccache. Allowed values for lock_type are:1089*1090* \li cc_lock_read: a read lock.1091* \li cc_lock_write: a write lock1092* \li cc_lock_upgrade: upgrade an already-obtained read lock to a write lock1093* \li cc_lock_downgrade: downgrade an already-obtained write lock to a read lock1094*1095* If block is cc_lock_block, lock() will not return until the lock is acquired.1096* If block is cc_lock_noblock, lock() will return immediately, either acquiring1097* the lock and returning ccNoError, or failing to acquire the lock and returning1098* an error explaining why.1099*1100* To avoid having to deal with differences between thread semantics on different1101* platforms, locks are granted per ccache, rather than per thread or per process.1102* That means that different threads of execution have to acquire separate contexts1103* in order to be able to synchronize with each other.1104*1105* The lock should be unlocked by using cc_ccache_unlock().1106*1107* \note All locks are advisory. For example, callers which do not call1108* cc_ccache_lock() and cc_ccache_unlock() will not be prevented from writing1109* to the ccache when you have a read lock. This is because the CCAPI1110* locking was added after the first release and thus adding mandatory locks would1111* have changed the user experience and performance of existing applications.1112*/1113cc_int32 (*lock) (cc_ccache_t io_ccache,1114cc_uint32 in_lock_type,1115cc_uint32 in_block);11161117/*!1118* \param io_ccache a ccache object.1119* \return On success, #ccNoError. On failure, an error code representing the failure.1120* \brief \b cc_ccache_unlock(): Unlock a ccache.1121*/1122cc_int32 (*unlock) (cc_ccache_t io_ccache);11231124/*!1125* \param in_ccache a cache object.1126* \param out_last_default_time on exit, the last time the ccache was default.1127* \return On success, #ccNoError. On failure, an error code representing the failure.1128* \brief \b cc_ccache_get_change_time(): Get the last time a ccache was the default ccache.1129*1130* This function returns the last time when the ccache was made the default ccache.1131* This allows clients to sort the ccaches by how recently they were default, which1132* is useful for user listing of ccaches. If the ccache was never default,1133* ccErrNeverDefault is returned.1134*/1135cc_int32 (*get_last_default_time) (cc_ccache_t in_ccache,1136cc_time_t *out_last_default_time);11371138/*!1139* \param in_ccache a cache object.1140* \param out_change_time on exit, the last time the ccache changed.1141* \return On success, #ccNoError. If the ccache was never the default ccache,1142* #ccErrNeverDefault. Otherwise, an error code representing the failure.1143* \brief \b cc_ccache_get_change_time(): Get the last time a ccache changed.1144*1145* This function returns the time of the most recent change made to a ccache.1146* By maintaining a local copy the caller can deduce whether or not the ccache has1147* been modified since the previous call to cc_ccache_get_change_time().1148*1149* The time returned by cc_ccache_get_change_time() increases whenever:1150*1151* \li a credential is stored1152* \li a credential is removed1153* \li a ccache principal is changed1154* \li the ccache becomes the default ccache1155* \li the ccache is no longer the default ccache1156*1157* \note In order to be able to compare two values returned by cc_ccache_get_change_time(),1158* the caller must use the same ccache object to acquire them. Callers should maintain a1159* single ccache object in memory for cc_ccache_get_change_time() calls rather than1160* creating a new ccache object for every call.1161*1162* \sa wait_for_change1163*/1164cc_int32 (*get_change_time) (cc_ccache_t in_ccache,1165cc_time_t *out_change_time);11661167/*!1168* \param in_ccache a ccache object.1169* \param in_compare_to_ccache a ccache object to compare with \a in_ccache.1170* \param out_equal on exit, whether or not the two ccaches refer to the same ccache.1171* \return On success, #ccNoError. On failure, an error code representing the failure.1172* \brief \b cc_ccache_compare(): Compare two ccache objects.1173*/1174cc_int32 (*compare) (cc_ccache_t in_ccache,1175cc_ccache_t in_compare_to_ccache,1176cc_uint32 *out_equal);11771178/*!1179* \param in_ccache a ccache object.1180* \param in_credentials_version the credentials version to get the time offset for.1181* \param out_time_offset on exit, the KDC time offset for \a in_ccache for credentials version1182* \a in_credentials_version.1183* \return On success, #ccNoError if a time offset was obtained or #ccErrTimeOffsetNotSet1184* if a time offset has not been set. On failure, an error code representing the failure.1185* \brief \b cc_ccache_get_kdc_time_offset(): Get the KDC time offset for credentials in a ccache.1186* \sa set_kdc_time_offset, clear_kdc_time_offset1187*1188* Sometimes the KDC and client's clocks get out of sync. cc_ccache_get_kdc_time_offset()1189* returns the difference between the KDC and client's clocks at the time credentials were1190* acquired. This offset allows callers to figure out how much time is left on a given1191* credential even though the end_time is based on the KDC's clock not the client's clock.1192*/1193cc_int32 (*get_kdc_time_offset) (cc_ccache_t in_ccache,1194cc_uint32 in_credentials_version,1195cc_time_t *out_time_offset);11961197/*!1198* \param in_ccache a ccache object.1199* \param in_credentials_version the credentials version to get the time offset for.1200* \param in_time_offset the new KDC time offset for \a in_ccache for credentials version1201* \a in_credentials_version.1202* \return On success, #ccNoError. On failure, an error code representing the failure.1203* \brief \b cc_ccache_set_kdc_time_offset(): Set the KDC time offset for credentials in a ccache.1204* \sa get_kdc_time_offset, clear_kdc_time_offset1205*1206* Sometimes the KDC and client's clocks get out of sync. cc_ccache_set_kdc_time_offset()1207* sets the difference between the KDC and client's clocks at the time credentials were1208* acquired. This offset allows callers to figure out how much time is left on a given1209* credential even though the end_time is based on the KDC's clock not the client's clock.1210*/1211cc_int32 (*set_kdc_time_offset) (cc_ccache_t io_ccache,1212cc_uint32 in_credentials_version,1213cc_time_t in_time_offset);12141215/*!1216* \param in_ccache a ccache object.1217* \param in_credentials_version the credentials version to get the time offset for.1218* \return On success, #ccNoError. On failure, an error code representing the failure.1219* \brief \b cc_ccache_clear_kdc_time_offset(): Clear the KDC time offset for credentials in a ccache.1220* \sa get_kdc_time_offset, set_kdc_time_offset1221*1222* Sometimes the KDC and client's clocks get out of sync. cc_ccache_clear_kdc_time_offset()1223* clears the difference between the KDC and client's clocks at the time credentials were1224* acquired. This offset allows callers to figure out how much time is left on a given1225* credential even though the end_time is based on the KDC's clock not the client's clock.1226*/1227cc_int32 (*clear_kdc_time_offset) (cc_ccache_t io_ccache,1228cc_uint32 in_credentials_version);12291230/*!1231* \param in_ccache a ccache object.1232* \return On success, #ccNoError. On failure, an error code representing the failure.1233* \brief \b cc_ccache_wait_for_change(): Wait for the next change to a ccache.1234*1235* This function blocks until the next change is made to the ccache referenced by1236* \a in_ccache. By repeatedly calling cc_ccache_wait_for_change() from1237* a worker thread the caller can effectively receive callbacks whenever the1238* ccache changes. This is considerably more efficient than polling1239* with cc_ccache_get_change_time().1240*1241* cc_ccache_wait_for_change() will return whenever:1242*1243* \li a credential is stored1244* \li a credential is removed1245* \li the ccache principal is changed1246* \li the ccache becomes the default ccache1247* \li the ccache is no longer the default ccache1248*1249* \note In order to make sure that the caller doesn't miss any changes,1250* cc_ccache_wait_for_change() always returns immediately after the first time it1251* is called on a new ccache object. Callers must use the same ccache object1252* for successive calls to cc_ccache_wait_for_change() rather than creating a new1253* ccache object for every call.1254*1255* \sa get_change_time1256*/1257cc_int32 (*wait_for_change) (cc_ccache_t in_ccache);1258};12591260/*!1261* Function pointer table for cc_string_t. For more information see1262* \ref cc_string_reference.1263*/1264struct cc_string_f {1265/*!1266* \param io_string the string object to release.1267* \return On success, #ccNoError. On failure, an error code representing the failure.1268* \brief \b cc_string_release(): Release memory associated with a cc_string_t object.1269*/1270cc_int32 (*release) (cc_string_t io_string);1271};12721273/*!1274* Function pointer table for cc_credentials_t. For more information see1275* \ref cc_credentials_reference.1276*/1277struct cc_credentials_f {1278/*!1279* \param io_credentials the credentials object to release.1280* \return On success, #ccNoError. On failure, an error code representing the failure.1281* \brief \b cc_credentials_release(): Release memory associated with a cc_credentials_t object.1282*/1283cc_int32 (*release) (cc_credentials_t io_credentials);12841285/*!1286* \param in_credentials a credentials object.1287* \param in_compare_to_credentials a credentials object to compare with \a in_credentials.1288* \param out_equal on exit, whether or not the two credentials objects refer to the1289* same credentials in the cache collection.1290* \return On success, #ccNoError. On failure, an error code representing the failure.1291* \brief \b cc_credentials_compare(): Compare two credentials objects.1292*/1293cc_int32 (*compare) (cc_credentials_t in_credentials,1294cc_credentials_t in_compare_to_credentials,1295cc_uint32 *out_equal);1296};12971298/*!1299* Function pointer table for cc_ccache_iterator_t. For more information see1300* \ref cc_ccache_iterator_reference.1301*/1302struct cc_ccache_iterator_f {1303/*!1304* \param io_ccache_iterator the ccache iterator object to release.1305* \return On success, #ccNoError. On failure, an error code representing the failure.1306* \brief \b cc_ccache_iterator_release(): Release memory associated with a cc_ccache_iterator_t object.1307*/1308cc_int32 (*release) (cc_ccache_iterator_t io_ccache_iterator);13091310/*!1311* \param in_ccache_iterator a ccache iterator object.1312* \param out_ccache on exit, the next ccache in the cache collection.1313* \return On success, #ccNoError if the next ccache in the cache collection was1314* obtained or #ccIteratorEnd if there are no more ccaches.1315* On failure, an error code representing the failure.1316* \brief \b cc_ccache_iterator_next(): Get the next ccache in the cache collection.1317*/1318cc_int32 (*next) (cc_ccache_iterator_t in_ccache_iterator,1319cc_ccache_t *out_ccache);13201321/*!1322* \param in_ccache_iterator a ccache iterator object.1323* \param out_ccache_iterator on exit, a copy of \a in_ccache_iterator.1324* \return On success, #ccNoError. On failure, an error code representing the failure.1325* \brief \b cc_ccache_iterator_clone(): Make a copy of a ccache iterator.1326*/1327cc_int32 (*clone) (cc_ccache_iterator_t in_ccache_iterator,1328cc_ccache_iterator_t *out_ccache_iterator);1329};13301331/*!1332* Function pointer table for cc_credentials_iterator_t. For more information see1333* \ref cc_credentials_iterator_reference.1334*/1335struct cc_credentials_iterator_f {1336/*!1337* \param io_credentials_iterator the credentials iterator object to release.1338* \return On success, #ccNoError. On failure, an error code representing the failure.1339* \brief \b cc_credentials_iterator_release(): Release memory associated with a cc_credentials_iterator_t object.1340*/1341cc_int32 (*release) (cc_credentials_iterator_t io_credentials_iterator);13421343/*!1344* \param in_credentials_iterator a credentials iterator object.1345* \param out_credentials on exit, the next credentials in the ccache.1346* \return On success, #ccNoError if the next credential in the ccache was obtained1347* or #ccIteratorEnd if there are no more credentials.1348* On failure, an error code representing the failure.1349* \brief \b cc_credentials_iterator_next(): Get the next credentials in the ccache.1350*/1351cc_int32 (*next) (cc_credentials_iterator_t in_credentials_iterator,1352cc_credentials_t *out_credentials);13531354/*!1355* \ingroup cc_credentials_iterator_reference1356* \param in_credentials_iterator a credentials iterator object.1357* \param out_credentials_iterator on exit, a copy of \a in_credentials_iterator.1358* \return On success, #ccNoError. On failure, an error code representing the failure.1359* \brief \b cc_credentials_iterator_clone(): Make a copy of a credentials iterator.1360*/1361cc_int32 (*clone) (cc_credentials_iterator_t in_credentials_iterator,1362cc_credentials_iterator_t *out_credentials_iterator);1363};13641365/*!1366* \ingroup cc_context_reference1367* \param out_context on exit, a new context object. Must be free with cc_context_release().1368* \param in_version the requested API version. This should be the maximum version the1369* application supports.1370* \param out_supported_version if non-NULL, on exit contains the maximum API version1371* supported by the implementation.1372* \param out_vendor if non-NULL, on exit contains a pointer to a read-only C string which1373* contains a string describing the vendor which implemented the credentials cache API.1374* \return On success, #ccNoError. On failure, an error code representing the failure.1375* May return CCAPI v2 error CC_BAD_API_VERSION if #ccapi_version_2 is passed in.1376* \brief Initialize a new cc_context.1377*/1378CCACHE_API cc_int32 cc_initialize (cc_context_t *out_context,1379cc_int32 in_version,1380cc_int32 *out_supported_version,1381char const **out_vendor);138213831384/*! \defgroup helper_macros CCAPI Function Helper Macros1385* @{ */13861387/*! Helper macro for cc_context_f release() */1388#define cc_context_release(context) \1389((context) -> functions -> release (context))1390/*! Helper macro for cc_context_f get_change_time() */1391#define cc_context_get_change_time(context, change_time) \1392((context) -> functions -> get_change_time (context, change_time))1393/*! Helper macro for cc_context_f get_default_ccache_name() */1394#define cc_context_get_default_ccache_name(context, name) \1395((context) -> functions -> get_default_ccache_name (context, name))1396/*! Helper macro for cc_context_f open_ccache() */1397#define cc_context_open_ccache(context, name, ccache) \1398((context) -> functions -> open_ccache (context, name, ccache))1399/*! Helper macro for cc_context_f open_default_ccache() */1400#define cc_context_open_default_ccache(context, ccache) \1401((context) -> functions -> open_default_ccache (context, ccache))1402/*! Helper macro for cc_context_f create_ccache() */1403#define cc_context_create_ccache(context, name, version, principal, ccache) \1404((context) -> functions -> create_ccache (context, name, version, principal, ccache))1405/*! Helper macro for cc_context_f create_default_ccache() */1406#define cc_context_create_default_ccache(context, version, principal, ccache) \1407((context) -> functions -> create_default_ccache (context, version, principal, ccache))1408/*! Helper macro for cc_context_f create_new_ccache() */1409#define cc_context_create_new_ccache(context, version, principal, ccache) \1410((context) -> functions -> create_new_ccache (context, version, principal, ccache))1411/*! Helper macro for cc_context_f new_ccache_iterator() */1412#define cc_context_new_ccache_iterator(context, iterator) \1413((context) -> functions -> new_ccache_iterator (context, iterator))1414/*! Helper macro for cc_context_f lock() */1415#define cc_context_lock(context, type, block) \1416((context) -> functions -> lock (context, type, block))1417/*! Helper macro for cc_context_f unlock() */1418#define cc_context_unlock(context) \1419((context) -> functions -> unlock (context))1420/*! Helper macro for cc_context_f compare() */1421#define cc_context_compare(context, compare_to, equal) \1422((context) -> functions -> compare (context, compare_to, equal))1423/*! Helper macro for cc_context_f wait_for_change() */1424#define cc_context_wait_for_change(context) \1425((context) -> functions -> wait_for_change (context))14261427/*! Helper macro for cc_ccache_f release() */1428#define cc_ccache_release(ccache) \1429((ccache) -> functions -> release (ccache))1430/*! Helper macro for cc_ccache_f destroy() */1431#define cc_ccache_destroy(ccache) \1432((ccache) -> functions -> destroy (ccache))1433/*! Helper macro for cc_ccache_f set_default() */1434#define cc_ccache_set_default(ccache) \1435((ccache) -> functions -> set_default (ccache))1436/*! Helper macro for cc_ccache_f get_credentials_version() */1437#define cc_ccache_get_credentials_version(ccache, version) \1438((ccache) -> functions -> get_credentials_version (ccache, version))1439/*! Helper macro for cc_ccache_f get_name() */1440#define cc_ccache_get_name(ccache, name) \1441((ccache) -> functions -> get_name (ccache, name))1442/*! Helper macro for cc_ccache_f get_principal() */1443#define cc_ccache_get_principal(ccache, version, principal) \1444((ccache) -> functions -> get_principal (ccache, version, principal))1445/*! Helper macro for cc_ccache_f set_principal() */1446#define cc_ccache_set_principal(ccache, version, principal) \1447((ccache) -> functions -> set_principal (ccache, version, principal))1448/*! Helper macro for cc_ccache_f store_credentials() */1449#define cc_ccache_store_credentials(ccache, credentials) \1450((ccache) -> functions -> store_credentials (ccache, credentials))1451/*! Helper macro for cc_ccache_f remove_credentials() */1452#define cc_ccache_remove_credentials(ccache, credentials) \1453((ccache) -> functions -> remove_credentials (ccache, credentials))1454/*! Helper macro for cc_ccache_f new_credentials_iterator() */1455#define cc_ccache_new_credentials_iterator(ccache, iterator) \1456((ccache) -> functions -> new_credentials_iterator (ccache, iterator))1457/*! Helper macro for cc_ccache_f lock() */1458#define cc_ccache_lock(ccache, type, block) \1459((ccache) -> functions -> lock (ccache, type, block))1460/*! Helper macro for cc_ccache_f unlock() */1461#define cc_ccache_unlock(ccache) \1462((ccache) -> functions -> unlock (ccache))1463/*! Helper macro for cc_ccache_f get_last_default_time() */1464#define cc_ccache_get_last_default_time(ccache, last_default_time) \1465((ccache) -> functions -> get_last_default_time (ccache, last_default_time))1466/*! Helper macro for cc_ccache_f get_change_time() */1467#define cc_ccache_get_change_time(ccache, change_time) \1468((ccache) -> functions -> get_change_time (ccache, change_time))1469/*! Helper macro for cc_ccache_f move() */1470#define cc_ccache_move(source, destination) \1471((source) -> functions -> move (source, destination))1472/*! Helper macro for cc_ccache_f compare() */1473#define cc_ccache_compare(ccache, compare_to, equal) \1474((ccache) -> functions -> compare (ccache, compare_to, equal))1475/*! Helper macro for cc_ccache_f get_kdc_time_offset() */1476#define cc_ccache_get_kdc_time_offset(ccache, version, time_offset) \1477((ccache) -> functions -> get_kdc_time_offset (ccache, version, time_offset))1478/*! Helper macro for cc_ccache_f set_kdc_time_offset() */1479#define cc_ccache_set_kdc_time_offset(ccache, version, time_offset) \1480((ccache) -> functions -> set_kdc_time_offset (ccache, version, time_offset))1481/*! Helper macro for cc_ccache_f clear_kdc_time_offset() */1482#define cc_ccache_clear_kdc_time_offset(ccache, version) \1483((ccache) -> functions -> clear_kdc_time_offset (ccache, version))1484/*! Helper macro for cc_ccache_f wait_for_change() */1485#define cc_ccache_wait_for_change(ccache) \1486((ccache) -> functions -> wait_for_change (ccache))14871488/*! Helper macro for cc_string_f release() */1489#define cc_string_release(string) \1490((string) -> functions -> release (string))14911492/*! Helper macro for cc_credentials_f release() */1493#define cc_credentials_release(credentials) \1494((credentials) -> functions -> release (credentials))1495/*! Helper macro for cc_credentials_f compare() */1496#define cc_credentials_compare(credentials, compare_to, equal) \1497((credentials) -> functions -> compare (credentials, compare_to, equal))14981499/*! Helper macro for cc_ccache_iterator_f release() */1500#define cc_ccache_iterator_release(iterator) \1501((iterator) -> functions -> release (iterator))1502/*! Helper macro for cc_ccache_iterator_f next() */1503#define cc_ccache_iterator_next(iterator, ccache) \1504((iterator) -> functions -> next (iterator, ccache))1505/*! Helper macro for cc_ccache_iterator_f clone() */1506#define cc_ccache_iterator_clone(iterator, new_iterator) \1507((iterator) -> functions -> clone (iterator, new_iterator))15081509/*! Helper macro for cc_credentials_iterator_f release() */1510#define cc_credentials_iterator_release(iterator) \1511((iterator) -> functions -> release (iterator))1512/*! Helper macro for cc_credentials_iterator_f next() */1513#define cc_credentials_iterator_next(iterator, credentials) \1514((iterator) -> functions -> next (iterator, credentials))1515/*! Helper macro for cc_credentials_iterator_f clone() */1516#define cc_credentials_iterator_clone(iterator, new_iterator) \1517((iterator) -> functions -> clone (iterator, new_iterator))1518/*!@}*/15191520#if defined(__APPLE__) && (defined(__ppc__) || defined(__ppc64__) || defined(__i386__) || defined(__x86_64__))1521#pragma pack(pop)1522#endif15231524#ifdef __cplusplus1525}1526#endif /* __cplusplus */15271528#endif /* __CREDENTIALSCACHE__ */152915301531