Fix source file permissions in the project
[platform/core/security/tef-simulator.git] / simulatordaemon / src / ClientCommands / CommandOpenSession.cpp
1 /*
2  * =====================================================================================
3  *
4  *       Filename:  CommandOpenSession.cpp
5  *
6  *    Description:  CommandOpenSession class
7  *
8  *        Version:  1.0
9  *        Created:  23 April 2015 12:42:03  IST
10  *       Revision:  Original
11  *       Compiler:  gcc
12  *
13  *         Author:  CHERYL (cb), cheryl.b@samsung.com
14  *   Organization:  Samsung Electronics
15  *
16  * =====================================================================================
17  */
18
19 /*-----------------------------------------------------------------------------
20  *  Include files
21  *-----------------------------------------------------------------------------*/
22 #include "ClientCommands/CommandOpenSession.h"
23 #include "TEEContext.h"
24
25 /*-----------------------------------------------------------------------------
26  *  Member functions
27  *-----------------------------------------------------------------------------*/
28 /**
29  * OpenSession command handling.
30  * @param data received from TEECLib
31  * @param TEECtx object associated with command
32  */
33 CommandOpenSession::CommandOpenSession(OpenSessionData data, TEEContext *TEECtx) :
34                 CommandBase(TEECtx) {
35         this->data = data;
36 }
37
38 /**
39  * OpenSession command execute.
40  * @param none
41  */
42 CommandOpenSession::~CommandOpenSession() {
43 }
44
45 void CommandOpenSession::execute() {
46         TEEC_Result result = TEEC_ERROR_GENERIC;
47         result = pTEECtx->openSession(data);
48         if (result != TEEC_SUCCESS) {
49                 FinalizeContextData fdata;
50                 fdata.contextID = data.contextID;
51                 pTEECtx->finContext(fdata);
52                 delete pTEECtx;
53         }
54 }