SAP Router

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

In [1]:
from pysap.SAPRouter import *
from IPython.display import display

SAP Router Admin packets

In [2]:
for command in router_adm_commands:
    p = SAPRouter(type=SAPRouter.SAPROUTER_ADMIN, adm_command=command)
    print(router_adm_commands[command])
    display(p.canvas_dump())
Information Request
../_images/protocols_SAPRouter_4_1.png
New Route Table Request
../_images/protocols_SAPRouter_4_3.png
Toggle Trace Request
../_images/protocols_SAPRouter_4_5.png
Stop Request
../_images/protocols_SAPRouter_4_7.png
Cancel Route Request
../_images/protocols_SAPRouter_4_9.png
Dump Buffers Request
../_images/protocols_SAPRouter_4_11.png
Flush Buffers Request
../_images/protocols_SAPRouter_4_13.png
Soft Shutdown Request
../_images/protocols_SAPRouter_4_15.png
Set Trace Peer
../_images/protocols_SAPRouter_4_17.png
Clear Trace Peer
../_images/protocols_SAPRouter_4_19.png
Trace Connection
../_images/protocols_SAPRouter_4_21.png
Trace Connection
../_images/protocols_SAPRouter_4_23.png
Hide Error Information Request
../_images/protocols_SAPRouter_4_25.png

SAP Router Error Information / Control packets

In [3]:
for opcode in router_control_opcodes:
    p = SAPRouter(type=SAPRouter.SAPROUTER_CONTROL, opcode=opcode)
    if opcode in [70, 71]:
        p.snc_frame = ""
    print(router_control_opcodes[opcode])
    display(p.canvas_dump())
Error information
../_images/protocols_SAPRouter_6_1.png
Version request
../_images/protocols_SAPRouter_6_3.png
Version response
../_images/protocols_SAPRouter_6_5.png
Send Handle (5)
../_images/protocols_SAPRouter_6_7.png
Send Handle (6)
../_images/protocols_SAPRouter_6_9.png
SNC handshake complete
../_images/protocols_SAPRouter_6_11.png
Send Handle (8)
../_images/protocols_SAPRouter_6_13.png
SNC request
../_images/protocols_SAPRouter_6_15.png

SAP Router Route packet

In [4]:
router_string = [SAPRouterRouteHop(hostname="8.8.8.8", port=3299),
                 SAPRouterRouteHop(hostname="10.0.0.1", port=3200, password="S3cr3t")]
router_string_lens = map(len, map(str, router_string))
p = SAPRouter(type=SAPRouter.SAPROUTER_ROUTE,
              route_entries=len(router_string),
              route_talk_mode=1,
              route_rest_nodes=1,
              route_length=sum(router_string_lens),
              route_offset=router_string_lens[0],
              route_string=router_string)
display(p.canvas_dump())
for x in router_string:
    display(x.canvas_dump())
../_images/protocols_SAPRouter_8_0.png
../_images/protocols_SAPRouter_8_1.png
../_images/protocols_SAPRouter_8_2.png

SAP Router Pong packet

In [5]:
p = SAPRouter(type=SAPRouter.SAPROUTER_PONG)
p.canvas_dump()
Out[5]:
../_images/protocols_SAPRouter_10_0.png