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