Table of Contents

Defining Parameters
 

 
When you click , you can define the parameters for the simulation model. 

The button  defines the packet format of the protocol. Here is an example of the IP packet format. 

You can edit the name, data type, data length, default value of each field. The example code below shows how to use the packet format in the source code.
// Sender
Packet *ip_pkptr;

ip_pkptr = op_pk_create_fmt( "ip_dgram" );          // Allocate memory for packet.
op_pk_nfd_set( ip_pkptr, "src_net", src_net );      // Fill the data field.
op_pk_nfd_set( ip_pkptr, "src_node", src_node );
op_pk_send( ip_pkptr, IP_STREAM );                // Send packet to outgoing stream
                                                  // Do not free memory here!

// Receiver
Packet *pkptr;

pkptr = op_pk_get( in_strm );              // Obtain a packet from the input stream
op_pk_nfd_get( pkptr, "src_net", &src_net );      // read in fields from the packet
op_pk_nfd_get( pkptr, "src_node", &src_node );
op_pk_destroy(decap_pkptr);                       // destroy the memory


Table of Contents