Remove gcov rpm package
[platform/core/connectivity/smartcard-service.git] / common / include / SessionHelper.h
1 /*
2  * Copyright (c) 2012 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 #ifndef SESSIONHELPER_H_
18 #define SESSIONHELPER_H_
19
20 /* standard library header */
21 #include <vector>
22
23 /* SLP library header */
24
25 /* local header */
26 #include "Synchronous.h"
27 #include "ByteArray.h"
28 #include "Channel.h"
29
30 using namespace std;
31
32 namespace smartcard_service_api
33 {
34         /* LCOV_EXCL_START */
35         class ReaderHelper;
36
37         typedef void (*openChannelCallback)(Channel *channel, int error, void *userData);
38         typedef void (*getATRCallback)(unsigned char *atr, unsigned int length, int error, void *userData);
39         typedef void (*closeSessionCallback)(int error, void *userData);
40         typedef void (*getChannelCountCallback)(unsigned count, int error, void *userData);
41
42         class SessionHelper : public Synchronous
43         {
44         protected:
45                 ReaderHelper *reader;
46                 vector<Channel *> channels;
47                 ByteArray atr;
48                 bool closed;
49
50         public:
51                 SessionHelper(ReaderHelper *reader) :
52                         reader(reader), closed(true) {}
53                 virtual ~SessionHelper() {}
54
55                 ReaderHelper *getReader() const throw() { return reader; }
56                 bool isClosed() const throw() { return closed; }
57
58                 virtual void closeChannels() = 0;
59
60                 virtual int getATR(getATRCallback callback, void *userData) = 0;
61                 virtual int close(closeSessionCallback callback, void *userData) = 0;
62
63                 virtual int openBasicChannel(const ByteArray &aid, openChannelCallback callback, void *userData) = 0;
64                 virtual int openBasicChannel(const unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData) = 0;
65                 virtual int openLogicalChannel(const ByteArray &aid, openChannelCallback callback, void *userData) = 0;
66                 virtual int openLogicalChannel(const unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData) = 0;
67
68                 virtual const ByteArray getATRSync() = 0;
69
70                 virtual void closeSync() = 0;
71
72                 virtual Channel *openBasicChannelSync(const ByteArray &aid) = 0;
73
74                 virtual Channel *openBasicChannelSync(const unsigned char *aid, unsigned int length) = 0;
75
76                 virtual Channel *openLogicalChannelSync(const ByteArray &aid) = 0;
77
78                 virtual Channel *openLogicalChannelSync(const unsigned char *aid, unsigned int length) = 0;
79
80                 virtual Channel *openBasicChannelSync(const ByteArray &aid, unsigned char P2) = 0;
81
82                 virtual Channel *openBasicChannelSync(const unsigned char *aid, unsigned int length, unsigned char P2) = 0;
83
84                 virtual Channel *openLogicalChannelSync(const ByteArray &aid, unsigned char P2) = 0;
85
86                 virtual Channel *openLogicalChannelSync(const unsigned char *aid, unsigned int length, unsigned char P2) = 0;
87         };
88
89         /* LCOV_EXCL_STOP */
90 } /* namespace smartcard_service_api */
91 #endif /* SESSIONHELPER_H_ */