GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATSecurityContext.h

Go to the documentation of this file.
00001 /** @file GATSecurityContext.h
00002  * Header file for the GATSecurityContext class.
00003  * 
00004  * A container for security information.  Each context has a type associated with it.  
00005  * The type indicates if the GATSecurityContext instance corresponds to a "password"
00006  * GATSecurityContext or a "certificate" GATSecurityContext.
00007  *
00008  * Currently we provide additional auxiliary operations to create a context
00009  * based upon password information or upon credentials stored in a file.
00010  * GATContexts based upon these mechanisms can be used by adaptors to create
00011  * further contexts containing opaque data objects, e.g. GSSAPI credentials.
00012  * 
00013  * @date $Date: 2004/04/01 17:21:28 $
00014  * 
00015  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATSecurityContext.h,v 1.8 2004/04/01 17:21:28 hartmutkaiser Exp $
00016  *
00017  *  Copyright (C) Kelly Davis
00018  *  This file is part of the GAT Engine.
00019  *  Contributed by Kelly Davis <kdavis@aei.mpg.de>.
00020  *
00021  *  Use, modification and distribution is subject to the Gridlab Software
00022  *  License. (See accompanying file GLlicense.txt or copy at
00023  *  http://www.gridlab.org/GLlicense.txt)
00024  */
00025 
00026 #ifndef _GATSECURITYCONTEXT_H_
00027 #define _GATSECURITYCONTEXT_H_ 1
00028 
00029 #include "GATType.h"
00030 #include "GATList.h"
00031 #include "GATInternal.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" 
00035 {
00036 #endif
00037 
00038 /* GATList_GATSecurityContext */
00039 GATLIST_DECLARE_QUALIFIED(extern, GATSecurityContext, GATList_GATSecurityContext);
00040 
00041 /* Declare the converters to/from GATObject */
00042 GATOBJECT_DECLARE_CONVERTERS(GATSecurityContext);
00043 
00044 /**
00045  * Creates a new security context of a specific type. The type indicates 
00046  * the means by which this instance allows "secure" communications to be 
00047  * established. The allowed values for this type are the various public 
00048  * class variables of this class established for this purpose.
00049  *
00050  * @param type The type of this security context
00051  */
00052 GATSecurityContext GATSecurityContext_Create(GATSecurityContextType type);
00053 
00054 /**
00055  * Destroys a security context.
00056  *
00057  * @param this The GATSecurityContext to destory
00058  */
00059 void GATSecurityContext_Destroy(GATSecurityContext *ctx); 
00060 
00061 /**
00062  * This fucntion returns the type, a #GATType of the passed #GATSecurityContext_const.
00063  * This function will always return #GATType_GATSecurityContext.
00064  *
00065  * @param this The #GATSecurityContext_const to query
00066  * @return The #GATType of the passed @c this
00067  */
00068 GATType GATSecurityContext_GetType(GATSecurityContext_const ctx);
00069 
00070 /** GATSecurityContext_Clone
00071  * Clone is used to clone a specified context, copying all
00072  * state and security information.  The new GATSecurityContext is
00073  * completely independent from the original one, which may 
00074  * be destroyed with no effect on the new one.
00075  *
00076  * @param this The GATSecurityContext to clone
00077  * @param thisClone The cloned GATSecurityContext
00078  * @return An error code
00079  */
00080 GATResult 
00081   GATSecurityContext_Clone(GATSecurityContext_const ctx, 
00082     GATSecurityContext *thisClone);
00083  
00084 /**
00085  * For two GATSecurityContexts to be considered equal requires that they 
00086  * must be acquired over the same mechanisms and must refer to the same 
00087  * name.
00088  *
00089  * @param this The first GATSecurityContext
00090  * @param that The second GATSecurityContext
00091  * @param isequal Result of comparrison
00092  * @return An error code
00093  */
00094 GATResult 
00095   GATSecurityContext_Equals(GATSecurityContext_const ctx, 
00096     GATSecurityContext_const that, GATBool *isequal);
00097 
00098 /** GATSecurityContext_GetInterface
00099  *  This function gets an interface supported by this GATSecurityContext
00100  *
00101  *  The function GATSecurityContext_GetInterface allows to get a pointer to an 
00102  *  additional interface supported by this GATSecurityContext.
00103  *
00104  *  @param object The object to be asked for the new interface.
00105  *  @param iftype The interface the object is to be asked for.
00106  *  @param ifp The pointer, through which the result is to be returned.
00107  *  @return An error type.
00108  */
00109 GATResult 
00110   GATSecurityContext_GetInterface(GATSecurityContext_const object, 
00111     GATInterface iftype, void const **ifp);
00112 
00113 /**
00114  * Makes this a "Password" type security context and stores the username 
00115  * and password in the context.
00116  *
00117  * @param this The GATSecurityContext to modify
00118  * @param username Username associated with password
00119  * @param password Password
00120  * @return A GATResult indicating the GATError return code
00121  */
00122 GATResult 
00123   GATSecurityContext_SetPasswordAuthenticate(GATSecurityContext ctx, 
00124     const char *username, const char *password);
00125 
00126 /**
00127  * If this is a "Password" type security context get the username and password 
00128  * from the context.
00129  *
00130  * @param this The GATSecurityContext to query
00131  * @param username Pointer to the username pointer
00132  * @param password Pointer to the password pointer
00133  * @return A GATResult indicating the error state
00134  */
00135 GATResult 
00136   GATSecurityContext_GetPasswordAuthenticate(GATSecurityContext ctx, 
00137     char **username, char **password);
00138 
00139 /**
00140  * Makes this a "Certificate" type security context and stores the
00141  * information about the location of keyfile and certificate file 
00142  * in the context.
00143  *
00144  * @param this The GATSecurityContext to modify
00145  * @param keyfile Keyfile, containing valid absolute or relative local
00146  * path to keyfile.  A relative path will be converted to an absolute
00147  * path based upon the current working directory.
00148  * @param certificate Certificate, containing valid absolute or local 
00149  * path to certificate file. A relative path will be converted to an 
00150  * absolute path based upon the current working directory.
00151  * @param passphrase Passphrase (OPTIONAL)
00152  * @return A GATResult indicating the GATError return code
00153  */
00154 GATResult 
00155   GATSecurityContext_SetCertificateAuthenticate(GATSecurityContext ctx, 
00156     const char *keyfile, const char *certificate, const char *passphrase);
00157 
00158 /**
00159  * If this is a "Certificate" type security context get the
00160  * information about the location of keyfile and certificate 
00161  * file stored in the context.
00162  *
00163  * @param this The GATSecurityContext to query
00164  * @param keyfile Pointer to the keyfile pointer
00165  * @param certificate Pointer to the certificate pointer
00166  * @param passphrase Pointer to the passphrase pointer
00167  * @retun A GATResult indicating success
00168  */
00169 GATResult 
00170   GATSecurityContext_GetCertificateAuthenticate(GATSecurityContext ctx, 
00171     char **keyfile, char **certificate, char **passphrase);
00172 
00173 /**
00174  * Makes this a "Remote" type security context and stores the information 
00175  * about the location of remote credential server in the context.
00176  *
00177  * @param this The GATSecurityContext to modify
00178  * @param location Location for remote credential server
00179  * @param name Username associated with the credential
00180  * @param passphrase Passphrase associated with the credential
00181  * @return A GATResult indicating the GATError return code
00182  */
00183 GATResult 
00184   GATSecurityContext_SetRemoteAuthenticate(GATSecurityContext ctx, 
00185     GATLocation location, const char *name, const char *passphrase);
00186 
00187 /**
00188  * If this is a "Remote" type security context get the information about 
00189  * the location of remote credential server stored in the context.
00190  *
00191  * @param this The GATSecurityContext to query
00192  * @param location Pointer to the GATLocation
00193  * @param name Pointer to the name pointer
00194  * @param passphrase Pointer to the passphrase pointer
00195  * @retun A GATResult indicating success
00196  */
00197 GATResult 
00198   GATSecurityContext_GetRemoteAuthenticate(GATSecurityContext ctx, 
00199     GATLocation *location, char **name, char **passphrase);
00200 
00201 /**
00202  * This function returns the GATSecurityContextType of this GATSecurityContext
00203  *
00204  * @param this The GATSecurityContext to query
00205  * @param type The GATSecurityContextType of this
00206  * @return An error code
00207  */
00208 GATResult 
00209   GATSecurityContext_GetSecurityContextType(GATSecurityContext ctx, 
00210     GATSecurityContextType *type); 
00211 
00212 #ifdef __cplusplus
00213 }
00214 #endif
00215 
00216 #endif /* _GATSECURITYCONTEXT_H_ */