本文整理汇总了C++中PEG_TRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ PEG_TRACE函数的具体用法?C++ PEG_TRACE怎么用?C++ PEG_TRACE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PEG_TRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SSL_get_error
Boolean SSLSocket::incompleteSecureReadOccurred(Sint32 retCode)
{
Sint32 err = SSL_get_error(static_cast<SSL*>(_SSLConnection), retCode);
Boolean isIncompleteRead =
((err == SSL_ERROR_SYSCALL) &&
(_sslReadErrno == EAGAIN || _sslReadErrno == EINTR)) ||
(err == SSL_ERROR_WANT_READ) ||
(err == SSL_ERROR_WANT_WRITE);
if (Tracer::isTraceOn())
{
unsigned long rc = ERR_get_error ();
char buff[256];
ERR_error_string_n (rc, buff, sizeof (buff)); // added in OpenSSL 0.9.6
PEG_TRACE((TRC_SSL, Tracer::LEVEL4,
"In SSLSocket::incompleteSecureReadOccurred : err = %d %s",
err, buff));
if (!isIncompleteRead && retCode < 0)
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL4,
"In SSLSocket::incompleteSecureReadOccurred : err = %d %s",
err, buff));
}
}
return isIncompleteRead;
}
示例2: PEG_METHOD_ENTER
ProviderModule* DefaultProviderManager::_lookupModule(
const String& moduleFileName)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
"DefaultProviderManager::_lookupModule");
// lock the providerTable mutex
AutoMutex lock(_providerTableMutex);
// look up provider module in cache
ProviderModule* module = 0;
if (_modules.lookup(moduleFileName, module))
{
// found provider module in cache
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"Found Provider Module %s in Provider Manager Cache",
(const char*)moduleFileName.getCString()));
}
else
{
// provider module not found in cache, create provider module
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"Creating Provider Module %s",
(const char*)moduleFileName.getCString()));
module = new ProviderModule(moduleFileName);
// insert provider module in module table
_modules.insert(moduleFileName, module);
}
PEG_METHOD_EXIT();
return module;
}
示例3: CreateFile
AutoFileLock::AutoFileLock(const char* fileName)
{
// Repeat createFile, if there is a sharing violation.
do
{
_hFile = CreateFile (fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}while ((GetLastError() == ERROR_SHARING_VIOLATION));
// If this conditon succeeds, There is an error opening the file. Hence
// returning from here as Lock can not be acquired.
if((_hFile == INVALID_HANDLE_VALUE)
&& (GetLastError() != ERROR_ALREADY_EXISTS)
&& (GetLastError() != ERROR_SUCCESS))
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"AutoFileLock: Failed to open lock file '%s', error code %d.",
fileName, GetLastError()));
return;
}
OVERLAPPED l={0,0,0,0,0};
if(LockFileEx(_hFile,LOCKFILE_EXCLUSIVE_LOCK, 0, 0, 0, &l) == 0)
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"AutoFileLock: Failed to Acquire lock on file %s, error code %d.",
fileName, GetLastError()));
CloseHandle(_hFile);
_hFile = INVALID_HANDLE_VALUE;
}
}
示例4: PEG_METHOD_ENTER
void CIMExportClient::exportIndication(
const String& url,
const CIMInstance& instanceName,
const ContentLanguageList& contentLanguages)
{
PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportClient::exportIndication()");
try
{
// encode request
CIMRequestMessage* request = new CIMExportIndicationRequestMessage(
String::EMPTY,
url,
instanceName,
QueueIdStack(),
String::EMPTY,
String::EMPTY);
request->operationContext.set
(ContentLanguageListContainer(contentLanguages));
PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
"Exporting %s Indication for destination %s:%d%s",
(const char*)(instanceName.getClassName().getString().
getCString()),
(const char*)(_connectHost.getCString()), _connectPortNumber,
(const char*)(url.getCString())));
Message* message = _doRequest(request,
CIM_EXPORT_INDICATION_RESPONSE_MESSAGE);
PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
"%s Indication for destination %s:%d%s exported successfully",
(const char*)(instanceName.getClassName().getString().
getCString()),
(const char*)(_connectHost.getCString()), _connectPortNumber,
(const char*)(url.getCString())));
CIMExportIndicationResponseMessage* response =
(CIMExportIndicationResponseMessage*)message;
AutoPtr<CIMExportIndicationResponseMessage> ap(response);
}
catch (const Exception& e)
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"Failed to export indication: %s",
(const char*)e.getMessage().getCString()));
throw;
}
catch (...)
{
PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1,
"Failed to export indication");
throw;
}
PEG_METHOD_EXIT();
}
示例5: catch
/**
Update the specified property name and value in the current
config file.
*/
Boolean ConfigFileHandler::updateCurrentValue(
const CIMName& name,
const String& value,
Boolean unset)
{
// Remove the old property name and value from the table
if (_currentConfig->table.contains(name.getString()))
{
if (!_currentConfig->table.remove(name.getString()))
{
return false;
}
}
if (!unset)
{
// Store the new property name and value in to the table
if (!_currentConfig->table.insert(name.getString(), value))
{
return false;
}
}
try
{
// Store the new property in current config file.
_currentConfFile->save(_currentConfig);
}
catch (CannotRenameFile& e)
{
//
// Back up creation failed
// FUTURE: Log this message in a log file.
//
PEG_TRACE((TRC_CONFIG, Tracer::LEVEL1,
"Backup configuration file creation failed: %s",
(const char*)e.getMessage().getCString()));
return false;
}
catch (CannotOpenFile& cof)
{
PEG_TRACE((TRC_CONFIG, Tracer::LEVEL1,
"Setting permissions on current configuration file failed: %s",
(const char*)cof.getMessage().getCString()));
return false;
}
//
// The current config file would now been created,
// so set the flag to true.
//
_currentFileExist = true;
return true;
}
示例6: PEG_METHOD_ENTER
SCMOClass ProviderAgent::_scmoClassCache_GetClass(
const CIMNamespaceName& nameSpace,
const CIMName& className)
{
PEG_METHOD_ENTER(TRC_PROVIDERAGENT,
"ProviderAgent::_scmoClassCache_GetClass");
// create message
ProvAgtGetScmoClassRequestMessage* message =
new ProvAgtGetScmoClassRequestMessage(
XmlWriter::getNextMessageId(),
nameSpace,
className,
QueueIdStack());
// Send the request for the SCMOClass to the server
_providerAgent->_writeResponse(message);
delete message;
// Wait for semaphore signaled by _readAndProcessRequest()
if (!_scmoClassDelivered.time_wait(
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS))
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"Timed-out waiting for SCMOClass for "
"Name Space Name '%s' Class Name '%s'",
(const char*)nameSpace.getString().getCString(),
(const char*)className.getString().getCString()));
PEG_METHOD_EXIT();
return SCMOClass("","");
}
if ( 0 == _transferSCMOClass)
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"No SCMOClass received for Name Space Name '%s' Class Name '%s'",
(const char*)nameSpace.getString().getCString(),
(const char*)className.getString().getCString()));
PEG_METHOD_EXIT();
return SCMOClass("","");
}
// Create a local copy.
SCMOClass ret = SCMOClass(*_transferSCMOClass);
// Delete the transferred instance.
delete _transferSCMOClass;
_transferSCMOClass = 0;
PEG_METHOD_EXIT();
return ret;
}
示例7: PEG_METHOD_ENTER
void CIMExportRequestDispatcher::handleEnqueue(Message* message)
{
PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
"CIMExportRequestDispatcher::handleEnqueue");
PEGASUS_ASSERT(message != 0);
switch (message->getType())
{
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
{
CIMExportIndicationResponseMessage* response =
_handleExportIndicationRequest(
(CIMExportIndicationRequestMessage*) message);
PEG_TRACE((
TRC_HTTP,
Tracer::LEVEL4,
"_CIMExportRequestDispatcher::handleEnqueue(message) - "
"message->getCloseConnect() returned %d",
message->getCloseConnect()));
response->setCloseConnect(message->getCloseConnect());
MessageQueue* queue = MessageQueue::lookup(response->dest);
PEGASUS_ASSERT(queue != 0);
queue->enqueue(response);
break;
}
default:
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
break;
}
示例8: openFile
virtual FILE* openFile(
const char* path,
int mode)
{
FILE* fhandle = NULL;
switch (mode)
{
case 'r':
fhandle = fopen(path, "r");
break;
case 'w':
fhandle = fopen(path, "w");
break;
case 'a':
fhandle = fopen(path, "a+");
break;
default:
PEGASUS_ASSERT(fhandle);
break;
}
if(!fhandle)
{
PEG_TRACE((TRC_SERVER, Tracer::LEVEL1,
"Open of file %s in mode %c failed: %s",path,mode,
(const char*) PEGASUS_SYSTEM_ERRORMSG.getCString()));
}
return fhandle;
}
示例9: PEG_METHOD_ENTER
void CMPIProvider::terminate()
{
PEG_METHOD_ENTER(
TRC_CMPIPROVIDERINTERFACE,
"CMPIProvider::terminate()");
if (_status == INITIALIZED)
{
try
{
_terminate(true);
PEGASUS_ASSERT(unloadStatus == CMPI_RC_OK);
}
catch (...)
{
PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
"Exception caught in CMPIProviderFacade::Terminate for %s",
(const char*)getName().getCString()));
throw;
}
}
// Provider's cleanup method called successfully, if there are still any
// pending operations with provider then we were asked to cleanup forcibly,
// don't uninitialize provider.
if (_current_operations.get() == 0)
{
_status = UNINITIALIZED;
}
PEG_METHOD_EXIT();
}
示例10: PEG_METHOD_ENTER
/** This method should be called after the consumer is terminated and the
* module is unloaded. Note that we cannot test for a loaded condition,
* since the _module reference here may still exist (if more than one
* consumer is using the module).
* Simply test whether the consumer is initialized.
* If it was terminated properly, initialized will be false and the _module
* ref count will be decremented.
*/
void DynamicConsumer::reset()
{
PEG_METHOD_ENTER(TRC_LISTENER, "DynamicConsumer::reset");
if (_initialized)
{
throw Exception(
MessageLoaderParms(
"DynListener.DynamicConsumer.CONSUMER_INVALID_STATE",
"Error: The consumer is not in the correct state to "
"perform the operation."));
}
// do not delete it, that is taken care of in ConsumerModule itself
_module = 0;
// ATTN: attempting to delete this causes an exception -- why??
_consumer = 0;
PEG_TRACE((TRC_LISTENER,Tracer::LEVEL4,
"Deleting %d outstanding requests for %s",
_eventqueue.size(),
(const char*)_name.getCString()));
//delete outstanding requests
IndicationDispatchEvent* event = 0;
for (Uint32 i = 0; i < _eventqueue.size(); i++)
{
event = _eventqueue.remove_front();
delete event;
}
PEG_METHOD_EXIT();
}
示例11: _queueId
MessageQueue::MessageQueue(const char* name)
: _queueId(getNextQueueId())
{
//
// Copy the name:
//
PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,"MessageQueue::MessageQueue()");
if (!name)
{
name = "";
}
_name = new char[strlen(name) + 1];
strcpy(_name, name);
PEG_TRACE((TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
"MessageQueue::MessageQueue name = %s, queueId = %u", name, _queueId));
//
// Insert into queue table:
//
AutoMutex autoMut(q_table_mut);
while (!_queueTable.insert(_queueId, this))
;
PEG_METHOD_EXIT();
}
示例12: defined
Boolean System::isPrivilegedUser(const String& userName)
{
#if defined(PEGASUS_OS_PASE)
CString user = userName.getCString();
// this function only can be found in PASE environment
return umeIsPrivilegedUser((const char *)user);
#else
struct passwd pwd;
struct passwd *result;
const unsigned int PWD_BUFF_SIZE = 1024;
char pwdBuffer[PWD_BUFF_SIZE];
if (getpwnam_r(
userName.getCString(), &pwd, pwdBuffer, PWD_BUFF_SIZE, &result) != 0)
{
PEG_TRACE((
TRC_OS_ABSTRACTION,
Tracer::LEVEL1,
"getpwnam_r failure : %s",
strerror(errno)));
}
// Check if the requested entry was found. If not return false.
if ( result != NULL )
{
// Check if the uid is 0.
if ( pwd.pw_gid == 0 || pwd.pw_uid == 0 )
{
return true;
}
}
return false;
#endif
}
示例13: ClientCIMOMHandleAccessController
ClientCIMOMHandleAccessController(Mutex& lock)
: _lock(lock)
{
try
{
// assume default client timeout
if (!_lock.timed_lock(PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS))
{
throw CIMException(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
"Provider.CIMOMHandle.CIMOMHANDLE_TIMEOUT",
"Timeout waiting for CIMOMHandle"));
}
}
catch (Exception& e)
{
PEG_TRACE((TRC_CIMOM_HANDLE, Tracer::LEVEL2,
"Unexpected Exception: %s",
(const char*)e.getMessage().getCString()));
throw;
}
catch (...)
{
PEG_TRACE_CSTRING(TRC_CIMOM_HANDLE, Tracer::LEVEL2,
"Unexpected exception");
throw;
}
}
示例14: PEGASUS_DEBUG_ASSERT
void EnumerationContext::setClientClosed()
{
PEGASUS_DEBUG_ASSERT(valid());
_clientClosed = true;
_processing = false;
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3,
"setClientClosed. ContextId=%s ", *Str(getContextId()) ));
#endif
// Clear any existing responses out of the cache. They will never
// be used.
_responseCache.clear();
if (!_providersComplete)
{
// Signal that cache size has dropped.
signalProviderWaitCondition();
}
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE
trace();
#endif
}
示例15: timeout
/*
Test interoperation timer against current time. Return true if timed out
or timer set 0 zero indicating that the timer is not active.
Returns bool true if timer not zero and Interoperation timer
is greater than interoperation timeout (i.e timed out).
*/
bool EnumerationContext::isTimedOut(Uint64 currentTime)
{
PEGASUS_DEBUG_ASSERT(valid());
if (_operationTimerUsec == 0)
{
return false;
}
bool timedOut = _operationTimerUsec <= currentTime;
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4,
"isTimedOut Timer. ContextId=%s timer(sec)=%lu"
" current(sec)=%lu time to timeout(usec)=%ld isTimedOut=%s",
*Str(getContextId()),
(long unsigned int)(_operationTimerUsec / PEG_MICROSEC),
(long unsigned int)(currentTime / PEG_MICROSEC),
(long signed int)((_operationTimerUsec - currentTime)),
boolToString(timedOut) ));
#endif
// If it is timed out, set timer inactive.
if (timedOut)
{
_operationTimerUsec = 0;
}
return(timedOut);
}