• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

sac.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   Standalone Collator
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #include "ink_config.h"
00025 #include "ink_file.h"
00026 #include "I_Layout.h"
00027 #include "I_Version.h"
00028 #include "P_Net.h"
00029 
00030 #define PROGRAM_NAME  "traffic_sac"
00031 
00032 #include "LogStandalone.cc"
00033 
00034 #include "LogAccess.h"
00035 #include "LogField.h"
00036 #include "LogFilter.h"
00037 #include "LogFormat.h"
00038 #include "LogFile.h"
00039 #include "LogHost.h"
00040 #include "LogObject.h"
00041 #include "LogConfig.h"
00042 #include "LogBuffer.h"
00043 #include "LogUtils.h"
00044 #include "LogSock.h"
00045 #include "Log.h"
00046 #include "DiagsConfig.h"
00047 #include "I_Machine.h"
00048 
00049 #define DIAGS_LOG_FILENAME "collector.log"
00050 
00051 // sac-specific command-line flags
00052 //
00053 static int version_flag = 0;
00054 
00055 // command-line argument descriptions
00056 //
00057 
00058 ArgumentDescription argument_descriptions[] = {
00059 
00060   {"version", 'V', "Print Version Id", "T", &version_flag, NULL, NULL},
00061 #ifdef DEBUG
00062   {"error_tags", 'T', "Colon-Separated Debug Tags", "S1023", &error_tags,
00063    NULL, NULL},
00064   {"action_tags", 'A', "Colon-Separated Debug Tags", "S1023", &action_tags,
00065    NULL, NULL},
00066 #endif
00067   {"help", 'h', "HELP!", NULL, NULL, NULL, usage},
00068 };
00069 
00070 /*-------------------------------------------------------------------------
00071   main
00072   -------------------------------------------------------------------------*/
00073 
00074 int
00075 main(int /* argc ATS_UNUSED */, char *argv[])
00076 {
00077   // build the application information structure
00078   //
00079   appVersionInfo.setup(PACKAGE_NAME,PROGRAM_NAME, PACKAGE_VERSION, __DATE__,
00080                        __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
00081 
00082   // Before accessing file system initialize Layout engine
00083   Layout::create();
00084   // take care of command-line arguments
00085   //
00086   process_args(argument_descriptions, countof(argument_descriptions), argv);
00087 
00088   // check for the version number request
00089   //
00090   if (version_flag) {
00091     fprintf(stderr, "%s\n", appVersionInfo.FullVersionInfoStr);
00092     _exit(0);
00093   }
00094 
00095   diagsConfig = new DiagsConfig(DIAGS_LOG_FILENAME, error_tags, action_tags, false);
00096   diags = diagsConfig->diags;
00097   diags->prefix_str = "Collector ";
00098 
00099   // initialize this application for standalone logging operation
00100   //
00101   bool one_copy = true;
00102   init_log_standalone(PROGRAM_NAME, one_copy);
00103 
00104   // set up IO Buffers
00105   //
00106   int config_max_iobuffer_size = DEFAULT_MAX_BUFFER_SIZE;
00107   max_iobuffer_size = buffer_size_to_index(config_max_iobuffer_size, DEFAULT_BUFFER_SIZES - 1);
00108   if (default_small_iobuffer_size > max_iobuffer_size)
00109     default_small_iobuffer_size = max_iobuffer_size;
00110   if (default_large_iobuffer_size > max_iobuffer_size)
00111     default_large_iobuffer_size = max_iobuffer_size;
00112   init_buffer_allocators();
00113 
00114   // initialize the event and net processor
00115   //
00116   size_t stacksize;
00117 
00118   REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
00119   eventProcessor.start(ink_number_of_processors(), stacksize);
00120   ink_net_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
00121   netProcessor.start(0, stacksize);
00122   Machine::init();
00123 
00124   Log::init(Log::NO_REMOTE_MANAGEMENT | Log::STANDALONE_COLLATOR);
00125 
00126   // we're off to the races ...
00127   //
00128   Note("-- SAC running --");
00129   this_thread()->execute();
00130 }

Generated by  doxygen 1.7.1