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:

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

SAP Router Admin packets

[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.svg
New Route Table Request
../_images/protocols_SAPRouter_4_3.svg
Toggle Trace Request
../_images/protocols_SAPRouter_4_5.svg
Stop Request
../_images/protocols_SAPRouter_4_7.svg
Cancel Route Request
../_images/protocols_SAPRouter_4_9.svg
Dump Buffers Request
../_images/protocols_SAPRouter_4_11.svg
Flush Buffers Request
../_images/protocols_SAPRouter_4_13.svg
Soft Shutdown Request
../_images/protocols_SAPRouter_4_15.svg
Set Trace Peer
../_images/protocols_SAPRouter_4_17.svg
Clear Trace Peer
../_images/protocols_SAPRouter_4_19.svg
Trace Connection
../_images/protocols_SAPRouter_4_21.svg
Trace Connection
../_images/protocols_SAPRouter_4_23.svg
Hide Error Information Request
../_images/protocols_SAPRouter_4_25.svg

SAP Router Error Information / Control packets

[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.svg
Version request
../_images/protocols_SAPRouter_6_3.svg
Version response
../_images/protocols_SAPRouter_6_5.svg
Send Handle (5)
../_images/protocols_SAPRouter_6_7.svg
Send Handle (6)
../_images/protocols_SAPRouter_6_9.svg
Send Handle (8)
../_images/protocols_SAPRouter_6_11.svg
SNC request
../_images/protocols_SAPRouter_6_13.svg
SNC handshake complete
../_images/protocols_SAPRouter_6_15.svg

SAP Router Route packet

[4]:
router_string = [SAPRouterRouteHop(hostname="8.8.8.8", port=3299),
                 SAPRouterRouteHop(hostname="10.0.0.1", port=3200, password="S3cr3t")]
router_string_lens = list(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.svg
../_images/protocols_SAPRouter_8_1.svg
../_images/protocols_SAPRouter_8_2.svg

SAP Router Pong packet

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

SAP Router Error Text packet

[6]:
p = SAPRouterError(error='connection refused', return_code='-94')
p.canvas_dump()
[6]:
../_images/protocols_SAPRouter_12_0.svg

SAP Router Information response packets

[7]:
p = SAPRouterInfoServer(pid=1234, ppid=1, port=3299, pport=3200)
display(p.canvas_dump())

p = SAPRouterInfoClients(clients=[SAPRouterInfoClient(id=1, address='127.0.0.1', partner='10.0.0.1', service='3200')])
display(p.canvas_dump())
display(p.clients[0].canvas_dump())
../_images/protocols_SAPRouter_14_0.svg
../_images/protocols_SAPRouter_14_1.svg
../_images/protocols_SAPRouter_14_2.svg