summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonkyu Kwon <wonkyu.kwon@samsung.com>2013-07-24 17:24:40 +0900
committerWonkyu Kwon <wonkyu.kwon@samsung.com>2013-07-24 17:56:22 +0900
commit5833fcabe09c3418dc151c4a13ba14d49a5570b2 (patch)
treed93f25a430a402aa2d6d60115ef65bbbb4bbedbf
parent6d381c193fc79dc6e364fc4bc9a1a85436f22c1e (diff)
downloadsmartcard-service-5833fcabe09c3418dc151c4a13ba14d49a5570b2.tar.gz
smartcard-service-5833fcabe09c3418dc151c4a13ba14d49a5570b2.tar.bz2
smartcard-service-5833fcabe09c3418dc151c4a13ba14d49a5570b2.zip
Change log macro
Change-Id: Ifc71d0d4e1c011ea6553310a2f5455ec77bacb60
-rw-r--r--client/ClientChannel.cpp28
-rw-r--r--client/ClientDispatcher.cpp16
-rw-r--r--client/ClientIPC.cpp36
-rw-r--r--client/Reader.cpp34
-rw-r--r--client/SEService.cpp50
-rw-r--r--client/Session.cpp46
-rw-r--r--common/APDUHelper.cpp2
-rw-r--r--common/AccessCondition.cpp38
-rw-r--r--common/AccessControlList.cpp10
-rw-r--r--common/ByteArray.cpp19
-rw-r--r--common/DispatcherHelper.cpp6
-rw-r--r--common/EFDIR.cpp6
-rw-r--r--common/FCI.cpp32
-rw-r--r--common/FileObject.cpp28
-rw-r--r--common/GPSEACL.cpp42
-rw-r--r--common/IPCHelper.cpp98
-rw-r--r--common/Message.cpp14
-rw-r--r--common/OpensslHelper.cpp6
-rw-r--r--common/PKCS15.cpp18
-rw-r--r--common/PKCS15DODF.cpp22
-rw-r--r--common/PKCS15ODF.cpp32
-rw-r--r--common/PKCS15OID.cpp20
-rw-r--r--common/PKCS15Object.cpp4
-rw-r--r--common/ProviderHelper.cpp2
-rw-r--r--common/SEServiceHelper.cpp4
-rw-r--r--common/SignatureHelper.cpp26
-rw-r--r--common/SimpleTLV.cpp6
-rw-r--r--common/TLVHelper.cpp2
-rw-r--r--common/include/Debug.h84
-rw-r--r--server/ClientInstance.cpp4
-rw-r--r--server/ServerChannel.cpp8
-rw-r--r--server/ServerDispatcher.cpp50
-rw-r--r--server/ServerIPC.cpp54
-rw-r--r--server/ServerReader.cpp6
-rw-r--r--server/ServerResource.cpp102
-rw-r--r--server/ServerSEService.cpp24
-rw-r--r--server/ServerSession.cpp2
-rw-r--r--server/ServiceInstance.cpp2
-rw-r--r--server/smartcard-daemon.cpp24
-rw-r--r--test-client/test-client-sync.cpp46
-rw-r--r--test-client/test-client.cpp52
41 files changed, 560 insertions, 545 deletions
diff --git a/client/ClientChannel.cpp b/client/ClientChannel.cpp
index cb69384..14f1412 100644
--- a/client/ClientChannel.cpp
+++ b/client/ClientChannel.cpp
@@ -45,7 +45,7 @@ namespace smartcard_service_api
if (handle == NULL)
{
- SCARD_DEBUG_ERR("ClientIPC::getInstance() failed");
+ _ERR("ClientIPC::getInstance() failed");
return;
}
@@ -86,13 +86,13 @@ namespace smartcard_service_api
rv = waitTimedCondition(0);
if (rv < 0)
{
- SCARD_DEBUG_ERR("closeSync failed [%d]", rv);
+ _ERR("closeSync failed [%d]", rv);
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -107,7 +107,7 @@ namespace smartcard_service_api
else
{
/* FIXME */
- SCARD_DEBUG("unavailable channel");
+ _DBG("unavailable channel");
}
}
#endif
@@ -139,7 +139,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable channel");
+ _ERR("unavailable channel");
result = SCARD_ERROR_ILLEGAL_STATE;
}
}
@@ -178,14 +178,14 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("timeout");
+ _ERR("timeout");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
}
syncUnlock();
@@ -197,7 +197,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable channel");
+ _ERR("unavailable channel");
throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
}
@@ -233,7 +233,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable channel");
+ _ERR("unavailable channel");
result = SCARD_ERROR_ILLEGAL_STATE;
}
@@ -248,7 +248,7 @@ namespace smartcard_service_api
if (msg == NULL)
{
- SCARD_DEBUG_ERR("message is null");
+ _ERR("message is null");
return result;
}
@@ -259,7 +259,7 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_TRANSMIT :
{
/* transmit result */
- SCARD_DEBUG("MSG_REQUEST_TRANSMIT");
+ _DBG("MSG_REQUEST_TRANSMIT");
if (msg->error == 0 &&
ResponseHelper::getStatus(msg->data) == 0)
@@ -293,7 +293,7 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_CLOSE_CHANNEL :
{
- SCARD_DEBUG("MSG_REQUEST_CLOSE_CHANNEL");
+ _DBG("MSG_REQUEST_CLOSE_CHANNEL");
if (msg->isSynchronousCall() == true) /* synchronized call */
{
@@ -316,7 +316,7 @@ namespace smartcard_service_api
break;
default:
- SCARD_DEBUG("unknwon message : %s", msg->toString());
+ _DBG("Unknown message : %s", msg->toString());
break;
}
@@ -334,7 +334,7 @@ namespace smartcard_service_api
} \
else \
{ \
- SCARD_DEBUG_ERR("Invalid param"); \
+ _ERR("Invalid param"); \
}
using namespace smartcard_service_api;
diff --git a/client/ClientDispatcher.cpp b/client/ClientDispatcher.cpp
index 158689e..5161104 100644
--- a/client/ClientDispatcher.cpp
+++ b/client/ClientDispatcher.cpp
@@ -50,7 +50,7 @@ namespace smartcard_service_api
bool result = true;
map<void *, SEService *>::iterator item;
- SCARD_BEGIN();
+ _BEGIN();
if ((item = mapSESerivces.find(context)) == mapSESerivces.end())
{
@@ -58,10 +58,10 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("SEService [%p] exists", context);
+ _DBG("SEService [%p] exists", context);
}
- SCARD_END();
+ _END();
return result;
}
@@ -70,7 +70,7 @@ namespace smartcard_service_api
{
map<void *, SEService *>::iterator item;
- SCARD_BEGIN();
+ _BEGIN();
if ((item = mapSESerivces.find(context)) != mapSESerivces.end())
{
@@ -78,15 +78,15 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("SEService doesn't exist");
+ _DBG("SEService doesn't exist");
}
- SCARD_END();
+ _END();
}
void *ClientDispatcher::dispatcherThreadFunc(DispatcherMsg *msg, void *data)
{
- SCARD_BEGIN();
+ _BEGIN();
if (msg == NULL)
return NULL;
@@ -209,7 +209,7 @@ namespace smartcard_service_api
break;
}
- SCARD_END();
+ _END();
return NULL;
}
diff --git a/client/ClientIPC.cpp b/client/ClientIPC.cpp
index b4de978..bc7cf59 100644
--- a/client/ClientIPC.cpp
+++ b/client/ClientIPC.cpp
@@ -52,11 +52,11 @@ namespace smartcard_service_api
{
cookie.setBuffer(buffer, length);
- SCARD_DEBUG("cookie : %s", cookie.toString());
+ _DBG("cookie : %s", cookie.toString());
}
else
{
- SCARD_DEBUG_ERR("security_server_request_cookie failed [%d]", error);
+ _ERR("security_server_request_cookie failed [%d]", error);
}
delete []buffer;
@@ -64,7 +64,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("security_server_get_cookie_size failed");
+ _ERR("security_server_get_cookie_size failed");
}
#endif
}
@@ -86,7 +86,7 @@ namespace smartcard_service_api
DBusGConnection *connection;
GError *error = NULL;
- SCARD_BEGIN();
+ _BEGIN();
dbus_g_thread_init();
@@ -106,26 +106,26 @@ namespace smartcard_service_api
if (dbus_g_proxy_call(proxy, "launch", &error, G_TYPE_INVALID,
G_TYPE_INT, &result, G_TYPE_INVALID) == false)
{
- SCARD_DEBUG_ERR("org_tizen_smartcard_service_launch failed");
+ _ERR("org_tizen_smartcard_service_launch failed");
if (error != NULL)
{
- SCARD_DEBUG_ERR("message : [%s]", error->message);
+ _ERR("message : [%s]", error->message);
g_error_free(error);
}
}
}
else
{
- SCARD_DEBUG_ERR("ERROR: Can't make dbus proxy");
+ _ERR("ERROR: Can't make dbus proxy");
}
}
else
{
- SCARD_DEBUG_ERR("ERROR: Can't get on system bus [%s]", error->message);
+ _ERR("ERROR: Can't get on system bus [%s]", error->message);
g_error_free(error);
}
- SCARD_END();
+ _END();
}
#endif
@@ -144,7 +144,7 @@ namespace smartcard_service_api
#endif
length = stream.getLength();
- SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
+ _DBG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
ipcSocket, msg->message, stream.getLength());
return IPCHelper::sendMessage(ipcSocket, stream);
@@ -152,7 +152,7 @@ namespace smartcard_service_api
int ClientIPC::handleIOErrorCondition(void *channel, GIOCondition condition)
{
- SCARD_BEGIN();
+ _BEGIN();
if (dispatcher != NULL)
{
@@ -169,19 +169,19 @@ namespace smartcard_service_api
#endif
}
- SCARD_END();
+ _END();
return FALSE;
}
int ClientIPC::handleInvalidSocketCondition(void *channel, GIOCondition condition)
{
- SCARD_BEGIN();
+ _BEGIN();
/* finalize context */
destroyConnectSocket();
- SCARD_END();
+ _END();
return FALSE;
}
@@ -190,7 +190,7 @@ namespace smartcard_service_api
{
int result = FALSE;
- SCARD_BEGIN();
+ _BEGIN();
#ifndef CLIENT_IPC_THREAD
if (channel == ioChannel)
@@ -198,7 +198,7 @@ namespace smartcard_service_api
#endif
Message *msg = NULL;
- SCARD_DEBUG("message from server to client socket");
+ _DBG("message from server to client socket");
/* read message */
msg = retrieveMessage();
@@ -234,11 +234,11 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Unknown channel event [%p]", channel);
+ _ERR("Unknown channel event [%p]", channel);
}
#endif
- SCARD_END();
+ _END();
return result;
}
diff --git a/client/Reader.cpp b/client/Reader.cpp
index 8acb9a7..e687dd8 100644
--- a/client/Reader.cpp
+++ b/client/Reader.cpp
@@ -39,14 +39,14 @@ namespace smartcard_service_api
{
unsigned int length = 0;
- SCARD_BEGIN();
+ _BEGIN();
this->context = NULL;
this->handle = NULL;
if (context == NULL || name == NULL || strlen(name) == 0 || handle == NULL)
{
- SCARD_DEBUG_ERR("invalid param");
+ _ERR("invalid param");
return;
}
@@ -60,7 +60,7 @@ namespace smartcard_service_api
present = true;
- SCARD_END();
+ _END();
}
Reader::~Reader()
@@ -113,13 +113,13 @@ namespace smartcard_service_api
rv = waitTimedCondition(0);
if (rv != 0)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -132,7 +132,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable reader");
+ _ERR("unavailable reader");
throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
}
@@ -143,7 +143,7 @@ namespace smartcard_service_api
{
int result;
- SCARD_BEGIN();
+ _BEGIN();
if (isSecureElementPresent() == true)
{
@@ -163,17 +163,17 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
result = SCARD_ERROR_IPC_FAILED;
}
}
else
{
- SCARD_DEBUG_ERR("unavailable reader");
+ _ERR("unavailable reader");
result = SCARD_ERROR_ILLEGAL_STATE;
}
- SCARD_END();
+ _END();
return result;
}
@@ -184,11 +184,11 @@ namespace smartcard_service_api
Reader *reader;
bool result = false;
- SCARD_BEGIN();
+ _BEGIN();
if (msg == NULL)
{
- SCARD_DEBUG_ERR("message is null");
+ _ERR("message is null");
return result;
}
@@ -200,7 +200,7 @@ namespace smartcard_service_api
{
Session *session = NULL;
- SCARD_DEBUG("MSG_REQUEST_OPEN_SESSION");
+ _DBG("MSG_REQUEST_OPEN_SESSION");
if (msg->param1 != 0)
{
@@ -208,7 +208,7 @@ namespace smartcard_service_api
session = new Session(reader->context, reader, (void *)msg->param1);
if (session == NULL)
{
- SCARD_DEBUG_ERR("Session creating instance failed");
+ _ERR("Session creating instance failed");
return session;
}
@@ -239,11 +239,11 @@ namespace smartcard_service_api
break;
default:
- SCARD_DEBUG("unknown [%s]", msg->toString());
+ _DBG("unknown [%s]", msg->toString());
break;
}
- SCARD_END();
+ _END();
return result;
}
@@ -260,7 +260,7 @@ namespace smartcard_service_api
} \
else \
{ \
- SCARD_DEBUG_ERR("Invalid param"); \
+ _ERR("Invalid param"); \
}
using namespace smartcard_service_api;
diff --git a/client/SEService.cpp b/client/SEService.cpp
index f5a29a9..6ec2551 100644
--- a/client/SEService.cpp
+++ b/client/SEService.cpp
@@ -74,11 +74,11 @@ namespace smartcard_service_api
}
catch(ExceptionBase &e)
{
- SCARD_DEBUG_ERR("EXCEPTION : %s", e.what());
+ _ERR("EXCEPTION : %s", e.what());
}
catch(...)
{
- SCARD_DEBUG_ERR("EXCEPTION!!!");
+ _ERR("EXCEPTION!!!");
}
for (i = 0; i < readers.size(); i++)
@@ -120,7 +120,7 @@ namespace smartcard_service_api
if (ClientIPC::getInstance().sendMessage(&msg) == false)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
}
}
}
@@ -160,12 +160,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
}
syncUnlock();
}
@@ -178,7 +178,7 @@ namespace smartcard_service_api
ClientIPC *clientIPC;
ClientDispatcher *clientDispatcher;
- SCARD_BEGIN();
+ _BEGIN();
/* initialize client */
if (!g_thread_supported())
@@ -194,7 +194,7 @@ namespace smartcard_service_api
#ifndef CLIENT_IPC_THREAD
if (clientDispatcher->runDispatcherThread() == false)
{
- SCARD_DEBUG_ERR("clientDispatcher->runDispatcherThread() failed");
+ _ERR("clientDispatcher->runDispatcherThread() failed");
return result;
}
@@ -202,7 +202,7 @@ namespace smartcard_service_api
if (clientIPC->createConnectSocket() == false)
{
- SCARD_DEBUG_ERR("clientIPC->createConnectSocket() failed");
+ _ERR("clientIPC->createConnectSocket() failed");
return result;
}
@@ -221,7 +221,7 @@ namespace smartcard_service_api
result = clientIPC->sendMessage(&msg);
}
- SCARD_END();
+ _END();
return result;
}
@@ -276,13 +276,11 @@ namespace smartcard_service_api
memcpy(&handle, data.getBuffer(offset), sizeof(handle));
offset += sizeof(handle);
- SCARD_DEBUG("Reader [%d] : name [%s], handle [%p]", i, name, handle);
-
/* add readers */
reader = new Reader(context, name, handle);
if (reader == NULL)
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
continue;
}
@@ -298,11 +296,11 @@ namespace smartcard_service_api
SEService *service = NULL;
bool result = false;
- SCARD_BEGIN();
+ _BEGIN();
if (msg == NULL)
{
- SCARD_DEBUG_ERR("message is null");
+ _ERR("message is null");
return result;
}
@@ -311,7 +309,7 @@ namespace smartcard_service_api
switch (msg->message)
{
case Message::MSG_REQUEST_READERS :
- SCARD_DEBUG("[MSG_REQUEST_READERS]");
+ _DBG("[MSG_REQUEST_READERS]");
service->connected = true;
@@ -330,7 +328,7 @@ namespace smartcard_service_api
break;
case Message::MSG_REQUEST_SHUTDOWN :
- SCARD_DEBUG("[MSG_REQUEST_SHUTDOWN]");
+ _DBG("[MSG_REQUEST_SHUTDOWN]");
if (msg->isSynchronousCall() == true) /* synchronized call */
{
@@ -352,7 +350,7 @@ namespace smartcard_service_api
{
Reader *reader = NULL;
- SCARD_DEBUG("[MSG_NOTIFY_SE_INSERTED]");
+ _DBG("[MSG_NOTIFY_SE_INSERTED]");
/* add readers */
reader = new Reader(service->context,
@@ -363,7 +361,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
if (service->listener != NULL)
@@ -373,7 +371,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("listener is null");
+ _DBG("listener is null");
}
}
break;
@@ -382,7 +380,7 @@ namespace smartcard_service_api
{
size_t i;
- SCARD_DEBUG("[MSG_NOTIFY_SE_REMOVED]");
+ _DBG("[MSG_NOTIFY_SE_REMOVED]");
for (i = 0; i < service->readers.size(); i++)
{
@@ -400,13 +398,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("listener is null");
+ _DBG("listener is null");
}
}
break;
case Message::MSG_OPERATION_RELEASE_CLIENT :
- SCARD_DEBUG("[MSG_OPERATION_RELEASE_CLIENT]");
+ _DBG("[MSG_OPERATION_RELEASE_CLIENT]");
if (service->listener != NULL)
{
@@ -417,16 +415,16 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("service->listener is null");
+ _ERR("service->listener is null");
}
break;
default :
- SCARD_DEBUG("unknown message [%s]", msg->toString());
+ _DBG("unknown message [%s]", msg->toString());
break;
}
- SCARD_END();
+ _END();
return result;
}
@@ -443,7 +441,7 @@ namespace smartcard_service_api
} \
else \
{ \
- SCARD_DEBUG_ERR("Invalid param"); \
+ _ERR("Invalid param"); \
}
using namespace smartcard_service_api;
diff --git a/client/Session.cpp b/client/Session.cpp
index 95f85af..924f959 100644
--- a/client/Session.cpp
+++ b/client/Session.cpp
@@ -42,7 +42,7 @@ namespace smartcard_service_api
if (context == NULL || handle == NULL)
{
- SCARD_DEBUG_ERR("handle is null");
+ _ERR("handle is null");
return;
}
@@ -102,13 +102,13 @@ namespace smartcard_service_api
rv = waitTimedCondition(0);
if (rv != 0)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -124,7 +124,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
}
@@ -169,7 +169,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
result = SCARD_ERROR_ILLEGAL_STATE;
}
@@ -203,13 +203,13 @@ namespace smartcard_service_api
if (rv != 0)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -275,13 +275,13 @@ namespace smartcard_service_api
rv = waitTimedCondition(0);
if (rv != 0)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -294,7 +294,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
}
@@ -328,7 +328,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
result = SCARD_ERROR_ILLEGAL_STATE;
}
@@ -362,13 +362,13 @@ namespace smartcard_service_api
rv = waitTimedCondition(0);
if (rv != 0)
{
- SCARD_DEBUG_ERR("time over");
+ _ERR("time over");
this->error = SCARD_ERROR_OPERATION_TIMEOUT;
}
}
else
{
- SCARD_DEBUG_ERR("sendMessage failed");
+ _ERR("sendMessage failed");
this->error = SCARD_ERROR_IPC_FAILED;
}
syncUnlock();
@@ -380,7 +380,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
}
@@ -416,7 +416,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unavailable session");
+ _ERR("unavailable session");
result = SCARD_ERROR_ILLEGAL_STATE;
}
@@ -477,7 +477,7 @@ namespace smartcard_service_api
if (msg == NULL)
{
- SCARD_DEBUG_ERR("message is null");
+ _ERR("message is null");
return result;
}
@@ -489,7 +489,7 @@ namespace smartcard_service_api
{
Channel *channel = NULL;
- SCARD_DEBUG("MSG_REQUEST_OPEN_CHANNEL");
+ _DBG("MSG_REQUEST_OPEN_CHANNEL");
if (msg->param1 != 0)
{
@@ -502,7 +502,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
msg->error = SCARD_ERROR_OUT_OF_MEMORY;
}
@@ -532,7 +532,7 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_GET_ATR :
{
- SCARD_DEBUG("MSG_REQUEST_GET_ATR");
+ _DBG("MSG_REQUEST_GET_ATR");
if (msg->isSynchronousCall() == true) /* synchronized call */
{
@@ -557,7 +557,7 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_CLOSE_SESSION :
{
- SCARD_DEBUG("MSG_REQUEST_CLOSE_SESSION");
+ _DBG("MSG_REQUEST_CLOSE_SESSION");
if (msg->isSynchronousCall() == true) /* synchronized call */
{
@@ -581,7 +581,7 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_GET_CHANNEL_COUNT :
{
- SCARD_DEBUG("MSG_REQUEST_GET_CHANNEL_COUNT");
+ _DBG("MSG_REQUEST_GET_CHANNEL_COUNT");
if (msg->isSynchronousCall() == true) /* synchronized call */
{
@@ -605,7 +605,7 @@ namespace smartcard_service_api
break;
default :
- SCARD_DEBUG("unknown message : %s", msg->toString());
+ _DBG("unknown message : %s", msg->toString());
break;
}
@@ -623,7 +623,7 @@ namespace smartcard_service_api
} \
else \
{ \
- SCARD_DEBUG_ERR("Invalid param"); \
+ _ERR("Invalid param"); \
}
using namespace smartcard_service_api;
diff --git a/common/APDUHelper.cpp b/common/APDUHelper.cpp
index 8718737..757c1a8 100644
--- a/common/APDUHelper.cpp
+++ b/common/APDUHelper.cpp
@@ -230,7 +230,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("command stream is not correct, command.getLength() [%d], offset [%d]", command.getLength(), offset);
+ _ERR("command stream is not correct, command.getLength() [%d], offset [%d]", command.getLength(), offset);
}
return result;
diff --git a/common/AccessCondition.cpp b/common/AccessCondition.cpp
index 703d0de..d45c553 100644
--- a/common/AccessCondition.cpp
+++ b/common/AccessCondition.cpp
@@ -48,7 +48,7 @@ namespace smartcard_service_api
value = tlv.getValue();
- SCARD_DEBUG("APDU rule : %s", value.toString());
+ _DBG("APDU rule : %s", value.toString());
if (value.getLength() == 8) /* apdu 4 bytes + mask 4 bytes */
{
@@ -61,19 +61,19 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Invalid APDU rule : %s", value.toString());
+ _ERR("Invalid APDU rule : %s", value.toString());
}
}
else
{
- SCARD_DEBUG_ERR("Unknown tag : 0x%02X", tlv.getTag());
+ _ERR("Unknown tag : 0x%02X", tlv.getTag());
}
}
tlv.returnToParentTLV();
break;
default :
- SCARD_DEBUG_ERR("Unknown tag : 0x%02X", tlv.getTag());
+ _ERR("Unknown tag : 0x%02X", tlv.getTag());
break;
}
}
@@ -98,7 +98,7 @@ namespace smartcard_service_api
void APDUAccessRule::printAPDUAccessRules()
{
- SCARD_DEBUG(" +-- APDU Access Rule");
+ _DBG(" +-- APDU Access Rule");
if (mapApduFilters.size() > 0)
{
@@ -106,12 +106,12 @@ namespace smartcard_service_api
for (iterMap = mapApduFilters.begin(); iterMap != mapApduFilters.end(); iterMap++)
{
- SCARD_DEBUG(" +--- APDU : %s, Mask : %s", ((ByteArray)(iterMap->first)).toString(), iterMap->second.toString());
+ _DBG(" +--- APDU : %s, Mask : %s", ((ByteArray)(iterMap->first)).toString(), iterMap->second.toString());
}
}
else
{
- SCARD_DEBUG(" +--- permission : %s", permission ? "granted all" : "denied all");
+ _DBG(" +--- permission : %s", permission ? "granted all" : "denied all");
}
}
@@ -131,8 +131,8 @@ namespace smartcard_service_api
void NFCAccessRule::printNFCAccessRules()
{
- SCARD_DEBUG(" +-- NFC Access Rule");
- SCARD_DEBUG(" +--- permission : %s", permission ? "granted all" : "denied all");
+ _DBG(" +-- NFC Access Rule");
+ _DBG(" +--- permission : %s", permission ? "granted all" : "denied all");
}
void AccessCondition::loadAccessCondition(ByteArray &aid, ByteArray &data)
@@ -152,7 +152,7 @@ namespace smartcard_service_api
switch (tlv.getTag())
{
case 0x04 : /* OCTET STRING : CertHash */
- SCARD_DEBUG("aid : %s, hash : %s", aid.toString(), tlv.getValue().toString());
+ _DBG("aid : %s, hash : %s", aid.toString(), tlv.getValue().toString());
hashes.push_back(tlv.getValue());
break;
@@ -172,31 +172,31 @@ namespace smartcard_service_api
break;
default :
- SCARD_DEBUG_ERR("Unknown tag : 0x%02X", tlv.getTag());
+ _ERR("Unknown tag : 0x%02X", tlv.getTag());
break;
}
}
else
{
- SCARD_DEBUG_ERR("tlv.decodeTLV failed");
+ _ERR("tlv.decodeTLV failed");
}
tlv.returnToParentTLV();
break;
default :
- SCARD_DEBUG_ERR("Unknown tag : 0x%02X", tlv.getTag());
+ _ERR("Unknown tag : 0x%02X", tlv.getTag());
break;
}
}
else
{
- SCARD_DEBUG_ERR("tlv.decodeTLV failed");
+ _ERR("tlv.decodeTLV failed");
}
tlv.returnToParentTLV();
}
else
{
- SCARD_DEBUG("access granted for all applications, aid : %s", aid.toString());
+ _DBG("access granted for all applications, aid : %s", aid.toString());
permission = true;
break;
@@ -205,7 +205,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("access denied for all applications, aid : %s", aid.toString());
+ _DBG("access denied for all applications, aid : %s", aid.toString());
permission = false;
}
@@ -256,7 +256,7 @@ namespace smartcard_service_api
void AccessCondition::printAccessConditions()
{
- SCARD_DEBUG(" +-- Access Condition");
+ _DBG(" +-- Access Condition");
if (hashes.size() > 0)
{
@@ -264,12 +264,12 @@ namespace smartcard_service_api
for (i = 0; i < hashes.size(); i++)
{
- SCARD_DEBUG(" +--- hash : %s", hashes[i].toString());
+ _DBG(" +--- hash : %s", hashes[i].toString());
}
}
else
{
- SCARD_DEBUG(" +--- permission : %s", permission ? "granted all" : "denied all");
+ _DBG(" +--- permission : %s", permission ? "granted all" : "denied all");
}
}
} /* namespace smartcard_service_api */
diff --git a/common/AccessControlList.cpp b/common/AccessControlList.cpp
index 9ed93f1..47c4982 100644
--- a/common/AccessControlList.cpp
+++ b/common/AccessControlList.cpp
@@ -56,8 +56,8 @@ namespace smartcard_service_api
if (result == false)
{
- SCARD_DEBUG("aid : %s", aid.toString());
- SCARD_DEBUG("hash : %s", certHash.toString());
+ _DBG("aid : %s", aid.toString());
+ _DBG("hash : %s", certHash.toString());
/* null aid means default applet */
if (aid.isEmpty() == true)
@@ -115,16 +115,16 @@ namespace smartcard_service_api
/* release map and vector */
map<ByteArray, AccessCondition>::iterator iterMap;
- SCARD_DEBUG("================ Certification Hashes ==================");
+ _DBG("================ Certification Hashes ==================");
for (iterMap = mapConditions.begin(); iterMap != mapConditions.end(); iterMap++)
{
temp = iterMap->first;
- SCARD_DEBUG("+ aid : %s", (temp == AID_DEFAULT) ? "DEFAULT" : (temp == AID_ALL) ? "ALL" : temp.toString());
+ _DBG("+ aid : %s", (temp == AID_DEFAULT) ? "DEFAULT" : (temp == AID_ALL) ? "ALL" : temp.toString());
iterMap->second.printAccessConditions();
}
- SCARD_DEBUG("========================================================");
+ _DBG("========================================================");
}
} /* namespace smartcard_service_api */
diff --git a/common/ByteArray.cpp b/common/ByteArray.cpp
index 745800f..d68e47b 100644
--- a/common/ByteArray.cpp
+++ b/common/ByteArray.cpp
@@ -68,7 +68,7 @@ namespace smartcard_service_api
buffer = new uint8_t[bufferLen];
if (buffer == NULL)
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
return false;
}
@@ -110,7 +110,7 @@ namespace smartcard_service_api
if (offset >= length)
{
- SCARD_DEBUG_ERR("buffer overflow, offset [%d], length [%d]", offset, length);
+ _ERR("buffer overflow, offset [%d], length [%d]", offset, length);
return NULL;
}
@@ -121,7 +121,7 @@ namespace smartcard_service_api
{
if (index >= length)
{
- SCARD_DEBUG_ERR("buffer overflow, index [%d], length [%d]", index, length);
+ _ERR("buffer overflow, index [%d], length [%d]", index, length);
return buffer[length -1];
}
@@ -132,7 +132,7 @@ namespace smartcard_service_api
{
if (index >= length)
{
- SCARD_DEBUG_ERR("buffer underflow, index [%d], length [%d]", index, length);
+ _ERR("buffer underflow, index [%d], length [%d]", index, length);
return buffer[0];
}
@@ -145,7 +145,7 @@ namespace smartcard_service_api
if (array == NULL || bufferLen == 0)
{
- SCARD_DEBUG_ERR("invaild param");
+ _ERR("invaild param");
return false;
}
@@ -175,7 +175,7 @@ namespace smartcard_service_api
if (length == 0)
{
- SCARD_DEBUG("length is zero");
+ _DBG("length is zero");
return T;
}
@@ -191,7 +191,7 @@ namespace smartcard_service_api
if (newBuffer == NULL)
{
/* assert.... */
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
return *this;
}
@@ -248,7 +248,7 @@ namespace smartcard_service_api
{
if (index >= length)
{
- SCARD_DEBUG_ERR("buffer overflow, index [%d], length [%d]", index, length);
+ _ERR("buffer overflow, index [%d], length [%d]", index, length);
return buffer[length -1];
}
@@ -311,11 +311,10 @@ namespace smartcard_service_api
fflush(file);
fclose(file);
- SCARD_DEBUG("file has written, file [%s], length[%d]", filePath, length);
}
else
{
- SCARD_DEBUG_ERR("file open failed, [%d]", errno);
+ _ERR("file open failed, [%d]", errno);
}
}
diff --git a/common/DispatcherHelper.cpp b/common/DispatcherHelper.cpp
index a4b5510..eb3d474 100644
--- a/common/DispatcherHelper.cpp
+++ b/common/DispatcherHelper.cpp
@@ -117,17 +117,17 @@ namespace smartcard_service_api
if ((ret = pthread_create(&dispatcherThread, &attr, &DispatcherHelper::_dispatcherThreadFunc, this)) != 0)
{
- SCARD_DEBUG_ERR("pthread_create failed [%d]", ret);
+ _ERR("pthread_create failed [%d]", ret);
}
else
{
- SCARD_DEBUG("pthread_create success");
+ _DBG("pthread_create success");
result = true;
}
}
else
{
- SCARD_DEBUG("thread already start");
+ _DBG("thread already start");
result = true;
}
diff --git a/common/EFDIR.cpp b/common/EFDIR.cpp
index 16dfc54..bc78a18 100644
--- a/common/EFDIR.cpp
+++ b/common/EFDIR.cpp
@@ -36,11 +36,11 @@ namespace smartcard_service_api
ret = select(dirPath, false);
if (ret == FileObject::SUCCESS)
{
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
}
else
{
- SCARD_DEBUG_ERR("EFDIR select failed, [%d]", ret);
+ _ERR("EFDIR select failed, [%d]", ret);
}
}
@@ -83,7 +83,7 @@ namespace smartcard_service_api
if (matched == true)
{
- SCARD_DEBUG("Found!! : path %s", result.toString());
+ _DBG("Found!! : path %s", result.toString());
}
else
{
diff --git a/common/FCI.cpp b/common/FCI.cpp
index 1771dea..dd03a32 100644
--- a/common/FCI.cpp
+++ b/common/FCI.cpp
@@ -64,7 +64,7 @@ namespace smartcard_service_api
bool result = false;
SimpleTLV tlv;
- SCARD_BEGIN();
+ _BEGIN();
releaseFCP();
@@ -75,7 +75,7 @@ namespace smartcard_service_api
if (fcpBuffer[0] != 0x62)
{
- SCARD_DEBUG_ERR("it is not FCP response [%02X]", fcpBuffer[0]);
+ _ERR("it is not FCP response [%02X]", fcpBuffer[0]);
return false;
}
@@ -92,7 +92,7 @@ namespace smartcard_service_api
{
case 0x80 : /* file length without sturctural inforamtion */
{
- SCARD_DEBUG("0x%02X : file length without sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : file length without sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString());
if (tlv.getLength() > 0)
{
fileSize = NumberStream::getBigEndianNumber(tlv.getValue());
@@ -102,7 +102,7 @@ namespace smartcard_service_api
case 0x81 : /* file length with sturctural inforamtion */
{
- SCARD_DEBUG("0x%02X : file length with sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : file length with sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString());
if (tlv.getLength() > 0)
{
maxRecordSize = NumberStream::getBigEndianNumber(tlv.getValue());
@@ -112,14 +112,14 @@ namespace smartcard_service_api
case 0x82 : /* file descriptor bytes */
{
- SCARD_DEBUG("0x%02X : file descriptor bytes : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : file descriptor bytes : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
case 0x83 : /* file identifier */
{
- SCARD_DEBUG("0x%02X : file identifier : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : file identifier : %s", tlv.getTag(), tlv.getValue().toString());
if (tlv.getLength() > 0)
{
ByteArray value = tlv.getValue();
@@ -140,7 +140,7 @@ namespace smartcard_service_api
case 0x85 : /* proprietary information not encoded in BER-TLV */
{
- SCARD_DEBUG("0x%02X : proprietary information not encoded in BER-TLV : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : proprietary information not encoded in BER-TLV : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
@@ -154,14 +154,14 @@ namespace smartcard_service_api
case 0x87 : /* Identifier of an EF containing an extension of the file control information */
{
- SCARD_DEBUG("0x%02X : Identifier of an EF containing an extension of the file control information : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : Identifier of an EF containing an extension of the file control information : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
case 0x88 : /* Short EF identifier */
{
- SCARD_DEBUG("0x%02X : Short EF identifier : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : Short EF identifier : %s", tlv.getTag(), tlv.getValue().toString());
if (tlv.getLength() > 0)
{
@@ -176,7 +176,7 @@ namespace smartcard_service_api
case 0x8A : /* life cycle status byte */
{
- SCARD_DEBUG("0x%02X : life cycle status byte : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : life cycle status byte : %s", tlv.getTag(), tlv.getValue().toString());
if (tlv.getLength() > 0)
{
ByteArray value = tlv.getValue();
@@ -232,14 +232,14 @@ namespace smartcard_service_api
case 0xA2 : /* Template consisting of one or more pairs of data objects */
{
- SCARD_DEBUG("0x%02X : Template consisting of one or more pairs of data objects : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : Template consisting of one or more pairs of data objects : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
case 0xA5 : /* proprietary information encoded in BER-TLV */
{
- SCARD_DEBUG("0x%02X : proprietary information encoded in BER-TLV : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : proprietary information encoded in BER-TLV : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
@@ -253,7 +253,7 @@ namespace smartcard_service_api
case 0xAC : /* Cryptographic mechanism identifier template */
{
- SCARD_DEBUG("0x%02X : Cryptographic mechanism identifier template : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : Cryptographic mechanism identifier template : %s", tlv.getTag(), tlv.getValue().toString());
// ByteArray value = tlv.getValue();
}
break;
@@ -267,7 +267,7 @@ namespace smartcard_service_api
default :
{
- SCARD_DEBUG("0x%02X : unknown : %s", tlv.getTag(), tlv.getValue().toString());
+ _DBG("0x%02X : unknown : %s", tlv.getTag(), tlv.getValue().toString());
}
break;
}
@@ -276,10 +276,10 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("tlv.decodeTLV failed");
+ _ERR("tlv.decodeTLV failed");
}
- SCARD_END();
+ _END();
return result;
}
diff --git a/common/FileObject.cpp b/common/FileObject.cpp
index e93e459..65c18d3 100644
--- a/common/FileObject.cpp
+++ b/common/FileObject.cpp
@@ -65,20 +65,20 @@ namespace smartcard_service_api
fcp.setFCP(resp.getDataField());
- SCARD_DEBUG("FCP : %s", fcp.toString());
+ _DBG("FCP : %s", fcp.toString());
opened = true;
result = true;
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]",
+ _ERR("status word [%d][ %02X %02X ]",
resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("invalid response : %s", response.toString());
+ _ERR("invalid response : %s", response.toString());
}
return result;
@@ -91,7 +91,7 @@ namespace smartcard_service_api
if (channel == NULL || channel->isClosed())
{
- SCARD_DEBUG_ERR("channel is not open");
+ _ERR("channel is not open");
return ret;
}
@@ -122,7 +122,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]",
+ _ERR("select apdu is failed, rv [%d], length [%d]",
ret, result.getLength());
ret = ERROR_ILLEGAL_STATE;
@@ -225,18 +225,18 @@ namespace smartcard_service_api
ret = resp.getStatus();
if (ret == 0)
{
- SCARD_DEBUG("response [%d] : %s", response.getLength(), response.toString());
+ _DBG("response [%d] : %s", response.getLength(), response.toString());
result = Record(recordId, resp.getDataField());
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
}
return ret;
@@ -268,7 +268,7 @@ namespace smartcard_service_api
if (resp.getStatus() == 0)
{
- SCARD_DEBUG("response [%d] : %s", response.getLength(), response.toString());
+ _DBG("response [%d] : %s", response.getLength(), response.toString());
result = resp.getDataField();
@@ -276,12 +276,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
}
return ret;
@@ -303,18 +303,18 @@ namespace smartcard_service_api
if (resp.getStatus() == 0)
{
- SCARD_DEBUG("response [%d] : %s", response.getLength(), response.toString());
+ _DBG("response [%d] : %s", response.getLength(), response.toString());
ret = SUCCESS;
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", ret, response.getLength());
}
return ret;
diff --git a/common/GPSEACL.cpp b/common/GPSEACL.cpp
index a6eb0f7..d5ecc11 100644
--- a/common/GPSEACL.cpp
+++ b/common/GPSEACL.cpp
@@ -78,22 +78,22 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("loadAccessControl failed, every request will be accepted.");
+ _ERR("loadAccessControl failed, every request will be accepted.");
}
}
else
{
- SCARD_DEBUG_ERR("dodf null, every request will be accepted.");
+ _ERR("dodf null, every request will be accepted.");
}
}
else
{
- SCARD_DEBUG_ERR("odf null, every request will be accepted.");
+ _ERR("odf null, every request will be accepted.");
}
}
else
{
- SCARD_DEBUG_ERR("failed to open PKCS15, every request will be accepted.");
+ _ERR("failed to open PKCS15, every request will be accepted.");
}
delete pkcs15;
@@ -116,12 +116,12 @@ namespace smartcard_service_api
ByteArray data;
FileObject file(channel);
- SCARD_DEBUG("oid path : %s", path.toString());
+ _DBG("oid path : %s", path.toString());
file.select(NumberStream::getLittleEndianNumber(path));
file.readBinary(0, 0, file.getFCP()->getFileSize(), data);
- SCARD_DEBUG("data : %s", data.toString());
+ _DBG("data : %s", data.toString());
/* PKCS #15 and DODF OID exists. apply access control rule!! */
allGranted = false;
@@ -136,7 +136,7 @@ namespace smartcard_service_api
ByteArray refreshTag;
refreshTag = SimpleTLV::getOctetString(tlv);
- SCARD_DEBUG("current refresh tag : %s", refreshTag.toString());
+ _DBG("current refresh tag : %s", refreshTag.toString());
if (this->refreshTag != refreshTag) /* need to update access control list */
{
@@ -152,15 +152,15 @@ namespace smartcard_service_api
/* OCTET STRING */
path = SimpleTLV::getOctetString(tlv.getValue());
- SCARD_DEBUG("access control rule path : %s", path.toString());
+ _DBG("access control rule path : %s", path.toString());
if (loadRules(channel, path) == 0)
{
- SCARD_DEBUG("loadRules success");
+ _DBG("loadRules success");
}
else
{
- SCARD_DEBUG_ERR("loadRules failed");
+ _ERR("loadRules failed");
}
}
}
@@ -168,12 +168,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("tlv.decodeTLV failed");
+ _ERR("tlv.decodeTLV failed");
}
}
else
{
- SCARD_DEBUG_ERR("OID not found");
+ _ERR("OID not found");
}
return result;
@@ -187,7 +187,7 @@ namespace smartcard_service_api
file.select(NumberStream::getLittleEndianNumber(path));
file.readBinary(0, 0, file.getFCP()->getFileSize(), data);
- SCARD_DEBUG("data : %s", data.toString());
+ _DBG("data : %s", data.toString());
SimpleTLV tlv(data);
@@ -213,7 +213,7 @@ namespace smartcard_service_api
break;
}
- SCARD_DEBUG("aid : %s", aid.toString());
+ _DBG("aid : %s", aid.toString());
/* access condition path */
if (tlv.decodeTLV() == true && tlv.getTag() == 0x30) /* SEQUENCE : Path */
@@ -222,25 +222,25 @@ namespace smartcard_service_api
/* OCTET STRING */
path = SimpleTLV::getOctetString(tlv.getValue());
- SCARD_DEBUG("path : %s", path.toString());
+ _DBG("path : %s", path.toString());
if (loadAccessConditions(channel, aid, path) == 0)
{
- SCARD_DEBUG("loadCertHashes success");
+ _DBG("loadCertHashes success");
}
else
{
- SCARD_DEBUG_ERR("loadCertHashes failed");
+ _ERR("loadCertHashes failed");
}
}
else
{
- SCARD_DEBUG_ERR("decodeTLV failed");
+ _ERR("decodeTLV failed");
}
}
else
{
- SCARD_DEBUG_ERR("decodeTLV failed");
+ _ERR("decodeTLV failed");
}
tlv.returnToParentTLV();
}
@@ -256,7 +256,7 @@ namespace smartcard_service_api
file.select(NumberStream::getLittleEndianNumber(path));
file.readBinary(0, 0, file.getFCP()->getFileSize(), data);
- SCARD_DEBUG("data : %s", data.toString());
+ _DBG("data : %s", data.toString());
AccessCondition condition;
@@ -281,7 +281,7 @@ namespace smartcard_service_api
} \
else \
{ \
- SCARD_DEBUG_ERR("Invalid param"); \
+ _ERR("Invalid param"); \
}
using namespace smartcard_service_api;
diff --git a/common/IPCHelper.cpp b/common/IPCHelper.cpp
index 708575a..8f296b1 100644
--- a/common/IPCHelper.cpp
+++ b/common/IPCHelper.cpp
@@ -52,7 +52,7 @@ static void setNonBlockSocket(int socket)
if (fcntl(socket, F_SETFL, flags) < 0)
{
- /* SCARD_DEBUG_ERR("fcntl, executing nonblock error"); */
+ /* _ERR("fcntl, executing nonblock error"); */
}
}
@@ -78,11 +78,11 @@ namespace smartcard_service_api
IPCHelper *helper = (IPCHelper *)data;
gboolean result = FALSE;
- SCARD_DEBUG("channel [%p], condition [%d], data [%p]", channel, condition, data);
+ _DBG("channel [%p], condition [%d], data [%p]", channel, condition, data);
if (helper == NULL)
{
- SCARD_DEBUG_ERR("ipchelper is null");
+ _ERR("ipchelper is null");
return result;
}
@@ -117,7 +117,7 @@ namespace smartcard_service_api
ipcSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (ipcSocket == -1)
{
- SCARD_DEBUG_ERR("get socket is failed");
+ _ERR("get socket is failed");
return false;
}
@@ -128,19 +128,19 @@ namespace smartcard_service_api
if (bind(ipcSocket, (struct sockaddr *)&saddrun_rv, sizeof(saddrun_rv)) < 0)
{
- SCARD_DEBUG_ERR("bind is failed \n");
+ _ERR("bind is failed \n");
goto ERROR;
}
if (chmod(SCARD_SERVER_DOMAIN, 0777) < 0)
{
- SCARD_DEBUG_ERR("can not change permission of UNIX DOMAIN file");
+ _ERR("can not change permission of UNIX DOMAIN file");
goto ERROR;
}
if (listen(ipcSocket, IPC_SERVER_MAX_CLIENT) < 0)
{
- SCARD_DEBUG_ERR("listen is failed \n");
+ _ERR("listen is failed \n");
goto ERROR;
}
@@ -148,13 +148,13 @@ namespace smartcard_service_api
{
if ((watchId = g_io_add_watch(ioChannel, condition, &IPCHelper::channelCallbackFunc, this)) < 1)
{
- SCARD_DEBUG_ERR(" g_io_add_watch is failed \n");
+ _ERR(" g_io_add_watch is failed \n");
goto ERROR;
}
}
else
{
- SCARD_DEBUG_ERR(" g_io_channel_unix_new is failed \n");
+ _ERR(" g_io_channel_unix_new is failed \n");
goto ERROR;
}
@@ -165,7 +165,7 @@ namespace smartcard_service_api
gid = security_server_get_gid("smartcard-service");
if(gid == 0)
{
- SCARD_DEBUG("get gid from security server is failed. this object is not allowed by security server");
+ _DBG("get gid from security server is failed. this object is not allowed by security server");
goto ERROR;
}
@@ -178,11 +178,11 @@ namespace smartcard_service_api
}
#endif
- SCARD_DEBUG("server ipc is initialized");
+ _DBG("server ipc is initialized");
return true;
ERROR :
- SCARD_DEBUG_ERR("error while initializing server ipc");
+ _ERR("error while initializing server ipc");
destroyListenSocket();
@@ -203,11 +203,11 @@ ERROR :
for (i = 0; i < events; i++)
{
- SCARD_DEBUG("pollEvents[%d].events [%X]", i, pollEvents[i].events);
+ _DBG("pollEvents[%d].events [%X]", i, pollEvents[i].events);
if ((pollEvents[i].events & EPOLLHUP) || (pollEvents[i].events & EPOLLERR))
{
- SCARD_DEBUG_ERR("connection is closed");
+ _ERR("connection is closed");
result = 0;
break;
}
@@ -220,13 +220,13 @@ ERROR :
}
else if (errno == EINTR)
{
- SCARD_DEBUG_ERR("epoll_wait interrupted");
+ _ERR("epoll_wait interrupted");
}
else
{
char buffer[1024];
- SCARD_DEBUG_ERR("epoll_wait failed, errno [%d], %s", errno, strerror_r(errno, buffer, sizeof(buffer)));
+ _ERR("epoll_wait failed, errno [%d], %s", errno, strerror_r(errno, buffer, sizeof(buffer)));
}
#else
if (select(ipcSocket + 1, &fdSetRead, NULL, NULL, NULL) > 0)
@@ -240,30 +240,30 @@ ERROR :
{
if (val == 0)
{
- SCARD_DEBUG("socket is readable");
+ _DBG("socket is readable");
result = 1;
}
else
{
- SCARD_DEBUG("socket is not available. maybe disconnected");
+ _DBG("socket is not available. maybe disconnected");
result = 0;
}
}
else
{
- SCARD_DEBUG_ERR("getsockopt failed, errno [%d]", errno);
+ _ERR("getsockopt failed, errno [%d]", errno);
result = errno;
}
}
else
{
- SCARD_DEBUG_ERR("FD_ISSET false!!! what's wrong");
+ _ERR("FD_ISSET false!!! what's wrong");
result = -1;
}
}
else
{
- SCARD_DEBUG_ERR("select failed [%d]", errno);
+ _ERR("select failed [%d]", errno);
result = errno;
}
#endif
@@ -282,7 +282,7 @@ ERROR :
sigemptyset(&newmask);
sigaddset(&newmask, SIGTERM);
pthread_sigmask(SIG_UNBLOCK, &newmask, NULL);
- SCARD_DEBUG("sighandler is registered");
+ _DBG("sighandler is registered");
pthread_mutex_lock(&g_client_lock);
pthread_cond_signal ((pthread_cond_t *) data);
@@ -312,7 +312,7 @@ ERROR :
}
}
- SCARD_DEBUG("threadRead is terminated");
+ _DBG("threadRead is terminated");
return (void *)NULL;
}
@@ -326,7 +326,7 @@ ERROR :
int result = 0;
char err[200] = { 0, };
- SCARD_BEGIN();
+ _BEGIN();
if (ipcSocket >= 0)
return true;
@@ -341,12 +341,12 @@ ERROR :
ipcSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (ipcSocket == -1)
{
- SCARD_DEBUG_ERR("get socket is failed [%d, %s]",
+ _ERR("get socket is failed [%d, %s]",
errno, strerror_r(errno, err, sizeof(err)));
goto ERROR;
}
- SCARD_DEBUG("socket is created");
+ _DBG("socket is created");
::setNonBlockSocket(ipcSocket);
@@ -357,7 +357,7 @@ ERROR :
if ((result = connect(ipcSocket, (struct sockaddr *)&saddrun_rv, len_saddr)) < 0)
{
- SCARD_DEBUG_ERR("connect failed [%d, %s]",
+ _ERR("connect failed [%d, %s]",
errno, strerror_r(errno, err, sizeof(err)));
goto ERROR;
}
@@ -366,7 +366,7 @@ ERROR :
#ifdef USE_IPC_EPOLL
if((fdPoll = epoll_create1(EPOLL_CLOEXEC)) == -1)
{
- SCARD_DEBUG_ERR("epoll_create1 failed [%d, %s]",
+ _ERR("epoll_create1 failed [%d, %s]",
errno, strerror_r(errno, err, sizeof(err)));
goto ERROR;
}
@@ -374,7 +374,7 @@ ERROR :
pollEvents = (struct epoll_event *)calloc(EPOLL_SIZE, sizeof(struct epoll_event));
if (pollEvents == NULL)
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
goto ERROR;
}
@@ -396,7 +396,7 @@ ERROR :
if (pthread_create(&readThread, NULL, &IPCHelper::threadRead, this) != 0)
#endif
{
- SCARD_DEBUG_ERR("pthread_create is failed");
+ _ERR("pthread_create is failed");
goto ERROR;
}
@@ -409,32 +409,32 @@ ERROR :
{
if ((watchId = g_io_add_watch(ioChannel, condition, &IPCHelper::channelCallbackFunc, this)) < 1)
{
- SCARD_DEBUG_ERR(" g_io_add_watch is failed");
+ _ERR(" g_io_add_watch is failed");
goto ERROR;
}
}
else
{
- SCARD_DEBUG_ERR(" g_io_channel_unix_new is failed");
+ _ERR(" g_io_channel_unix_new is failed");
goto ERROR;
}
#endif
pthread_mutex_unlock(&ipcLock);
- SCARD_DEBUG("connecting success");
+ _DBG("connecting success");
- SCARD_END();
+ _END();
return true;
ERROR :
- SCARD_DEBUG_ERR("error while initializing client ipc");
+ _ERR("error while initializing client ipc");
destroyConnectSocket();
pthread_mutex_unlock(&ipcLock);
- SCARD_END();
+ _END();
return false;
}
@@ -524,7 +524,7 @@ ERROR :
stream = msg->serialize();
length = stream.getLength();
- SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
+ _DBG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
socket, msg->message, stream.getLength());
return sendMessage(socket, stream);
@@ -564,12 +564,12 @@ ERROR :
}
else
{
- SCARD_DEBUG_ERR("send failed, sentBytes [%d]", sentBytes);
+ _ERR("send failed, sentBytes [%d]", sentBytes);
}
}
else
{
- SCARD_DEBUG_ERR("stream length is zero");
+ _ERR("stream length is zero");
}
return result;
@@ -585,7 +585,7 @@ ERROR :
ByteArray buffer;
Message *msg = NULL;
- SCARD_BEGIN();
+ _BEGIN();
buffer = retrieveBuffer(socket);
if (buffer.getLength() > 0)
@@ -597,15 +597,15 @@ ERROR :
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
{
- SCARD_DEBUG_ERR("retrieveBuffer failed ");
+ _ERR("retrieveBuffer failed ");
}
- SCARD_END();
+ _END();
return msg;
}
@@ -616,7 +616,7 @@ ERROR :
unsigned int length = 0;
int readBytes = 0;
- SCARD_BEGIN();
+ _BEGIN();
/* read 4 bytes (length) */
pthread_mutex_lock(&ipcLock);
@@ -647,7 +647,7 @@ ERROR :
while (current < length);
pthread_mutex_unlock(&ipcLock);
- SCARD_DEBUG("<<<[RETRIEVE]<<< socket [%d], msg_length [%d]", socket, length);
+ _DBG("<<<[RETRIEVE]<<< socket [%d], msg_length [%d]", socket, length);
buffer.setBuffer(temp, length);
@@ -655,20 +655,20 @@ ERROR :
}
else
{
- SCARD_DEBUG_ERR("allocation failed");
+ _ERR("allocation failed");
}
}
else
{
- SCARD_DEBUG_ERR("invalid length, socket = [%d], msg_length = [%d]", socket, length);
+ _ERR("invalid length, socket = [%d], msg_length = [%d]", socket, length);
}
}
else
{
- SCARD_DEBUG_ERR("failed to recv length, socket = [%d], readBytes [%d]", socket, readBytes);
+ _ERR("failed to recv length, socket = [%d], readBytes [%d]", socket, readBytes);
}
- SCARD_END();
+ _END();
return buffer;
}
diff --git a/common/Message.cpp b/common/Message.cpp
index a9b815e..14755b5 100644
--- a/common/Message.cpp
+++ b/common/Message.cpp
@@ -98,7 +98,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("allocation failed");
+ _ERR("allocation failed");
}
return result;
@@ -114,22 +114,22 @@ namespace smartcard_service_api
unsigned int current = 0;
unsigned int dataLength = 0;
-// SCARD_DEBUG("buffer [%p], length [%d]", buffer, length);
+// _DBG("buffer [%p], length [%d]", buffer, length);
memcpy(&message, buffer + current, sizeof(message));
current += sizeof(message);
-// SCARD_DEBUG("message [%d]", message);
+// _DBG("message [%d]", message);
memcpy(&param1, buffer + current, sizeof(param1));
current += sizeof(param1);
-// SCARD_DEBUG("param1 [%d]", param1);
+// _DBG("param1 [%d]", param1);
memcpy(&param2, buffer + current, sizeof(param2));
current += sizeof(param2);
-// SCARD_DEBUG("param2 [%d]", param2);
+// _DBG("param2 [%d]", param2);
memcpy(&error, buffer + current, sizeof(error));
current += sizeof(error);
@@ -143,14 +143,14 @@ namespace smartcard_service_api
memcpy(&userParam, buffer + current, sizeof(userParam));
current += sizeof(userParam);
-// SCARD_DEBUG("userContext [%p]", userContext);
+// _DBG("userContext [%p]", userContext);
if (current + sizeof(dataLength) < length)
{
memcpy(&dataLength, buffer + current, sizeof(dataLength));
current += sizeof(dataLength);
-// SCARD_DEBUG("dataLength [%d]", dataLength);
+// _DBG("dataLength [%d]", dataLength);
data.setBuffer(buffer + current, dataLength);
current += dataLength;
diff --git a/common/OpensslHelper.cpp b/common/OpensslHelper.cpp
index 52161d7..3f9a3b9 100644
--- a/common/OpensslHelper.cpp
+++ b/common/OpensslHelper.cpp
@@ -109,7 +109,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
return ret;
@@ -144,7 +144,7 @@ namespace smartcard_service_api
{
if (EVP_DigestUpdate(&mdCtx, buffer.getBuffer(), buffer.getLength()) == 0)
{
- SCARD_DEBUG_ERR("EVP_DigestUpdate failed");
+ _ERR("EVP_DigestUpdate failed");
}
if (EVP_DigestFinal(&mdCtx, temp, &resultLen) > 0 &&
@@ -157,7 +157,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("EVP_get_digestbyname(\"%s\") returns NULL", algorithm);
+ _ERR("EVP_get_digestbyname(\"%s\") returns NULL", algorithm);
}
return ret;
diff --git a/common/PKCS15.cpp b/common/PKCS15.cpp
index 46236d7..ce9729b 100644
--- a/common/PKCS15.cpp
+++ b/common/PKCS15.cpp
@@ -38,24 +38,24 @@ namespace smartcard_service_api
ret = select(PKCS15::PKCS15_AID);
if (ret == FileObject::SUCCESS)
{
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
}
else if (ret == ResponseHelper::ERROR_FILE_NOT_FOUND)
{
- SCARD_DEBUG_ERR("PKCS15 AID not found, search in EF DIR");
+ _ERR("PKCS15 AID not found, search in EF DIR");
if (selectFromEFDIR() == true)
{
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
}
else
{
- SCARD_DEBUG_ERR("PKCS15 select failed, [%d]", ret);
+ _ERR("PKCS15 select failed, [%d]", ret);
}
}
else
{
- SCARD_DEBUG_ERR("PKCS15 select failed, [%d]", ret);
+ _ERR("PKCS15 select failed, [%d]", ret);
}
}
@@ -91,12 +91,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("path select failed, [%d]", ret);
+ _ERR("path select failed, [%d]", ret);
}
}
else
{
- SCARD_DEBUG_ERR("PKCS15 not found");
+ _ERR("PKCS15 not found");
}
return result;
@@ -110,14 +110,14 @@ namespace smartcard_service_api
if (odf != NULL && odf->isClosed() == true)
{
- SCARD_DEBUG_ERR("failed to open ODF");
+ _ERR("failed to open ODF");
delete odf;
odf = NULL;
}
}
- SCARD_DEBUG("odf [%p]", odf);
+ _DBG("odf [%p]", odf);
return odf;
}
diff --git a/common/PKCS15DODF.cpp b/common/PKCS15DODF.cpp
index 7009957..6e9d9cf 100644
--- a/common/PKCS15DODF.cpp
+++ b/common/PKCS15DODF.cpp
@@ -38,22 +38,22 @@ namespace smartcard_service_api
{
ByteArray dodfData, extra;
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
if ((ret = readBinary(0, 0, getFCP()->getFileSize(), dodfData)) == 0)
{
- SCARD_DEBUG("odfData : %s", dodfData.toString());
+ _DBG("odfData : %s", dodfData.toString());
parseData(dodfData);
}
else
{
- SCARD_DEBUG_ERR("readBinary failed, [%d]", ret);
+ _ERR("readBinary failed, [%d]", ret);
}
}
else
{
- SCARD_DEBUG_ERR("select failed, [%d]", ret);
+ _ERR("select failed, [%d]", ret);
}
}
@@ -65,22 +65,22 @@ namespace smartcard_service_api
{
ByteArray dodfData, extra;
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
if ((ret = readBinary(0, 0, getFCP()->getFileSize(), dodfData)) == 0)
{
- SCARD_DEBUG("dodfData : %s", dodfData.toString());
+ _DBG("dodfData : %s", dodfData.toString());
parseData(dodfData);
}
else
{
- SCARD_DEBUG_ERR("readBinary failed, [%d]", ret);
+ _ERR("readBinary failed, [%d]", ret);
}
}
else
{
- SCARD_DEBUG_ERR("select failed, [%d]", ret);
+ _ERR("select failed, [%d]", ret);
}
}
@@ -101,7 +101,7 @@ namespace smartcard_service_api
{
PKCS15OID oid(tlv.getValue());
- SCARD_DEBUG("OID DataObject");
+ _DBG("OID DataObject");
pair<ByteArray, PKCS15OID> newPair(oid.getOID(), oid);
mapOID.insert(newPair);
@@ -109,12 +109,12 @@ namespace smartcard_service_api
break;
default :
- SCARD_DEBUG("Unknown tlv : t [%X], l [%d], v %s", tlv.getTag(), tlv.getLength(), tlv.getValue().toString());
+ _DBG("Unknown tlv : t [%X], l [%d], v %s", tlv.getTag(), tlv.getLength(), tlv.getValue().toString());
break;
}
}
- SCARD_DEBUG("dataList.size() = %d", mapOID.size());
+ _DBG("dataList.size() = %d", mapOID.size());
return result;
}
diff --git a/common/PKCS15ODF.cpp b/common/PKCS15ODF.cpp
index 686cef6..ba795e5 100644
--- a/common/PKCS15ODF.cpp
+++ b/common/PKCS15ODF.cpp
@@ -35,22 +35,22 @@ namespace smartcard_service_api
{
ByteArray odfData, extra;
- SCARD_DEBUG("response : %s", selectResponse.toString());
+ _DBG("response : %s", selectResponse.toString());
if ((ret = readBinary(0, 0, getFCP()->getFileSize(), odfData)) == 0)
{
- SCARD_DEBUG("odfData : %s", odfData.toString());
+ _DBG("odfData : %s", odfData.toString());
parseData(odfData);
}
else
{
- SCARD_DEBUG_ERR("readBinary failed, [%d]", ret);
+ _ERR("readBinary failed, [%d]", ret);
}
}
else
{
- SCARD_DEBUG_ERR("select failed, [%d]", ret);
+ _ERR("select failed, [%d]", ret);
}
}
@@ -62,13 +62,13 @@ namespace smartcard_service_api
if ((ret = readBinary(0, 0, 0, odfData)) == 0)
{
- SCARD_DEBUG("odfData : %s", odfData.toString());
+ _DBG("odfData : %s", odfData.toString());
parseData(odfData);
}
else
{
- SCARD_DEBUG_ERR("readBinary failed, [%d]", ret);
+ _ERR("readBinary failed, [%d]", ret);
}
}
@@ -94,11 +94,11 @@ namespace smartcard_service_api
{
ByteArray dodf;
- SCARD_DEBUG("TAG_DODF");
+ _DBG("TAG_DODF");
dodf = PKCS15Object::getOctetStream(tlv.getValue());
- SCARD_DEBUG("path : %s", dodf.toString());
+ _DBG("path : %s", dodf.toString());
pair<unsigned int, ByteArray> newPair(tlv.getTag(), dodf);
dataList.insert(newPair);
@@ -109,11 +109,11 @@ namespace smartcard_service_api
{
ByteArray tokeninfo;
- SCARD_DEBUG("TAG_TOKENINFO");
+ _DBG("TAG_TOKENINFO");
tokeninfo = PKCS15Object::getOctetStream(tlv.getValue());
- SCARD_DEBUG("path : %s", tokeninfo.toString());
+ _DBG("path : %s", tokeninfo.toString());
pair<unsigned int, ByteArray> newPair(tlv.getTag(), tokeninfo);
dataList.insert(newPair);
@@ -121,14 +121,14 @@ namespace smartcard_service_api
break;
default :
- SCARD_DEBUG("Unknown tlv : t [%X], l [%d], v %s",
+ _DBG("Unknown tlv : t [%X], l [%d], v %s",
tlv.getTag(), tlv.getLength(), tlv.getValue().toString());
break;
}
}
- SCARD_DEBUG("dataList.size() = %d", dataList.size());
+ _DBG("dataList.size() = %d", dataList.size());
return result;
}
@@ -145,12 +145,12 @@ namespace smartcard_service_api
NumberStream num(item->second);
unsigned int fid = num.getLittleEndianNumber();
- SCARD_DEBUG("fid [%X]", fid);
+ _DBG("fid [%X]", fid);
dodf = new PKCS15DODF(fid, channel);
if (dodf != NULL && dodf->isClosed() == true)
{
- SCARD_DEBUG_ERR("failed to open DODF");
+ _ERR("failed to open DODF");
delete dodf;
dodf = NULL;
@@ -158,11 +158,11 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("[%02X] is not found. total [%d]", TAG_DODF, dataList.size());
+ _ERR("[%02X] is not found. total [%d]", TAG_DODF, dataList.size());
}
}
- SCARD_DEBUG("dodf [%p]", dodf);
+ _DBG("dodf [%p]", dodf);
return dodf;
}
diff --git a/common/PKCS15OID.cpp b/common/PKCS15OID.cpp
index 86a7923..1b9c10e 100644
--- a/common/PKCS15OID.cpp
+++ b/common/PKCS15OID.cpp
@@ -40,7 +40,7 @@ namespace smartcard_service_api
bool result = false;
SimpleTLV tlv(data);
- SCARD_BEGIN();
+ _BEGIN();
while (tlv.decodeTLV() == true)
{
@@ -62,12 +62,12 @@ namespace smartcard_service_api
{
/* common object attribute */
/* if you want to use this value, add member variable and parse here */
-// SCARD_DEBUG_ERR("common object attribute is empty");
+// _ERR("common object attribute is empty");
}
break;
case 0xA0 : /* CHOICE 0 : External Oid??? */
- SCARD_DEBUG_ERR("oid doesn't exist");
+ _ERR("oid doesn't exist");
break;
case 0xA1 : /* CHOICE 1 : OidDO */
@@ -83,11 +83,11 @@ namespace smartcard_service_api
{
oid = tlv.getValue();
- SCARD_DEBUG("oid : %s", oid.toString());
+ _DBG("oid : %s", oid.toString());
}
else
{
- SCARD_DEBUG_ERR("oid is empty");
+ _ERR("oid is empty");
}
/* path */
@@ -95,32 +95,32 @@ namespace smartcard_service_api
{
path = SimpleTLV::getOctetString(tlv.getValue());
- SCARD_DEBUG("path : %s", path.toString());
+ _DBG("path : %s", path.toString());
result = true;
}
else
{
- SCARD_DEBUG_ERR("sequence is empty");
+ _ERR("sequence is empty");
}
tlv.returnToParentTLV();
}
else
{
- SCARD_DEBUG_ERR("common dataobject attribute is empty");
+ _ERR("common dataobject attribute is empty");
}
tlv.returnToParentTLV();
break;
default :
- SCARD_DEBUG_ERR("Unknown tag : 0x%02X", tlv.getTag());
+ _ERR("Unknown tag : 0x%02X", tlv.getTag());
break;
}
}
- SCARD_END();
+ _END();
return result;
}
diff --git a/common/PKCS15Object.cpp b/common/PKCS15Object.cpp
index debc182..25f62fb 100644
--- a/common/PKCS15Object.cpp
+++ b/common/PKCS15Object.cpp
@@ -56,13 +56,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("TAG_OCTET_STREAM not found");
+ _ERR("TAG_OCTET_STREAM not found");
}
tlv.returnToParentTLV();
}
else
{
- SCARD_DEBUG_ERR("TAG_SEQUENCE not found");
+ _ERR("TAG_SEQUENCE not found");
}
return result;
diff --git a/common/ProviderHelper.cpp b/common/ProviderHelper.cpp
index 39817be..4ce927f 100644
--- a/common/ProviderHelper.cpp
+++ b/common/ProviderHelper.cpp
@@ -34,7 +34,7 @@ namespace smartcard_service_api
if (channel == NULL)
{
- SCARD_DEBUG_ERR("invalid channel");
+ _ERR("invalid channel");
return;
}
diff --git a/common/SEServiceHelper.cpp b/common/SEServiceHelper.cpp
index 85ce608..383b2fb 100644
--- a/common/SEServiceHelper.cpp
+++ b/common/SEServiceHelper.cpp
@@ -27,8 +27,8 @@ namespace smartcard_service_api
{
SEServiceHelper::~SEServiceHelper()
{
- SCARD_BEGIN();
- SCARD_END();
+ _BEGIN();
+ _END();
}
} /* namespace smartcard_service_api */
diff --git a/common/SignatureHelper.cpp b/common/SignatureHelper.cpp
index abd5ca4..183a46d 100644
--- a/common/SignatureHelper.cpp
+++ b/common/SignatureHelper.cpp
@@ -49,14 +49,14 @@ namespace smartcard_service_api
if(pkgmgrinfo_appinfo_get_appinfo(packageName, &handle_appinfo) != PMINFO_R_OK)
{
- SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_appinfo fail");
+ _ERR("pkgmgrinfo_appinfo_get_appinfo fail");
return result;
}
if(pkgmgrinfo_appinfo_get_pkgid(handle_appinfo, &pkgid) != PMINFO_R_OK)
{
pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
- SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_pkgid fail");
+ _ERR("pkgmgrinfo_appinfo_get_pkgid fail");
return result;
}
pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
@@ -80,7 +80,7 @@ namespace smartcard_service_api
OpensslHelper::decodeBase64String(value, result, false);
if (result.getLength() > 0)
{
- SCARD_DEBUG("type [%d] hash [%d] : %s", type, result.getLength(), result.toString());
+ _DBG("type [%d] hash [%d] : %s", type, result.getLength(), result.toString());
break;
}
}
@@ -89,14 +89,14 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
+ _ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
}
pkgmgr_pkginfo_destroy_certinfo(handle);
}
else
{
- SCARD_DEBUG_ERR("pkgmgr_pkginfo_create_certinfo failed [%d]", ret);
+ _ERR("pkgmgr_pkginfo_create_certinfo failed [%d]", ret);
}
return result;
@@ -114,7 +114,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("aul_app_get_pkgname_bypid failed [%d]", error);
+ _ERR("aul_app_get_pkgname_bypid failed [%d]", error);
}
return result;
@@ -132,7 +132,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("aul_app_get_pkgname_bypid failed [%d]", error);
+ _ERR("aul_app_get_pkgname_bypid failed [%d]", error);
}
return result;
@@ -148,14 +148,14 @@ namespace smartcard_service_api
if(pkgmgrinfo_appinfo_get_appinfo(packageName, &handle_appinfo) != PMINFO_R_OK)
{
- SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_appinfo fail");
+ _ERR("pkgmgrinfo_appinfo_get_appinfo fail");
return result;
}
if(pkgmgrinfo_appinfo_get_pkgid(handle_appinfo, &pkgid) != PMINFO_R_OK)
{
pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
- SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_pkgid fail");
+ _ERR("pkgmgrinfo_appinfo_get_pkgid fail");
return result;
}
@@ -183,7 +183,7 @@ namespace smartcard_service_api
OpensslHelper::digestBuffer("sha1", decodeValue.getBuffer(), decodeValue.getLength(), hash);
if(hash.getLength() > 0)
{
- SCARD_DEBUG("type [%d] hash [%d] : %s", type, hash.getLength(), hash.toString());
+ _DBG("type [%d] hash [%d] : %s", type, hash.getLength(), hash.toString());
certHashes.push_back(hash);
}
}
@@ -195,7 +195,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
+ _ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
}
pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
@@ -204,7 +204,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("pkgmgr_pkginfo_create_certinfo failed [%d]", ret);
+ _ERR("pkgmgr_pkginfo_create_certinfo failed [%d]", ret);
}
return result;
@@ -250,7 +250,7 @@ certiHash *__signature_helper_vector_to_linked_list(vector<ByteArray> &certHashe
return head;
ERROR :
- SCARD_DEBUG_ERR("mem alloc fail");
+ _ERR("mem alloc fail");
while (head)
{
diff --git a/common/SimpleTLV.cpp b/common/SimpleTLV.cpp
index 638e6c7..90ffbfe 100644
--- a/common/SimpleTLV.cpp
+++ b/common/SimpleTLV.cpp
@@ -193,7 +193,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getOctetString failed (0x%02X)", tlv.getTag());
+ _ERR("getOctetString failed (0x%02X)", tlv.getTag());
}
return result;
@@ -219,7 +219,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getBoolean failed (0x%02X)", tlv.getTag());
+ _ERR("getBoolean failed (0x%02X)", tlv.getTag());
}
return result;
@@ -241,7 +241,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getInteger failed (0x%02X)", tlv.getTag());
+ _ERR("getInteger failed (0x%02X)", tlv.getTag());
}
return result;
diff --git a/common/TLVHelper.cpp b/common/TLVHelper.cpp
index b577996..d50c811 100644
--- a/common/TLVHelper.cpp
+++ b/common/TLVHelper.cpp
@@ -162,7 +162,7 @@ namespace smartcard_service_api
{
bool result = true;
-// SCARD_DEBUG("current [%p], parent [%p]", currentTLV, currentTLV->getParentTLV());
+// _DBG("current [%p], parent [%p]", currentTLV, currentTLV->getParentTLV());
if (currentTLV->getParentTLV() != NULL)
{
diff --git a/common/include/Debug.h b/common/include/Debug.h
index e3f918a..2efcb65 100644
--- a/common/include/Debug.h
+++ b/common/include/Debug.h
@@ -24,38 +24,56 @@
/* local header */
-#define COLOR_RED "\033[0;31m"
-#define COLOR_GREEN "\033[0;32m"
-#define COLOR_BROWN "\033[0;33m"
-#define COLOR_BLUE "\033[0;34m"
-#define COLOR_PURPLE "\033[0;35m"
-#define COLOR_CYAN "\033[0;36m"
-#define COLOR_LIGHTBLUE "\033[0;37m"
-#define COLOR_END "\033[0;m"
-
-#define SCARD_DEBUG(fmt, ...)\
- do\
- {\
- LOGD(fmt, ##__VA_ARGS__);\
- } while (0)
-
-#define SCARD_DEBUG_ERR(fmt, ...)\
- do\
- {\
- LOGE(COLOR_RED fmt COLOR_END, ##__VA_ARGS__);\
- }while (0)
-
-#define SCARD_BEGIN() \
- do\
- {\
- LOGD(COLOR_BLUE "BEGIN >>>>" COLOR_END);\
- } while( 0 )
-
-#define SCARD_END() \
- do\
- {\
- LOGD(COLOR_BLUE "END <<<<" COLOR_END);\
- } \
- while( 0 )
+#define COLOR_BLACK "\033[0;30m"
+#define COLOR_RED "\033[0;31m"
+#define COLOR_GREEN "\033[0;32m"
+#define COLOR_BROWN "\033[0;33m"
+#define COLOR_BLUE "\033[0;34m"
+#define COLOR_PURPLE "\033[0;35m"
+#define COLOR_CYAN "\033[0;36m"
+#define COLOR_GRAY "\033[0;37m"
+#define COLOR_END "\033[0;m"
+
+#define _ERR(fmt, ...) \
+ do \
+ { \
+ LOGE(COLOR_RED fmt COLOR_END, ##__VA_ARGS__); \
+ } \
+ while (0)
+
+#define _INFO(fmt, ...) \
+ do \
+ { \
+ LOGI(COLOR_GREEN fmt COLOR_END, ##__VA_ARGS__); \
+ } \
+ while (0)
+
+#define _WARN(fmt, ...) \
+ do \
+ { \
+ LOGI(COLOR_BROWN fmt COLOR_END, ##__VA_ARGS__); \
+ } \
+ while (0)
+
+#define _DBG(fmt, ...) \
+ do \
+ { \
+ LOGD(fmt, ##__VA_ARGS__); \
+ } \
+ while (0)
+
+#define _BEGIN() \
+ do \
+ { \
+ LOGD(COLOR_BLUE"BEGIN >>>>"COLOR_END); \
+ } \
+ while (0)
+
+#define _END() \
+ do \
+ { \
+ LOGD(COLOR_BLUE"END <<<<"COLOR_END); \
+ } \
+ while (0)
#endif /* DEBUG_H_ */
diff --git a/server/ClientInstance.cpp b/server/ClientInstance.cpp
index 667608b..7eecf39 100644
--- a/server/ClientInstance.cpp
+++ b/server/ClientInstance.cpp
@@ -56,12 +56,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
{
- SCARD_DEBUG_ERR("service already exist [%d]", context);
+ _ERR("service already exist [%d]", context);
}
return result;
diff --git a/server/ServerChannel.cpp b/server/ServerChannel.cpp
index d0f880a..ed923ae 100644
--- a/server/ServerChannel.cpp
+++ b/server/ServerChannel.cpp
@@ -62,16 +62,16 @@ namespace smartcard_service_api
if (resp.getStatus() == 0)
{
- SCARD_DEBUG("close success");
+ _DBG("close success");
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", rv, result.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", rv, result.getLength());
}
}
@@ -107,7 +107,7 @@ namespace smartcard_service_api
helper.getBuffer(command);
- SCARD_DEBUG("command [%d] : %s", command.getLength(), command.toString());
+ _DBG("command [%d] : %s", command.getLength(), command.toString());
ret = terminal->transmitSync(command, result);
if (ret == 0 && ResponseHelper::getStatus(result) == 0)
diff --git a/server/ServerDispatcher.cpp b/server/ServerDispatcher.cpp
index 0173bb9..05c13d0 100644
--- a/server/ServerDispatcher.cpp
+++ b/server/ServerDispatcher.cpp
@@ -34,11 +34,11 @@ namespace smartcard_service_api
{
ServerDispatcher::ServerDispatcher():DispatcherHelper()
{
- SCARD_BEGIN();
+ _BEGIN();
runDispatcherThread();
- SCARD_END();
+ _END();
}
ServerDispatcher::~ServerDispatcher()
@@ -59,13 +59,13 @@ namespace smartcard_service_api
if (data == NULL)
{
- SCARD_DEBUG_ERR("dispatcher instance is null");
+ _ERR("dispatcher instance is null");
return NULL;
}
if (msg == NULL)
{
- SCARD_DEBUG_ERR("message is null");
+ _ERR("message is null");
return NULL;
}
@@ -96,7 +96,7 @@ namespace smartcard_service_api
if (instance->getPID() == -1)
{
instance->setPID(msg->error);
- SCARD_DEBUG_ERR("update PID [%d]", msg->error);
+ _ERR("update PID [%d]", msg->error);
/* generate certification hashes */
instance->generateCertificationHashes();
@@ -114,19 +114,19 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("no secure elements");
+ _DBG("no secure elements");
}
}
else
{
- SCARD_DEBUG_ERR("createClient failed");
+ _ERR("createClient failed");
response.error = SCARD_ERROR_UNAVAILABLE;
}
}
else
{
- SCARD_DEBUG("client doesn't exist, socket [%d]", socket);
+ _DBG("client doesn't exist, socket [%d]", socket);
response.error = SCARD_ERROR_UNAVAILABLE;
}
@@ -140,7 +140,7 @@ namespace smartcard_service_api
{
Message response(*msg);
- SCARD_DEBUG("[MSG_REQUEST_SHUTDOWN]");
+ _DBG("[MSG_REQUEST_SHUTDOWN]");
response.error = SCARD_ERROR_OK;
@@ -156,7 +156,7 @@ namespace smartcard_service_api
Message response(*msg);
unsigned int handle = IntegerHandle::INVALID_HANDLE;
- SCARD_DEBUG("[MSG_REQUEST_OPEN_SESSION]");
+ _DBG("[MSG_REQUEST_OPEN_SESSION]");
if (resource->isValidReaderHandle(msg->param1))
{
@@ -169,13 +169,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("createSession failed [%d]", handle);
+ _ERR("createSession failed [%d]", handle);
response.error = SCARD_ERROR_OUT_OF_MEMORY;
}
}
else
{
- SCARD_DEBUG_ERR("request invalid reader handle [%d]", msg->param1);
+ _ERR("request invalid reader handle [%d]", msg->param1);
response.error = SCARD_ERROR_ILLEGAL_PARAM;
}
@@ -190,7 +190,7 @@ namespace smartcard_service_api
{
Message response(*msg);
- SCARD_DEBUG("[MSG_REQUEST_CLOSE_SESSION]");
+ _DBG("[MSG_REQUEST_CLOSE_SESSION]");
response.param1 = 0;
response.error = SCARD_ERROR_OK;
@@ -209,7 +209,7 @@ namespace smartcard_service_api
{
Message response(*msg);
- SCARD_DEBUG("[MSG_REQUEST_OPEN_CHANNEL]");
+ _DBG("[MSG_REQUEST_OPEN_CHANNEL]");
response.param1 = IntegerHandle::INVALID_HANDLE;
response.param2 = 0;
@@ -234,13 +234,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("IS IT POSSIBLE??????????????????");
+ _ERR("IS IT POSSIBLE??????????????????");
response.error = SCARD_ERROR_UNKNOWN;
}
}
else
{
- SCARD_DEBUG_ERR("channel is null.");
+ _ERR("channel is null.");
/* set error value */
response.error = SCARD_ERROR_UNAVAILABLE;
@@ -260,7 +260,7 @@ namespace smartcard_service_api
{
Message response(*msg);
- SCARD_DEBUG("[MSG_REQUEST_GET_CHANNEL_COUNT]");
+ _DBG("[MSG_REQUEST_GET_CHANNEL_COUNT]");
response.error = SCARD_ERROR_OK;
response.param1 = resource->getChannelCount(socket, msg->error/* service context */, msg->param1);
@@ -274,7 +274,7 @@ namespace smartcard_service_api
{
Message response(*msg);
- SCARD_DEBUG("[MSG_REQUEST_CLOSE_CHANNEL]");
+ _DBG("[MSG_REQUEST_CLOSE_CHANNEL]");
response.error = SCARD_ERROR_OK;
@@ -295,7 +295,7 @@ namespace smartcard_service_api
ByteArray result;
ServiceInstance *client = NULL;
- SCARD_DEBUG("[MSG_REQUEST_GET_ATR]");
+ _DBG("[MSG_REQUEST_GET_ATR]");
if ((client = resource->getService(socket, msg->error/* service context */)) != NULL)
{
@@ -310,20 +310,20 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("transmit failed [%d]", rv);
+ _ERR("transmit failed [%d]", rv);
response.error = rv;
}
}
else
{
- SCARD_DEBUG_ERR("getTerminal failed : socket [%d], context [%d], session [%d]", socket, msg->error/* service context */, msg->param1);
+ _ERR("getTerminal failed : socket [%d], context [%d], session [%d]", socket, msg->error/* service context */, msg->param1);
response.error = SCARD_ERROR_UNAVAILABLE;
}
}
else
{
- SCARD_DEBUG_ERR("getClient failed : socket [%d], context [%d], session [%d]", socket, msg->error/* service context */, msg->param1);
+ _ERR("getClient failed : socket [%d], context [%d], session [%d]", socket, msg->error/* service context */, msg->param1);
response.error = SCARD_ERROR_UNAVAILABLE;
}
@@ -339,7 +339,7 @@ namespace smartcard_service_api
ByteArray result;
Channel *channel = NULL;
- SCARD_DEBUG("[MSG_REQUEST_TRANSMIT]");
+ _DBG("[MSG_REQUEST_TRANSMIT]");
if ((channel = resource->getChannel(socket, msg->error/* service context */, msg->param1)) != NULL)
{
@@ -350,14 +350,14 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("transmit failed [%d]", rv);
+ _ERR("transmit failed [%d]", rv);
response.error = rv;
}
}
else
{
- SCARD_DEBUG_ERR("invalid handle : socket [%d], context [%d], channel [%d]", socket, msg->error/* service context */, msg->param1);
+ _ERR("invalid handle : socket [%d], context [%d], channel [%d]", socket, msg->error/* service context */, msg->param1);
response.error = SCARD_ERROR_UNAVAILABLE;
}
diff --git a/server/ServerIPC.cpp b/server/ServerIPC.cpp
index eb25f24..6d8ceae 100644
--- a/server/ServerIPC.cpp
+++ b/server/ServerIPC.cpp
@@ -38,11 +38,11 @@ namespace smartcard_service_api
{
ServerIPC::ServerIPC():IPCHelper()
{
- SCARD_BEGIN();
+ _BEGIN();
setDispatcher(ServerDispatcher::getInstance());
- SCARD_END();
+ _END();
}
ServerIPC::~ServerIPC()
@@ -61,7 +61,7 @@ namespace smartcard_service_api
ByteArray buffer;
Message *msg = NULL;
- SCARD_BEGIN();
+ _BEGIN();
buffer = IPCHelper::retrieveBuffer(socket);
if (buffer.getLength() > 0)
@@ -78,7 +78,7 @@ namespace smartcard_service_api
gid = security_server_get_gid("smartcard-daemon");
if ((result = security_server_check_privilege(cookie.getBuffer(), gid)) != SECURITY_SERVER_API_SUCCESS)
{
- SCARD_DEBUG_ERR("security_server_check_privilege failed [%d]", result);
+ _ERR("security_server_check_privilege failed [%d]", result);
return msg;
}
#endif
@@ -89,15 +89,15 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
{
- SCARD_DEBUG_ERR("retrieveBuffer failed ");
+ _ERR("retrieveBuffer failed ");
}
- SCARD_END();
+ _END();
return msg;
}
@@ -110,7 +110,7 @@ namespace smartcard_service_api
GIOChannel *client_channel = NULL;
int client_src_id;
- SCARD_DEBUG("client is trying to connect to server");
+ _DBG("client is trying to connect to server");
pthread_mutex_lock(&ipcLock);
client_sock_fd = accept(ipcSocket, NULL, &addrlen);
@@ -118,29 +118,29 @@ namespace smartcard_service_api
if (client_sock_fd < 0)
{
- SCARD_DEBUG_ERR("can not accept client");
+ _ERR("can not accept client");
goto ERROR;
}
- SCARD_DEBUG("client is accepted by server");
+ _DBG("client is accepted by server");
if ((client_channel = g_io_channel_unix_new(client_sock_fd)) == NULL)
{
- SCARD_DEBUG_ERR("create new g io channel is failed");
+ _ERR("create new g io channel is failed");
goto ERROR;
}
if ((client_src_id = g_io_add_watch(client_channel, condition, &IPCHelper::channelCallbackFunc, this)) < 1)
{
- SCARD_DEBUG_ERR("add io callback is failed");
+ _ERR("add io callback is failed");
goto ERROR;
}
- SCARD_DEBUG("client socket is bond with g_io_channel");
+ _DBG("client socket is bond with g_io_channel");
if (ServerResource::getInstance().createClient(client_channel, client_sock_fd, client_src_id, 0, -1) == false)
{
- SCARD_DEBUG_ERR("failed to add client");
+ _ERR("failed to add client");
}
return true;
@@ -188,11 +188,11 @@ ERROR :
int ServerIPC::handleIOErrorCondition(void *channel, GIOCondition condition)
{
- SCARD_BEGIN();
+ _BEGIN();
if(channel == ioChannel)
{
- SCARD_DEBUG("server socket is closed");
+ _DBG("server socket is closed");
restartServerIPC();
}
else
@@ -200,9 +200,9 @@ ERROR :
DispatcherMsg dispMsg;
int peerSocket = g_io_channel_unix_get_fd((GIOChannel *)channel);
- SCARD_DEBUG("client socket is closed, socket [%d]", peerSocket);
+ _DBG("client socket is closed, socket [%d]", peerSocket);
- /* push messsage to dispatcher */
+ /* push message to dispatcher */
dispMsg.message = Message::MSG_OPERATION_RELEASE_CLIENT;
dispMsg.param1 = peerSocket;
dispMsg.setPeerSocket(peerSocket);
@@ -211,15 +211,15 @@ ERROR :
ServerDispatcher::getInstance()->pushMessage(&dispMsg);
}
- SCARD_END();
+ _END();
return FALSE;
}
int ServerIPC::handleInvalidSocketCondition(void *channel, GIOCondition condition)
{
- SCARD_BEGIN();
- SCARD_END();
+ _BEGIN();
+ _END();
return FALSE;
}
@@ -228,12 +228,12 @@ ERROR :
{
int result = FALSE;
- SCARD_BEGIN();
+ _BEGIN();
if(channel == ioChannel)
{
/* connect state. should accept */
- SCARD_DEBUG("new client connected");
+ _DBG("new client connected");
result = acceptClient();
}
@@ -241,7 +241,7 @@ ERROR :
{
int peerSocket = g_io_channel_unix_get_fd((GIOChannel *)channel);
- SCARD_DEBUG("data incomming from [%d]", peerSocket);
+ _DBG("data incoming from [%d]", peerSocket);
if (peerSocket >= 0)
{
@@ -262,16 +262,16 @@ ERROR :
else
{
/* clear client connection */
- SCARD_DEBUG_ERR("retrieve message failed, socket [%d]", peerSocket);
+ _ERR("retrieve message failed, socket [%d]", peerSocket);
}
}
else
{
- SCARD_DEBUG_ERR("client context doesn't exist, socket [%d]", peerSocket);
+ _ERR("client context doesn't exist, socket [%d]", peerSocket);
}
}
- SCARD_END();
+ _END();
return result;
}
diff --git a/server/ServerReader.cpp b/server/ServerReader.cpp
index fa51f1a..8f0d614 100644
--- a/server/ServerReader.cpp
+++ b/server/ServerReader.cpp
@@ -39,7 +39,7 @@ namespace smartcard_service_api
if (seService == NULL || name == NULL || strlen(name) == 0 || terminal == NULL)
{
- SCARD_DEBUG_ERR("invalid param");
+ _ERR("invalid param");
return;
}
@@ -55,7 +55,7 @@ namespace smartcard_service_api
adminChannel = new ServerChannel(NULL, NULL, 0, terminal);
if (adminChannel == NULL)
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
@@ -102,7 +102,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
diff --git a/server/ServerResource.cpp b/server/ServerResource.cpp
index e55365a..e7db889 100644
--- a/server/ServerResource.cpp
+++ b/server/ServerResource.cpp
@@ -61,14 +61,14 @@ namespace smartcard_service_api
while (!result.second);
}
- SCARD_DEBUG("assign handle : newHandle [%d]", newHandle);
+ _DBG("assign handle : newHandle [%d]", newHandle);
return newHandle;
}
void IntegerHandle::releaseHandle(unsigned int handle)
{
- SCARD_DEBUG("will be released : Handle [%d]", handle);
+ _DBG("will be released : Handle [%d]", handle);
SCOPE_LOCK(mutexLock)
{
@@ -81,12 +81,12 @@ namespace smartcard_service_api
ServerResource::ServerResource()
: mainLoop(NULL), seLoaded(false)
{
- SCARD_BEGIN();
+ _BEGIN();
serverIPC = ServerIPC::getInstance();
serverDispatcher = ServerDispatcher::getInstance();
- SCARD_END();
+ _END();
}
ServerResource::~ServerResource()
@@ -114,12 +114,12 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
{
- SCARD_DEBUG_ERR("client already exist [%d]", socket);
+ _ERR("client already exist [%d]", socket);
}
return result;
@@ -167,7 +167,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("client removed already [%d]", socket);
+ _DBG("client removed already [%d]", socket);
}
}
@@ -196,13 +196,13 @@ namespace smartcard_service_api
{
if ((result = instance->createService(context)) == NULL)
{
- SCARD_DEBUG_ERR("ClientInstance::createService failed [%d] [%d]", socket, context);
+ _ERR("ClientInstance::createService failed [%d] [%d]", socket, context);
}
}
}
else
{
- SCARD_DEBUG_ERR("client doesn't exist [%d]", socket);
+ _ERR("client doesn't exist [%d]", socket);
}
return result;
@@ -219,7 +219,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("client doesn't exist [%d]", socket);
+ _ERR("client doesn't exist [%d]", socket);
}
return result;
@@ -235,7 +235,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("client doesn't exist [%d]", socket);
+ _ERR("client doesn't exist [%d]", socket);
}
}
@@ -249,7 +249,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("client doesn't exist [%d]", socket);
+ _ERR("client doesn't exist [%d]", socket);
}
}
@@ -264,7 +264,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Terminal doesn't exist [%d]", terminalID);
+ _ERR("Terminal doesn't exist [%d]", terminalID);
}
return result;
@@ -298,7 +298,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Terminal doesn't exist, reader ID [%d]", readerID);
+ _ERR("Terminal doesn't exist, reader ID [%d]", readerID);
}
return result;
@@ -336,7 +336,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
+ _ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
}
return result;
@@ -353,7 +353,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Session doesn't exist : socket [%d], context [%d], handle [%d]", socket, context, sessionID);
+ _ERR("Session doesn't exist : socket [%d], context [%d], handle [%d]", socket, context, sessionID);
}
return result;
@@ -370,7 +370,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
+ _ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
}
return result;
@@ -386,7 +386,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
+ _ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
}
}
@@ -405,7 +405,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("acList is null");
+ _ERR("acList is null");
result = false;
}
@@ -432,18 +432,18 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
if (0)
{
/* TODO : if there is no more channel, return error code */
- SCARD_DEBUG_ERR("no more logical channel");
+ _ERR("no more logical channel");
result = -2;
}
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", rv, response.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", rv, response.getLength());
}
return result;
@@ -465,17 +465,17 @@ namespace smartcard_service_api
if (resp.getStatus() == 0)
{
- SCARD_DEBUG("channel closed [%d]", channelNum);
+ _DBG("channel closed [%d]", channelNum);
result = 0;
}
else
{
- SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+ _ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
}
}
else
{
- SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", rv, response.getLength());
+ _ERR("select apdu is failed, rv [%d], length [%d]", rv, response.getLength());
}
return result;
@@ -494,11 +494,11 @@ namespace smartcard_service_api
channelNum = _openLogicalChannel(terminal);
if (channelNum > 0)
{
- SCARD_DEBUG("channelNum [%d]", channelNum);
+ _DBG("channelNum [%d]", channelNum);
}
else
{
- SCARD_DEBUG_ERR("_openLogicalChannel failed [%d]", channelNum);
+ _ERR("_openLogicalChannel failed [%d]", channelNum);
throw ExceptionBase(SCARD_ERROR_NOT_ENOUGH_RESOURCE);
}
}
@@ -507,7 +507,7 @@ namespace smartcard_service_api
result = service->openChannel(sessionID, channelNum, ByteArray::EMPTY);
if (result == IntegerHandle::INVALID_HANDLE)
{
- SCARD_DEBUG_ERR("channel is null.");
+ _ERR("channel is null.");
/* close logical channel */
if (channelNum > 0)
@@ -537,7 +537,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("select failed");
+ _ERR("select failed");
service->closeChannel(result);
throw ExceptionBase(SCARD_ERROR_IO_FAILED);
@@ -555,7 +555,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("select failed [%d]", rv);
+ _ERR("select failed [%d]", rv);
service->closeChannel(result);
throw ExceptionBase(SCARD_ERROR_IO_FAILED);
@@ -564,7 +564,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("unauthorized access");
+ _ERR("unauthorized access");
service->closeChannel(result);
throw ExceptionBase(SCARD_ERROR_SECURITY_NOT_ALLOWED);
@@ -593,24 +593,24 @@ namespace smartcard_service_api
result = _createChannel(terminal, service, channelType, sessionID, aid);
if (result == IntegerHandle::INVALID_HANDLE)
{
- SCARD_DEBUG_ERR("create channel failed [%d]", sessionID);
+ _ERR("create channel failed [%d]", sessionID);
}
}
else
{
- SCARD_DEBUG_ERR("session is invalid [%d]", sessionID);
+ _ERR("session is invalid [%d]", sessionID);
throw ExceptionBase(SCARD_ERROR_UNAVAILABLE);
}
}
else
{
- SCARD_DEBUG_ERR("session is invalid [%d]", sessionID);
+ _ERR("session is invalid [%d]", sessionID);
throw ExceptionBase(SCARD_ERROR_ILLEGAL_PARAM);
}
}
else
{
- SCARD_DEBUG_ERR("getService is failed [%d] [%d]", socket, context);
+ _ERR("getService is failed [%d] [%d]", socket, context);
throw ExceptionBase(SCARD_ERROR_UNAVAILABLE);
}
@@ -628,7 +628,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("Channel doesn't exist : socket [%d], context [%d], handle [%d]", socket, context, channelID);
+ _ERR("Channel doesn't exist : socket [%d], context [%d], handle [%d]", socket, context, channelID);
}
return result;
@@ -644,7 +644,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
+ _ERR("getService doesn't exist : socket [%d], context [%d]", socket, context);
}
}
@@ -663,7 +663,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
@@ -689,7 +689,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
}
else
@@ -712,16 +712,16 @@ namespace smartcard_service_api
terminal = (Terminal *)createInstance();
if (terminal != NULL)
{
- SCARD_DEBUG("terminal [%p]", terminal);
+ _DBG("terminal [%p]", terminal);
}
else
{
- SCARD_DEBUG_ERR("terminal is null");
+ _ERR("terminal is null");
}
}
else
{
- SCARD_DEBUG_ERR("create_instance is null [%d]", errno);
+ _ERR("create_instance is null [%d]", errno);
}
return terminal;
@@ -747,7 +747,7 @@ namespace smartcard_service_api
terminal->setStatusCallback(&ServerResource::terminalCallback);
- SCARD_DEBUG("register success [%s] [%p] [%s] [%p]", library, libHandle, terminal->getName(), terminal);
+ _DBG("register success [%s] [%p] [%s] [%p]", library, libHandle, terminal->getName(), terminal);
if (terminal->isSecureElementPresence() == true)
{
@@ -758,14 +758,14 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("terminal is null [%s]", library);
+ _ERR("terminal is null [%s]", library);
dlclose(libHandle);
}
}
else
{
- SCARD_DEBUG_ERR("it is not se file [%s] [%d]", library, errno);
+ _ERR("it is not se file [%s] [%d]", library, errno);
}
return result;
@@ -917,13 +917,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
result = -1;
}
}
else
{
- SCARD_DEBUG("no secure element");
+ _DBG("no secure element");
}
return result;
@@ -945,7 +945,7 @@ namespace smartcard_service_api
void ServerResource::terminalCallback(void *terminal, int event, int error, void *user_param)
{
- SCARD_DEBUG("terminal [%s], event [%d], error [%d], user_param [%p]", (char *)terminal, event, error, user_param);
+ _DBG("terminal [%s], event [%d], error [%d], user_param [%p]", (char *)terminal, event, error, user_param);
switch (event)
{
@@ -955,7 +955,7 @@ namespace smartcard_service_api
unsigned int terminalID = IntegerHandle::INVALID_HANDLE;
Message msg;
- SCARD_DEBUG("[NOTIFY_SE_AVAILABLE]");
+ _DBG("[NOTIFY_SE_AVAILABLE]");
terminalID = instance.getTerminalID((char *)terminal);
if (terminalID != IntegerHandle::INVALID_HANDLE)
@@ -976,7 +976,7 @@ namespace smartcard_service_api
unsigned int readerID = IntegerHandle::INVALID_HANDLE;
Message msg;
- SCARD_DEBUG("[NOTIFY_SE_NOT_AVAILABLE]");
+ _DBG("[NOTIFY_SE_NOT_AVAILABLE]");
readerID = instance.getReaderID((char *)terminal);
@@ -991,7 +991,7 @@ namespace smartcard_service_api
break;
default :
- SCARD_DEBUG("terminal [%s], event [%d], error [%d], user_param [%p]", (char *)terminal, event, error, user_param);
+ _DBG("terminal [%s], event [%d], error [%d], user_param [%p]", (char *)terminal, event, error, user_param);
break;
}
}
diff --git a/server/ServerSEService.cpp b/server/ServerSEService.cpp
index 9df5b29..cb2465a 100644
--- a/server/ServerSEService.cpp
+++ b/server/ServerSEService.cpp
@@ -62,16 +62,16 @@ namespace smartcard_service_api
terminal = (Terminal *)createInstance();
if (terminal != NULL)
{
- SCARD_DEBUG("terminal [%p]", terminal);
+ _DBG("terminal [%p]", terminal);
}
else
{
- SCARD_DEBUG_ERR("terminal is null");
+ _ERR("terminal is null");
}
}
else
{
- SCARD_DEBUG_ERR("create_instance is null [%d]", errno);
+ _ERR("create_instance is null [%d]", errno);
}
return terminal;
@@ -90,7 +90,7 @@ namespace smartcard_service_api
terminal = createInstance(libHandle);
if (terminal != NULL)
{
- SCARD_DEBUG("SE info : [%s] [%s]", library, terminal->getName());
+ _DBG("SE info : [%s] [%s]", library, terminal->getName());
libraries.push_back(libHandle);
@@ -102,33 +102,33 @@ namespace smartcard_service_api
ServerReader *reader = new ServerReader(this, terminal->getName(), terminal);
if (reader != NULL)
{
- SCARD_DEBUG("register success [%s]", terminal->getName());
+ _DBG("register success [%s]", terminal->getName());
readers.push_back(reader);
}
else
{
- SCARD_DEBUG_ERR("ServerReader alloc failed [%s]", terminal->getName());
+ _ERR("ServerReader alloc failed [%s]", terminal->getName());
/* throw exception */
}
}
else
{
- SCARD_DEBUG("SE is not ready [%s]", terminal->getName());
+ _DBG("SE is not ready [%s]", terminal->getName());
}
result = true;
}
else
{
- SCARD_DEBUG_ERR("createInstance failed [%s]", library);
+ _ERR("createInstance failed [%s]", library);
dlclose(libHandle);
}
}
else
{
- SCARD_DEBUG_ERR("it is not se file [%s] [%d]", library, errno);
+ _ERR("it is not se file [%s] [%d]", library, errno);
}
return result;
@@ -197,7 +197,7 @@ namespace smartcard_service_api
if (resource.createService(socket, msg->error) != NULL)
{
- SCARD_DEBUG_ERR("client added : pid [%d]", msg->error);
+ _ERR("client added : pid [%d]", msg->error);
response.error = SCARD_ERROR_OK;
@@ -208,13 +208,13 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG("no secure elements");
+ _DBG("no secure elements");
response.param1 = 0;
}
}
else
{
- SCARD_DEBUG_ERR("createClient failed");
+ _ERR("createClient failed");
response.error = SCARD_ERROR_OUT_OF_MEMORY;
}
diff --git a/server/ServerSession.cpp b/server/ServerSession.cpp
index 0b8fcb9..7dc80fc 100644
--- a/server/ServerSession.cpp
+++ b/server/ServerSession.cpp
@@ -37,7 +37,7 @@ namespace smartcard_service_api
if (caller == NULL || terminal == NULL)
{
- SCARD_DEBUG_ERR("invalid param");
+ _ERR("invalid param");
return;
}
diff --git a/server/ServiceInstance.cpp b/server/ServiceInstance.cpp
index 94979dd..a324dd5 100644
--- a/server/ServiceInstance.cpp
+++ b/server/ServiceInstance.cpp
@@ -114,7 +114,7 @@ namespace smartcard_service_api
}
else
{
- SCARD_DEBUG_ERR("alloc failed");
+ _ERR("alloc failed");
}
return handle;
diff --git a/server/smartcard-daemon.cpp b/server/smartcard-daemon.cpp
index 4309bab..c416fba 100644
--- a/server/smartcard-daemon.cpp
+++ b/server/smartcard-daemon.cpp
@@ -114,26 +114,26 @@ G_STMT_END
GQuark smartcard_service_error_quark(void)
{
- SCARD_DEBUG("smartcard_service_error_quark entered");
+ _DBG("smartcard_service_error_quark entered");
return g_quark_from_static_string("smartcard_service_error");
}
static void smartcard_service_init(Smartcard_Service *smartcard_service)
{
- SCARD_DEBUG("smartcard_service_init entered");
+ _DBG("smartcard_service_init entered");
}
static void smartcard_service_class_init(Smartcard_ServiceClass *smartcard_service_class)
{
- SCARD_DEBUG("smartcard_service_class_init entered");
+ _DBG("smartcard_service_class_init entered");
dbus_g_object_type_install_info(SMARTCARD_SERVICE_TYPE, &dbus_glib_smartcard_service_object_info);
}
gboolean smartcard_service_launch(Smartcard_Service *smartcard_service, guint *result_val, GError **error)
{
- SCARD_DEBUG("smartcard_service_launch entered");
+ _DBG("smartcard_service_launch entered");
return TRUE;
}
@@ -144,7 +144,7 @@ static void _initialize_dbus()
DBusGProxy *proxy = NULL;
guint ret = 0;
- SCARD_BEGIN();
+ _BEGIN();
g_type_init();
@@ -160,7 +160,7 @@ static void _initialize_dbus()
{
if (!org_freedesktop_DBus_request_name(proxy, SMARTCARD_SERVICE_NAME, 0, &ret, &error))
{
- SCARD_DEBUG_ERR("Unable to register service: %s", error->message);
+ _ERR("Unable to register service: %s", error->message);
g_error_free(error);
}
@@ -168,32 +168,32 @@ static void _initialize_dbus()
}
else
{
- SCARD_DEBUG_ERR("dbus_g_proxy_new_for_name failed");
+ _ERR("dbus_g_proxy_new_for_name failed");
}
}
else
{
- SCARD_DEBUG_ERR("ERROR: Can't get on system bus [%s]", error->message);
+ _ERR("ERROR: Can't get on system bus [%s]", error->message);
g_error_free(error);
}
- SCARD_END();
+ _END();
}
static void _finalize_dbus()
{
- SCARD_BEGIN();
+ _BEGIN();
dbus_g_connection_unregister_g_object(connection, object);
g_object_unref(object);
- SCARD_END();
+ _END();
}
#endif
static void __sighandler(int sig)
{
- SCARD_DEBUG("signal!! [%d]", sig);
+ _DBG("signal!! [%d]", sig);
#ifdef USE_AUTOSTART
_finalize_dbus();
diff --git a/test-client/test-client-sync.cpp b/test-client/test-client-sync.cpp
index 69bb32e..91b617f 100644
--- a/test-client/test-client-sync.cpp
+++ b/test-client/test-client-sync.cpp
@@ -51,27 +51,27 @@ class TestEventHandler : public SEServiceListener
{
void serviceConnected(SEServiceHelper *service, void *userData)
{
- SCARD_BEGIN();
+ _BEGIN();
testConnectedCallback(service, userData);
- SCARD_END();
+ _END();
}
void eventHandler(SEServiceHelper *service, char *seName, int event, void *userData)
{
- SCARD_BEGIN();
+ _BEGIN();
- SCARD_DEBUG("event occured service [%p], seName[%p], event [%d]", service, seName, event);
+ _DBG("event occured service [%p], seName[%p], event [%d]", service, seName, event);
- SCARD_END();
+ _END();
}
void errorHandler(SEServiceHelper *service, int error, void *userData)
{
- SCARD_BEGIN();
+ _BEGIN();
- SCARD_DEBUG("error occured service [%p], error [%d]", service, error);
+ _DBG("error occured service [%p], error [%d]", service, error);
- SCARD_END();
+ _END();
}
};
@@ -82,11 +82,11 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
vector<ReaderHelper *> readers;
user_context_t *context = (user_context_t *)userData;
- SCARD_BEGIN();
+ _BEGIN();
if (service != NULL)
{
- SCARD_DEBUG("callback called, service [%p]", service);
+ _DBG("callback called, service [%p]", service);
context->clientService = service;
@@ -98,16 +98,16 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
reader = (Reader *)readers[0];
- SCARD_DEBUG("reader [%p]", reader);
+ _DBG("reader [%p]", reader);
Session *session = (Session *)reader->openSessionSync();
if (session != NULL)
{
- SCARD_DEBUG("session [%p]", session);
+ _DBG("session [%p]", session);
ByteArray temp;
temp = session->getATRSync();
- SCARD_DEBUG("atr[%d] : %s", temp.getLength(), temp.toString());
+ _DBG("atr[%d] : %s", temp.getLength(), temp.toString());
unsigned char MF[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 };
ByteArray aid;
@@ -116,52 +116,52 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
ClientChannel *channel = (ClientChannel *)session->openLogicalChannelSync(aid);
if (channel != NULL)
{
- SCARD_DEBUG("channel [%p]", channel);
+ _DBG("channel [%p]", channel);
ByteArray response;
ByteArray data, command;
int fid = 0x00003150;
response = channel->getSelectResponse();
- SCARD_DEBUG("response : %s", response.toString());
+ _DBG("response : %s", response.toString());
- SCARD_DEBUG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical");
- SCARD_DEBUG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened");
+ _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical");
+ _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened");
data.setBuffer((unsigned char *)&fid, 2);
command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, data);
int error = channel->transmitSync(command, response);
- SCARD_DEBUG("error : %d, response : %s", error, response.toString());
+ _DBG("error : %d, response : %s", error, response.toString());
channel->closeSync();
}
else
{
- SCARD_DEBUG_ERR("openLogicalChannelSync failed");
+ _ERR("openLogicalChannelSync failed");
}
session->closeSync();
}
else
{
- SCARD_DEBUG_ERR("openSessionSync failed");
+ _ERR("openSessionSync failed");
}
service->shutdown();
}
else
{
- SCARD_DEBUG_ERR("reader is empty");
+ _ERR("reader is empty");
}
}
else
{
- SCARD_DEBUG_ERR("service is NULL");
+ _ERR("service is NULL");
}
g_main_loop_quit(loop);
- SCARD_END();
+ _END();
}
int main(int argv, char *args[])
diff --git a/test-client/test-client.cpp b/test-client/test-client.cpp
index d55d0fe..9b865a5 100644
--- a/test-client/test-client.cpp
+++ b/test-client/test-client.cpp
@@ -50,9 +50,9 @@ class TestEventHandler : public SEServiceListener
{
void serviceConnected(SEServiceHelper *service, void *userData)
{
- SCARD_BEGIN();
+ _BEGIN();
testConnectedCallback(service, userData);
- SCARD_END();
+ _END();
}
void eventHandler(SEServiceHelper *service, char *seName, int event, void *userData)
@@ -61,15 +61,15 @@ class TestEventHandler : public SEServiceListener
vector<ReaderHelper *> readers;
size_t i;
- SCARD_BEGIN();
+ _BEGIN();
- SCARD_DEBUG("event occured service [%p], seName[%s], event [%d], userData [%p]", service, seName, event, userData);
+ _DBG("event occured service [%p], seName[%s], event [%d], userData [%p]", service, seName, event, userData);
readers = service->getReaders();
for (i = 0; i < readers.size(); i++)
{
- SCARD_DEBUG("Reader[%d] : name [%s], %s", i, readers[i]->getName(), readers[i]->isSecureElementPresent() ? "available" : "unavailable");
+ _DBG("Reader[%d] : name [%s], %s", i, readers[i]->getName(), readers[i]->isSecureElementPresent() ? "available" : "unavailable");
}
if (event == 1)
@@ -77,16 +77,16 @@ class TestEventHandler : public SEServiceListener
testConnectedCallback(service, userData);
}
- SCARD_END();
+ _END();
}
void errorHandler(SEServiceHelper *service, int error, void *userData)
{
- SCARD_BEGIN();
+ _BEGIN();
- SCARD_DEBUG("error occured service [%p], error [%d]", service, error);
+ _DBG("error occured service [%p], error [%d]", service, error);
- SCARD_END();
+ _END();
}
};
@@ -96,7 +96,7 @@ void testCloseCallback(int error, void *userData)
{
user_context_t *context = (user_context_t *)userData;
- SCARD_DEBUG("result [%d], userData [%p]", error, userData);
+ _DBG("result [%d], userData [%p]", error, userData);
context->clientService->shutdown();
}
@@ -106,14 +106,14 @@ void testTransmitCallback(unsigned char *buffer, unsigned int length, int error,
ByteArray response(buffer, length);
user_context_t *context = (user_context_t *)userData;
- SCARD_DEBUG("buffer [%p], length [%d], error [%d], userData [%p]", buffer, length, error, userData);
+ _DBG("buffer [%p], length [%d], error [%d], userData [%p]", buffer, length, error, userData);
context->clientChannel->close(testCloseCallback, userData);
}
void testOpenChannelCallback(Channel *channel, int error, void *userData)
{
- SCARD_DEBUG("channel [%p]", channel);
+ _DBG("channel [%p]", channel);
if (error == 0 && channel != NULL)
{
@@ -126,10 +126,10 @@ void testOpenChannelCallback(Channel *channel, int error, void *userData)
response = channel->getSelectResponse();
- SCARD_DEBUG("response : %s", response.toString());
+ _DBG("response : %s", response.toString());
- SCARD_DEBUG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical");
- SCARD_DEBUG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened");
+ _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical");
+ _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened");
data.setBuffer((unsigned char *)&fid, 2);
command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, data);
@@ -137,7 +137,7 @@ void testOpenChannelCallback(Channel *channel, int error, void *userData)
}
else
{
- SCARD_DEBUG_ERR("openBasicChannel failed");
+ _ERR("openBasicChannel failed");
}
}
@@ -148,7 +148,7 @@ void testGetATRCallback(unsigned char *atr, unsigned int length, int error, void
ByteArray aid, result(atr, length);
user_context_t *context = (user_context_t *)userData;
- SCARD_DEBUG("atr[%d] : %s", result.getLength(), result.toString());
+ _DBG("atr[%d] : %s", result.getLength(), result.toString());
aid.setBuffer(MF, sizeof(MF));
context->clientSession->openLogicalChannel(aid, testOpenChannelCallback, userData);
@@ -161,7 +161,7 @@ void testCloseSessionCallback(int error, void *userData)
void testOpenSessionCallback(SessionHelper *session, int error, void *userData)
{
- SCARD_DEBUG("session [%p]", session);
+ _DBG("session [%p]", session);
if (session != NULL)
{
@@ -172,7 +172,7 @@ void testOpenSessionCallback(SessionHelper *session, int error, void *userData)
}
else
{
- SCARD_DEBUG_ERR("openSession failed");
+ _ERR("openSession failed");
}
}
@@ -181,11 +181,11 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
vector<ReaderHelper *> readers;
user_context_t *context = (user_context_t *)userData;
- SCARD_BEGIN();
+ _BEGIN();
if (service != NULL)
{
- SCARD_DEBUG("callback called, service [%p]", service);
+ _DBG("callback called, service [%p]", service);
context->clientService = service;
@@ -197,21 +197,21 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
reader = (Reader *)readers[0];
- SCARD_DEBUG("reader [%p]", reader);
+ _DBG("reader [%p]", reader);
reader->openSession(testOpenSessionCallback, userData);
}
else
{
- SCARD_DEBUG_ERR("reader is empty");
+ _ERR("reader is empty");
}
}
else
{
- SCARD_DEBUG_ERR("service is NULL");
+ _ERR("service is NULL");
}
- SCARD_END();
+ _END();
}
int main(int argv, char *args[])
@@ -224,7 +224,7 @@ int main(int argv, char *args[])
}
catch (...)
{
- SCARD_DEBUG_ERR("exception raised!!!");
+ _ERR("exception raised!!!");
}
if (service != NULL)