亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gateway.cpp

?? 一個開源的網絡開發庫ACE
?? CPP
字號:
// Gateway.cpp,v 4.33 1998/12/19 05:11:03 levine Exp

#define ACE_BUILD_SVC_DLL

#include "ace/Service_Config.h"
#include "Config_Files.h"
#include "Event_Channel.h"
#include "Gateway.h"

ACE_RCSID(Gateway, Gateway, "Gateway.cpp,v 4.33 1998/12/19 05:11:03 levine Exp")

class ACE_Svc_Export Gateway : public ACE_Service_Object
{
  // = TITLE
  //     Integrates the whole Gateway application.
  //
  // = DESCRIPTION
  //     This implementation uses the <Event_Channel> as the basis
  //     for the <Gateway> routing.
protected:
  // = Service configurator hooks.
  virtual int init (int argc, char *argv[]);
  // Perform initialization.

  virtual int fini (void);
  // Perform termination when unlinked dynamically.

  virtual int info (char **, size_t) const;
  // Return info about this service.

  // = Configuration methods.
  int parse_connection_config_file (void);
  // Parse the proxy configuration file.

  int parse_consumer_config_file (void);
  // Parse the consumer configuration file.

  // = Lifecycle management methods.
  int handle_input (ACE_HANDLE);
  // Shut down the Gateway when input comes in from the controlling
  // console.

  int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
  // Shut down the Gateway when a signal arrives.

  Event_Channel event_channel_;
  // The Event Channel routes events from Supplier(s) to Consumer(s)
  // using <Supplier_Handler> and <Consumer_Handler> objects.

  Connection_Handler_Factory connection_handler_factory_;
  // Creates the appropriate type of <Connection_Handlers>.
};

int
Gateway::handle_signal (int signum, siginfo_t *, ucontext_t *)
{
  ACE_UNUSED_ARG (signum);

  // Shut down the main event loop.
  ACE_Reactor::end_event_loop ();
  return 0;
}

int
Gateway::handle_input (ACE_HANDLE h)
{
  char buf[BUFSIZ];
  // Consume the input...
  ACE_OS::read (h, buf, sizeof (buf));

  // Shut us down.
  return this->handle_signal ((int) h);
}

int
Gateway::init (int argc, char *argv[])
{
  // Parse the "command-line" arguments.
  Options::instance ()->parse_args (argc, argv);

  ACE_Sig_Set sig_set;
  sig_set.sig_add (SIGINT);
  sig_set.sig_add (SIGQUIT);

  // Register ourselves to receive signals so we can shut down
  // gracefully.

  if (ACE_Reactor::instance ()->register_handler (sig_set,
                                                  this) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "(%t) %p\n",
                       "register_handler"),
                      -1);

  // Register this handler to receive events on stdin.  We use this to
  // shutdown the Gateway gracefully.
  if (ACE_Event_Handler::register_stdin_handler (this,
                                                 ACE_Reactor::instance (),
                                                 ACE_Thread_Manager::instance ()) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "(%t) %p\n",
                       "register_stdin_handler"),
                      -1);

  // If this->performance_window_ > 0 start a timer.

  if (Options::instance ()->performance_window () > 0)
    {
      if (ACE_Reactor::instance ()->schedule_timer
          (&this->event_channel_, 0,
           Options::instance ()->performance_window ()) == -1)
        ACE_ERROR ((LM_ERROR,
                    "(%t) %p\n",
                    "schedule_timer"));
      else
        ACE_DEBUG ((LM_DEBUG,
                    "starting timer for %d seconds...\n",
                   Options::instance ()->performance_window ()));
    }

  // Are we running as a connector?
  if (Options::instance ()->enabled
      (Options::CONSUMER_CONNECTOR | Options::SUPPLIER_CONNECTOR))
    {
      // Parse the proxy configuration file.
      this->parse_connection_config_file ();

      // Parse the consumer config file and build the event forwarding
      // discriminator.
      this->parse_consumer_config_file ();
    }

  // Initialize the Event_Channel.
  return this->event_channel_.open ();
}

// This method is automatically called when the Gateway is shutdown.

int
Gateway::fini (void)
{
  // Remove the handler that receive events on stdin.  Otherwise, we
  // will crash on shutdown.
  ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance (),
                                           ACE_Thread_Manager::instance ());

  // Close down the event channel.
  this->event_channel_.close ();

  // Need to make sure we cleanup this Singleton.
  delete Options::instance ();
  return 0;
}

// Returns information on the currently active service.

int
Gateway::info (char **strp, size_t length) const
{
  char buf[BUFSIZ];

  ACE_OS::sprintf (buf, "%s\t %s", "Gateway daemon",
             "# Application-level gateway\n");

  if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
    return -1;
  else
    ACE_OS::strncpy (*strp, buf, length);
  return ACE_OS::strlen (buf);
}

// Parse and build the proxy table.

int
Gateway::parse_connection_config_file (void)
{
  // File that contains the proxy configuration information.
  Connection_Config_File_Parser connection_file;
  int file_empty = 1;
  int line_number = 0;

  if (connection_file.open (Options::instance ()->connection_config_file ()) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "(%t) %p\n",
                       Options::instance ()->connection_config_file ()),
                      -1);

  // Keep track of the previous connection id to make sure the
  // connection config file isn't corrupted.
  int previous_connection_id = 0;

  // Read config file one line at a time.

  for (Connection_Config_Info pci;
       connection_file.read_entry (pci, line_number) != FP::EOFILE;
       )
    {
      file_empty = 0;

      // First time in check.
      if (previous_connection_id == 0)
        {
          previous_connection_id = 1;

          if (pci.connection_id_ != 1)
            ACE_DEBUG ((LM_DEBUG,
                        "(%t) warning, the first connection id should be 1 not %d\n",
                        pci.connection_id_));
        }
      else if (previous_connection_id + 1 != pci.connection_id_)
        ACE_DEBUG ((LM_DEBUG,
                    "(%t) warning, connection ids should keep increasing by 1 and %d + 1 != %d\n",
                    previous_connection_id,
                    pci.connection_id_));

      // Update the last connection id to ensure that we monotonically
      // increase by 1.
      previous_connection_id = pci.connection_id_;

      if (Options::instance ()->enabled (Options::DEBUG))
        ACE_DEBUG ((LM_DEBUG,
                    "(%t) conn id = %d, "
                    "host = %s, "
                    "remote port = %d, "
                    "proxy role = %c, "
                    "max retry timeout = %d, "
                    "local port = %d, "
                    "priority = %d\n",
                    pci.connection_id_,
                    pci.host_,
                    pci.remote_port_,
                    pci.connection_role_,
                    pci.max_retry_timeout_,
                    pci.local_port_,
                    pci.priority_));

      pci.event_channel_ = &this->event_channel_;

      // Create the appropriate type of Proxy.
      Connection_Handler *connection_handler;

      ACE_ALLOCATOR_RETURN (connection_handler,
                            this->connection_handler_factory_.make_connection_handler (pci),
                            -1);

      // Bind the new Connection_Handler to the connection ID.
      this->event_channel_.bind_proxy (connection_handler);
    }

  // Keep track of the next available connection id, which is
  // necessary for Peers that connect with us, rather than vice versa.
  Options::instance ()->connection_id () = previous_connection_id + 1;

  if (file_empty)
    ACE_ERROR ((LM_WARNING,
               "warning: connection connection_handler configuration file was empty\n"));
  return 0;
}

int
Gateway::parse_consumer_config_file (void)
{
  // File that contains the consumer event forwarding information.
  Consumer_Config_File_Parser consumer_file;
  int file_empty = 1;
  int line_number = 0;

  if (consumer_file.open (Options::instance ()->consumer_config_file ()) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "(%t) %p\n",
                       Options::instance ()->consumer_config_file ()),
                      -1);

  // Read config file line at a time.
  for (Consumer_Config_Info cci_entry;
       consumer_file.read_entry (cci_entry, line_number) != FP::EOFILE;
       )
    {
      file_empty = 0;

      if (Options::instance ()->enabled (Options::DEBUG))
        {
          ACE_DEBUG ((LM_DEBUG,
                      "(%t) connection id = %d, payload = %d, "
                      "number of consumers = %d\n",
                      cci_entry.connection_id_,
                      cci_entry.type_,
                      cci_entry.total_consumers_));

          for (int i = 0; i < cci_entry.total_consumers_; i++)
            ACE_DEBUG ((LM_DEBUG,
                        "(%t) destination[%d] = %d\n",
                        i,
                        cci_entry.consumers_[i]));
        }

      Consumer_Dispatch_Set *dispatch_set;
      ACE_NEW_RETURN (dispatch_set,
                      Consumer_Dispatch_Set,
                      -1);

      Event_Key event_addr (cci_entry.connection_id_,
                            cci_entry.type_);

      // Add the Consumers to the Dispatch_Set.
      for (int i = 0; i < cci_entry.total_consumers_; i++)
        {
          Connection_Handler *connection_handler = 0;

          // Lookup destination and add to Consumer_Dispatch_Set set
          // if found.
          if (this->event_channel_.find_proxy (cci_entry.consumers_[i],
                                               connection_handler) != -1)
            dispatch_set->insert (connection_handler);
          else
            ACE_ERROR ((LM_ERROR,
                        "(%t) not found: destination[%d] = %d\n",
                        i,
                        cci_entry.consumers_[i]));
        }

      this->event_channel_.subscribe (event_addr, dispatch_set);
    }

  if (file_empty)
    ACE_ERROR ((LM_WARNING,
               "warning: consumer map configuration file was empty\n"));
  return 0;
}

// The following is a "Factory" used by the ACE_Service_Config and
// svc.conf file to dynamically initialize the state of the Gateway.

ACE_SVC_FACTORY_DEFINE (Gateway)

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Node<Connection_Handler *>;
template class ACE_Unbounded_Set<Connection_Handler *>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Node<Connection_Handler *>
#pragma instantiate ACE_Unbounded_Set<Connection_Handler *>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久男人中文字幕资源站| 欧美mv日韩mv| 91影院在线观看| 成人精品视频一区二区三区尤物| 久久精品国产精品亚洲红杏| 亚洲国产色一区| 视频精品一区二区| 天天爽夜夜爽夜夜爽精品视频 | 狠狠色狠狠色综合系列| 美女在线观看视频一区二区| 久久国产欧美日韩精品| 毛片基地黄久久久久久天堂| 九九国产精品视频| 成人永久免费视频| 91在线丨porny丨国产| 欧美色图片你懂的| 欧美一级高清大全免费观看| 日韩欧美中文字幕公布| 国产欧美一区二区精品性| 国产精品乱人伦一区二区| 亚洲精品国产a久久久久久| 亚洲一区二区三区国产| 美国一区二区三区在线播放| 国产伦理精品不卡| av亚洲精华国产精华精华| 99re成人精品视频| 9191久久久久久久久久久| 2022国产精品视频| 亚洲日本韩国一区| 日本伊人色综合网| 成人精品免费网站| 制服丝袜成人动漫| 日本一区二区三级电影在线观看| 亚洲欧美一区二区不卡| 麻豆国产一区二区| 91视频在线观看| 91黄色免费网站| 久久精品国产99国产精品| 一区二区三区欧美久久| 国产性做久久久久久| 精彩视频一区二区三区| 国产一区二区在线观看视频| 色综合色狠狠综合色| 日韩三级伦理片妻子的秘密按摩| 亚洲国产精华液网站w| 日本午夜一区二区| 91麻豆产精品久久久久久| 精品国产伦一区二区三区免费| 亚洲欧美日韩精品久久久久| 国产一本一道久久香蕉| 欧美日韩视频在线一区二区 | 18成人在线观看| 国内欧美视频一区二区 | 91精品国产综合久久精品| 中文字幕国产一区| 国产专区综合网| 69堂亚洲精品首页| 一区二区三区自拍| 91啪在线观看| 国产精品久久久久久久浪潮网站| 日本女优在线视频一区二区| 在线观看欧美精品| 亚洲人成影院在线观看| 成人午夜激情在线| 亚洲国产精华液网站w| 国产美女在线精品| 精品久久国产97色综合| 日韩激情一区二区| 4438x亚洲最大成人网| 亚洲大片免费看| 欧美性生活大片视频| 亚洲国产视频一区| 欧美日韩国产123区| 亚洲福利一二三区| 欧美欧美欧美欧美| 男女男精品视频| 日韩欧美在线综合网| 久久国产精品99精品国产| 日韩欧美国产高清| 久久99深爱久久99精品| 日韩精品专区在线影院重磅| 另类小说一区二区三区| 久久夜色精品国产噜噜av| 国产精品影视在线| 中文字幕制服丝袜成人av| 91网址在线看| 一区二区成人在线观看| 欧美色综合天天久久综合精品| 亚洲国产美国国产综合一区二区 | 日本不卡视频在线观看| 欧美成人性战久久| 丁香啪啪综合成人亚洲小说| 日韩一区有码在线| 欧美电影影音先锋| 国产永久精品大片wwwapp| 国产精品久久网站| 色综合激情久久| 日本视频免费一区| 国产午夜精品在线观看| 成人av午夜电影| 婷婷综合另类小说色区| 国产日韩影视精品| 在线观看国产精品网站| 久久国产精品露脸对白| 国产精品久久久久久久蜜臀 | 欧美主播一区二区三区| 日韩一区精品字幕| 中文在线一区二区| 欧美日韩精品一区视频| 国产毛片精品一区| 亚洲一区二区三区免费视频| 久久亚洲影视婷婷| 欧美日韩中文精品| 风流少妇一区二区| 男人的天堂久久精品| 亚洲欧美日韩久久精品| 精品国产一区二区在线观看| 色综合久久综合网欧美综合网| 免费看日韩精品| 亚洲美女淫视频| 中文字幕av一区二区三区高| 91精品国产综合久久精品图片 | 精品国产乱码久久久久久影片| 99精品国产热久久91蜜凸| 精品夜夜嗨av一区二区三区| 一区二区三区欧美日韩| 国产欧美日韩另类视频免费观看| 欧美日韩在线精品一区二区三区激情 | 亚洲影视在线播放| 国产精品色哟哟| 久久老女人爱爱| 欧美一区二区三区公司| 91国偷自产一区二区开放时间 | 亚洲精选在线视频| 国产精品视频yy9299一区| 欧美xfplay| 欧美一区二区三区四区在线观看 | 日本一区免费视频| 日韩精品一区二区三区三区免费| 欧美三级日本三级少妇99| 97精品久久久午夜一区二区三区| 国产一区二区三区免费看| 久久精品免费看| 视频一区欧美精品| 日韩国产精品大片| 爽好多水快深点欧美视频| 亚洲午夜免费视频| 亚洲午夜羞羞片| 亚洲午夜精品在线| 亚洲在线中文字幕| 亚洲一区二区中文在线| 亚洲国产精品久久艾草纯爱| 亚洲综合区在线| 亚洲综合区在线| 午夜伦欧美伦电影理论片| 婷婷成人激情在线网| 五月天中文字幕一区二区| 亚洲成av人片观看| 日本亚洲最大的色成网站www| 首页亚洲欧美制服丝腿| 人人爽香蕉精品| 国产麻豆视频一区| 国产69精品久久99不卡| www.一区二区| 色屁屁一区二区| 欧美日韩免费观看一区二区三区| 欧美日韩国产大片| 精品国产乱码久久久久久影片| 久久一区二区三区四区| 国产精品久久久久久久久搜平片 | 亚洲欧美经典视频| 一区二区三区不卡视频在线观看| 亚洲综合丝袜美腿| 日本午夜一本久久久综合| 九九**精品视频免费播放| 成人h动漫精品一区二区| 色爱区综合激月婷婷| 欧美精品1区2区| xvideos.蜜桃一区二区| 国产精品人妖ts系列视频| 依依成人综合视频| 精品一区二区三区的国产在线播放 | 老司机精品视频线观看86| 国产成人亚洲综合a∨猫咪| 91在线云播放| 日韩精品中文字幕一区| 国产精品国产三级国产aⅴ入口 | 一区二区在线电影| 日本女人一区二区三区| 成人三级伦理片| 欧美日韩性生活| 久久精品夜色噜噜亚洲aⅴ| 一区二区三区四区高清精品免费观看 | 精品少妇一区二区三区免费观看 | 国产一区二区免费视频| 色综合久久综合| 久久精品无码一区二区三区| 亚洲一卡二卡三卡四卡五卡| 国产盗摄一区二区| 91精品国产欧美一区二区|