From: Wonkyu Kwon Date: Wed, 24 Jul 2013 08:25:17 +0000 (+0900) Subject: Adjust logging level X-Git-Tag: accepted/tizen/20130912.185847^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=213967a15edd52063d98130036624dfb2eb4960a;p=platform%2Fcore%2Fconnectivity%2Fsmartcard-service.git Adjust logging level - change logging level - correct spelling Change-Id: I01bebf873e9601f196759da8efd11dd681b7dd60 --- diff --git a/client/ClientChannel.cpp b/client/ClientChannel.cpp index 14f1412..f7bc165 100644 --- a/client/ClientChannel.cpp +++ b/client/ClientChannel.cpp @@ -86,7 +86,7 @@ namespace smartcard_service_api rv = waitTimedCondition(0); if (rv < 0) { - _ERR("closeSync failed [%d]", rv); + _ERR("timeout [%d]", rv); this->error = SCARD_ERROR_OPERATION_TIMEOUT; } } @@ -106,8 +106,7 @@ namespace smartcard_service_api } else { - /* FIXME */ - _DBG("unavailable channel"); + _INFO("unavailable channel"); } } #endif @@ -134,6 +133,7 @@ namespace smartcard_service_api if (ClientIPC::getInstance().sendMessage(&msg) == false) { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -173,13 +173,11 @@ namespace smartcard_service_api if (rv >= 0) { result = response; - rv = SCARD_ERROR_OK; } else { - _ERR("timeout"); - + _ERR("timeout [%d]", rv); this->error = SCARD_ERROR_OPERATION_TIMEOUT; } } @@ -228,6 +226,7 @@ namespace smartcard_service_api } else { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -259,7 +258,7 @@ namespace smartcard_service_api case Message::MSG_REQUEST_TRANSMIT : { /* transmit result */ - _DBG("MSG_REQUEST_TRANSMIT"); + _INFO("MSG_REQUEST_TRANSMIT"); if (msg->error == 0 && ResponseHelper::getStatus(msg->data) == 0) @@ -293,7 +292,7 @@ namespace smartcard_service_api case Message::MSG_REQUEST_CLOSE_CHANNEL : { - _DBG("MSG_REQUEST_CLOSE_CHANNEL"); + _INFO("MSG_REQUEST_CLOSE_CHANNEL"); if (msg->isSynchronousCall() == true) /* synchronized call */ { diff --git a/client/Reader.cpp b/client/Reader.cpp index e687dd8..4d46906 100644 --- a/client/Reader.cpp +++ b/client/Reader.cpp @@ -200,7 +200,7 @@ namespace smartcard_service_api { Session *session = NULL; - _DBG("MSG_REQUEST_OPEN_SESSION"); + _INFO("MSG_REQUEST_OPEN_SESSION"); if (msg->param1 != 0) { diff --git a/client/SEService.cpp b/client/SEService.cpp index 6ec2551..903320c 100644 --- a/client/SEService.cpp +++ b/client/SEService.cpp @@ -151,7 +151,6 @@ namespace smartcard_service_api int rv; rv = waitTimedCondition(0); - if (rv == 0) { ClientDispatcher::getInstance().removeSEService(context); @@ -309,7 +308,7 @@ namespace smartcard_service_api switch (msg->message) { case Message::MSG_REQUEST_READERS : - _DBG("[MSG_REQUEST_READERS]"); + _INFO("[MSG_REQUEST_READERS]"); service->connected = true; @@ -328,7 +327,7 @@ namespace smartcard_service_api break; case Message::MSG_REQUEST_SHUTDOWN : - _DBG("[MSG_REQUEST_SHUTDOWN]"); + _INFO("[MSG_REQUEST_SHUTDOWN]"); if (msg->isSynchronousCall() == true) /* synchronized call */ { @@ -350,7 +349,7 @@ namespace smartcard_service_api { Reader *reader = NULL; - _DBG("[MSG_NOTIFY_SE_INSERTED]"); + _INFO("[MSG_NOTIFY_SE_INSERTED]"); /* add readers */ reader = new Reader(service->context, @@ -380,7 +379,7 @@ namespace smartcard_service_api { size_t i; - _DBG("[MSG_NOTIFY_SE_REMOVED]"); + _INFO("[MSG_NOTIFY_SE_REMOVED]"); for (i = 0; i < service->readers.size(); i++) { @@ -404,7 +403,7 @@ namespace smartcard_service_api break; case Message::MSG_OPERATION_RELEASE_CLIENT : - _DBG("[MSG_OPERATION_RELEASE_CLIENT]"); + _INFO("[MSG_OPERATION_RELEASE_CLIENT]"); if (service->listener != NULL) { diff --git a/client/Session.cpp b/client/Session.cpp index 924f959..8fa7b4c 100644 --- a/client/Session.cpp +++ b/client/Session.cpp @@ -156,6 +156,7 @@ namespace smartcard_service_api } else { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -242,6 +243,7 @@ namespace smartcard_service_api if (ClientIPC::getInstance().sendMessage(&msg) == false) { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -323,6 +325,7 @@ namespace smartcard_service_api } else { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -411,6 +414,7 @@ namespace smartcard_service_api } else { + _ERR("sendMessage failed"); result = SCARD_ERROR_IPC_FAILED; } } @@ -489,7 +493,7 @@ namespace smartcard_service_api { Channel *channel = NULL; - _DBG("MSG_REQUEST_OPEN_CHANNEL"); + _INFO("MSG_REQUEST_OPEN_CHANNEL"); if (msg->param1 != 0) { @@ -532,7 +536,7 @@ namespace smartcard_service_api case Message::MSG_REQUEST_GET_ATR : { - _DBG("MSG_REQUEST_GET_ATR"); + _INFO("MSG_REQUEST_GET_ATR"); if (msg->isSynchronousCall() == true) /* synchronized call */ { @@ -557,7 +561,7 @@ namespace smartcard_service_api case Message::MSG_REQUEST_CLOSE_SESSION : { - _DBG("MSG_REQUEST_CLOSE_SESSION"); + _INFO("MSG_REQUEST_CLOSE_SESSION"); if (msg->isSynchronousCall() == true) /* synchronized call */ { @@ -581,7 +585,7 @@ namespace smartcard_service_api case Message::MSG_REQUEST_GET_CHANNEL_COUNT : { - _DBG("MSG_REQUEST_GET_CHANNEL_COUNT"); + _INFO("MSG_REQUEST_GET_CHANNEL_COUNT"); if (msg->isSynchronousCall() == true) /* synchronized call */ { diff --git a/common/AccessCondition.cpp b/common/AccessCondition.cpp index d45c553..964b4cf 100644 --- a/common/AccessCondition.cpp +++ b/common/AccessCondition.cpp @@ -196,7 +196,7 @@ namespace smartcard_service_api } else { - _DBG("access granted for all applications, aid : %s", aid.toString()); + _INFO("access granted for all applications, aid : %s", aid.toString()); permission = true; break; @@ -205,7 +205,7 @@ namespace smartcard_service_api } else { - _DBG("access denied for all applications, aid : %s", aid.toString()); + _INFO("access denied for all applications, aid : %s", aid.toString()); permission = false; } diff --git a/common/FCI.cpp b/common/FCI.cpp index dd03a32..6be4bc0 100644 --- a/common/FCI.cpp +++ b/common/FCI.cpp @@ -90,9 +90,9 @@ namespace smartcard_service_api { switch (tlv.getTag()) { - case 0x80 : /* file length without sturctural inforamtion */ + case 0x80 : /* file length without structural information */ { - _DBG("0x%02X : file length without sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString()); + _DBG("0x%02X : file length without structural information : %s", tlv.getTag(), tlv.getValue().toString()); if (tlv.getLength() > 0) { fileSize = NumberStream::getBigEndianNumber(tlv.getValue()); @@ -100,9 +100,9 @@ namespace smartcard_service_api } break; - case 0x81 : /* file length with sturctural inforamtion */ + case 0x81 : /* file length with structural information */ { - _DBG("0x%02X : file length with sturctural inforamtion : %s", tlv.getTag(), tlv.getValue().toString()); + _DBG("0x%02X : file length with structural information : %s", tlv.getTag(), tlv.getValue().toString()); if (tlv.getLength() > 0) { maxRecordSize = NumberStream::getBigEndianNumber(tlv.getValue()); diff --git a/common/IPCHelper.cpp b/common/IPCHelper.cpp index 8f296b1..46b51e0 100644 --- a/common/IPCHelper.cpp +++ b/common/IPCHelper.cpp @@ -39,7 +39,7 @@ #include "IPCHelper.h" #ifdef USE_UNIX_DOMAIN -#define SCARD_SERVER_DOMAIN "/tmp/omapi-server-domain" +#define SCARD_SERVER_DOMAIN "/tmp/smartcard-server-domain" #endif /* USE_UNIX_DOMAIN */ static void setNonBlockSocket(int socket) @@ -128,7 +128,7 @@ namespace smartcard_service_api if (bind(ipcSocket, (struct sockaddr *)&saddrun_rv, sizeof(saddrun_rv)) < 0) { - _ERR("bind is failed \n"); + _ERR("bind is failed"); goto ERROR; } @@ -140,7 +140,7 @@ namespace smartcard_service_api if (listen(ipcSocket, IPC_SERVER_MAX_CLIENT) < 0) { - _ERR("listen is failed \n"); + _ERR("listen is failed"); goto ERROR; } @@ -148,13 +148,13 @@ namespace smartcard_service_api { if ((watchId = g_io_add_watch(ioChannel, condition, &IPCHelper::channelCallbackFunc, this)) < 1) { - _ERR(" g_io_add_watch is failed \n"); + _ERR(" g_io_add_watch is failed"); goto ERROR; } } else { - _ERR(" g_io_channel_unix_new is failed \n"); + _ERR(" g_io_channel_unix_new is failed"); goto ERROR; } @@ -178,7 +178,7 @@ namespace smartcard_service_api } #endif - _DBG("server ipc is initialized"); + _INFO("server ipc is initialized"); return true; ERROR : @@ -312,7 +312,7 @@ ERROR : } } - _DBG("threadRead is terminated"); + _INFO("threadRead is terminated"); return (void *)NULL; } @@ -421,7 +421,7 @@ ERROR : #endif pthread_mutex_unlock(&ipcLock); - _DBG("connecting success"); + _INFO("connecting success"); _END(); diff --git a/common/ISO7816BERTLV.cpp b/common/ISO7816BERTLV.cpp index 425376a..eb0719d 100644 --- a/common/ISO7816BERTLV.cpp +++ b/common/ISO7816BERTLV.cpp @@ -110,7 +110,7 @@ namespace smartcard_service_api if (count > 4) return -1; - count++; /* increse count and increase i value, too */ + count++; for (i = 1; i < count; i++) { diff --git a/common/PKCS15DODF.cpp b/common/PKCS15DODF.cpp index 6e9d9cf..12fad2f 100644 --- a/common/PKCS15DODF.cpp +++ b/common/PKCS15DODF.cpp @@ -114,7 +114,7 @@ namespace smartcard_service_api } } - _DBG("dataList.size() = %d", mapOID.size()); + _INFO("dataList.size() = %d", mapOID.size()); return result; } diff --git a/common/PKCS15ODF.cpp b/common/PKCS15ODF.cpp index ba795e5..362634d 100644 --- a/common/PKCS15ODF.cpp +++ b/common/PKCS15ODF.cpp @@ -128,7 +128,7 @@ namespace smartcard_service_api } - _DBG("dataList.size() = %d", dataList.size()); + _INFO("dataList.size() = %d", dataList.size()); return result; } diff --git a/common/SignatureHelper.cpp b/common/SignatureHelper.cpp index 183a46d..6619975 100644 --- a/common/SignatureHelper.cpp +++ b/common/SignatureHelper.cpp @@ -250,7 +250,7 @@ certiHash *__signature_helper_vector_to_linked_list(vector &certHashe return head; ERROR : - _ERR("mem alloc fail"); + _ERR("alloc fail"); while (head) { diff --git a/common/TLVHelper.cpp b/common/TLVHelper.cpp index d50c811..8d8f08b 100644 --- a/common/TLVHelper.cpp +++ b/common/TLVHelper.cpp @@ -162,8 +162,6 @@ namespace smartcard_service_api { bool result = true; -// _DBG("current [%p], parent [%p]", currentTLV, currentTLV->getParentTLV()); - if (currentTLV->getParentTLV() != NULL) { currentTLV = currentTLV->getParentTLV(); diff --git a/server/ClientInstance.cpp b/server/ClientInstance.cpp index 7eecf39..f33cbc7 100644 --- a/server/ClientInstance.cpp +++ b/server/ClientInstance.cpp @@ -27,20 +27,9 @@ namespace smartcard_service_api { - gboolean ClientInstance::_getCertificationHashes(gpointer user_data) - { - gboolean result = false; - ClientInstance *instance = (ClientInstance *)user_data; - - SignatureHelper::getCertificationHashes(instance->getPID(), instance->certHashes); - - return result; - } - void ClientInstance::setPID(int pid) { this->pid = pid; - } ServiceInstance *ClientInstance::createService(unsigned int context) @@ -119,6 +108,6 @@ namespace smartcard_service_api void ClientInstance::generateCertificationHashes() { - g_idle_add(_getCertificationHashes, (gpointer)this); + SignatureHelper::getCertificationHashes(getPID(), certHashes); } } /* namespace smartcard_service_api */ diff --git a/server/ServerChannel.cpp b/server/ServerChannel.cpp index ed923ae..17d7355 100644 --- a/server/ServerChannel.cpp +++ b/server/ServerChannel.cpp @@ -104,7 +104,6 @@ namespace smartcard_service_api /* TODO : insert channel ID using atr information */ helper.setChannel(APDUCommand::CLA_CHANNEL_STANDARD, channelNum); - helper.getBuffer(command); _DBG("command [%d] : %s", command.getLength(), command.toString()); diff --git a/server/ServerDispatcher.cpp b/server/ServerDispatcher.cpp index 05c13d0..39192f1 100644 --- a/server/ServerDispatcher.cpp +++ b/server/ServerDispatcher.cpp @@ -77,7 +77,7 @@ namespace smartcard_service_api /* handle message */ case Message::MSG_REQUEST_READERS : { - SCARD_DEBUG("[MSG_REQUEST_READERS]"); + _INFO("[MSG_REQUEST_READERS]"); int count = 0; Message response(*msg); @@ -96,7 +96,7 @@ namespace smartcard_service_api if (instance->getPID() == -1) { instance->setPID(msg->error); - _ERR("update PID [%d]", msg->error); + _INFO("update PID [%d]", msg->error); /* generate certification hashes */ instance->generateCertificationHashes(); @@ -114,7 +114,7 @@ namespace smartcard_service_api } else { - _DBG("no secure elements"); + _INFO("no secure elements"); } } else @@ -126,7 +126,7 @@ namespace smartcard_service_api } else { - _DBG("client doesn't exist, socket [%d]", socket); + _ERR("client doesn't exist, socket [%d]", socket); response.error = SCARD_ERROR_UNAVAILABLE; } @@ -140,7 +140,7 @@ namespace smartcard_service_api { Message response(*msg); - _DBG("[MSG_REQUEST_SHUTDOWN]"); + _INFO("[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; - _DBG("[MSG_REQUEST_OPEN_SESSION]"); + _INFO("[MSG_REQUEST_OPEN_SESSION]"); if (resource->isValidReaderHandle(msg->param1)) { @@ -190,7 +190,7 @@ namespace smartcard_service_api { Message response(*msg); - _DBG("[MSG_REQUEST_CLOSE_SESSION]"); + _INFO("[MSG_REQUEST_CLOSE_SESSION]"); response.param1 = 0; response.error = SCARD_ERROR_OK; @@ -209,7 +209,7 @@ namespace smartcard_service_api { Message response(*msg); - _DBG("[MSG_REQUEST_OPEN_CHANNEL]"); + _INFO("[MSG_REQUEST_OPEN_CHANNEL]"); response.param1 = IntegerHandle::INVALID_HANDLE; response.param2 = 0; @@ -260,7 +260,7 @@ namespace smartcard_service_api { Message response(*msg); - _DBG("[MSG_REQUEST_GET_CHANNEL_COUNT]"); + _INFO("[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); - _DBG("[MSG_REQUEST_CLOSE_CHANNEL]"); + _INFO("[MSG_REQUEST_CLOSE_CHANNEL]"); response.error = SCARD_ERROR_OK; @@ -295,7 +295,7 @@ namespace smartcard_service_api ByteArray result; ServiceInstance *client = NULL; - _DBG("[MSG_REQUEST_GET_ATR]"); + _INFO("[MSG_REQUEST_GET_ATR]"); if ((client = resource->getService(socket, msg->error/* service context */)) != NULL) { @@ -339,7 +339,7 @@ namespace smartcard_service_api ByteArray result; Channel *channel = NULL; - _DBG("[MSG_REQUEST_TRANSMIT]"); + _INFO("[MSG_REQUEST_TRANSMIT]"); if ((channel = resource->getChannel(socket, msg->error/* service context */, msg->param1)) != NULL) { @@ -368,22 +368,22 @@ namespace smartcard_service_api case Message::MSG_OPERATION_RELEASE_CLIENT : { - SCARD_DEBUG("[MSG_OPERATION_RELEASE_CLIENT]"); + _INFO("[MSG_OPERATION_RELEASE_CLIENT]"); resource->removeClient(msg->param1); - SCARD_DEBUG("remain client [%d]", resource->getClientCount()); + _DBG("remain client [%d]", resource->getClientCount()); } #ifdef USE_AUTOSTART if (resource->getClientCount() == 0) { - SCARD_DEBUG("There is no client. shutting down service"); + _DBG("There is no client. shutting down service"); g_main_loop_quit((GMainLoop *)resource->getMainLoopInstance()); } #endif break; default : - SCARD_DEBUG("unknown message [%s], socket [%d]", msg->toString(), socket); + _DBG("unknown message [%s], socket [%d]", msg->toString(), socket); break; } diff --git a/server/ServerIPC.cpp b/server/ServerIPC.cpp index 6d8ceae..d462b06 100644 --- a/server/ServerIPC.cpp +++ b/server/ServerIPC.cpp @@ -136,7 +136,7 @@ namespace smartcard_service_api goto ERROR; } - _DBG("client socket is bond with g_io_channel"); + _INFO("client socket is bond with g_io_channel"); if (ServerResource::getInstance().createClient(client_channel, client_sock_fd, client_src_id, 0, -1) == false) { @@ -192,7 +192,7 @@ ERROR : if(channel == ioChannel) { - _DBG("server socket is closed"); + _INFO("server socket is closed"); restartServerIPC(); } else @@ -200,7 +200,7 @@ ERROR : DispatcherMsg dispMsg; int peerSocket = g_io_channel_unix_get_fd((GIOChannel *)channel); - _DBG("client socket is closed, socket [%d]", peerSocket); + _INFO("client socket is closed, socket [%d]", peerSocket); /* push message to dispatcher */ dispMsg.message = Message::MSG_OPERATION_RELEASE_CLIENT; @@ -233,7 +233,7 @@ ERROR : if(channel == ioChannel) { /* connect state. should accept */ - _DBG("new client connected"); + _INFO("new client connected"); result = acceptClient(); } diff --git a/server/ServerResource.cpp b/server/ServerResource.cpp index e7db889..70b802b 100644 --- a/server/ServerResource.cpp +++ b/server/ServerResource.cpp @@ -923,7 +923,7 @@ namespace smartcard_service_api } else { - _DBG("no secure element"); + _INFO("no secure element"); } return result; @@ -955,7 +955,7 @@ namespace smartcard_service_api unsigned int terminalID = IntegerHandle::INVALID_HANDLE; Message msg; - _DBG("[NOTIFY_SE_AVAILABLE]"); + _INFO("[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; - _DBG("[NOTIFY_SE_NOT_AVAILABLE]"); + _INFO("[NOTIFY_SE_NOT_AVAILABLE]"); readerID = instance.getReaderID((char *)terminal); diff --git a/test-client/test-client-sync.cpp b/test-client/test-client-sync.cpp index 91b617f..2e5526c 100644 --- a/test-client/test-client-sync.cpp +++ b/test-client/test-client-sync.cpp @@ -60,7 +60,7 @@ class TestEventHandler : public SEServiceListener { _BEGIN(); - _DBG("event occured service [%p], seName[%p], event [%d]", service, seName, event); + _INFO("event occurred service [%p], seName[%p], event [%d]", service, seName, event); _END(); } @@ -69,7 +69,7 @@ class TestEventHandler : public SEServiceListener { _BEGIN(); - _DBG("error occured service [%p], error [%d]", service, error); + _ERR("error occurred service [%p], error [%d]", service, error); _END(); } @@ -122,7 +122,7 @@ void testConnectedCallback(SEServiceHelper *service, void *userData) int fid = 0x00003150; response = channel->getSelectResponse(); - _DBG("response : %s", response.toString()); + _INFO("response : %s", response.toString()); _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical"); _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened"); @@ -131,7 +131,7 @@ void testConnectedCallback(SEServiceHelper *service, void *userData) command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, data); int error = channel->transmitSync(command, response); - _DBG("error : %d, response : %s", error, response.toString()); + _INFO("error : %d, response : %s", error, response.toString()); channel->closeSync(); } diff --git a/test-client/test-client.cpp b/test-client/test-client.cpp index 9b865a5..29b8077 100644 --- a/test-client/test-client.cpp +++ b/test-client/test-client.cpp @@ -63,7 +63,7 @@ class TestEventHandler : public SEServiceListener _BEGIN(); - _DBG("event occured service [%p], seName[%s], event [%d], userData [%p]", service, seName, event, userData); + _INFO("event occurred service [%p], seName[%s], event [%d], userData [%p]", service, seName, event, userData); readers = service->getReaders(); @@ -84,7 +84,7 @@ class TestEventHandler : public SEServiceListener { _BEGIN(); - _DBG("error occured service [%p], error [%d]", service, error); + _ERR("error occurred service [%p], error [%d]", service, error); _END(); } @@ -126,7 +126,7 @@ void testOpenChannelCallback(Channel *channel, int error, void *userData) response = channel->getSelectResponse(); - _DBG("response : %s", response.toString()); + _INFO("response : %s", response.toString()); _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical"); _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened");