Example #1
0
FileRegion::FileWriteRequest::FileReadHandler::FileReadHandler(
    FileWriteRequest* req, int pipe_in, size_t bytesToRead)
  : req_(req), pipe_in_(pipe_in), bytesToRead_(bytesToRead) {
  CHECK(req_->readBase_->isInEventBaseThread());
  initHandler(req_->readBase_, pipe_in);
  if (!registerHandler(EventFlags::WRITE | EventFlags::PERSIST)) {
    req_->fail(__func__, AsyncSocketException(
        AsyncSocketException::INTERNAL_ERROR,
        "registerHandler failed"));
  }
}
Example #2
0
/*!
    \internal
*/
void QImageReaderPrivate::getText()
{
    if (!text.isEmpty() || (!handler && !initHandler()) || !handler->supportsOption(QImageIOHandler::Description))
        return;
    foreach (const QString &pair, handler->option(QImageIOHandler::Description).toString().split(
                QLatin1String("\n\n"))) {
        int index = pair.indexOf(QLatin1Char(':'));
        if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
            text.insert(QLatin1String("Description"), pair.simplified());
        } else {
            QString key = pair.left(index);
            text.insert(key, pair.mid(index + 2).simplified());
        }
    }
}
LogHandler* addLogHandlerToList(LogHandlerList* logHandlerList, LogLevel logLevel, unsigned long logCategoryMask, char* handlerName, OutputStream* outputStream) {
    if (logHandlerList == NULL || logHandlerList->maxSize == 0) {
        writeError(LOG_LIST_NOT_INITIALIZED);
        return NULL;
    }
    unsigned char size = logHandlerList->size;

    if (size < logHandlerList->maxSize) {
        LogHandler* result = getLogHandler(logHandlerList, size);
        // get a pointer on a logHandler already allocated (because we provide at init a pointer on an array of logHandler
        logHandlerList->size++;
        initHandler(result, handlerName, outputStream, logLevel, logCategoryMask);
        return result;
    }
    else {
        writeError(LOG_LIST_TOO_MUCH_LOG_HANDLERS);
        return NULL;
    }
}
Example #4
0
int main(int argc, char** argv)
{
  OSS::OSS_init();

  ServiceOptions::daemonize(argc, argv);
  ServiceOptions service(argc, argv, "sipXsbc", "1.0.0", "(c) eZuce, Inc. All rights reserved.");
  service.addDaemonOptions();

  //
  // Initialize the logger
  //
  service.addOptionString('L', "log-file", ": Specify the application log file.", ServiceOptions::CommandLineOption);
  service.addOptionInt('l', "log-level",
      ": Specify the application log priority level."
      "Valid level is between 0-7.  "
      "0 (EMERG) 1 (ALERT) 2 (CRIT) 3 (ERR) 4 (WARNING) 5 (NOTICE) 6 (INFO) 7 (DEBUG)"
            , ServiceOptions::CommandLineOption);
  service.addOptionFlag("log-no-compress", ": Specify if logs will be compressed after rotation.");
  service.addOptionInt("log-purge-count", ": Specify the number of archive to maintain.");
  service.parseOptions();
  initLogger(service);


  OSS::SIP::B2BUA::SBController sbc;
  //
  // Initialize the datastore
  //
  initDataStore(sbc);
  //
  // Initialize java scripts
  //
  initHandler(sbc, service);
  //
  // Initialize the transports
  //
  initListeners(sbc, service);

  sbc.run();

  OSS::app_wait_for_termination_request();

  OSS::OSS_deinit();
}
Example #5
0
 void setDefaults()
 {
    if(!theHandler.valid())
    {
       initHandler();
       initEntry();
    }
    ossim::defaultTileSize(theOverviewTileSize);
    theStageHistogramFlag = false;
    theStageOverviewFlag = false;
    theHistogramFilename = "";
    theOverviewFilename = "";
    if(theHandler.valid())
    {
       theStageOverviewFlag  = !(theHandler->hasOverviews());
       theOverviewFilename   = theHandler->createDefaultOverviewFilename();
       theHistogramFilename  = theHandler->createDefaultHistogramFilename();
       theStageHistogramFlag = !(theHistogramFilename.exists());
    }
 }