22.11.2014 Views

Understanding TCP/IP Model Internals and Interfaces

Understanding TCP/IP Model Internals and Interfaces

Understanding TCP/IP Model Internals and Interfaces

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Sending a Packet to <strong>IP</strong><br />

The MAC process receives a packet from the network, it decapsulates the <strong>IP</strong> packet from the MAC<br />

packet <strong>and</strong> sends it to the ARP module. No ICIs are involved here. In the simple_mac process model<br />

this is performed in the function simple_mac_packet_from_ntwk_h<strong>and</strong>le (no need to<br />

make any coding changes):<br />

FIN (simple_mac_packet_from_ntwk_h<strong>and</strong>le (mac_pkptr));<br />

/* Decapsulate the <strong>IP</strong> datagram from the packet. */<br />

op_pk_nfd_get (mac_pkptr, "data", &ip_pkptr);<br />

/* Print a trace Message */<br />

if (SMC_LTRACE_ACTIVE)<br />

{<br />

/* Get the source address from the packet */<br />

op_pk_nfd_get (mac_pkptr, "source address",<br />

&source_address);<br />

sprintf (msg, "Source Address: %d", source_address);<br />

op_prg_odb_print_major ("Received a Packet from the”<br />

“Network", msg, OPC_NIL);<br />

}<br />

/* Send the packet to the higher layer. */<br />

op_pk_send (ip_pkptr, SMC_OUT_STRM_INDEX_TO_ARP);<br />

/* Destroy the MAC packet. */<br />

op_pk_destroy (mac_pkptr);<br />

FOUT;<br />

Save <strong>and</strong> Compile the Process <strong>Model</strong><br />

1. Save <strong>and</strong> compile the process model.<br />

2. If you are having problems in compilation, you may<br />

a. Close the simple_mac process model.<br />

b. Open the simple_mac_ref process model.<br />

c. Save it as simple_mac.<br />

d. Recompile.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!