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