eapol/eapol_framework/eapol_common/am/include/abs_eap_am_semaphore.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined( _ABS_EAP_AM_SEMAPHORE_H_ )
       
    22 #define _ABS_EAP_AM_SEMAPHORE_H_
       
    23 
       
    24 #include "eap_am_types.h"
       
    25 #include "eap_variable_data.h"
       
    26 #include "eap_am_export.h"
       
    27 
       
    28 class eap_am_semaphore_reference_c;
       
    29 
       
    30 // ---------------------------------------------
       
    31 
       
    32 /// This class is interface to semaphore.
       
    33 class EAP_EXPORT abs_eap_am_semaphore_c
       
    34 {
       
    35 private:
       
    36 
       
    37 public:
       
    38 
       
    39 	EAP_FUNC_IMPORT virtual ~abs_eap_am_semaphore_c();
       
    40 
       
    41 	EAP_FUNC_IMPORT abs_eap_am_semaphore_c();
       
    42 
       
    43 	// - - - - - - - - - - - - - - - - - - - - - - - -
       
    44 
       
    45 	/**
       
    46 	 * This function reserves the semaphore. Thread will block until the semaphore is released
       
    47 	 * by other owner of the semaphore.
       
    48 	 */
       
    49 	EAP_FUNC_IMPORT virtual eap_status_e semaphore_reserve() = 0;
       
    50 
       
    51 	/**
       
    52 	 * This function releases the semaphore. Other blocking thread will continue execution.
       
    53 	 */
       
    54 	EAP_FUNC_IMPORT virtual eap_status_e semaphore_release() = 0;
       
    55 
       
    56 	/**
       
    57 	 * The semaphore handle must be dublicated in Symbian operating system for each thread.
       
    58 	 */
       
    59 	EAP_FUNC_IMPORT virtual abs_eap_am_semaphore_c * dublicate_semaphore() = 0;
       
    60 
       
    61 	EAP_FUNC_IMPORT virtual u32_t get_count() const = 0;
       
    62 
       
    63 	/**
       
    64 	 * Returns the validity of the semaphore.
       
    65 	 */
       
    66 	EAP_FUNC_IMPORT virtual bool get_is_valid() const = 0;
       
    67 
       
    68 #if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
       
    69 	EAP_FUNC_IMPORT virtual eap_am_semaphore_reference_c * get_reference() const = 0;
       
    70 	EAP_FUNC_IMPORT virtual void set_am_tools(abs_eap_am_tools_c * const tools) = 0;
       
    71 #endif //#if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
       
    72 
       
    73 	// - - - - - - - - - - - - - - - - - - - - - - - -
       
    74 
       
    75 };
       
    76 
       
    77 // ---------------------------------------------
       
    78 
       
    79 /// This class defines a reference counter of a semaphore.
       
    80 class EAP_EXPORT eap_am_semaphore_reference_c
       
    81 {
       
    82 
       
    83 private:
       
    84 
       
    85 	/// This is the reference count to the semaphore.
       
    86 	u32_t m_reference_count;
       
    87 
       
    88 public:
       
    89 
       
    90 	EAP_FUNC_IMPORT virtual ~eap_am_semaphore_reference_c();
       
    91 
       
    92 	EAP_FUNC_IMPORT eap_am_semaphore_reference_c();
       
    93 
       
    94 	EAP_FUNC_IMPORT void add_reference();
       
    95 
       
    96 	EAP_FUNC_IMPORT void remove_reference();
       
    97 
       
    98 	EAP_FUNC_IMPORT u32_t get_reference_count();
       
    99 };
       
   100 
       
   101 // ---------------------------------------------
       
   102 
       
   103 /// This class is base of the semaphore.
       
   104 class EAP_EXPORT eap_am_semaphore_base_c
       
   105 {
       
   106 private:
       
   107 
       
   108 	eap_am_semaphore_reference_c * m_reference;
       
   109 
       
   110 	bool m_is_valid;
       
   111 
       
   112 public:
       
   113 
       
   114 	EAP_FUNC_IMPORT virtual ~eap_am_semaphore_base_c();
       
   115 
       
   116 	EAP_FUNC_IMPORT eap_am_semaphore_base_c();
       
   117 
       
   118 	EAP_FUNC_IMPORT eap_am_semaphore_base_c(const eap_am_semaphore_base_c * const owner);
       
   119 
       
   120 	EAP_FUNC_IMPORT eap_am_semaphore_reference_c * get_reference() const;
       
   121 
       
   122 	// - - - - - - - - - - - - - - - - - - - - - - - -
       
   123 
       
   124 	/// Returns the validity of the semaphore.
       
   125 	EAP_FUNC_IMPORT bool get_is_valid() const;
       
   126 
       
   127 	// - - - - - - - - - - - - - - - - - - - - - - - -
       
   128 
       
   129 };
       
   130 
       
   131 // ---------------------------------------------
       
   132 
       
   133 #endif //#if !defined( _ABS_EAP_AM_SEMAPHORE_H_ )
       
   134 
       
   135 
       
   136 
       
   137 // End.