简单了解一下ndnSIM中的APP

Application helper

Application helper是创建、配置、安装ndnSIM application的入口。
基本用法:

  • 创建一个特定类型的app:
// Create helper for the consumer generating Interests with constant rate
AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
  • 设置前缀
    前缀是interest请求数据的时候用的,返回data的时候也会用到
consumerHelper.SetPrefix(prefix);
  • 设置特定的属性
// Set frequency parameter
consumerHelper.SetAttribute("Frequency", StringValue ("10")); // 10 interests a second
  • 安装
NodeContainer nodes;
...
consumerHelper.Install(nodes)

各种apps

ConsumerCbr

以预定义的模式来产生Interest包,比如固定频率,指数随机等。

// Create application using the app helper
AppHelper helper("ns3::ndn::ConsumerCbr");
  • 固定频率
 // Set attribute using the app helper
helper.SetAttribute("Frequency", DoubleValue (1.0));
  • 随机
    参数选项
    1. ”none”没有随机化
    2. “uniform” (0, 1/Frequency)范围内的均匀分布
    3. “exponential”平均值为1/Frequency的指数分布
// Set attribute using the app helper
helper.SetAttribute("Randomize", StringValue("uniform"));

ConsumerZipfMandelbrot

产生服从Zipf-Mandelbrot分布的interest

// Create application using the app helper
ndn::AppHelper helper("ns3::ndn::ConsumerZipfMandelbrot");

ConsumerBatches

ConsumerBatches是一种开关风格的应用,它可以在特定的节点产生指定数量的interest。

// Create application using the app helper
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerBatches");

主要参数

Batches

用于指定interest包的模式,默认为空,模式是指,有多少interest包在什么时候被发送。如1个Interest在时间点1秒时,被发送,5个Interest在2秒时被发送,2个Interest在10秒时被发送。

// Set attribute using the app helper
consumerHelper.SetAttribute("Batches", StringValue("1s 1 2s 5 10s 2"));

由于Interest包不是瞬发的,ConsumerBatches仅仅是在指定时间开始数据包的发送,有可能出现如下结果:

1s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 0
2s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 1
2s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 2
2.2s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 3
2.4s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 4
2.6s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 5
10s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 6
10.2s 0 ndn.Consumer:SendPacket(): [INFO ] > Interest for 7

ConsumerWindow

ConsumerWindow是一种产生变化速率Interest包的app。

// Create application using the app helper
AppHelper consumerHelper("ns3::ndn::ConsumerWindow");

参数:

  • window 它的值表示Initial number of Interests that will be send out without waiting for the data (number of outstanding Interests)
  • PayloadSize data的payload
  • Size 默认-1,Amount of data to be requested (will stop issuing Interests after Size data is received) ,If Size is set to -1, Interests will be requested till the end of the simulation.

Producer

// Create application using the app helper
AppHelper consumerHelper("ns3::ndn::Producer");

Custom applications

APP通过AppLinkService 与系统的核心进行交互,为了简化NDN中APP的实现, ndnSIM提供了一个基本的App类, 它已经将AppLinkService 创建好并注册到NDN的协议栈中,同时,提供了默认的处理Interest和Data包的方法。

研究代码中。。。更多详细待补充

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值