Remove dead code related to downloadable TA
[platform/core/security/tef-simulator.git] / simulatordaemon / inc / TAFactory.h
1 /**
2  * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file
19  * @author CHERYL (cb) (cheryl.b@samsung.com)
20  * @brief  TAFactory header file
21  */
22
23
24 #if !defined(_TAFACTORY_H)
25 #define _TAFACTORY_H
26
27 /*-----------------------------------------------------------------------------
28  *  Include files
29  *-----------------------------------------------------------------------------*/
30 #include <list>
31 #include <pthread.h>
32 #include <time.h>
33 #include <spawn.h>
34 #include <sys/wait.h>
35 #include <sstream>
36 #include <stdlib.h>
37 #include "ISession.h"
38 #include "TAInstance.h"
39 #include "TABinaryManager.h"
40
41 /*-----------------------------------------------------------------------------
42  *  Class definitions
43  *-----------------------------------------------------------------------------*/
44 class TAFactory {
45 public:
46         pthread_rwlock_t mTAInstanceMapLock;
47         multimap<string, TAInstancePtr> mTAInstanceMap;
48         static TAFactory* getInstance();
49         TAInstancePtr getTAInstance(TEEC_UUID TAUUID, ISession* session);
50 private:
51         static TAFactory *instance;
52         // instLock for TA Instance ID
53         pthread_rwlock_t instIDLock;
54         uint32_t InstID;
55         TAFactory();
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);
61         ~TAFactory();
62 };
63
64 #endif  //_TAFACTORY_H