Home | History | Annotate | Download | only in native
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef __DMTPRINCIPAL_H__
     18 #define __DMTPRINCIPAL_H__
     19 
     20 #ifndef __cplusplus
     21 #error "This is a C++ header file; it requires C++ to compile."
     22 #endif
     23 
     24 /**
     25  \file dmtPrincipal.hpp
     26  \brief The dmtPrincipal.hpp header file contains DmtPrincipal class definition. \n
     27                This class represents actors from the security viewpoint. Every DmtTree \n
     28                 is associated with a DMTPrincipal,  and they are also used in DmtAcl.
     29 */
     30 
     31 #include "jem_defs.hpp"
     32 
     33 /**
     34   * DmtPrincipal represents actors from the security viewpoint.
     35   * Every DmtTree is associated with a DMTPrincipal,
     36   * and they are also used in DmtAcl.
     37   * \par Category: General
     38   * \par Persistence: Transient
     39   * \par Security: Non-Secure
     40   * \par Migration State: FINAL
     41   */
     42 class DmtPrincipal
     43 {
     44 private:
     45   DMString  m_strPrincipal;
     46 
     47 public:
     48  /**
     49   * Default constructor - no memory allocation or any other resources have been performed.
     50   */
     51   DmtPrincipal() {}
     52 
     53 /**
     54   * Constructor receive object DmtPrincipal as a parameter. The memory for DMT Principal name will be allocated.
     55   * \param oCopyFrom [in] - reference to DmtPrincipal object
     56   */
     57   DmtPrincipal( const DmtPrincipal& oCopyFrom ) {m_strPrincipal = oCopyFrom.m_strPrincipal; }
     58 
     59  /**
     60   * Constructor receive DmtPrincipal name as a parameter. The memory for DMT Principal name will be allocated.
     61   * \param princip [in] - DMT principal as a string
     62   */
     63   DmtPrincipal(CPCHAR princip) {m_strPrincipal = princip;}
     64 
     65   /**
     66   * Comparison operator (equally)
     67   * \par Sync (or) Async:
     68   * This is a Synchronous function.
     69   * \par Secure (or) Non-Secure (or) N/A:
     70   * This is a Non-Secure function.
     71   * \param p [in] -  pointer to DmtPrincipal object
     72   * \return boolean result of comparison
     73   * \par Prospective Clients:
     74   * Internal Classes.
     75   */
     76   BOOLEAN operator==( const DmtPrincipal &p ) const { return m_strPrincipal == p.m_strPrincipal;}
     77 
     78 
     79  /**
     80   * Retrieves  name of DMT principle
     81   * \par Sync (or) Async:
     82   * This is a Synchronous function.
     83   * \par Secure (or) Non-Secure (or) N/A:
     84   * This is a Non-Secure function.
     85   * \return principal as ad DMString.
     86   * \par Prospective Clients:
     87   * All potential applications that require configuration settings and Internal Classes.
     88   */
     89   const DMString& getName() const
     90   {
     91      return m_strPrincipal;
     92   }
     93 
     94  /**
     95   * Assigns DMT principle to the Provided string
     96   * \par Sync (or) Async:
     97   * This is a Synchronous function.
     98   * \par Secure (or) Non-Secure (or) N/A:
     99   * This is a Non-Secure function.
    100   * \param princip [in] - principal as a string
    101   * \par Prospective Clients:
    102   * All potential applications that require configuration settings and Internal Classes.
    103   */
    104   void assign(CPCHAR princip) {m_strPrincipal = princip;}
    105 
    106 };
    107 
    108 #endif
    109