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 /* 18 * DESCRIPTION: 19 * The dmClientSrvCreds.h header file provides declaration 20 * for class DMClientServerCreds 21 */ 22 23 #ifndef __DMCLIENT_SRVCREDS_H__ 24 #define __DMCLIENT_SRVCREDS_H__ 25 26 #ifndef __cplusplus 27 #error "This is a C++ header file; it requires C++ to compile." 28 #endif 29 30 #include "dmSessionDefs.h" 31 32 class DMClientServerCreds 33 { 34 public: 35 DMClientServerCreds(); 36 37 SYNCML_DM_RET_STATUS_T LoadInitialValues(); 38 SYNCML_DM_RET_STATUS_T SetPrefClientAuth( SYNCML_DM_CHAL_TYPE_T nClientAuthType ); 39 SYNCML_DM_RET_STATUS_T SetPrefServerAuth( SYNCML_DM_CHAL_TYPE_T nServerAuthType ); 40 41 SYNCML_DM_RET_STATUS_T SaveClientAttribute( CPCHAR szAttribute, CPCHAR szValue ); 42 SYNCML_DM_RET_STATUS_T SaveServerAttribute( CPCHAR szAttribute, CPCHAR szValue ); 43 SYNCML_DM_RET_STATUS_T SaveAttribute( CPCHAR szProfile, CPCHAR szAttribute, CPCHAR szValue ); 44 SYNCML_DM_RET_STATUS_T SaveAuthPref(); 45 46 static SYNCML_DM_RET_STATUS_T DMGetDeviceID( DMString& device_id ); 47 static DMString GetDefaultAuthType(); 48 49 // implementation 50 private: 51 static SYNCML_DM_CHAL_TYPE_T Str2ChalType( CPCHAR szChal ); 52 static CPCHAR ChalType2Str( SYNCML_DM_CHAL_TYPE_T nChal ); 53 SYNCML_DM_RET_STATUS_T SetClientAuth( CPCHAR szLastAuthPref, BOOLEAN bTryDefault ); 54 SYNCML_DM_RET_STATUS_T GetDeviceID( DMString& device_id ); 55 56 // data 57 public: 58 // to minimize number of changes names for data members are left as in DM 1.1 59 // and members are declared public 60 DMString pDMAccNodeName; // Profile name for Current ServerID 61 DMString pClientUserName; // AAuthName for client profile 62 DMString pClientPW; // AAuthSecret for client profile 63 DMString pClientNonce; // AAuthData for client profile 64 DMString pServerId; // ServerID 65 DMString pServerPW; // AAuthSecret for server profile 66 DMString pServerNonce; // AAuthData for server profile 67 SYNCML_DM_CHAL_TYPE_T AuthPrefCredType; // used to choose right client credentials 68 SYNCML_DM_CHAL_TYPE_T ServerChalType; // used to choose server credentials 69 70 private: 71 DMString m_strClientProfileURI; 72 DMString m_strServerProfileURI; 73 DMString m_strdevIMEI; 74 BOOLEAN m_bAuthPrefUpdated; 75 }; 76 77 #endif /*__DMCLIENT_SRVCREDS_H__*/ 78