SAP RFC

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.SAPRFC import *
from IPython.display import display

SAP RFC External packets


In [2]:
for version in [2, 3]:
    for req_type in rfc_req_type_values:
        p = SAPRFC(version=version, req_type=req_type)
        print("Packet type: {} Version: {}".format(rfc_req_type_values[req_type], version))
        display(p.canvas_dump())


Packet type: GW_UNDEF_TYPE Version: 2
Packet type: CHECK_GATEWAY Version: 2
Packet type: GW_CONNECT_GWWP Version: 2
Packet type: GW_NORMAL_CLIENT Version: 2
Packet type: GW_REMOTE_GATEWAY Version: 2
Packet type: STOP_GATEWAY Version: 2
Packet type: GW_LOCAL_R3 Version: 2
Packet type: GW_SEND_INTERNAL_ERROR Version: 2
Packet type: GW_SEND_INFO Version: 2
Packet type: GW_SEND_CMD Version: 2
Packet type: GW_WORKPROCESS_DIED Version: 2
Packet type: GW_REGISTER_TP Version: 2
Packet type: GW_UNREGISTER_TP Version: 2
Packet type: GW_CONNECT_DISP Version: 2
Packet type: GW_GET_NO_REGISTER_TP Version: 2
Packet type: GW_SAP_WP_CLIENT Version: 2
Packet type: GW_CANCEL_REGISTER_TP Version: 2
Packet type: GW_FROM_REMOTE_GATEWAY Version: 2
Packet type: GW_CONTAINER_RECEIVED Version: 2
Packet type: GW_UNDEF_TYPE Version: 3
Packet type: CHECK_GATEWAY Version: 3
Packet type: GW_CONNECT_GWWP Version: 3
Packet type: GW_NORMAL_CLIENT Version: 3
Packet type: GW_REMOTE_GATEWAY Version: 3
Packet type: STOP_GATEWAY Version: 3
Packet type: GW_LOCAL_R3 Version: 3
Packet type: GW_SEND_INTERNAL_ERROR Version: 3
Packet type: GW_SEND_INFO Version: 3
Packet type: GW_SEND_CMD Version: 3
Packet type: GW_WORKPROCESS_DIED Version: 3
Packet type: GW_REGISTER_TP Version: 3
Packet type: GW_UNREGISTER_TP Version: 3
Packet type: GW_CONNECT_DISP Version: 3
Packet type: GW_GET_NO_REGISTER_TP Version: 3
Packet type: GW_SAP_WP_CLIENT Version: 3
Packet type: GW_CANCEL_REGISTER_TP Version: 3
Packet type: GW_FROM_REMOTE_GATEWAY Version: 3
Packet type: GW_CONTAINER_RECEIVED Version: 3

SAP RFC Gateway Monitor packets


In [3]:
for command in rfc_monitor_cmd_values:
    p = SAPRFC(req_type=9, cmd=command)
    print(rfc_monitor_cmd_values[command])
    display(p.canvas_dump())


NOOP
DELETE_CONN
CANCEL_CONN
RST_SINGLE_ERR_CNT
RST_ALL_ERR_CNT
INCREASE_TRACE
DECREASE_TRACE
READ_SEC_INFO
REFRESH_SEC_INFO
READ_GWSYS_TBL
READ_CONN_TBL
READ_PROC_TBL
READ_CONN_ATTR
READ_MEMORY
READ_REQ_BLK
ACT_STATISTIC
DEACT_STATISTIC
READ_STATISTIC
RESET_STATISTIC
READ_PARAMETER
DUMP_NIBUFFER
RESET_NIBUFFER
ACT_EXTPGM_TRACE
DEACT_EXTPGM_TRACE
ACT_CONN_TRACE
DEACT_CONN_TRACE
RESET_TRACE
SUICIDE
READ_SEC_INFO2
CANCEL_REG_TP
DUMP
READ_GWSYS_TBL2
CHANGE_PARAMETER
GET_CONN_PARTNER
DELETE_CLIENT
DELETE_REMGW
DISCONNECT
ENABLE_RESTART
DISABLE_RESTART
NI_TRACE
CLI_INFO
GW_INFO
CONVID_INFO
GET_NO_REG_TP
CV_INFO
SO_KEEPALIVE
READ_CONN_TBL2
READ_GWSYS_TBL3
RELOAD_ACL

RFC Extend Info packet


In [4]:
p = SAPRFCEXTEND()
display(p.canvas_dump())


RFC DT structure


In [5]:
p = SAPRFCDTStruct()
display(p.canvas_dump())


CPIC Suffix structure


In [6]:
p = SAPCPICSUFFIX()
display(p.canvas_dump())



In [7]:
p.suff_unk9 = "\x00\x01"
display(p.canvas_dump())


CPIC PARAM structures


In [8]:
for cls in [SAPCPICPARAM, SAPCPICPARAM2]:
    p = cls()
    p.ip = p.mask = "0.0.0.0"
    display(p.canvas_dump())


SAP RFC TH structure


In [9]:
p = SAPRFCTHStruct()
display(p.canvas_dump())


SAP RFC XPG structure


In [10]:
p = SAPRFXPG()
display(p.canvas_dump())


SAP Started RFCPING packets


In [11]:
p = SAPRFCPING()
display(p.canvas_dump())


SAP CPIC Packet


In [12]:
for cls in [SAPCPIC, SAPCPIC2]:
    p = cls()
    display(p.canvas_dump())