@litmusio/miravo-cli-linux-arm64 0.0.0-stage → 0.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +199 -0
- package/NOTICE +9 -0
- package/README.md +6 -2
- package/THIRD_PARTY_LICENSES.txt +15289 -0
- package/THIRD_PARTY_NOTICES.md +995 -0
- package/console-dist/assets/AnimatePresence-DWGUB15i.js +9 -0
- package/console-dist/assets/activity-DruTYzT1.js +1 -0
- package/console-dist/assets/api-V5Tf5xfh.js +57 -0
- package/console-dist/assets/arrow-up-right-DOENs04V.js +1 -0
- package/console-dist/assets/asset-detail-D_icTa2K.js +1 -0
- package/console-dist/assets/asset-detail-actions-DIYego9D.js +1 -0
- package/console-dist/assets/backup-power-Q84DVs_z.js +1 -0
- package/console-dist/assets/badge-CdRB4Nd_.js +1 -0
- package/console-dist/assets/boiler-s_q0j7rz.js +1 -0
- package/console-dist/assets/by-path-Cm2TEP7z.js +1 -0
- package/console-dist/assets/check-BTUv4z-H.js +1 -0
- package/console-dist/assets/chevron-down-CqA_2_CH.js +1 -0
- package/console-dist/assets/chevron-right-CVrgKBLR.js +1 -0
- package/console-dist/assets/chiller-r7DzAhJq.js +1 -0
- package/console-dist/assets/chunk-6KYCQHYJ-ga3Yekab.js +3 -0
- package/console-dist/assets/circle-x-BRkh0A1P.js +1 -0
- package/console-dist/assets/commercial-building-Cezt2R6W.js +1 -0
- package/console-dist/assets/compressor-ChZLMC94.js +1 -0
- package/console-dist/assets/console-panel-BnSjjW6l.js +1 -0
- package/console-dist/assets/dialog-BYkdndf9.js +1 -0
- package/console-dist/assets/district-heating-By_6QdGQ.js +1 -0
- package/console-dist/assets/dom-BxZbg3NX.js +1 -0
- package/console-dist/assets/download-CvjDP5mu.js +1 -0
- package/console-dist/assets/fira-code-cyrillic-ext-wght-normal-DhYMMuQd.woff2 +0 -0
- package/console-dist/assets/fira-code-cyrillic-wght-normal-Y3u8pIsh.woff2 +0 -0
- package/console-dist/assets/fira-code-greek-ext-wght-normal-wWus70Ix.woff2 +0 -0
- package/console-dist/assets/fira-code-greek-wght-normal-B2SviObF.woff2 +0 -0
- package/console-dist/assets/fira-code-latin-ext-wght-normal-Dvfvaomy.woff2 +0 -0
- package/console-dist/assets/fira-code-latin-wght-normal-CHoedHDv.woff2 +0 -0
- package/console-dist/assets/fira-code-symbols2-wght-normal-CE6EOz_n.woff2 +0 -0
- package/console-dist/assets/floor-page-DIUJBBhh.js +1 -0
- package/console-dist/assets/floor-page-E-0txA4z.css +1 -0
- package/console-dist/assets/format-YLUJ7AXt.js +1 -0
- package/console-dist/assets/genset-C6_EUoFo.js +1 -0
- package/console-dist/assets/index-BrlZMcSu.js +15 -0
- package/console-dist/assets/index-eZjXAdLh.css +2 -0
- package/console-dist/assets/loader-circle-w3T2fxvn.js +1 -0
- package/console-dist/assets/login-CpbaxAVs.js +136 -0
- package/console-dist/assets/not-found-CZjkulKD.js +1 -0
- package/console-dist/assets/pharma-cleanroom-CT2M_Mbh.js +1 -0
- package/console-dist/assets/preload-helper-7y9sWmk5.js +1 -0
- package/console-dist/assets/react-DRt7cCXI.js +1 -0
- package/console-dist/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
- package/console-dist/assets/rtu-ByogcRPI.js +1 -0
- package/console-dist/assets/runtime-link-D88Db2wY.js +1 -0
- package/console-dist/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2 +0 -0
- package/console-dist/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2 +0 -0
- package/console-dist/assets/server-B0q1NVkV.js +1 -0
- package/console-dist/assets/shallow-mIK1Qu8X.js +1 -0
- package/console-dist/assets/smart-factory-gfMWfMWM.js +1 -0
- package/console-dist/assets/source-host-miravo-BW-SKMTe.js +1 -0
- package/console-dist/assets/stages-EYRT12Yp.js +1 -0
- package/console-dist/assets/status-DQYLUbXs.js +1 -0
- package/console-dist/assets/tank-Btg5piqB.js +1 -0
- package/console-dist/assets/tooltip-Dfmuq2yz.js +1 -0
- package/console-dist/assets/trash-2-BAh5-hxl.js +1 -0
- package/console-dist/assets/triangle-alert-3Ab-dBrN.js +1 -0
- package/console-dist/assets/use-engine-command-mutation-BmSUqrCp.js +1 -0
- package/console-dist/assets/use-transition-navigate-DIfW9U34.js +2 -0
- package/console-dist/assets/useQuery-yLeYL5Es.js +1 -0
- package/console-dist/assets/utils-D6wrZy-b.js +1 -0
- package/console-dist/assets/validation-DEb_QCoK.js +1 -0
- package/console-dist/assets/vendor-charts-Bquh2dWE.js +56 -0
- package/console-dist/assets/vendor-table-5YnGQUhO.js +4 -0
- package/console-dist/assets/vendor-ui-BGeFlRLR.js +1 -0
- package/console-dist/assets/water-treatment-DbSVGWoj.js +1 -0
- package/console-dist/icon.png +0 -0
- package/console-dist/index.html +53 -0
- package/console-dist/miravo-logo.webp +0 -0
- package/licenses/EPL-2.0.txt +80 -0
- package/licenses/GCC-exception-3.1.txt +33 -0
- package/licenses/GPL-2.0-only.txt +117 -0
- package/licenses/GPL-3.0-only.txt +232 -0
- package/licenses/LGPL-2.1-only.txt +176 -0
- package/licenses/MPL-2.0.txt +373 -0
- package/licenses/OFL-1.1.txt +93 -0
- package/licenses/overrides/@headlessui+vue@1.7.23.txt +24 -0
- package/licenses/overrides/@next+env@16.4.6.txt +24 -0
- package/licenses/overrides/@radix-ui+react-compose-refs@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-context@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-direction@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-id@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-callback-ref@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-escape-keydown@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-layout-effect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-rect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-size@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+rect@1.1.1.txt +24 -0
- package/licenses/overrides/@replit+codemirror-css-color-picker@6.3.0.txt +6 -0
- package/licenses/overrides/@scalar+openapi-types@0.8.0.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.10.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.7.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.9.txt +24 -0
- package/licenses/overrides/@scalar+postman-to-openapi@0.7.1.txt +24 -0
- package/licenses/overrides/@scalar+schemas@0.19.0.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.46.3.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.75.0.txt +24 -0
- package/licenses/overrides/assert-plus@1.0.0.txt +24 -0
- package/licenses/overrides/client-only@0.0.1.txt +24 -0
- package/licenses/overrides/embla-carousel-react@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel-reactive-utils@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel@8.6.0.txt +24 -0
- package/licenses/overrides/fastdom@1.0.12.txt +12 -0
- package/licenses/overrides/precond@0.2.3.txt +22 -0
- package/licenses/overrides/react-remove-scroll-bar@2.3.8.txt +24 -0
- package/licenses/overrides/strictdom@1.0.1.txt +12 -0
- package/licenses/overrides/victory-vendor@36.9.2.txt +33 -0
- package/licenses/runtime/Bun-1.4.3-LICENSE.md +85 -0
- package/licenses/runtime/ICU-78.1-LICENSE.txt +568 -0
- package/licenses/runtime/bun-components/boringssl.txt +238 -0
- package/licenses/runtime/bun-components/brotli.txt +19 -0
- package/licenses/runtime/bun-components/c-ares.txt +24 -0
- package/licenses/runtime/bun-components/highway.txt +371 -0
- package/licenses/runtime/bun-components/libarchive.txt +65 -0
- package/licenses/runtime/bun-components/libbase64.txt +28 -0
- package/licenses/runtime/bun-components/libdeflate.txt +22 -0
- package/licenses/runtime/bun-components/libjpeg-turbo.txt +147 -0
- package/licenses/runtime/bun-components/libspng.txt +25 -0
- package/licenses/runtime/bun-components/libuv.txt +19 -0
- package/licenses/runtime/bun-components/libwebp.txt +30 -0
- package/licenses/runtime/bun-components/llvm.txt +311 -0
- package/licenses/runtime/bun-components/lol-html.txt +27 -0
- package/licenses/runtime/bun-components/ls-hpack.txt +21 -0
- package/licenses/runtime/bun-components/ls-qpack.txt +21 -0
- package/licenses/runtime/bun-components/lsquic-chrome.txt +32 -0
- package/licenses/runtime/bun-components/lsquic.txt +21 -0
- package/licenses/runtime/bun-components/mimalloc.txt +21 -0
- package/licenses/runtime/bun-components/picohttpparser.txt +24 -0
- package/licenses/runtime/bun-components/simdutf-apache.txt +201 -0
- package/licenses/runtime/bun-components/simdutf-mit.txt +18 -0
- package/licenses/runtime/bun-components/tigerbeetle.txt +177 -0
- package/licenses/runtime/bun-components/tinycc.txt +504 -0
- package/licenses/runtime/bun-components/typescript-go.txt +55 -0
- package/licenses/runtime/bun-components/usockets.txt +201 -0
- package/licenses/runtime/bun-components/uucode.txt +30 -0
- package/licenses/runtime/bun-components/uwebsockets.txt +201 -0
- package/licenses/runtime/bun-components/xxhash.txt +31 -0
- package/licenses/runtime/bun-components/zlib-ng.txt +19 -0
- package/licenses/runtime/bun-components/zstd-copying.txt +339 -0
- package/licenses/runtime/bun-components/zstd.txt +30 -0
- package/licenses/runtime/musl-1.2.6-COPYRIGHT.txt +193 -0
- package/miravo +4 -0
- package/native/S7-NOTICES.txt +11 -0
- package/native/miravo-s7.node +0 -0
- package/native/s7-source/CMakeLists.txt +23 -0
- package/native/s7-source/NODE-SNAP7-LICENSE +24 -0
- package/native/s7-source/addon.cpp +124 -0
- package/native/s7-source/bridge.cpp +150 -0
- package/native/s7-source/node-api-headers/LICENSE +21 -0
- package/native/s7-source/node-api-headers/include/js_native_api.h +591 -0
- package/native/s7-source/node-api-headers/include/js_native_api_types.h +213 -0
- package/native/s7-source/node-api-headers/include/node_api.h +265 -0
- package/native/s7-source/node-api-headers/include/node_api_types.h +58 -0
- package/native/s7-source/node-api-windows.h +78 -0
- package/native/s7-source/snap7/HISTORY.txt +277 -0
- package/native/s7-source/snap7/gpl.txt +674 -0
- package/native/s7-source/snap7/lgpl-3.0.txt +165 -0
- package/native/s7-source/snap7/src/core/miravo_request_validation.h +72 -0
- package/native/s7-source/snap7/src/core/s7_client.cpp +503 -0
- package/native/s7-source/snap7/src/core/s7_client.h +104 -0
- package/native/s7-source/snap7/src/core/s7_firmware.h +1256 -0
- package/native/s7-source/snap7/src/core/s7_isotcp.cpp +541 -0
- package/native/s7-source/snap7/src/core/s7_isotcp.h +271 -0
- package/native/s7-source/snap7/src/core/s7_micro_client.cpp +3328 -0
- package/native/s7-source/snap7/src/core/s7_micro_client.h +364 -0
- package/native/s7-source/snap7/src/core/s7_partner.cpp +1178 -0
- package/native/s7-source/snap7/src/core/s7_partner.h +284 -0
- package/native/s7-source/snap7/src/core/s7_peer.cpp +121 -0
- package/native/s7-source/snap7/src/core/s7_peer.h +58 -0
- package/native/s7-source/snap7/src/core/s7_server.cpp +2161 -0
- package/native/s7-source/snap7/src/core/s7_server.h +261 -0
- package/native/s7-source/snap7/src/core/s7_text.cpp +788 -0
- package/native/s7-source/snap7/src/core/s7_text.h +49 -0
- package/native/s7-source/snap7/src/core/s7_types.h +1066 -0
- package/native/s7-source/snap7/src/lib/snap7.def +129 -0
- package/native/s7-source/snap7/src/lib/snap7_libmain.cpp +1196 -0
- package/native/s7-source/snap7/src/lib/snap7_libmain.h +201 -0
- package/native/s7-source/snap7/src/sys/snap_msgsock.cpp +958 -0
- package/native/s7-source/snap7/src/sys/snap_msgsock.h +339 -0
- package/native/s7-source/snap7/src/sys/snap_platform.h +152 -0
- package/native/s7-source/snap7/src/sys/snap_sysutils.cpp +73 -0
- package/native/s7-source/snap7/src/sys/snap_sysutils.h +39 -0
- package/native/s7-source/snap7/src/sys/snap_tcpsrvr.cpp +487 -0
- package/native/s7-source/snap7/src/sys/snap_tcpsrvr.h +247 -0
- package/native/s7-source/snap7/src/sys/snap_threads.cpp +162 -0
- package/native/s7-source/snap7/src/sys/snap_threads.h +45 -0
- package/native/s7-source/snap7/src/sys/sol_threads.h +208 -0
- package/native/s7-source/snap7/src/sys/unix_threads.h +228 -0
- package/native/s7-source/snap7/src/sys/win_threads.h +159 -0
- package/nodesets/.ignore +1 -0
- package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
- package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
- package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
- package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
- package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
- package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
- package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
- package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
- package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
- package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
- package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
- package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
- package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
- package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
- package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
- package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
- package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
- package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
- package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
- package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
- package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
- package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
- package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
- package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
- package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
- package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
- package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
- package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
- package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
- package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
- package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
- package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
- package/nodesets/Opc.Ua.Types.bsd +3499 -0
- package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
- package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
- package/nodesets/UANodeSet.xsd +497 -0
- package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
- package/package.json +37 -4
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/*=============================================================================|
|
|
2
|
+
| PROJECT SNAP7 1.3.0 |
|
|
3
|
+
|==============================================================================|
|
|
4
|
+
| Copyright (C) 2013, 2015 Davide Nardella |
|
|
5
|
+
| All rights reserved. |
|
|
6
|
+
|==============================================================================|
|
|
7
|
+
| SNAP7 is free software: you can redistribute it and/or modify |
|
|
8
|
+
| it under the terms of the Lesser GNU General Public License as published by |
|
|
9
|
+
| the Free Software Foundation, either version 3 of the License, or |
|
|
10
|
+
| (at your option) any later version. |
|
|
11
|
+
| |
|
|
12
|
+
| It means that you can distribute your commercial software linked with |
|
|
13
|
+
| SNAP7 without the requirement to distribute the source code of your |
|
|
14
|
+
| application and without the requirement that your application be itself |
|
|
15
|
+
| distributed under LGPL. |
|
|
16
|
+
| |
|
|
17
|
+
| SNAP7 is distributed in the hope that it will be useful, |
|
|
18
|
+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
19
|
+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
20
|
+
| Lesser GNU General Public License for more details. |
|
|
21
|
+
| |
|
|
22
|
+
| You should have received a copy of the GNU General Public License and a |
|
|
23
|
+
| copy of Lesser GNU General Public License along with Snap7. |
|
|
24
|
+
| If not, see http://www.gnu.org/licenses/ |
|
|
25
|
+
|=============================================================================*/
|
|
26
|
+
#ifndef s7_isotcp_h
|
|
27
|
+
#define s7_isotcp_h
|
|
28
|
+
//---------------------------------------------------------------------------
|
|
29
|
+
#include "snap_msgsock.h"
|
|
30
|
+
//---------------------------------------------------------------------------
|
|
31
|
+
#pragma pack(1)
|
|
32
|
+
|
|
33
|
+
#define isoTcpVersion 3 // RFC 1006
|
|
34
|
+
#define isoTcpPort 102 // RFC 1006
|
|
35
|
+
#define isoInvalidHandle 0
|
|
36
|
+
#define MaxTSAPLength 16 // Max Lenght for Src and Dst TSAP
|
|
37
|
+
#define MaxIsoFragments 64 // Max fragments
|
|
38
|
+
#define IsoPayload_Size 4096 // Iso telegram Buffer size
|
|
39
|
+
|
|
40
|
+
#define noError 0
|
|
41
|
+
|
|
42
|
+
const longword errIsoMask = 0x000F0000;
|
|
43
|
+
const longword errIsoBase = 0x0000FFFF;
|
|
44
|
+
|
|
45
|
+
const longword errIsoConnect = 0x00010000; // Connection error
|
|
46
|
+
const longword errIsoDisconnect = 0x00020000; // Disconnect error
|
|
47
|
+
const longword errIsoInvalidPDU = 0x00030000; // Bad format
|
|
48
|
+
const longword errIsoInvalidDataSize = 0x00040000; // Bad Datasize passed to send/recv : buffer is invalid
|
|
49
|
+
const longword errIsoNullPointer = 0x00050000; // Null passed as pointer
|
|
50
|
+
const longword errIsoShortPacket = 0x00060000; // A short packet received
|
|
51
|
+
const longword errIsoTooManyFragments = 0x00070000; // Too many packets without EoT flag
|
|
52
|
+
const longword errIsoPduOverflow = 0x00080000; // The sum of fragments data exceded maximum packet size
|
|
53
|
+
const longword errIsoSendPacket = 0x00090000; // An error occurred during send
|
|
54
|
+
const longword errIsoRecvPacket = 0x000A0000; // An error occurred during recv
|
|
55
|
+
const longword errIsoInvalidParams = 0x000B0000; // Invalid TSAP params
|
|
56
|
+
const longword errIsoResvd_1 = 0x000C0000; // Unassigned
|
|
57
|
+
const longword errIsoResvd_2 = 0x000D0000; // Unassigned
|
|
58
|
+
const longword errIsoResvd_3 = 0x000E0000; // Unassigned
|
|
59
|
+
const longword errIsoResvd_4 = 0x000F0000; // Unassigned
|
|
60
|
+
|
|
61
|
+
const longword ISO_OPT_TCP_NODELAY = 0x00000001; // Disable Nagle algorithm
|
|
62
|
+
const longword ISO_OPT_INSIDE_MTU = 0x00000002; // Max packet size < MTU ethernet card
|
|
63
|
+
|
|
64
|
+
// TPKT Header - ISO on TCP - RFC 1006 (4 bytes)
|
|
65
|
+
typedef struct{
|
|
66
|
+
u_char Version; // Always 3 for RFC 1006
|
|
67
|
+
u_char Reserved; // 0
|
|
68
|
+
u_char HI_Lenght; // High part of packet lenght (entire frame, payload and TPDU included)
|
|
69
|
+
u_char LO_Lenght; // Low part of packet lenght (entire frame, payload and TPDU included)
|
|
70
|
+
} TTPKT; // Packet length : min 7 max 65535
|
|
71
|
+
|
|
72
|
+
typedef struct {
|
|
73
|
+
u_char PduSizeCode;
|
|
74
|
+
u_char PduSizeLen;
|
|
75
|
+
u_char PduSizeVal;
|
|
76
|
+
u_char TSAP[245]; // We don't know in advance these fields....
|
|
77
|
+
} TCOPT_Params ;
|
|
78
|
+
|
|
79
|
+
// PDU Type constants - ISO 8073, not all are mentioned in RFC 1006
|
|
80
|
+
// For our purposes we use only those labeled with **
|
|
81
|
+
// These constants contains 4 low bit order 0 (credit nibble)
|
|
82
|
+
//
|
|
83
|
+
// $10 ED : Expedited Data
|
|
84
|
+
// $20 EA : Expedited Data Ack
|
|
85
|
+
// $40 UD : CLTP UD
|
|
86
|
+
// $50 RJ : Reject
|
|
87
|
+
// $70 AK : Ack data
|
|
88
|
+
// ** $80 DR : Disconnect request (note : S7 doesn't use it)
|
|
89
|
+
// ** $C0 DC : Disconnect confirm (note : S7 doesn't use it)
|
|
90
|
+
// ** $D0 CC : Connection confirm
|
|
91
|
+
// ** $E0 CR : Connection request
|
|
92
|
+
// ** $F0 DT : Data
|
|
93
|
+
//
|
|
94
|
+
|
|
95
|
+
// COTP Header for CONNECTION REQUEST/CONFIRM - DISCONNECT REQUEST/CONFIRM
|
|
96
|
+
typedef struct {
|
|
97
|
+
u_char HLength; // Header length : initialized to 6 (length without params - 1)
|
|
98
|
+
// descending classes that add values in params field must update it.
|
|
99
|
+
u_char PDUType; // 0xE0 Connection request
|
|
100
|
+
// 0xD0 Connection confirm
|
|
101
|
+
// 0x80 Disconnect request
|
|
102
|
+
// 0xDC Disconnect confirm
|
|
103
|
+
u_short DstRef; // Destination reference : Always 0x0000
|
|
104
|
+
u_short SrcRef; // Source reference : Always 0x0000
|
|
105
|
+
u_char CO_R; // If the telegram is used for Connection request/Confirm,
|
|
106
|
+
// the meaning of this field is CLASS+OPTION :
|
|
107
|
+
// Class (High 4 bits) + Option (Low 4 bits)
|
|
108
|
+
// Class : Always 4 (0100) but is ignored in input (RFC States this)
|
|
109
|
+
// Option : Always 0, also this in ignored.
|
|
110
|
+
// If the telegram is used for Disconnect request,
|
|
111
|
+
// the meaning of this field is REASON :
|
|
112
|
+
// 1 Congestion at TSAP
|
|
113
|
+
// 2 Session entity not attached to TSAP
|
|
114
|
+
// 3 Address unknown (at TCP connect time)
|
|
115
|
+
// 128+0 Normal disconnect initiated by the session
|
|
116
|
+
// entity.
|
|
117
|
+
// 128+1 Remote transport entity congestion at connect
|
|
118
|
+
// request time
|
|
119
|
+
// 128+3 Connection negotiation failed
|
|
120
|
+
// 128+5 Protocol Error
|
|
121
|
+
// 128+8 Connection request refused on this network
|
|
122
|
+
// connection
|
|
123
|
+
// Parameter data : depending on the protocol implementation.
|
|
124
|
+
// ISO 8073 define several type of parameters, but RFC 1006 recognizes only
|
|
125
|
+
// TSAP related parameters and PDU size. See RFC 0983 for more details.
|
|
126
|
+
TCOPT_Params Params;
|
|
127
|
+
/* Other params not used here, list only for completeness
|
|
128
|
+
ACK_TIME = 0x85, 1000 0101 Acknowledge Time
|
|
129
|
+
RES_ERROR = 0x86, 1000 0110 Residual Error Rate
|
|
130
|
+
PRIORITY = 0x87, 1000 0111 Priority
|
|
131
|
+
TRANSIT_DEL = 0x88, 1000 1000 Transit Delay
|
|
132
|
+
THROUGHPUT = 0x89, 1000 1001 Throughput
|
|
133
|
+
SEQ_NR = 0x8A, 1000 1010 Subsequence Number (in AK)
|
|
134
|
+
REASSIGNMENT = 0x8B, 1000 1011 Reassignment Time
|
|
135
|
+
FLOW_CNTL = 0x8C, 1000 1100 Flow Control Confirmation (in AK)
|
|
136
|
+
TPDU_SIZE = 0xC0, 1100 0000 TPDU Size
|
|
137
|
+
SRC_TSAP = 0xC1, 1100 0001 TSAP-ID / calling TSAP ( in CR/CC )
|
|
138
|
+
DST_TSAP = 0xC2, 1100 0010 TSAP-ID / called TSAP
|
|
139
|
+
CHECKSUM = 0xC3, 1100 0011 Checksum
|
|
140
|
+
VERSION_NR = 0xC4, 1100 0100 Version Number
|
|
141
|
+
PROTECTION = 0xC5, 1100 0101 Protection Parameters (user defined)
|
|
142
|
+
OPT_SEL = 0xC6, 1100 0110 Additional Option Selection
|
|
143
|
+
PROTO_CLASS = 0xC7, 1100 0111 Alternative Protocol Classes
|
|
144
|
+
PREF_MAX_TPDU_SIZE = 0xF0, 1111 0000
|
|
145
|
+
INACTIVITY_TIMER = 0xF2, 1111 0010
|
|
146
|
+
ADDICC = 0xe0 1110 0000 Additional Information on Connection Clearing
|
|
147
|
+
*/
|
|
148
|
+
} TCOTP_CO ;
|
|
149
|
+
typedef TCOTP_CO *PCOTP_CO;
|
|
150
|
+
|
|
151
|
+
// COTP Header for DATA EXCHANGE
|
|
152
|
+
typedef struct {
|
|
153
|
+
u_char HLength; // Header length : 3 for this header
|
|
154
|
+
u_char PDUType; // 0xF0 for this header
|
|
155
|
+
u_char EoT_Num; // EOT (bit 7) + PDU Number (bits 0..6)
|
|
156
|
+
// EOT = 1 -> End of Trasmission Packet (This packet is complete)
|
|
157
|
+
// PDU Number : Always 0
|
|
158
|
+
} TCOTP_DT;
|
|
159
|
+
typedef TCOTP_DT *PCOTP_DT;
|
|
160
|
+
|
|
161
|
+
// Info part of a PDU, only common parts. We use it to check the consistence
|
|
162
|
+
// of a telegram regardless of it's nature (control or data).
|
|
163
|
+
typedef struct {
|
|
164
|
+
TTPKT TPKT; // TPKT Header
|
|
165
|
+
// Common part of any COTP
|
|
166
|
+
u_char HLength; // Header length : 3 for this header
|
|
167
|
+
u_char PDUType; // Pdu type
|
|
168
|
+
} TIsoHeaderInfo ;
|
|
169
|
+
typedef TIsoHeaderInfo *PIsoHeaderInfo;
|
|
170
|
+
|
|
171
|
+
// PDU Type consts (Code + Credit)
|
|
172
|
+
const byte pdu_type_CR = 0xE0; // Connection request
|
|
173
|
+
const byte pdu_type_CC = 0xD0; // Connection confirm
|
|
174
|
+
const byte pdu_type_DR = 0x80; // Disconnect request
|
|
175
|
+
const byte pdu_type_DC = 0xC0; // Disconnect confirm
|
|
176
|
+
const byte pdu_type_DT = 0xF0; // Data transfer
|
|
177
|
+
|
|
178
|
+
const byte pdu_EoT = 0x80; // End of Trasmission Packet (This packet is complete)
|
|
179
|
+
|
|
180
|
+
const longword DataHeaderSize = sizeof(TTPKT)+sizeof(TCOTP_DT);
|
|
181
|
+
const longword IsoFrameSize = IsoPayload_Size+DataHeaderSize;
|
|
182
|
+
|
|
183
|
+
typedef struct {
|
|
184
|
+
TTPKT TPKT; // TPKT Header
|
|
185
|
+
TCOTP_CO COTP; // COPT Header for CONNECTION stuffs
|
|
186
|
+
} TIsoControlPDU;
|
|
187
|
+
typedef TIsoControlPDU *PIsoControlPDU;
|
|
188
|
+
|
|
189
|
+
typedef u_char TIsoPayload[IsoPayload_Size];
|
|
190
|
+
|
|
191
|
+
typedef struct {
|
|
192
|
+
TTPKT TPKT; // TPKT Header
|
|
193
|
+
TCOTP_DT COTP; // COPT Header for DATA EXCHANGE
|
|
194
|
+
TIsoPayload Payload; // Payload
|
|
195
|
+
} TIsoDataPDU ;
|
|
196
|
+
|
|
197
|
+
typedef TIsoDataPDU *PIsoDataPDU;
|
|
198
|
+
typedef TIsoPayload *PIsoPayload;
|
|
199
|
+
|
|
200
|
+
typedef enum {
|
|
201
|
+
pkConnectionRequest,
|
|
202
|
+
pkDisconnectRequest,
|
|
203
|
+
pkEmptyFragment,
|
|
204
|
+
pkInvalidPDU,
|
|
205
|
+
pkUnrecognizedType,
|
|
206
|
+
pkValidData
|
|
207
|
+
} TPDUKind ;
|
|
208
|
+
|
|
209
|
+
#pragma pack()
|
|
210
|
+
|
|
211
|
+
void ErrIsoText(int Error, char *Msg, int len);
|
|
212
|
+
|
|
213
|
+
class TIsoTcpSocket : public TMsgSocket
|
|
214
|
+
{
|
|
215
|
+
private:
|
|
216
|
+
|
|
217
|
+
TIsoControlPDU FControlPDU;
|
|
218
|
+
int IsoMaxFragments; // max fragments allowed for an ISO telegram
|
|
219
|
+
// Checks the PDU format
|
|
220
|
+
int CheckPDU(void *pPDU, u_char PduTypeExpected);
|
|
221
|
+
// Receives the next fragment
|
|
222
|
+
int isoRecvFragment(void *From, int Max, int &Size, bool &EoT);
|
|
223
|
+
protected:
|
|
224
|
+
TIsoDataPDU PDU;
|
|
225
|
+
int SetIsoError(int Error);
|
|
226
|
+
// Builds the control PDU starting from address properties
|
|
227
|
+
virtual int BuildControlPDU();
|
|
228
|
+
// Calcs the PDU size
|
|
229
|
+
int PDUSize(void *pPDU);
|
|
230
|
+
// Parses the connection request PDU to extract TSAP and PDU size info
|
|
231
|
+
virtual void IsoParsePDU(TIsoControlPDU PDU);
|
|
232
|
+
// Confirms the connection, override this method for special pourpose
|
|
233
|
+
// By default it checks the PDU format and resend it changing the pdu type
|
|
234
|
+
int IsoConfirmConnection(u_char PDUType);
|
|
235
|
+
void ClrIsoError();
|
|
236
|
+
virtual void FragmentSkipped(int Size);
|
|
237
|
+
public:
|
|
238
|
+
word SrcTSap; // Source TSAP
|
|
239
|
+
word DstTSap; // Destination TSAP
|
|
240
|
+
word SrcRef; // Source Reference
|
|
241
|
+
word DstRef; // Destination Reference
|
|
242
|
+
int IsoPDUSize;
|
|
243
|
+
int LastIsoError;
|
|
244
|
+
//--------------------------------------------------------------------------
|
|
245
|
+
TIsoTcpSocket();
|
|
246
|
+
~TIsoTcpSocket();
|
|
247
|
+
// HIGH Level functions (work on payload hiding the underlying protocol)
|
|
248
|
+
// Connects with a peer, the connection PDU is automatically built starting from address scheme (see below)
|
|
249
|
+
int isoConnect();
|
|
250
|
+
// Disconnects from a peer, if OnlyTCP = true, only a TCP disconnect is performed,
|
|
251
|
+
// otherwise a disconnect PDU is built and send.
|
|
252
|
+
int isoDisconnect(bool OnlyTCP);
|
|
253
|
+
// Sends a buffer, a valid header is created
|
|
254
|
+
int isoSendBuffer(void *Data, int Size);
|
|
255
|
+
// Receives a buffer
|
|
256
|
+
int isoRecvBuffer(void *Data, int & Size);
|
|
257
|
+
// Exchange cycle send->receive
|
|
258
|
+
int isoExchangeBuffer(void *Data, int & Size);
|
|
259
|
+
// A PDU is ready (at least its header) to be read
|
|
260
|
+
bool IsoPDUReady();
|
|
261
|
+
// Same as isoSendBuffer, but the entire PDU has to be provided (in any case a check is performed)
|
|
262
|
+
int isoSendPDU(PIsoDataPDU Data);
|
|
263
|
+
// Same as isoRecvBuffer, but it returns the entire PDU, automatically enques the fragments
|
|
264
|
+
int isoRecvPDU(PIsoDataPDU Data);
|
|
265
|
+
// Same as isoExchangeBuffer, but the entire PDU has to be provided (in any case a check is performed)
|
|
266
|
+
int isoExchangePDU(PIsoDataPDU Data);
|
|
267
|
+
// Peeks an header info to know which kind of telegram is incoming
|
|
268
|
+
void IsoPeek(void *pPDU, TPDUKind &PduKind);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
#endif // s7_isotcp_h
|