Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

security.h

Go to the documentation of this file.
00001 /********************************************************************
00002 
00003 Copyright 2006, ACCESS Systems Americas, Inc. All rights reserved.
00004 
00005 The contents of this file are subject to the Mozilla Public License Version
00006 1.1 (the "License"); you may not use this file except in compliance with
00007 the License. You may obtain a copy of the License at
00008 http://www.mozilla.org/MPL/
00009 
00010 Software distributed under the License is distributed on an "AS IS" basis,
00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012 for the specific language governing rights and limitations under the
00013 License.
00014 
00015 The Original Code is the entire contents of this file.
00016 
00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00018 
00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All
00020 Rights Reserved.
00021 
00022 Contributor(s): none.
00023 
00024 ********************************************************************/
00032 #ifndef ALP_SECURITY_H_
00033 #define ALP_SECURITY_H_ 
00034 
00035 //-----------------------------------------------------------------------------
00036 // INCLUDES
00037 //-----------------------------------------------------------------------------
00038 
00039 #include <hiker/types.h>
00040 #include <sys/types.h>
00041 #include <hiker/sysclass.h>
00042 #include <unistd.h>
00043 #include <stdlib.h>
00044 
00045 #ifdef  __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 //-----------------------------------------------------------------------------
00050 // DEFINES
00051 //-----------------------------------------------------------------------------
00052 
00056 #define ALP_STATUS_SPF_E_NOERR                  ( ALP_CLASS_SPF | 0x00 )
00057 
00059 #define ALP_STATUS_SPF_NO_SERVER                ( ALP_CLASS_SPF | 0x01 )
00060 
00062 #define ALP_STATUS_SPF_INVALID_PARAM            ( ALP_CLASS_SPF | 0x02 )
00063 
00065 #define ALP_STATUS_SPF_MEM_ERROR                ( ALP_CLASS_SPF | 0x03 )
00066 
00067 /* todo: these error codes predate the move to ALP_STATUS_. We couldn't
00068 ** get approval from project management to include them. So we're going
00069 ** to have to do a complete documentation cycle before we can start
00070 ** using them. In the mean time, any calls that would have generated
00071 ** these return codes are now generating ALP_STATUS_SPF_INVALID_PARAM.
00072 */
00073 
00074 /*
00075 #define ALP_SPF_E_UPDATE_GENERAL                ( ALP_CLASS_SPF | 0x01 )
00076 #define ALP_SPF_E_UPDATE_BADSIG                 ( ALP_CLASS_SPF | 0x02 )
00077 #define ALP_SPF_E_UPDATE_BADACTOR               ( ALP_CLASS_SPF | 0x03 )
00078 #define ALP_SPF_E_QUERY_BADASSERTION            ( ALP_CLASS_SPF | 0x04 )
00079 #define ALP_SPF_E_QUERY_BADPOLICY               ( ALP_CLASS_SPF | 0x05 )
00080 #define ALP_SPF_E_QUERY_NOSERVICE               ( ALP_CLASS_SPF | 0x06 )
00081 #define ALP_SPF_E_QUERY_BADFORMAT               ( ALP_CLASS_SPF | 0x07 )
00082 */
00083 
00085 #define ALP_SPF_T_STRING   0
00086 
00088 #define ALP_SPF_T_BOOLEAN  1
00089 
00091 #define ALP_SPF_T_INT      2
00092 
00094 #define ALP_SPF_T_IPV4ADDR 3
00095 
00097 #define ALP_SPF_T_PATH     4
00098 
00100 #define ALP_SPF_T_URL      5
00101 
00103 #define ALP_SPF_PKCS5_PIN 0
00104 
00106 #define ALP_SPF_PKCS5_PUK 1
00107 
00108 //-----------------------------------------------------------------------------
00109 // TYPE DEFINITIONS
00110 //-----------------------------------------------------------------------------
00111 
00116 typedef unsigned int AlpSPFAssertionType;
00117 
00118 typedef unsigned int AlpPackageID;
00119 
00120 typedef struct {
00121   char *key;
00122   unsigned int value;
00123 } AlpSPFIntroInstance;
00124 
00125 typedef struct {
00126   unsigned int version;
00127   AlpSPFIntroInstance **instances;
00128 } AlpSPFIntroInfo;
00129 
00130 /* AlpSecurityResponse is deprecated. Do not test.
00131 **
00132 ** typedef struct _AlpSecurityResponse {
00133 **   uint response;
00134 **   char *facility;
00135 **   uint facility_len;
00136 **   char *subject;
00137 **   uint subject_len;
00138 **   char *object;
00139 **   uint object_len;
00140 **   char *operation;
00141 **   uint operation_len;
00142 ** } AlpSecurityResponse;
00143 */
00144 
00145 //-----------------------------------------------------------------------------
00146 // UPDATE APIs
00147 //-----------------------------------------------------------------------------
00148 
00156 alp_status_t alp_spf_update_open( void );
00157 
00169 alp_status_t alp_spf_update( char *message, uint message_len );
00170 
00178 alp_status_t alp_spf_update_close( void );
00179 
00180 //-----------------------------------------------------------------------------
00181 // POLICY STATUS APIs
00182 //-----------------------------------------------------------------------------
00183 
00191 alp_status_t alp_spf_ps_open( void );
00203 alp_status_t alp_spf_ps_get_policyname_from_policy( unsigned int policy, char **policyname );
00215 alp_status_t alp_spf_ps_get_policy_from_policyname( char *policyname, unsigned int *policy);
00216 
00228 alp_status_t alp_spf_ps_packageid_increment( unsigned int packageid, unsigned int *out_count );
00229 
00241 alp_status_t alp_spf_ps_packageid_decrement( unsigned int packageid, unsigned int *out_count );
00242 
00254 alp_status_t alp_spf_ps_packageid_count( unsigned int packageid, unsigned int *out_count );
00255 
00269 alp_status_t alp_spf_ps_get_policy_by_certificate( char *certificate, unsigned int certificate_length, unsigned int *policy);
00281 alp_status_t alp_spf_ps_get_policy_by_gid( gid_t gid, unsigned int *policy);
00299 alp_status_t alp_spf_ps_get_certificate_by_policy( unsigned int policy, char **certificate, unsigned int *certificate_length, char **certid, unsigned int *certid_length);
00311 alp_status_t alp_spf_ps_get_gid_by_policy( unsigned int policy, gid_t *gid );
00323 alp_status_t alp_spf_ps_get_policy_by_uid( uid_t uid, unsigned int *policy );
00337 alp_status_t alp_spf_ps_get_policy_by_package( char *path, unsigned int path_length, unsigned int *out_policy);
00349 alp_status_t alp_spf_ps_get_gids_length( unsigned int policy, unsigned int *size );
00368 alp_status_t alp_spf_ps_get_uid_gid_gids_by_policy( unsigned int policy, uid_t *uid, gid_t *gid, gid_t *sgids[], unsigned int *sgids_length );
00382 alp_status_t alp_prv_spf_ps_enroll_package( char *path, unsigned int path_length, unsigned int *out_packageid );
00390 alp_status_t alp_spf_ps_close( void );
00391 
00392 //-----------------------------------------------------------------------------
00393 // QUERY APIs
00394 //-----------------------------------------------------------------------------
00395 
00403 alp_status_t alp_spf_query_open( void );
00404 alp_status_t alp_spf_query_set_subject_pid( pid_t subject_pid );
00405 alp_status_t alp_spf_query_reset_subject_pid( void  );
00419 alp_status_t alp_spf_query_get_assertion_string( char *assertion, uint assertion_len, char **out_assertion_value);
00420 alp_status_t alp_spf_query_get_assertion_int( char *assertion, uint assertion_len, int *out_assertion_value );
00421 alp_status_t alp_spf_query_get_assertion_boolean( char *assertion, uint assertion_len, uint *out_assertion_value );
00422 
00434 alp_status_t alp_spf_query_free_assertion_string( char *assertion, uint assertion_len );
00448 alp_status_t alp_spf_query_assertion_type( char *assertion, uint assertion_len, AlpSPFAssertionType *out_type );
00464 alp_status_t alp_spf_query_get_assertion_string_from_policy( char *policy, char *assertion, uint assertion_len, char **out_assertion_value );
00465 alp_status_t alp_spf_query_get_assertion_int_from_policy( char *policy, char *assertion, uint assertion_len, int *out_assertion_value );
00466 alp_status_t alp_spf_query_get_assertion_boolean_from_policy( char *policy, char *assertion, uint assertion_len, uint *out_assertion_value );
00467 alp_status_t alp_spf_query_assertion_type_from_policy( char *policy, char *assertion, uint assertion_len, AlpSPFAssertionType *out_type );
00475  alp_status_t alp_spf_query_close( void );
00476 
00477 //-----------------------------------------------------------------------------
00478 // USER DIALOG MANAGER APIs
00479 //-----------------------------------------------------------------------------
00480 
00481 /* User Dialog Manager API calls are deprecated. Do not test.
00482 ** alp_status_t alp_spf_udm_open( void );
00483 ** alp_status_t alp_spf_udm_query( AlpSecurityResponse *response );
00484 ** alp_status_t alp_spf_udm_close( void );
00485 */
00486 
00487 alp_status_t alp_spf_info(  AlpSPFIntroInfo **out_info );
00488 
00489   /* PKCS5 Calls */
00490 
00491   alp_status_t alp_spf_pkcs5_set( unsigned int which, char *phrase );
00492   alp_status_t alp_spf_pkcs5_check( unsigned int which, char *phrase, unsigned int *correct );
00493   alp_status_t alp_spf_pkcs5_params_get( unsigned int which, unsigned int *iteration, char **salt, unsigned int *active );
00494   alp_status_t alp_spf_pkcs5_params_set( unsigned int which, unsigned int iteration, char *salt, unsigned int active );
00495 
00496 #ifdef  __cplusplus
00497 }
00498 #endif
00499 
00502 #endif /* ALP_SECURITY_H_ */

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4