opnet之General Sub-Package

op_pk_create_fmt()

Syntax
op_pk_create_fmt (format_name)

This value is the name of a packet format created using the Packet Format Editor. The packet format specified must be located in the model directories, or an error will occur.

lmz:
创建一个已定义宝格式的包。既然是已经定义的格式,则自定义的格式必须在当前的model目录下。

/* Compose a mac frame from all these elements */
mac_frame_ptr = op_pk_create_fmt ("fddi_mac_fr");
op_pk_nfd_set (mac_frame_ptr, "svc_class", svc_class);
op_pk_nfd_set (mac_frame_ptr, "dest_addr", dest_addr);
op_pk_nfd_set (mac_frame_ptr, "src_addr", my_address);
op_pk_nfd_set (mac_frame_ptr, "info", pdu_ptr);

if (svc_class == FDDI_SVC_ASYNC)
    {
    op_pk_nfd_set (mac_frame_ptr, "tk_class", req_tk_class);
    op_pk_nfd_set (mac_frame_ptr, "pri", req_pri);
    }

/* Enqueue the frame at the tail of the queue. */
op_subq_pk_insert (0, mac_frame_ptr, OPC_QPOS_TAIL); 

 op_pk_type()

>lmz:
包是有格式的:

  • OPC_PACKET_TYPE_FORMATTED 有格式
  • OPC_PACKET_TYPE_UNFORMATTED 无格式
  • OPC_PACKET_TYPE_VVEC 值向量
if (op_pk_type (pkptr) == OPC_PACKET_TYPE_VVEC)
        {
        /* Access the value vector in this packet */
        ...
        }
else
        {
        /* This packet contains fields. */
        /* Convert the packet to its value vector form */
        ...
        }

op_pk_send_quiet()

lmz:包的到达会触发流中断,但是这个函数不会触发。

op_pk_send_forced()

lmz:所谓的强制就是立即触发所要强制的中断,暂停当前的中断。
强制的中断执行完毕后再返回之前暂停的中断。

op_pk_send_delayed()

Forwards the specified packet through an output packet stream, schedules the packet’s arrival at a destination module for a delayed simulation time, and releases ownership of the packet by the invoking process.

op_pk_send()

Forwards the specified packet through an output packet stream, schedules the packet’s arrival at a destination module for the current simulation time, and releases ownership of the packet by the invoking process.

lmz:原来流中断的触发本质是schedule的一个remote中断。
以前就猜想包在包流中的传递不需要时间,当然只是相对于op_pk_send()来说。

tags:opnet

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值