Beispiel #1
0
        private void Stats(MemoryStream ms, OfpHeader header)
        {
            if (header.Type == OfpType.OFPT_STATS_REQUEST)
            {
                return;
            }
            else
            {
                OfpStatsReply reply  = new OfpStatsReply(ms, header);
                MemoryStream  bodyms = new MemoryStream(reply.Body);
                switch (reply.Type)
                {
                case OfpStatsTypes.OFPST_DESC:
                    OfpDescStats stats1 = new OfpDescStats(bodyms);
                    _controller.PluginSystem.DescStats(stats1, this);
                    break;

                case OfpStatsTypes.OFPST_FLOW:
                    OfpFlowStats stats2 = new OfpFlowStats(bodyms);
                    _controller.PluginSystem.FlowStats(stats2, this);
                    break;

                case OfpStatsTypes.OFPST_AGGREGATE:
                    OfpAggregateStats stats3 = new OfpAggregateStats(bodyms);
                    _controller.PluginSystem.AggregateStats(stats3, this);
                    break;

                case OfpStatsTypes.OFPST_TABLE:
                    OfpTableStats stats4 = new OfpTableStats(bodyms);
                    _controller.PluginSystem.TableStats(stats4, this);
                    break;

                case OfpStatsTypes.OFPST_PORT:
                    OfpPortStats stats5 = new OfpPortStats(bodyms);
                    _controller.PluginSystem.PortStats(stats5, this);
                    break;

                case OfpStatsTypes.OFPST_QUEUE:
                    OfpQueueStats stats6 = new OfpQueueStats(bodyms);
                    _controller.PluginSystem.QueueStats(stats6, this);
                    break;

                case OfpStatsTypes.OFPST_VENDOR:
                    OfpVendorStats stats7 = new OfpVendorStats(bodyms, (int)ms.Length);
                    _controller.PluginSystem.VendorStats(stats7, this);
                    break;

                default:
                    //throw new ArgumentOutOfRangeException();
                    break;
                }
                bodyms.Dispose();
            }
        }
Beispiel #2
0
 /// <summary>
 /// 处理描述统计消息
 /// </summary>
 /// <param name="stats"></param>
 /// <param name="handler"></param>
 /// <returns></returns>
 public virtual bool DescStats(OfpDescStats stats, IConnection handler)
 {
     foreach (var plugin in Plugins.Values.Where(plugin => plugin.Active))
     {
         try
         {
             bool result = plugin.MessageHandler.DescStats(stats, handler);
             if (result)
             {
                 break;
             }
         }
         catch (Exception e)
         {
             Debug.WriteLine(e);
         }
     }
     return(true);
 }
Beispiel #3
0
 /// <summary>
 /// 处理描述统计消息
 /// </summary>
 /// <param name="stats"></param>
 /// <param name="handler"></param>
 /// <returns></returns>
 public virtual bool DescStats(OfpDescStats stats, IConnection handler)
 {
     return(false);
 }