Change the authorization sequence
[platform/core/connectivity/smartcard-service.git] / server / include / ServerChannel.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
18 #ifndef SERVERCHANNEL_H_
19 #define SERVERCHANNEL_H_
20
21 /* standard library header */
22
23 /* SLP library header */
24
25 /* local header */
26 #include "Channel.h"
27 #include "Terminal.h"
28 #include "ServerSession.h"
29
30 namespace smartcard_service_api
31 {
32         class ServerChannel: public Channel
33         {
34         private:
35                 Terminal *terminal;
36                 void *caller;
37                 bool privilege;
38
39                 ServerChannel(ServerSession *session, void *caller, int channelNum, Terminal *terminal);
40                 void setChannelNumber(int channelNum) { this->channelNum = channelNum; }
41                 void unsetPrivilegeMode() { this->privilege = false; }
42
43         protected:
44                 void closeSync();
45                 int transmitSync(ByteArray command, ByteArray &result);
46
47         public:
48                 ~ServerChannel();
49
50                 int getChannelNumber() { return channelNum; }
51                 Terminal *getTerminal() { return terminal; }
52
53                 int close(closeCallback callback, void *userParam) { return -1; }
54                 int transmit(ByteArray command, transmitCallback callback, void *userParam) { return -1; };
55
56                 friend class ServerReader;
57                 friend class ServerSession;
58                 friend class ServiceInstance;
59                 friend class ServerResource;
60         };
61
62 } /* namespace smartcard_service_api */
63 #endif /* SERVERCHANNEL_H_ */