cip

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CIPServiceGetAttributeAll        = 0x01
	CIPServiceSetAttributeAll        = 0x02
	CIPServiceGetAttributeList       = 0x03
	CIPServiceSetAttributeList       = 0x04
	CIPServiceReset                  = 0x05
	CIPServiceStart                  = 0x06
	CIPServiceStop                   = 0x07
	CIPServiceCreate                 = 0x08
	CIPServiceDelete                 = 0x09
	CIPServiceMultipleServicePacket  = 0x0A
	CIPServiceApplyAttributes        = 0x0D
	CIPServiceGetAttributeSingle     = 0x0E
	CIPServiceSetAttributeSingle     = 0x10
	CIPServiceFindNextObjectInstance = 0x11
	CIPServiceRestore                = 0x15
	CIPServiceSave                   = 0x16
	CIPServiceNOP                    = 0x17
	CIPServiceGetMember              = 0x18
	CIPServiceSetMember              = 0x19
	CIPServiceInsertMember           = 0x1A
	CIPServiceRemoveMember           = 0x1B
	CIPServiceGroupSync              = 0x1C
	CIPServiceForwardClose           = 0x4E
	CIPServiceReadTag                = 0x4C
	CIPServiceWriteTag               = 0x4D
	CIPServiceUnconnectedSend        = 0x52
	CIPServiceWriteTagFragmented     = 0x53
	CIPServiceForwardOpen            = 0x54
	CIPServiceReadTagFragmented      = 0x55
	CIPServiceReadModifyWriteTag     = 0x56
)

CIP Service Codes

View Source
const (
	CIPStatusSuccess                      = 0x00
	CIPStatusConnectionFailure            = 0x01
	CIPStatusResourceUnavailable          = 0x02
	CIPStatusInvalidParameterValue        = 0x03
	CIPStatusPathSegmentError             = 0x04
	CIPStatusPathDestinationUnknown       = 0x05
	CIPStatusPartialTransfer              = 0x06
	CIPStatusConnectionLost               = 0x07
	CIPStatusServiceNotSupported          = 0x08
	CIPStatusInvalidAttributeValue        = 0x09
	CIPStatusAttributeListError           = 0x0A
	CIPStatusAlreadyInRequestedMode       = 0x0B
	CIPStatusObjectStateConflict          = 0x0C
	CIPStatusObjectAlreadyExists          = 0x0D
	CIPStatusAttributeNotSettable         = 0x0E
	CIPStatusPrivilegeViolation           = 0x0F
	CIPStatusDeviceStateConflict          = 0x10
	CIPStatusReplyDataTooLarge            = 0x11
	CIPStatusFragmentationOfPrimitive     = 0x12
	CIPStatusNotEnoughData                = 0x13
	CIPStatusAttributeNotSupported        = 0x14
	CIPStatusTooMuchData                  = 0x15
	CIPStatusObjectDoesNotExist           = 0x16
	CIPStatusServiceFragmentation         = 0x17
	CIPStatusNoStoredAttributeData        = 0x18
	CIPStatusStoreOperationFailure        = 0x19
	CIPStatusRoutingFailure               = 0x1A
	CIPStatusRoutingFailureRequest        = 0x1B
	CIPStatusRoutingFailureResponse       = 0x1C
	CIPStatusMissingAttributeListEntry    = 0x1D
	CIPStatusInvalidAttributeValueList    = 0x1E
	CIPStatusEmbeddedServiceError         = 0x1F
	CIPStatusVendorSpecificError          = 0x20
	CIPStatusInvalidParameter             = 0x21
	CIPStatusWriteOnceValueAlreadyWritten = 0x22
	CIPStatusInvalidReplyReceived         = 0x23
	CIPStatusKeyFailureInPath             = 0x25
	CIPStatusPathSizeInvalid              = 0x26
	CIPStatusUnexpectedAttributeInList    = 0x27
	CIPStatusInvalidMemberID              = 0x28
	CIPStatusMemberNotSettable            = 0x29
)

CIP Status Codes

View Source
const (
	ENIPCommandNOP               = 0x0000
	ENIPCommandListServices      = 0x0004
	ENIPCommandListIdentity      = 0x0063
	ENIPCommandListInterfaces    = 0x0064
	ENIPCommandRegisterSession   = 0x0065
	ENIPCommandUnregisterSession = 0x0066
	ENIPCommandSendRRData        = 0x006F
	ENIPCommandSendUnitData      = 0x0070
)

ENIP Command codes

View Source
const (
	CPFItemIDNullAddress       = 0x0000
	CPFItemIDConnectedAddress  = 0x00A1
	CPFItemIDSequencedAddress  = 0x8002
	CPFItemIDUnconnectedData   = 0x00B2
	CPFItemIDConnectedData     = 0x00B1
	CPFItemIDSocketAddrInfoO2T = 0x8000
	CPFItemIDSocketAddrInfoT2O = 0x8001
)

Common Packet Format item type IDs

View Source
const (
	CIPPathSegmentPortSegment     = 0x00
	CIPPathSegmentLogicalSegment  = 0x20
	CIPPathSegmentNetworkSegment  = 0x40
	CIPPathSegmentSymbolicSegment = 0x60
	CIPPathSegmentDataSegment     = 0x80
	CIPPathSegmentDataTypeConstr  = 0xA0
	CIPPathSegmentDataTypeElement = 0xC0
	CIPPathSegmentReserved        = 0xE0
)

CIP Path Segment Types

View Source
const (
	CIPLogicalSegmentClassID         = 0x00
	CIPLogicalSegmentInstanceID      = 0x04
	CIPLogicalSegmentMemberID        = 0x08
	CIPLogicalSegmentConnectionPoint = 0x0C
	CIPLogicalSegmentAttributeID     = 0x10
	CIPLogicalSegmentSpecial         = 0x14
	CIPLogicalSegmentServiceID       = 0x18
)

Logical Segment Type bits

Variables

View Source
var Decoder = &decoder.StreamDecoder{
	Type:        types.Type_NC_CIP,
	Name:        serviceCIP,
	Description: "Common Industrial Protocol (CIP) is used for ICS/SCADA communications in industrial automation",
	PostInit: func(d *decoder.StreamDecoder) error {
		var err error
		cipLog, _, err = logging.InitZapLogger(
			decoderconfig.Instance.Out,
			"cip",
			decoderconfig.Instance.Debug,
		)
		return err
	},
	CanDecode: func(client, server []byte) bool {

		return canDecodeCIP(client) || canDecodeCIP(server)
	},
	DeInit: func(sd *decoder.StreamDecoder) error {
		return cipLog.Sync()
	},
	Factory: &cipReader{},
	Typ:     core.TCP,
}

Decoder for protocol analysis and writing audit records to disk.

Functions

func GetServiceName

func GetServiceName(service uint8) string

GetServiceName returns the human-readable name for a CIP service code.

func GetStatusName

func GetStatusName(status uint8) string

GetStatusName returns the human-readable name for a CIP status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL