import cyrus-sasl-2.1.23
[cyrus-sasl.git] / mac / CommonKClient / mac_kclient3 / Headers / CredentialsCache / CredentialsCache2.h
1 /*\r * This is backwards compatibility for CCache API v2 clients to be able to run \r * against the CCache API v3 library\r */\r \r#ifndef __CREDENTIALSCACHE2__\r#define __CREDENTIALSCACHE2__\r \r#include <CredentialsCache/CredentialsCache.h>\r\r#ifdef __cplusplus\rextern "C" {\r#endif /* __cplusplus */\r\r#include <KerberosSupport/KerberosConditionalMacros.h>\r\r#if PRAGMA_IMPORT\r#       pragma import on\r#endif\r\r/* This stuff is to make sure that we always use the same compiler options for\r   this header file. Otherwise we get really exciting failure modes -- meeroh */\r/* Sadly, the v2 APi didn't specify the alignment, so we use the default except on MacOS\r   (where our implementation defined it to be 2-byte aligned) */\r#if TARGET_OS_MAC\r   #if PRAGMA_STRUCT_ALIGN\r                #pragma options align=mac68k\r   #elif PRAGMA_STRUCT_PACKPUSH\r           #pragma pack(push, 2)\r  #elif PRAGMA_STRUCT_PACK\r               #pragma pack(2)\r        #endif\r#endif\r\r#if PRAGMA_ENUM_ALWAYSINT\r       #pragma enumsalwaysint on\r#endif\r\r#if TARGET_CPU_68K\r   #pragma fourbyteints on\r#endif \r\r/* Some old types get directly mapped to new types */\r\rtypedef cc_context_d apiCB;\rtypedef cc_ccache_d ccache_p;\rtypedef cc_credentials_iterator_d ccache_cit_creds;\rtypedef cc_ccache_iterator_d ccache_cit_ccache;\rtypedef cc_data cc_data_compat;\rtypedef cc_int32 cc_cred_vers;\rtypedef cc_int32 cc_result;\r\r/* This doesn't exist in API v3 */\rtypedef cc_uint32 cc_flags;\r\r/* Credentials types are visible to the caller so we have to keep binary compatibility */\r\rtypedef struct cc_credentials_v5_compat {\r char*                           client;\r        char*                           server;\r        cc_data_compat          keyblock;\r      cc_time_t                       authtime;\r      cc_time_t                       starttime;\r     cc_time_t                       endtime;\r       cc_time_t                       renew_till;\r    cc_uint32                       is_skey;\r       cc_uint32                       ticket_flags;\r  cc_data_compat**        addresses;\r    cc_data_compat           ticket;\r        cc_data_compat          second_ticket;\r cc_data_compat**        authdata;\r} cc_credentials_v5_compat;\r \renum {\r MAX_V4_CRED_LEN = 1250\r};\r \renum {\r     KRB_NAME_SZ = 40,\r      KRB_INSTANCE_SZ = 40,\r  KRB_REALM_SZ = 40\r};\r \rtypedef struct cc_credentials_v4_compat {\r       unsigned char   kversion;\r      char                    principal[KRB_NAME_SZ+1];\r      char                    principal_instance[KRB_INSTANCE_SZ+1];\r char                    service[KRB_NAME_SZ+1];\r        char                    service_instance[KRB_INSTANCE_SZ+1];\r   char                    realm[KRB_REALM_SZ+1];\r unsigned char   session_key[8];\r        cc_int32                kvno;\r  cc_int32                str_to_key;\r    long                    issue_date;\r    cc_int32                lifetime;\r    cc_uint32         address;\r       cc_int32                ticket_sz;\r     unsigned char   ticket[MAX_V4_CRED_LEN];\r       unsigned long   oops;\r} cc_credentials_v4_compat;\r\rtypedef union cred_ptr_union_compat {\r    cc_credentials_v4_compat*  pV4Cred;\r    cc_credentials_v5_compat*  pV5Cred;\r} cred_ptr_union_compat;\r \rtypedef struct cred_union {\r    cc_int32                            cred_type;  // cc_cred_vers\r    cred_ptr_union_compat   cred;\r} cred_union;\r\r/* NC info structure is gone in v3 */\r\rstruct infoNC {\r    char*           name;\r  char*           principal;\r     cc_int32        vers;\r};\r\rtypedef struct infoNC infoNC;\r\r/* Some old type names */\r\rtypedef cc_credentials_v4_compat V4Cred_type;\rtypedef cc_credentials_v5_compat cc_creds;\rstruct ccache_cit;\rtypedef struct ccache_cit ccache_cit;\r\renum {\r  CC_API_VER_2 = ccapi_version_2\r};\r\renum {\r      CC_NOERROR,\r    CC_BADNAME,\r    CC_NOTFOUND,\r   CC_END,\r        CC_IO,\r CC_WRITE,\r      CC_NOMEM,\r      CC_FORMAT,\r     CC_LOCKED,\r     CC_BAD_API_VERSION,\r    CC_NO_EXIST,\r   CC_NOT_SUPP,\r   CC_BAD_PARM,\r   CC_ERR_CACHE_ATTACH,\r   CC_ERR_CACHE_RELEASE,\r  CC_ERR_CACHE_FULL,\r     CC_ERR_CRED_VERSION\r};\r\renum {\r CC_CRED_UNKNOWN,\r       CC_CRED_V4,\r    CC_CRED_V5,\r    CC_CRED_MAX\r};\r\rcc_int32 cc_shutdown (\r apiCB**                         ioContext);\r    \rcc_int32 cc_get_NC_info (\r     apiCB*                          inContext,\r     infoNC***                       outInfo);\r      \rcc_int32 cc_get_change_time (\r apiCB*                          inContext,\r     cc_time_t*                      outTime);\r      \rcc_int32 cc_open (\r    apiCB*                          inContext,\r     const char*                     inName,\r        cc_int32                        inVersion,\r     cc_uint32                       inFlags,\r       ccache_p**                      outCCache);\r    \rcc_int32 cc_create (\r  apiCB*                          inContext,\r     const char*                     inName,\r        const char*                     inPrincipal,\r   cc_int32                        inVersion,\r     cc_uint32                       inFlags,\r       ccache_p**                      outCCache);\r    \rcc_int32 cc_close (\r   apiCB*                          inContext,\r     ccache_p**                      ioCCache);\r     \rcc_int32 cc_destroy (\r apiCB*                          inContext,\r     ccache_p**                      ioCCache);\r     \rcc_int32 cc_seq_fetch_NCs_begin (\r     apiCB*                          inContext,\r     ccache_cit**            outIterator);\r\rcc_int32 cc_seq_fetch_NCs_next (\r        apiCB*                          inContext,\r     ccache_p**                      outCCache,\r     ccache_cit*                     inIterator);\r\rcc_int32 cc_seq_fetch_NCs_end (\r  apiCB*                          inContext,\r     ccache_cit**            ioIterator);\r\rcc_int32 cc_get_name (\r   apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      char**                          outName);\r      \rcc_int32 cc_get_cred_version (\r        apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      cc_int32*                       outVersion);\r   \rcc_int32 cc_set_principal (\r   apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      cc_int32                        inVersion,\r     char*                           inPrincipal);\r  \rcc_int32 cc_get_principal (\r   apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      char**                          outPrincipal);\r \rcc_int32 cc_store (\r   apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      cred_union                      inCredentials);\r\rcc_int32 cc_remove_cred (\r     apiCB*                          inContext,\r     ccache_p*                       inCCache,\r      cred_union                      inCredentials);\r\rcc_int32 cc_seq_fetch_creds_begin (\r   apiCB*                          inContext,\r     const ccache_p*         inCCache,\r      ccache_cit**            outIterator);\r\rcc_int32 cc_seq_fetch_creds_next (\r      apiCB*                          inContext,\r     cred_union**            outCreds,\r      ccache_cit*                     inIterator);\r   \rcc_int32 cc_seq_fetch_creds_end (\r     apiCB*                          inContext,\r     ccache_cit**            ioIterator);\r   \rcc_int32 cc_free_principal (\r  apiCB*                          inContext,\r     char**                          ioPrincipal);\r\rcc_int32 cc_free_name (\r apiCB*                          inContext,\r     char**                          ioName);\r\rcc_int32 cc_free_creds (\r     apiCB*                          inContext,\r     cred_union**            creds);\r\rcc_int32 cc_free_NC_info (\r    apiCB*                          inContext,\r     infoNC***                       ioInfo);\r       \r#if TARGET_OS_MAC\r     #if PRAGMA_STRUCT_ALIGN\r                #pragma options align=reset\r    #elif PRAGMA_STRUCT_PACKPUSH\r           #pragma pack(pop)\r      #elif PRAGMA_STRUCT_PACK\r               #pragma pack()\r #endif\r#endif\r\r#if PRAGMA_ENUM_ALWAYSINT\r       #pragma enumsalwaysint reset\r#endif\r\r#if TARGET_CPU_68K\r        #pragma fourbyteints reset\r#endif \r\r#if PRAGMA_IMPORT\r# pragma import reset\r#endif\r\r#ifdef __cplusplus\r}\r#endif /* __cplusplus */\r\r#endif /* __CREDENTIALSCACHE2__ */