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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sender.cpp

?? 一個開源的網(wǎng)絡(luò)開發(fā)庫ACE
?? CPP
字號:
/* -*- C++ -*- */
// sender.cpp,v 1.2 2002/02/18 16:01:56 crodrigu Exp

// ============================================================================
//
// = LIBRARY
//    ACE_wrappers/examples/QOS
//
// = FILENAME
//    client.cpp
//
// = AUTHOR
//    Vishal Kachroo <vishal@cs.wustl.edu>
//
// ============================================================================


#include "ace/OS.h"
#include "ace/QoS/QoS_Session.h"
#include "ace/QoS/QoS_Session_Factory.h"
#include "ace/QoS/QoS_Session_Impl.h"
#include "ace/QoS/QoS_Decorator.h"
#include "ace/QoS/SOCK_Dgram_Mcast_QoS.h"

#include "QoS_Util.h"
#include "Fill_ACE_QoS.h"
#include "QoS_Signal_Handler.h"
#include "Sender_QoS_Event_Handler.h"

// To open QOS sockets administrative access is required on the
// machine. Fill in default values for QoS structure.  The default
// values were simply choosen from existing QOS templates available
// via WSAGetQosByName.  Notice that ProviderSpecific settings are
// being allowed when picking the "default" template but not for
// "well-known" QOS templates.  Also notice that since data is only
// flowing from sender to receiver, different flowspecs are filled in
// depending upon whether this application is acting as a sender or
// receiver.

// This function fills up the ACE_QoS_Params with the supplied iovec and ACE_QoS.

int
FillQoSParams (ACE_QoS_Params &qos_params,
               iovec* iov, 
               ACE_QoS* qos)
{
  qos_params.callee_data (iov);
  qos_params.caller_data (0);
  qos_params.socket_qos (qos);
  qos_params.group_socket_qos (0);
  qos_params.flags (ACE_JL_BOTH);

  return 0;
}

int
main (int argc, char * argv[])
{  

  ACE_DEBUG ((LM_DEBUG,
              "Sender\n"));

  QoS_Util qos_util(argc, argv);

  if (qos_util.parse_args () == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "Error in parsing args\n"),
                      -1);

  // This is a multicast application.
  if (qos_util.multicast_flag ())
    {
       Fill_ACE_QoS  fill_ace_qos;

       // The application adds the flow specs that it wants into the
       // Fill_ACE_QoS. The Fill_ACE_QoS indexes the flow specs by the flow
       // spec names. Here the new flowspec being added is g_711.
       ACE_CString g_711 ("g_711");

       switch (fill_ace_qos.map ().bind (g_711,
                                         new ACE_Flow_Spec (9200,
                                                            708,
                                                            18400,
                                                            0,
                                                            0,
                                                            ACE_SERVICETYPE_CONTROLLEDLOAD,
                                                            368,
                                                            368,
                                                            25,
                                                            1)))
         {
         case 1 : 
           ACE_ERROR_RETURN ((LM_ERROR,
                              "Unable to bind the new flow spec\n"
                              "The Flow Spec name already exists\n"),
                             -1);
           break;
         case -1 :
           ACE_ERROR_RETURN ((LM_ERROR,
                              "Unable to bind the new flow spec\n"),
                             -1);
           break;
         }
    
       ACE_DEBUG ((LM_DEBUG,
                   "g_711 Flow Spec bound successfully\n"));

       // This is a sender. So we fill in the sending QoS parameters.
       ACE_QoS ace_qos_sender;

       if (fill_ace_qos.fill_simplex_sender_qos (ace_qos_sender,
                                                 g_711) !=0)
         ACE_ERROR_RETURN ((LM_ERROR,
                            "Unable to fill simplex sender qos\n"),
                           -1);
       else
         ACE_DEBUG ((LM_DEBUG,
                     "Filled up the Sender QoS parameters\n"));
       
       // Opening a new Multicast Datagram. It is absolutely necessary that
       // the sender and the receiver subscribe to the same multicast
       // addresses to make sure the "multicast sessions" for the two are
       // the same. This is used to match the RESV<->PATH states.
       ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos;
       
      // Multicast Session Address specified by user at command line.
      // If this address is not specified, 
      // <localhost:ACE_DEFAULT_MULTICAST_PORT> is assumed. 
       ACE_INET_Addr mult_addr (*(qos_util.mult_session_addr ()));
      
      // Fill the ACE_QoS_Params to be passed to the <ACE_OS::join_leaf>
      // through subscribe.
      
      ACE_QoS_Params qos_params;
      FillQoSParams (qos_params, 0, &ace_qos_sender);
      
      // Create a QoS Session Factory.
      ACE_QoS_Session_Factory session_factory;
      
      // Ask the factory to create a QoS session.
      ACE_QoS_Session *qos_session = 
        session_factory.create_session ();
      
      // Create a destination address for the QoS session. The same
      // address should be used for the subscribe call later. A copy is
      // made below only to distinguish the two usages of the dest
      // address.

      ACE_INET_Addr dest_addr (mult_addr);

      // A QoS session is defined by the 3-tuple [DestAddr, DestPort,
      // Protocol]. Initialize the QoS session.
      if (qos_session->open (mult_addr,
                             IPPROTO_UDP) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Error in opening the QoS session\n"),
                          -1);
      else
        ACE_DEBUG ((LM_DEBUG,
                    "QoS session opened successfully\n"));

      // The following call opens the Dgram_Mcast and calls the
      // <ACE_OS::join_leaf> with the qos_params supplied here. Note the
      // QoS session object is passed into this call. This subscribes the
      // underlying socket to the passed in QoS session. For joining
      // multiple multicast sessions, the following subscribe call should
      // be made with different multicast addresses and a new QoS session
      // object should be passed in for each such call. The QoS session
      // objects can be created only through the session factory. Care
      // should be taken that the mult_addr for the subscribe() call
      // matches the dest_addr of the QoS session object. If this is not
      // done, the subscribe call will fail. A more abstract version of
      // subscribe will be added that constrains the various features of
      // GQoS like different flags etc.
      
      if (dgram_mcast_qos.subscribe (mult_addr,
                                     qos_params,
                                     1,
                                     0,
                                     AF_INET,
                                     // ACE_FROM_PROTOCOL_INFO,
                                     0,
                                     0, // ACE_Protocol_Info,
                                     0,
                                     ACE_OVERLAPPED_SOCKET_FLAG 
                                     | ACE_FLAG_MULTIPOINT_C_LEAF 
                                     | ACE_FLAG_MULTIPOINT_D_LEAF,
                                     qos_session) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Error in subscribe\n"),
                          -1);
      else
        ACE_DEBUG ((LM_DEBUG,
                    "Dgram_Mcast subscribe succeeds \n"));

      int nIP_TTL = 25;
      char achInBuf [BUFSIZ];
      u_long dwBytes;
  
      // Should this be abstracted into QoS objects ?? Doesnt seem to have
      // to do anything directly with QoS.
      if (ACE_OS::ioctl (dgram_mcast_qos.get_handle (), // Socket.
                         ACE_SIO_MULTICAST_SCOPE, // IO control code.
                         &nIP_TTL, // In buffer.
                         sizeof (nIP_TTL), // Length of in buffer.
                         achInBuf, // Out buffer.
                         BUFSIZ, // Length of Out buffer.
                         &dwBytes, // bytes returned.
                         0, // Overlapped.
                         0) == -1) // Func.
        ACE_ERROR ((LM_ERROR,
                    "Error in Multicast scope ACE_OS::ioctl() \n"));
      else
        ACE_DEBUG ((LM_DEBUG,
                    "Setting TTL with Multicast scope ACE_OS::ioctl call succeeds \n"));
      
      int bFlag = 0;
      
      // Should this be abstracted into QoS objects ?? Doesnt seem to have
      // to do anything directly with QoS.
      if (ACE_OS::ioctl (dgram_mcast_qos.get_handle (), // Socket.
                         ACE_SIO_MULTIPOINT_LOOPBACK, // IO control code.
                         &bFlag, // In buffer.
                         sizeof (bFlag), // Length of in buffer.
                         achInBuf, // Out buffer.
                         BUFSIZ, // Length of Out buffer.
                         &dwBytes, // bytes returned.
                         0, // Overlapped.
                         0) == -1) // Func.
        ACE_ERROR ((LM_ERROR,
                    "Error in Loopback ACE_OS::ioctl() \n"));
      else
        ACE_DEBUG ((LM_DEBUG,
                    "Disable Loopback with ACE_OS::ioctl call succeeds \n"));
      
      // This is a sender. 
      qos_session->flags (ACE_QoS_Session::ACE_QOS_SENDER);
      
      ACE_QoS_Manager qos_manager = dgram_mcast_qos.qos_manager ();
      
      // Since we are using RSVP, it is imperative that the client
      // application have the option of supplying the source sender
      // port for the RSVP messages. A default will be chosen by the
      // ACE API if this is not done.
      qos_session->source_port (qos_util.source_port ());
      
      // Set the QoS for the session. Replaces the ioctl () call that
      // was being made previously.
      if (qos_session->qos (&dgram_mcast_qos,
                            &qos_manager,
                            ace_qos_sender) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Unable to set QoS\n"),
                          -1);
      else
        ACE_DEBUG ((LM_DEBUG,
                    "Setting QOS succeeds.\n"));
      
      // Register a signal handler that helps to gracefully close the open
      // QoS sessions.
      QoS_Signal_Handler qos_signal_handler (qos_session);

      // Register the usual SIGINT signal handler with the Reactor for
      // the application to gracefully release the QoS session and
      // shutdown.
      if (ACE_Reactor::instance ()->register_handler 
          (SIGINT, &qos_signal_handler) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Error in registering the Signal Handler.\n"),
                          -1);

      // Handler to process QoS and Data events for the reciever.
      Sender_QoS_Event_Handler qos_event_handler (dgram_mcast_qos,
                                                  qos_session);

      // Decorate the above handler with QoS functionality. 
      ACE_QoS_Decorator qos_decorator (&qos_event_handler,
                                       qos_session);

      // Initialize the Decorator.
      if (qos_decorator.init () != 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "QoS Decorator init () failed.\n"),
                          -1);

      // Register the decorated Event Handler with the Reactor.
      if (ACE_Reactor::instance ()->register_handler (&qos_decorator,
                                                      ACE_Event_Handler::QOS_MASK |
                                                      ACE_Event_Handler::READ_MASK) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Error in registering the Decorator with the Reactor\n"),
                          -1);


      
      // Start the event loop.
      ACE_DEBUG ((LM_DEBUG,
                  "Running the Event Loop ... \n"));
      
      ACE_Reactor::instance ()->run_event_loop ();
      
      ACE_DEBUG ((LM_DEBUG,
                  "(%P|%t) shutting down server logging daemon\n"));
    }
  else
    ACE_DEBUG ((LM_DEBUG,
                "Specify a -m option for multicast application\n"));
  return 0;
}







?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕欧美国产| 欧美一区二区视频在线观看2020 | 91精品婷婷国产综合久久 | 亚洲国产成人91porn| 亚洲美女偷拍久久| 一区二区免费在线播放| 亚洲永久精品国产| 亚洲中国最大av网站| 亚洲一区二区三区小说| 日韩精品一卡二卡三卡四卡无卡| 精品一区二区三区在线视频| 亚洲国产欧美一区二区三区丁香婷| 一区二区三区中文字幕在线观看| 洋洋成人永久网站入口| 亚洲午夜在线电影| 男女性色大片免费观看一区二区| 日本在线不卡视频| 国产精品小仙女| 成人国产亚洲欧美成人综合网| 99re视频精品| 欧美精品 国产精品| 日韩美女天天操| 国产婷婷色一区二区三区在线| 欧美国产亚洲另类动漫| 亚洲精品视频在线观看免费 | 3d成人动漫网站| 久久影视一区二区| 亚洲精品老司机| 蜜桃传媒麻豆第一区在线观看| 国精产品一区一区三区mba视频| 成人黄色小视频在线观看| 在线一区二区视频| 久久色视频免费观看| 亚洲视频在线一区二区| 青青青伊人色综合久久| 高清av一区二区| 欧美一区二区视频观看视频 | 99re视频精品| 精品国产欧美一区二区| 最新热久久免费视频| 老汉av免费一区二区三区| 91香蕉视频污在线| 久久亚洲综合色| 亚洲一二三级电影| 成人精品小蝌蚪| 日韩欧美一级在线播放| 尤物视频一区二区| 国产精品1024| 精品美女一区二区三区| 亚洲成人在线免费| av激情综合网| 久久久久久免费毛片精品| 天天综合日日夜夜精品| 91久久久免费一区二区| 国产精品免费久久| 狠狠久久亚洲欧美| 91麻豆精品国产91| 午夜私人影院久久久久| 色天天综合色天天久久| 国产精品国产三级国产有无不卡| 久久99精品久久久久久久久久久久| 欧美在线播放高清精品| 国产精品久久免费看| 懂色av中文一区二区三区| 精品久久人人做人人爰| 捆绑调教美女网站视频一区| 欧美久久久一区| 婷婷久久综合九色综合绿巨人 | 国产精品视频九色porn| 国产真实精品久久二三区| 欧美一级高清片在线观看| 亚洲与欧洲av电影| 欧美日韩黄色影视| 亚洲成a人片综合在线| 欧美午夜精品一区二区蜜桃| 亚洲精品国产无套在线观| 色女孩综合影院| 亚洲五月六月丁香激情| 欧美日韩一区二区三区不卡| 香蕉乱码成人久久天堂爱免费| 欧美日韩一二三区| 三级在线观看一区二区| 日韩一区二区三区视频| 久久成人久久鬼色| 精品精品欲导航| 国产精品一区在线观看你懂的| 国产丝袜欧美中文另类| 国产suv精品一区二区883| 中文字幕视频一区二区三区久| 99久久久精品| 亚洲第一成人在线| 日韩免费在线观看| 成人免费电影视频| 亚洲成在人线在线播放| 日韩欧美aaaaaa| 粉嫩13p一区二区三区| 一区二区在线电影| 欧美一区二区播放| 福利一区在线观看| 亚洲三级电影网站| 这里只有精品电影| 国产91精品免费| 亚洲国产精品一区二区www| 日韩精品一区二区三区四区视频| 国产91精品露脸国语对白| 亚洲精品免费在线播放| 精品免费日韩av| 色av一区二区| 国产在线视视频有精品| 亚洲欧洲制服丝袜| 精品人在线二区三区| 91日韩在线专区| 久久精品国产第一区二区三区| 国产精品久久看| 日韩一区二区三区观看| 91丨porny丨在线| 久久精品国产精品亚洲精品| 亚洲欧美日韩电影| 欧美tk—视频vk| 欧洲精品一区二区| 国产高清亚洲一区| 日本女优在线视频一区二区| 国产精品久久777777| 欧美不卡一区二区三区四区| 色综合中文字幕国产| 日韩精品亚洲一区| 亚洲国产成人自拍| 精品国产99国产精品| 欧美精品乱码久久久久久| 不卡欧美aaaaa| 国产呦萝稀缺另类资源| 天堂va蜜桃一区二区三区| 国产精品亲子伦对白| 欧美精品一区二区三区四区| 欧美日韩成人在线| 在线观看精品一区| 91亚洲精品久久久蜜桃| 国产999精品久久久久久| 久久99精品国产麻豆不卡| 亚洲一二三区视频在线观看| 亚洲视频免费在线| 最新国产精品久久精品| 欧美—级在线免费片| 久久综合九色综合久久久精品综合| 欧美人与禽zozo性伦| 91在线观看污| 91在线精品一区二区| 91视频在线观看| 91在线精品秘密一区二区| 99精品国产视频| www.亚洲精品| 色综合亚洲欧洲| 91美女福利视频| 91黄色激情网站| 欧美午夜一区二区三区| 在线观看免费成人| 欧美三级资源在线| 欧美精品在线观看播放| 欧美一区二区三区免费观看视频| 在线成人av网站| 日韩区在线观看| 欧美大黄免费观看| 久久精品一区二区三区不卡 | 精品久久人人做人人爽| 久久先锋资源网| 中文字幕欧美激情一区| 亚洲精品亚洲人成人网| 亚洲一区二区三区三| 偷偷要91色婷婷| 国产一区二区三区美女| 福利91精品一区二区三区| 99精品偷自拍| 在线不卡免费欧美| 久久蜜桃av一区精品变态类天堂 | 在线播放/欧美激情| 欧美经典一区二区| 亚洲少妇30p| 亚洲成在线观看| 韩国毛片一区二区三区| 成人高清免费观看| 欧美日韩一区二区三区不卡| 欧美成人精精品一区二区频| 欧美激情一区二区三区全黄| 一个色在线综合| 久久国产精品露脸对白| 99精品视频在线观看| 欧美日韩国产在线观看| 久久久久88色偷偷免费| 亚洲精品国产无套在线观| 美女精品自拍一二三四| 99久久精品国产精品久久| 欧美喷水一区二区| 国产精品无遮挡| 三级欧美韩日大片在线看| 成人午夜在线播放| 91精品国产综合久久香蕉麻豆| 国产精品色婷婷| 美女看a上一区| 欧美日韩国产一二三| 国产精品天干天干在观线|