SITL Translation Functions

This section describes the packet translation Kernel Procedures supplied with SITL.

Registration Functions

op_pk_sitl_register_translation_function()

Registers a translation/test function pair. The prototype is:

int op_pk_sitl_register_translation_function (
    OP_SIM_CONTEXT_ARG_OPT_COMMA 
    SitlT_Translation_Direction direction,
    SitlT_Translation_Function translation_func,
    SitlT_Translation_Test translation_test,
    const char* base_packet_format, int priority);

op_pk_sitl_unregister_translation_function()

De-registers a translation/test function pair. The prototype is:

int op_pk_sitl_unregister_translation_function (
    OP_SIM_CONTEXT_ARG_OPT_COMMA 
    SitlT_Translation_Direction direction, 
    SitlT_Translation_Function translation_func,
    SitlT_Translation_Test translation_test);

Payload Translation Functions

op_pk_sitl_translate_payload_from_real_to_sim()

Converts the payload of a packet from real to simulated. The prototype is:

int op_pk_sitl_translate_payload_from_real_to_sim (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_payload_from_sim_to_real()

Converts the payload of a packet from simulated to real. The prototype is:

int op_pk_sitl_translate_payload_from_sim_to_real (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

Initialization Function

op_pk_sitl_packet_translation_init()

Calls the registration function on all translation functions. See Built-in Translation Function Registration for details. The prototype is:

int op_pk_sitl_packet_translation_init (OP_SIM_CONTEXT_ARG_OPT_COMMA void);

Translation Functions from Real to Simulated

op_pk_sitl_from_real_all_supported()

Used as translation entry point. Calls the payload translation function. The prototype is:

int op_pk_sitl_from_real_all_supported (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ethernet()

Converts an Ethernet packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ethernet (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_arp()

Converts an ARP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_arp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_ip()

Converts an IPv4 IP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_ip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_icmp()

Converts an IPv4 ICMP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_icmp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_tcp()

Converts an IPv4 TCP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_tcp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_udp()

Converts an IPv4 UDP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_udp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_ospf()

Converts an IPv4 OSPF packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_ospf (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_from_real_ipv4_rip()

Converts an IPv4 RIP packet from real to simulated. The prototype is:

int op_pk_sitl_translate_from_real_ipv4_rip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

Translation Functions from Simulated to Real

op_pk_sitl_to_real_all_supported()

Used as translation entry point. Calls the payload translation function. The prototype is:

int op_pk_sitl_to_real_all_supported (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ethernet()

Converts an Ethernet packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ethernet (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_arp()

Converts an ARP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_arp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_ip()

Converts an IPv4 IP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_ip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_icmp()

Converts an IPv4 ICMP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_icmp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_tcp()

Converts an IPv4 TCP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_tcp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_udp()

Converts an IPv4 UDP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_udp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_ospf()

Converts an IPv4 OSPF packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_ospf (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

op_pk_sitl_translate_to_real_ipv4_rip()

Converts an IPv4 RIP packet from simulated to real. The prototype is:

int op_pk_sitl_translate_to_real_ipv4_rip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

Test Functions

These functions are paired with translation functions. However, most of time the same test function is used for both real-to-simulated and simulated-to-real translations.

int op_pk_sitl_test_from_real_ethernet (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_to_real_ethernet (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr)
int op_pk_sitl_test_from_real_arp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_ip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_icmp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_tcp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_udp (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_ospf (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_from_real_ipv4_rip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);
int op_pk_sitl_test_to_real_ipv4_ip (OP_SIM_CONTEXT_ARG_OPT_COMMA SitlT_SCDB* scdb_ptr);

Simulation Packet Formats Supported by SITL

The simulated-to-real KPs expect standard Riverbed packet formats. The supported formats are

  • ethernet_v2
  • ip_dgram_v4
  • arp_v2
  • tcp_seg_v2
  • ip_icmp_echo
  • udp_dgram_v2
  • rip_message2
  • ospf_hello_v2
  • ospf_dbase_desc_v2
  • ospf_ls_request_v2
  • ospf_ls_update_v2
  • ospf_ls_ack_v2

The KPs will translate any packet in one of these formats found at the current nesting level. You can examine the details of these formats by opening them in the Packet Format Editor.

The simulation packets returned by the real-to-simulated KPs use the same set of standard Riverbed packet formats. However, the formats might be modified as follows.

All Packets

If a packet of an unsupported protocol reaches SITL, at any nesting level, a block of memory holding the untranslated payload will be stored as a structure field in an unformatted packet and this packet will be the result of the translation, usually the payload of a lower-level packet. You can limit the translation to an arbitrary level using the Maximum Packet Translation Level attribute of SITL nodes. The untranslated data will be stored in an unformatted packet as described above.

TCP and UDP Packets

If the destination address for the real packet is inside the simulation, SITL tries to convert the payload. If the destination address for the real packet is outside the simulation, the payload data will be encapsulated in an unformatted packet (as described for all packets) and set as the payload packet of the TCP or UDP packet. This behavior is controlled by the Limit Pass-through Translation To IP Level attribute of SITL nodes. By default, it is set to “enabled”. You can set it to “disabled” to allow full translation of TCP and UDP packets passing through the simulation.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com