scapy.contrib.pnio_dcp

class scapy.contrib.pnio_dcp.DCPAliasNameBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPAliasNameBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

6

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

alias_name

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPBaseBlock

Bases: scapy.packet.Packet

base class for all DCP Blocks

aliastypes
extract_padding(s)
fields_desc
DCPBaseBlock fields

option

ByteEnumField

1

sub_option

MultiEnumField (Depends on option)

2

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

data

StrLenField

b''

class scapy.contrib.pnio_dcp.DCPControlBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPControlBlock fields

option

ByteEnumField

5

sub_option

MultiEnumField (Depends on option)

4

dcp_block_length

LenField

3

response

ByteEnumField

2

response_sub_option

MultiEnumField (Depends on option)

2

block_error

ByteEnumField

0

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceIDBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceIDBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

3

dcp_block_length

LenField

None

block_info

ShortEnumField

0

vendor_id

XShortField

42

device_id

XShortField

787

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceInstanceBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceInstanceBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

7

dcp_block_length

LenField

4

block_info

ShortEnumField

0

device_instance_high

XByteField

0

device_instance_low

XByteField

1

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceOptionsBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceOptionsBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

5

dcp_block_length

LenField

None

block_info

ShortEnumField

0

device_options

PacketListField

[]

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceRoleBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceRoleBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

4

dcp_block_length

LenField

4

block_info

ShortEnumField

0

device_role_details

ByteEnumField

1

reserved

XByteField

0

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPIPBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPIPBlock fields

option

ByteEnumField

1

sub_option

MultiEnumField (Depends on option)

2

dcp_block_length

LenField

None

block_info

ShortEnumField

1

ip

IPField

'192.168.0.2'

netmask

IPField

'255.255.255.0'

gateway

IPField

'192.168.0.1'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPMACBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPMACBlock fields

option

ByteEnumField

1

sub_option

MultiEnumField (Depends on option)

1

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

mac

MACField

'00:00:00:00:00:00'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPManufacturerSpecificBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPManufacturerSpecificBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

1

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

device_vendor_value

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPNameOfStationBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPNameOfStationBlock fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

2

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

name_of_station

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DeviceOption

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DeviceOption fields

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

5

class scapy.contrib.pnio_dcp.ProfinetDCP

Bases: scapy.packet.Packet

Profinet DCP Packet

Requests are handled via ConditionalField because here only 1 Block is used every time.

Response can contain 1..n Blocks, for that you have to use one ProfinetDCP Layer with one or multiple DCP*Block Layers:

ProfinetDCP / DCPNameOfStationBlock / DCPDeviceIDBlock ...

Example for a DCP Identify All Request:

Ether(dst="01:0e:cf:00:00:00") /
ProfinetIO(frameID=DCP_IDENTIFY_REQUEST_FRAME_ID) /
ProfinetDCP(service_id=DCP_SERVICE_ID_IDENTIFY,
    service_type=DCP_REQUEST, option=255, sub_option=255,
    dcp_data_length=4)

Example for a DCP Identify Response:

Ether(dst=dst_mac) /
ProfinetIO(frameID=DCP_IDENTIFY_RESPONSE_FRAME_ID) /
ProfinetDCP(
    service_id=DCP_SERVICE_ID_IDENTIFY,
    service_type=DCP_RESPONSE) /
DCPNameOfStationBlock(name_of_station="device1")

Example for a DCP Set Request:

Ether(dst=mac) /
ProfinetIO(frameID=DCP_GET_SET_FRAME_ID) /
ProfinetDCP(service_id=DCP_SERVICE_ID_SET, service_type=DCP_REQUEST,
    option=2, sub_option=2, dcp_data_length=14, dcp_block_length=10,
    name_of_station=name, reserved=0)
aliastypes
fields_desc
ProfinetDCP fields

service_id

ByteEnumField

5

service_type

ByteEnumField

0

xid

XIntField

16777217

reserved

ShortField

0

dcp_data_length

LenField

None

option

ByteEnumField (Cond)

2

sub_option

MultiEnumField (Cond, Depends on option)

3

dcp_block_length

LenField (Cond)

0

block_qualifier

ShortEnumField (Cond)

1

name_of_station

StrLenField (Cond)

b'et200sp'

mac

MACField (Cond)

'00:00:00:00:00:00'

ip

IPField (Cond)

'192.168.0.2'

netmask

IPField (Cond)

'255.255.255.0'

gateway

IPField (Cond)

'192.168.0.1'

name_of_station

StrLenField (Cond)

b'et200sp'

alias_name

StrLenField (Cond)

b'et200sp'

dcp_blocks

PacketListField (Cond)

[]

payload_guess

Possible sublayers: Padding

post_build(pkt, pay)
scapy.contrib.pnio_dcp.guess_dcp_block_class(packet, **kargs)

returns the correct dcp block class needed to dissect the current tag if nothing can be found -> dcp base block will be used

Parameters

packet – the current packet

Returns

dcp block class