Networking Reference
In-Depth Information
#define UPPER_STRM ( \
(op_intrpt_type() == OPC_INTRPT_STRM) && \
(op_intrpt_strm() == UPPER_IN_STRM_INDEX))
#define LOWER_STRM ( \
(op_intrpt_type() == OPC_INTRPT_STRM) && \
(op_intrpt_strm() == LOWER_IN_STRM_INDEX))
static void print_pk_size(Packet *);
HB block
Figure 5.35
static void print_pk_size(Packet *pk)
char msg[128];
sprintf(msg, "Payloadpacketsize:%d", \
op_sim_message("Wrapperpacketheader>5", msg);
FB block
Figure 5.36
function is valid only in the current source ſle and there is no naming conƀict if other
process model ſles deſne a function having the same name.
Q5.10 Why do we use “static” keywords?
This is because different process models are saved as different sourceſles. A “static”
keyword deſned for a function is used to limit the function in the scope of the current
sourceſle of the simulation program. In other sourceſles of the program, functions with
the same name can be deſned without a “redeſnition” error.
In FB block, add code to implement the function, shown in Figure 5.36. The macros
“FIN” and “FOUT” are used inOPNET functions to enable the OPNETdebugging kernel
to print out function information. For more details, check Chapter 11 on the topics of
debugging in OPNET Modeler.
In “from_src” state, add code to create the formatted packet “wrapper_pk,” set the
“header” ſeld of the formatted packet to a random integer number from 0 to 10, and
Search MirCeyron ::

Custom Search