CIP Reference

Documented CIP service and class codes are available in enum-like classes that can be imported for use, mostly useful for generic messaging. The following classes may be imported directly from the pycomm3 package.

Ethernet/IP Encapsulation Commands

class EncapsulationCommands(EnumMap):
    nop = b'\x00\x00'
    list_targets = b'\x01\x00'
    list_services = b'\x04\x00'
    list_identity = b'\x63\x00'
    list_interfaces = b'\x64\x00'
    register_session = b'\x65\x00'
    unregister_session = b'\x66\x00'
    send_rr_data = b'\x6F\x00'
    send_unit_data = b'\x70\x00'

CIP Services and Class Codes

class Services(EnumMap):

    # Common CIP Services
    get_attributes_all = b'\x01'
    set_attributes_all = b'\x02'
    get_attribute_list = b'\x03'
    set_attribute_list = b'\x04'
    reset = b'\x05'
    start = b'\x06'
    stop = b'\x07'
    create = b'\x08'
    delete = b'\x09'
    multiple_service_request = b'\x0A'
    apply_attributes = b'\x0D'
    get_attribute_single = b'\x0E'
    set_attribute_single = b'\x10'
    find_next_object_instance = b'\x11'
    error_response = b'\x14'
    restore = b'\x15'
    save = b'\x16'
    nop = b'\x17'
    get_member = b'\x18'
    set_member = b'\x19'
    insert_member = b'\x1A'
    remove_member = b'\x1B'
    group_sync = b'\x1C'

    # Rockwell Custom Services
    read_tag = b'\x4C'
    read_tag_fragmented = b'\x52'
    write_tag = b'\x4D'
    write_tag_fragmented = b'\x53'
    read_modify_write = b'\x4E'
    get_instance_attribute_list = b'\x55'

    @classmethod
    def from_reply(cls, reply_service):
        """
        Get service from reply service code
        """
        val = cls.get(USINT.encode(USINT.decode(reply_service) - 128))
        return val
class ClassCode(EnumMap):
    identity_object = b'\x01'
    message_router = b'\x02'
    device_net = b'\x03'
    assembly = b'\x04'
    connection = b'\x05'
    connection_manager = b'\x06'
    register = b'\x07'
    discrete_input = b'\x08'
    discrete_output = b'\x09'
    analog_input = b'\x0A'
    analog_output = b'\x0B'
    presence_sensing = b'\x0E'
    parameter = b'\x0F'

    parameter_group = b'\x10'
    group = b'\x12'
    discrete_input_group = b'\x1D'
    discrete_output_group = b'\x1E'
    discrete_group = b'\x1F'

    analog_input_group = b'\x20'
    analog_output_group = b'\x21'
    analog_group = b'\x22'
    position_sensor = b'\x23'
    position_controller_supervisor = b'\x24'
    position_controller = b'\x25'
    block_sequencer = b'\x26'
    command_block = b'\x27'
    motor_data = b'\x28'
    control_supervisor = b'\x29'
    ac_dc_drive = b'\x2A'
    acknowledge_handler = b'\x2B'
    overload = b'\x2C'
    softstart = b'\x2D'
    selection = b'\x2E'

    s_device_supervisor = b'\x30'
    s_analog_sensor = b'\x31'
    s_analog_actuator = b'\x32'
    s_single_stage_controller = b'\x33'
    s_gas_calibration = b'\x34'
    trip_point = b'\x35'
    file_object = b'\x37'
    s_partial_pressure = b'\x38'
    safety_supervisor = b'\x39'
    safety_validator = b'\x3A'
    safety_discrete_output_point = b'\x3B'
    safety_discrete_output_group = b'\x3C'
    safety_discrete_input_point = b'\x3D'
    safety_discrete_input_group = b'\x3E'
    safety_dual_channel_output = b'\x3F'

    s_sensor_calibration = b'\x40'
    event_log = b'\x41'
    motion_axis = b'\x42'
    time_sync = b'\x43'
    modbus = b'\x44'
    modbus_serial_link = b'\x46'

    symbol_object = b'\x6b'
    template_object = b'\x6c'
    program_name = b'\x64'  # Rockwell KB# 23341

    wall_clock_time = b'\x8b'  # Micro800 CIP client messaging quick start

    controlnet = b'\xF0'
    controlnet_keeper = b'\xF1'
    controlnet_scheduling = b'\xF2'
    connection_configuration = b'\xF3'
    port = b'\xF4'
    tcp_ip_interface = b'\xF5'
    ethernet_link = b'\xF6'
    componet_link = b'\xF7'
    componet_repeater = b'\xF8'
class CommonClassAttributes(EnumMap):
    revision = Attribute(1, UINT('revision'))
    max_instance = Attribute(2, UINT('max_instance'))
    number_of_instances = Attribute(3, UINT('number_of_instances'))
    optional_attribute_list = Attribute(4, UINT[UINT])
    optional_service_list = Attribute(5, UINT[UINT])
    max_id_number_class_attributes = Attribute(6, UINT('max_id_class_attrs'))
    max_id_number_instance_attributes = Attribute(7, UINT('max_id_instance_attrs'))

Identity Object

class IdentityObjectInstanceAttributes(EnumMap):
    vendor_id = Attribute(1, UINT('vendor_id'))
    device_type = Attribute(2, UINT('device_type'))
    product_code = Attribute(3, UINT('product_code'))
    revision = Attribute(4, Struct(USINT('major'), USINT('minor')))
    status = Attribute(5, WORD('status'))
    serial_number = Attribute(6, UDINT('serial_number'))
    product_name = Attribute(7, SHORT_STRING('product_name'))

Connection Manager Object

class ConnectionManagerServices(EnumMap):
    forward_close = b'\x4E'
    unconnected_send = b'\x52'
    forward_open = b'\x54'
    get_connection_data = b'\x56'
    search_connection_data = b'\x57'
    get_connection_owner = b'\x5A'
    large_forward_open = b'\x5B'
class ConnectionManagerInstances(EnumMap):
    open_request = b'\x01'
    open_format_rejected = b'\x02'
    open_resource_rejected = b'\x03'
    open_other_rejected = b'\x04'
    close_request = b'\x05'
    close_format_request = b'\x06'
    close_other_request = b'\x07'
    connection_timeout = b'\x08'

File Object

class FileObjectServices(EnumMap):
    initiate_upload = b'\x4B'
    initiate_download = b'\x4C'
    initiate_partial_read = b'\x4D'
    initiate_partial_write = b'\x4E'
    upload_transfer = b'\x4F'
    download_transfer = b'\x50'
    clear_file = b'\x51'
class FileObjectClassAttributes(EnumMap):
    directory = Attribute(32, Struct(UINT('instance_number'),
                                     STRINGI('instance_name'),
                                     STRINGI('file_name')))  # array of struct, len in attr 3
class FileObjectInstanceAttributes(EnumMap):
    state = Attribute(1, USINT('state'))
    instance_name = Attribute(2, STRINGI('instance_name'))
    instance_format_version = Attribute(3, UINT('instance_format_version'))
    file_name = Attribute(4, STRINGI('file_name'))
    file_revision = Attribute(5, Struct(USINT('major'), USINT('minor')))
    file_size = Attribute(6, UDINT('file_size'))
    file_checksum = Attribute(7, INT('file_checksum'))
    invocation_method = Attribute(8, USINT('invocation_method'))
    file_save_params = Attribute(9, BYTE('file_save_params'))
    file_type = Attribute(10, USINT('file_type'))
    file_encoding_format = Attribute(11, USINT('file_encoding_format'))
class FileObjectInstances(EnumMap):
    eds_file_and_icon = 0xC8
    related_eds_files_and_icons = 0xC9