2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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.
17 #ifndef CLIENTCHANNEL_H_
18 #define CLIENTCHANNEL_H_
20 /* standard library header */
23 /* SLP library header */
26 #include "smartcard-types.h"
30 #endif /* __cplusplus */
33 namespace smartcard_service_api
35 class ClientChannel: public Channel
42 ClientChannel(void *context, Session *session, int channelNum,
43 const ByteArray &selectResponse, void *handle);
46 static void channel_transmit_cb(GObject *source_object,
47 GAsyncResult *res, gpointer user_data);
48 static void channel_close_cb(GObject *source_object,
49 GAsyncResult *res, gpointer user_data);
52 int close(closeChannelCallback callback, void *userParam);
53 int transmit(const ByteArray &command,
54 transmitCallback callback, void *userParam);
57 throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
58 ErrorSecurity &, ErrorIllegalParameter &);
59 int transmitSync(const ByteArray &command, ByteArray &result)
60 throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
61 ErrorIllegalParameter &, ErrorSecurity &);
65 } /* namespace smartcard_service_api */
66 #endif /* __cplusplus */
72 #endif /* __cplusplus */
74 bool channel_is_basic_channel(channel_h handle);
75 bool channel_is_closed(channel_h handle);
77 unsigned int channel_get_select_response_length(channel_h handle);
78 bool channel_get_select_response(channel_h handle, unsigned char *buffer,
80 session_h channel_get_session(channel_h handle);
81 void channel_destroy_instance(channel_h handle) __attribute__((deprecated));
83 int channel_close(channel_h handle, channel_close_cb callback, void *userParam);
84 int channel_transmit(channel_h handle, unsigned char *command,
85 unsigned int length, channel_transmit_cb callback, void *userParam);
86 void channel_close_sync(channel_h handle);
87 int channel_transmit_sync(channel_h handle, unsigned char *command,
88 unsigned int cmd_len, unsigned char **response, unsigned int *resp_len);
92 #endif /* __cplusplus */
94 #endif /* CLIENTCHANNEL_H_ */