eapol/eapol_framework/eapol_symbian/am/include/eap_am_file_input_symbian.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 #if !defined(_EAP_AM_FILE_INPUT_SYMBIAN_H_)
       
    21 #define _EAP_AM_FILE_INPUT_SYMBIAN_H_
       
    22 
       
    23 
       
    24 #include "eap_tools.h"
       
    25 #include "abs_eap_am_tools.h"
       
    26 #include "eap_am_tools.h"
       
    27 #include "eap_variable_data.h"
       
    28 #include "eap_am_export.h"
       
    29 #include "abs_eap_am_file_input.h"
       
    30 #include <f32file.h>
       
    31 
       
    32 //--------------------------------------------------
       
    33 
       
    34 const u32_t EAP_AM_FILE_INPUT_BUFFER_SIZE = 1024;
       
    35 
       
    36 /// This is interface to EAP file input.
       
    37 /** The EAP file input is used in configuration file read operations.
       
    38  */
       
    39 class EAP_EXPORT eap_am_file_input_symbian_c
       
    40 : public abs_eap_am_file_input_c
       
    41 {
       
    42 
       
    43 private:
       
    44 
       
    45 	abs_eap_am_tools_c *m_am_tools;
       
    46 
       
    47 	/// Flag tells this object is valid.
       
    48 	bool m_is_valid;
       
    49 
       
    50 	/// Handle to file session.
       
    51 	RFs m_file_session;
       
    52 
       
    53 	/// Hamdle to file.
       
    54 	RFile m_File;
       
    55 
       
    56 	/// Cache input buffer to reduce Symbian read operations.
       
    57 	TBuf8<EAP_AM_FILE_INPUT_BUFFER_SIZE> * m_input_buffer;
       
    58 
       
    59 	/// Offset of read point in the m_input_buffer.
       
    60 	u32_t m_input_buffer_offset;
       
    61 
       
    62 	// On purpose unimplemented constructors.
       
    63 	eap_am_file_input_symbian_c(eap_am_file_input_symbian_c &source);
       
    64 	const eap_am_file_input_symbian_c & operator=(const eap_am_file_input_symbian_c& source);
       
    65 
       
    66 	/**
       
    67 	 * The set_is_valid() function sets the state of the object valid.
       
    68 	 * The creator of this object calls this function after it is initialized. 
       
    69 	 */
       
    70 	void set_is_valid();
       
    71 
       
    72 	/**
       
    73 	 * This function reads n bytes from file to buffer.
       
    74 	 */
       
    75 	eap_status_e file_read_buffer(
       
    76 		eap_variable_data_c * const buffer,
       
    77 		const u32_t required_bytes);
       
    78 
       
    79 public:
       
    80 
       
    81 	/**
       
    82 	 * The destructor of the eap_am_file_input_symbian_c class does nothing special.
       
    83 	 */
       
    84 	EAP_FUNC_IMPORT virtual ~eap_am_file_input_symbian_c();
       
    85 
       
    86 	/**
       
    87 	 * The constructor of the eap_am_file_input_symbian_c does nothing special.
       
    88 	 */
       
    89 	EAP_FUNC_IMPORT eap_am_file_input_symbian_c(
       
    90 		abs_eap_am_tools_c * const tools);
       
    91 
       
    92 	/**
       
    93 	 * This function checks the file of name file_name exists.
       
    94 	 * It returns eap_status_ok if file exists
       
    95 	 * in other cases some error status.
       
    96 	 * @param file_name is the pathname of the tested file.
       
    97 	 */
       
    98 	EAP_FUNC_IMPORT eap_status_e file_exists(
       
    99 		const eap_variable_data_c * const file_name);
       
   100 
       
   101 	/**
       
   102 	 * This function deletes the file of name if file_name exists.
       
   103 	 * It returns eap_status_ok if file did exist and it was deleted
       
   104 	 * in other cases some error status.
       
   105 	 * @param file_nameis the pathname of the deleted file.
       
   106 	 */
       
   107 	EAP_FUNC_IMPORT eap_status_e file_delete(
       
   108 		const eap_variable_data_c * const file_name);
       
   109 	
       
   110 	/**
       
   111 	 * This function copies the file source_file_name to file target_file_name.
       
   112 	 * @param target_file_name is the pathname of the target file.
       
   113 	 * @param source_file_name is the pathname of the source file.
       
   114 	 */
       
   115 	EAP_FUNC_IMPORT eap_status_e file_copy(
       
   116 		const eap_variable_data_c * const target_file_name,
       
   117 		const eap_variable_data_c * const source_file_name);
       
   118 
       
   119 	/**
       
   120 	 * This function opens file of name file_name.
       
   121 	 * @param file_name is the pathname of the opened file.
       
   122 	 * @param dir is the I/O direction (eap_file_io_direction_read or eap_file_io_direction_write).
       
   123 	 */
       
   124 	EAP_FUNC_IMPORT eap_status_e file_open(
       
   125 		const eap_variable_data_c * const file_name,
       
   126 		const eap_file_io_direction_e dir);
       
   127 
       
   128 	/**
       
   129 	 * This function closes the file.
       
   130 	 */
       
   131 	EAP_FUNC_IMPORT eap_status_e file_close();
       
   132 
       
   133 	/**
       
   134 	 * This function returns size of a file.
       
   135 	 */
       
   136 	EAP_FUNC_IMPORT u32_t file_size();
       
   137 
       
   138 	/**
       
   139 	 * This function reads data from file.
       
   140 	 * Maximum size read is the buffer size.
       
   141 	 * @param buffer must be initialised to reguired size.
       
   142 	 */
       
   143 	EAP_FUNC_IMPORT eap_status_e file_read(eap_variable_data_c * const buffer);
       
   144 
       
   145 	/**
       
   146 	 * This function write data to a file.
       
   147 	 * Maximum size write is the buffer size.
       
   148 	 * @param buffer includes the written data.
       
   149 	 */
       
   150 	EAP_FUNC_IMPORT eap_status_e file_write(const eap_variable_data_c * const buffer);
       
   151 
       
   152 	/**
       
   153 	 * This function reads line from file.
       
   154 	 * @param The read line will be copied to line parameter.
       
   155 	 */
       
   156 	EAP_FUNC_IMPORT eap_status_e file_read_line(eap_variable_data_c * const line);
       
   157 
       
   158 	/**
       
   159 	 * This function reads word from file.
       
   160 	 * @param The read word will be copied to word parameter.
       
   161 	 */
       
   162 	EAP_FUNC_IMPORT eap_status_e file_read_word(eap_variable_data_c * const word);
       
   163 
       
   164 
       
   165 	/**
       
   166 	 * Object must indicate it's validity.
       
   167 	 * If object initialization fails this function must return false.
       
   168 	 * @return This function returns the validity of this object.
       
   169 	 */
       
   170 	EAP_FUNC_IMPORT bool get_is_valid();
       
   171 
       
   172 	/**
       
   173 	 * This function opens directory of name directory_name.
       
   174 	 * @param file_name is the pathname of the opened directory.
       
   175 	 */
       
   176 	EAP_FUNC_IMPORT eap_status_e directory_open(
       
   177 		const eap_variable_data_c * const directory_name);
       
   178 
       
   179 	/**
       
   180 	 * This function reads the files and directories from open directory.
       
   181 	 * @param directory_list includes the stattus of each file and directory in open directory.
       
   182 	 */
       
   183 	EAP_FUNC_IMPORT eap_status_e directory_read(
       
   184 		eap_array_c<abs_eap_file_stat_c> * const directory_list);
       
   185 
       
   186 	/**
       
   187 	 * This function closes the directory.
       
   188 	 */
       
   189 	EAP_FUNC_IMPORT eap_status_e directory_close();
       
   190 
       
   191 
       
   192 }; // class eap_am_bloom_algorithm_c
       
   193 
       
   194 #endif //#if !defined(_EAP_AM_FILE_INPUT_SYMBIAN_H_)
       
   195 
       
   196 //--------------------------------------------------
       
   197 
       
   198 
       
   199 
       
   200 // End.