2 * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @author CHERYL (cb) (cheryl.b@samsung.com)
20 * @brief TAFactory header file
24 #if !defined(_TAFACTORY_H)
27 /*-----------------------------------------------------------------------------
29 *-----------------------------------------------------------------------------*/
38 #include "TAInstance.h"
39 #include "TABinaryManager.h"
41 /*-----------------------------------------------------------------------------
43 *-----------------------------------------------------------------------------*/
46 pthread_rwlock_t mTAInstanceMapLock;
47 multimap<string, TAInstancePtr> mTAInstanceMap;
48 static TAFactory* getInstance();
49 TAInstancePtr getTAInstance(TEEC_UUID TAUUID, ISession* session);
51 static TAFactory *instance;
52 // instLock for TA Instance ID
53 pthread_rwlock_t instIDLock;
56 bool checkIfTARunning(string TAUUID);
57 TAInstancePtr createUninitalizedTAInstance(string TAUUID, ISession* session);
58 bool launchTA(string TAUUID, std::stringstream& str, bool debug, pid_t& pid);
59 static void* waitForChild(void *pid);
60 void cleanupTAInstance(pid_t PID);