@litmusio/miravo-cli-linux-x64 0.0.0-stage → 0.15.9

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.
Files changed (235) hide show
  1. package/LICENSE +199 -0
  2. package/NOTICE +9 -0
  3. package/README.md +6 -2
  4. package/THIRD_PARTY_LICENSES.txt +15289 -0
  5. package/THIRD_PARTY_NOTICES.md +995 -0
  6. package/console-dist/assets/AnimatePresence-DWGUB15i.js +9 -0
  7. package/console-dist/assets/activity-DruTYzT1.js +1 -0
  8. package/console-dist/assets/api-13R-Szmo.js +57 -0
  9. package/console-dist/assets/arrow-up-right-DOENs04V.js +1 -0
  10. package/console-dist/assets/asset-detail-D142l0Fv.js +1 -0
  11. package/console-dist/assets/asset-detail-actions-Cf9kIXus.js +1 -0
  12. package/console-dist/assets/backup-power-B2I59W_p.js +1 -0
  13. package/console-dist/assets/badge-CdRB4Nd_.js +1 -0
  14. package/console-dist/assets/boiler-s_q0j7rz.js +1 -0
  15. package/console-dist/assets/by-path-BVKB6Tic.js +1 -0
  16. package/console-dist/assets/check-BTUv4z-H.js +1 -0
  17. package/console-dist/assets/chevron-down-CqA_2_CH.js +1 -0
  18. package/console-dist/assets/chevron-right-CVrgKBLR.js +1 -0
  19. package/console-dist/assets/chiller-r7DzAhJq.js +1 -0
  20. package/console-dist/assets/chunk-6KYCQHYJ-ga3Yekab.js +3 -0
  21. package/console-dist/assets/circle-x-BRkh0A1P.js +1 -0
  22. package/console-dist/assets/commercial-building-YWHjdNWm.js +1 -0
  23. package/console-dist/assets/compressor-ChZLMC94.js +1 -0
  24. package/console-dist/assets/console-panel-CnTkf-Zr.js +1 -0
  25. package/console-dist/assets/dialog-BYkdndf9.js +1 -0
  26. package/console-dist/assets/district-heating-DaU-3LzU.js +1 -0
  27. package/console-dist/assets/dom-BxZbg3NX.js +1 -0
  28. package/console-dist/assets/download-CvjDP5mu.js +1 -0
  29. package/console-dist/assets/fira-code-cyrillic-ext-wght-normal-DhYMMuQd.woff2 +0 -0
  30. package/console-dist/assets/fira-code-cyrillic-wght-normal-Y3u8pIsh.woff2 +0 -0
  31. package/console-dist/assets/fira-code-greek-ext-wght-normal-wWus70Ix.woff2 +0 -0
  32. package/console-dist/assets/fira-code-greek-wght-normal-B2SviObF.woff2 +0 -0
  33. package/console-dist/assets/fira-code-latin-ext-wght-normal-Dvfvaomy.woff2 +0 -0
  34. package/console-dist/assets/fira-code-latin-wght-normal-CHoedHDv.woff2 +0 -0
  35. package/console-dist/assets/fira-code-symbols2-wght-normal-CE6EOz_n.woff2 +0 -0
  36. package/console-dist/assets/floor-page-CiAcIxAW.js +1 -0
  37. package/console-dist/assets/floor-page-E-0txA4z.css +1 -0
  38. package/console-dist/assets/format-YLUJ7AXt.js +1 -0
  39. package/console-dist/assets/genset-C6_EUoFo.js +1 -0
  40. package/console-dist/assets/index-Cf8qRbyA.js +15 -0
  41. package/console-dist/assets/index-eZjXAdLh.css +2 -0
  42. package/console-dist/assets/loader-circle-w3T2fxvn.js +1 -0
  43. package/console-dist/assets/login-DP7gR4IQ.js +136 -0
  44. package/console-dist/assets/not-found-DeZnLH0i.js +1 -0
  45. package/console-dist/assets/pharma-cleanroom-DvWD_xsO.js +1 -0
  46. package/console-dist/assets/preload-helper-7y9sWmk5.js +1 -0
  47. package/console-dist/assets/react-DRt7cCXI.js +1 -0
  48. package/console-dist/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
  49. package/console-dist/assets/rtu-ByogcRPI.js +1 -0
  50. package/console-dist/assets/runtime-link-D88Db2wY.js +1 -0
  51. package/console-dist/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2 +0 -0
  52. package/console-dist/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2 +0 -0
  53. package/console-dist/assets/server-B0q1NVkV.js +1 -0
  54. package/console-dist/assets/shallow-mIK1Qu8X.js +1 -0
  55. package/console-dist/assets/smart-factory-gfMWfMWM.js +1 -0
  56. package/console-dist/assets/source-host-miravo-BW-SKMTe.js +1 -0
  57. package/console-dist/assets/stages-EYRT12Yp.js +1 -0
  58. package/console-dist/assets/status-DQYLUbXs.js +1 -0
  59. package/console-dist/assets/tank-Btg5piqB.js +1 -0
  60. package/console-dist/assets/tooltip-Dfmuq2yz.js +1 -0
  61. package/console-dist/assets/trash-2-BAh5-hxl.js +1 -0
  62. package/console-dist/assets/triangle-alert-3Ab-dBrN.js +1 -0
  63. package/console-dist/assets/use-engine-command-mutation-BXSIzBAw.js +1 -0
  64. package/console-dist/assets/use-transition-navigate-COPPNZaw.js +2 -0
  65. package/console-dist/assets/useQuery-BbehJ-ez.js +1 -0
  66. package/console-dist/assets/utils-D6wrZy-b.js +1 -0
  67. package/console-dist/assets/validation-6JNiaZvb.js +1 -0
  68. package/console-dist/assets/vendor-charts-Bquh2dWE.js +56 -0
  69. package/console-dist/assets/vendor-table-5YnGQUhO.js +4 -0
  70. package/console-dist/assets/vendor-ui-BGeFlRLR.js +1 -0
  71. package/console-dist/assets/water-treatment-BkzNjsHx.js +1 -0
  72. package/console-dist/icon.png +0 -0
  73. package/console-dist/index.html +53 -0
  74. package/console-dist/miravo-logo.webp +0 -0
  75. package/licenses/EPL-2.0.txt +80 -0
  76. package/licenses/GCC-exception-3.1.txt +33 -0
  77. package/licenses/GPL-2.0-only.txt +117 -0
  78. package/licenses/GPL-3.0-only.txt +232 -0
  79. package/licenses/LGPL-2.1-only.txt +176 -0
  80. package/licenses/MPL-2.0.txt +373 -0
  81. package/licenses/OFL-1.1.txt +93 -0
  82. package/licenses/overrides/@headlessui+vue@1.7.23.txt +24 -0
  83. package/licenses/overrides/@next+env@16.4.6.txt +24 -0
  84. package/licenses/overrides/@radix-ui+react-compose-refs@1.1.2.txt +24 -0
  85. package/licenses/overrides/@radix-ui+react-context@1.1.2.txt +24 -0
  86. package/licenses/overrides/@radix-ui+react-direction@1.1.1.txt +24 -0
  87. package/licenses/overrides/@radix-ui+react-id@1.1.1.txt +24 -0
  88. package/licenses/overrides/@radix-ui+react-use-callback-ref@1.1.1.txt +24 -0
  89. package/licenses/overrides/@radix-ui+react-use-escape-keydown@1.1.1.txt +24 -0
  90. package/licenses/overrides/@radix-ui+react-use-layout-effect@1.1.1.txt +24 -0
  91. package/licenses/overrides/@radix-ui+react-use-rect@1.1.1.txt +24 -0
  92. package/licenses/overrides/@radix-ui+react-use-size@1.1.1.txt +24 -0
  93. package/licenses/overrides/@radix-ui+rect@1.1.1.txt +24 -0
  94. package/licenses/overrides/@replit+codemirror-css-color-picker@6.3.0.txt +6 -0
  95. package/licenses/overrides/@scalar+openapi-types@0.8.0.txt +24 -0
  96. package/licenses/overrides/@scalar+openapi-types@0.9.10.txt +24 -0
  97. package/licenses/overrides/@scalar+openapi-types@0.9.7.txt +24 -0
  98. package/licenses/overrides/@scalar+openapi-types@0.9.9.txt +24 -0
  99. package/licenses/overrides/@scalar+postman-to-openapi@0.7.1.txt +24 -0
  100. package/licenses/overrides/@scalar+schemas@0.19.0.txt +24 -0
  101. package/licenses/overrides/@scalar+workspace-store@0.46.3.txt +24 -0
  102. package/licenses/overrides/@scalar+workspace-store@0.75.0.txt +24 -0
  103. package/licenses/overrides/assert-plus@1.0.0.txt +24 -0
  104. package/licenses/overrides/client-only@0.0.1.txt +24 -0
  105. package/licenses/overrides/embla-carousel-react@8.6.0.txt +24 -0
  106. package/licenses/overrides/embla-carousel-reactive-utils@8.6.0.txt +24 -0
  107. package/licenses/overrides/embla-carousel@8.6.0.txt +24 -0
  108. package/licenses/overrides/fastdom@1.0.12.txt +12 -0
  109. package/licenses/overrides/precond@0.2.3.txt +22 -0
  110. package/licenses/overrides/react-remove-scroll-bar@2.3.8.txt +24 -0
  111. package/licenses/overrides/strictdom@1.0.1.txt +12 -0
  112. package/licenses/overrides/victory-vendor@36.9.2.txt +33 -0
  113. package/licenses/runtime/Bun-1.4.3-LICENSE.md +85 -0
  114. package/licenses/runtime/ICU-78.1-LICENSE.txt +568 -0
  115. package/licenses/runtime/bun-components/boringssl.txt +238 -0
  116. package/licenses/runtime/bun-components/brotli.txt +19 -0
  117. package/licenses/runtime/bun-components/c-ares.txt +24 -0
  118. package/licenses/runtime/bun-components/highway.txt +371 -0
  119. package/licenses/runtime/bun-components/libarchive.txt +65 -0
  120. package/licenses/runtime/bun-components/libbase64.txt +28 -0
  121. package/licenses/runtime/bun-components/libdeflate.txt +22 -0
  122. package/licenses/runtime/bun-components/libjpeg-turbo.txt +147 -0
  123. package/licenses/runtime/bun-components/libspng.txt +25 -0
  124. package/licenses/runtime/bun-components/libuv.txt +19 -0
  125. package/licenses/runtime/bun-components/libwebp.txt +30 -0
  126. package/licenses/runtime/bun-components/llvm.txt +311 -0
  127. package/licenses/runtime/bun-components/lol-html.txt +27 -0
  128. package/licenses/runtime/bun-components/ls-hpack.txt +21 -0
  129. package/licenses/runtime/bun-components/ls-qpack.txt +21 -0
  130. package/licenses/runtime/bun-components/lsquic-chrome.txt +32 -0
  131. package/licenses/runtime/bun-components/lsquic.txt +21 -0
  132. package/licenses/runtime/bun-components/mimalloc.txt +21 -0
  133. package/licenses/runtime/bun-components/picohttpparser.txt +24 -0
  134. package/licenses/runtime/bun-components/simdutf-apache.txt +201 -0
  135. package/licenses/runtime/bun-components/simdutf-mit.txt +18 -0
  136. package/licenses/runtime/bun-components/tigerbeetle.txt +177 -0
  137. package/licenses/runtime/bun-components/tinycc.txt +504 -0
  138. package/licenses/runtime/bun-components/typescript-go.txt +55 -0
  139. package/licenses/runtime/bun-components/usockets.txt +201 -0
  140. package/licenses/runtime/bun-components/uucode.txt +30 -0
  141. package/licenses/runtime/bun-components/uwebsockets.txt +201 -0
  142. package/licenses/runtime/bun-components/xxhash.txt +31 -0
  143. package/licenses/runtime/bun-components/zlib-ng.txt +19 -0
  144. package/licenses/runtime/bun-components/zstd-copying.txt +339 -0
  145. package/licenses/runtime/bun-components/zstd.txt +30 -0
  146. package/licenses/runtime/musl-1.2.6-COPYRIGHT.txt +193 -0
  147. package/miravo +4 -0
  148. package/native/S7-NOTICES.txt +11 -0
  149. package/native/miravo-s7.node +0 -0
  150. package/native/s7-source/CMakeLists.txt +23 -0
  151. package/native/s7-source/NODE-SNAP7-LICENSE +24 -0
  152. package/native/s7-source/addon.cpp +124 -0
  153. package/native/s7-source/bridge.cpp +150 -0
  154. package/native/s7-source/node-api-headers/LICENSE +21 -0
  155. package/native/s7-source/node-api-headers/include/js_native_api.h +591 -0
  156. package/native/s7-source/node-api-headers/include/js_native_api_types.h +213 -0
  157. package/native/s7-source/node-api-headers/include/node_api.h +265 -0
  158. package/native/s7-source/node-api-headers/include/node_api_types.h +58 -0
  159. package/native/s7-source/node-api-windows.h +78 -0
  160. package/native/s7-source/snap7/HISTORY.txt +277 -0
  161. package/native/s7-source/snap7/gpl.txt +674 -0
  162. package/native/s7-source/snap7/lgpl-3.0.txt +165 -0
  163. package/native/s7-source/snap7/src/core/miravo_request_validation.h +72 -0
  164. package/native/s7-source/snap7/src/core/s7_client.cpp +503 -0
  165. package/native/s7-source/snap7/src/core/s7_client.h +104 -0
  166. package/native/s7-source/snap7/src/core/s7_firmware.h +1256 -0
  167. package/native/s7-source/snap7/src/core/s7_isotcp.cpp +541 -0
  168. package/native/s7-source/snap7/src/core/s7_isotcp.h +271 -0
  169. package/native/s7-source/snap7/src/core/s7_micro_client.cpp +3328 -0
  170. package/native/s7-source/snap7/src/core/s7_micro_client.h +364 -0
  171. package/native/s7-source/snap7/src/core/s7_partner.cpp +1178 -0
  172. package/native/s7-source/snap7/src/core/s7_partner.h +284 -0
  173. package/native/s7-source/snap7/src/core/s7_peer.cpp +121 -0
  174. package/native/s7-source/snap7/src/core/s7_peer.h +58 -0
  175. package/native/s7-source/snap7/src/core/s7_server.cpp +2161 -0
  176. package/native/s7-source/snap7/src/core/s7_server.h +261 -0
  177. package/native/s7-source/snap7/src/core/s7_text.cpp +788 -0
  178. package/native/s7-source/snap7/src/core/s7_text.h +49 -0
  179. package/native/s7-source/snap7/src/core/s7_types.h +1066 -0
  180. package/native/s7-source/snap7/src/lib/snap7.def +129 -0
  181. package/native/s7-source/snap7/src/lib/snap7_libmain.cpp +1196 -0
  182. package/native/s7-source/snap7/src/lib/snap7_libmain.h +201 -0
  183. package/native/s7-source/snap7/src/sys/snap_msgsock.cpp +958 -0
  184. package/native/s7-source/snap7/src/sys/snap_msgsock.h +339 -0
  185. package/native/s7-source/snap7/src/sys/snap_platform.h +152 -0
  186. package/native/s7-source/snap7/src/sys/snap_sysutils.cpp +73 -0
  187. package/native/s7-source/snap7/src/sys/snap_sysutils.h +39 -0
  188. package/native/s7-source/snap7/src/sys/snap_tcpsrvr.cpp +487 -0
  189. package/native/s7-source/snap7/src/sys/snap_tcpsrvr.h +247 -0
  190. package/native/s7-source/snap7/src/sys/snap_threads.cpp +162 -0
  191. package/native/s7-source/snap7/src/sys/snap_threads.h +45 -0
  192. package/native/s7-source/snap7/src/sys/sol_threads.h +208 -0
  193. package/native/s7-source/snap7/src/sys/unix_threads.h +228 -0
  194. package/native/s7-source/snap7/src/sys/win_threads.h +159 -0
  195. package/nodesets/.ignore +1 -0
  196. package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
  197. package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  198. package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
  199. package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
  200. package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
  201. package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  202. package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
  203. package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
  204. package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
  205. package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
  206. package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
  207. package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
  208. package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
  209. package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
  210. package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
  211. package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
  212. package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
  213. package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
  214. package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
  215. package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
  216. package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
  217. package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
  218. package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
  219. package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
  220. package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
  221. package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
  222. package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
  223. package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
  224. package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
  225. package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
  226. package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
  227. package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
  228. package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
  229. package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
  230. package/nodesets/Opc.Ua.Types.bsd +3499 -0
  231. package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
  232. package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
  233. package/nodesets/UANodeSet.xsd +497 -0
  234. package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
  235. package/package.json +37 -4
@@ -0,0 +1,1066 @@
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_types_h
27
+ #define s7_types_h
28
+ //------------------------------------------------------------------------------
29
+ #include "s7_isotcp.h"
30
+ //------------------------------------------------------------------------------
31
+ // EXPORT CONSTANTS
32
+ // Everything added in this section has to be copied into wrappers interface
33
+ //------------------------------------------------------------------------------
34
+
35
+ #ifdef OS_WINDOWS
36
+ #define SM7API __stdcall
37
+ #else
38
+ #define SM7API
39
+ #endif
40
+
41
+ // Area ID
42
+ const byte S7AreaPE = 0x81;
43
+ const byte S7AreaPA = 0x82;
44
+ const byte S7AreaMK = 0x83;
45
+ const byte S7AreaDB = 0x84;
46
+ const byte S7AreaCT = 0x1C;
47
+ const byte S7AreaTM = 0x1D;
48
+
49
+ const int MaxVars = 255;
50
+
51
+ const int S7WLBit = 0x01;
52
+ const int S7WLByte = 0x02;
53
+ const int S7WLChar = 0x03;
54
+ const int S7WLWord = 0x04;
55
+ const int S7WLInt = 0x05;
56
+ const int S7WLDWord = 0x06;
57
+ const int S7WLDInt = 0x07;
58
+ const int S7WLReal = 0x08;
59
+ const int S7WLCounter = 0x1C;
60
+ const int S7WLTimer = 0x1D;
61
+
62
+ // Block type
63
+ const byte Block_OB = 0x38;
64
+ const byte Block_DB = 0x41;
65
+ const byte Block_SDB = 0x42;
66
+ const byte Block_FC = 0x43;
67
+ const byte Block_SFC = 0x44;
68
+ const byte Block_FB = 0x45;
69
+ const byte Block_SFB = 0x46;
70
+
71
+ // Sub Block Type
72
+ const byte SubBlk_OB = 0x08;
73
+ const byte SubBlk_DB = 0x0A;
74
+ const byte SubBlk_SDB = 0x0B;
75
+ const byte SubBlk_FC = 0x0C;
76
+ const byte SubBlk_SFC = 0x0D;
77
+ const byte SubBlk_FB = 0x0E;
78
+ const byte SubBlk_SFB = 0x0F;
79
+
80
+ // Block languages
81
+ const byte BlockLangAWL = 0x01;
82
+ const byte BlockLangKOP = 0x02;
83
+ const byte BlockLangFUP = 0x03;
84
+ const byte BlockLangSCL = 0x04;
85
+ const byte BlockLangDB = 0x05;
86
+ const byte BlockLangGRAPH = 0x06;
87
+
88
+ // CPU status
89
+ const byte S7CpuStatusUnknown = 0x00;
90
+ const byte S7CpuStatusRun = 0x08;
91
+ const byte S7CpuStatusStop = 0x04;
92
+
93
+ const longword evcSnap7Base = 0x00008000;
94
+ // S7 Server Event Code
95
+ const longword evcPDUincoming = 0x00010000;
96
+ const longword evcDataRead = 0x00020000;
97
+ const longword evcDataWrite = 0x00040000;
98
+ const longword evcNegotiatePDU = 0x00080000;
99
+ const longword evcReadSZL = 0x00100000;
100
+ const longword evcClock = 0x00200000;
101
+ const longword evcUpload = 0x00400000;
102
+ const longword evcDownload = 0x00800000;
103
+ const longword evcDirectory = 0x01000000;
104
+ const longword evcSecurity = 0x02000000;
105
+ const longword evcControl = 0x04000000;
106
+ const longword evcReserved_08000000 = 0x08000000;
107
+ const longword evcReserved_10000000 = 0x10000000;
108
+ const longword evcReserved_20000000 = 0x20000000;
109
+ const longword evcReserved_40000000 = 0x40000000;
110
+ const longword evcReserved_80000000 = 0x80000000;
111
+ // Event SubCodes
112
+ const word evsUnknown = 0x0000;
113
+ const word evsStartUpload = 0x0001;
114
+ const word evsStartDownload = 0x0001;
115
+ const word evsGetBlockList = 0x0001;
116
+ const word evsStartListBoT = 0x0002;
117
+ const word evsListBoT = 0x0003;
118
+ const word evsGetBlockInfo = 0x0004;
119
+ const word evsGetClock = 0x0001;
120
+ const word evsSetClock = 0x0002;
121
+ const word evsSetPassword = 0x0001;
122
+ const word evsClrPassword = 0x0002;
123
+ // Event Result
124
+ const word evrNoError = 0;
125
+ const word evrFragmentRejected = 0x0001;
126
+ const word evrMalformedPDU = 0x0002;
127
+ const word evrSparseBytes = 0x0003;
128
+ const word evrCannotHandlePDU = 0x0004;
129
+ const word evrNotImplemented = 0x0005;
130
+ const word evrErrException = 0x0006;
131
+ const word evrErrAreaNotFound = 0x0007;
132
+ const word evrErrOutOfRange = 0x0008;
133
+ const word evrErrOverPDU = 0x0009;
134
+ const word evrErrTransportSize = 0x000A;
135
+ const word evrInvalidGroupUData = 0x000B;
136
+ const word evrInvalidSZL = 0x000C;
137
+ const word evrDataSizeMismatch = 0x000D;
138
+ const word evrCannotUpload = 0x000E;
139
+ const word evrCannotDownload = 0x000F;
140
+ const word evrUploadInvalidID = 0x0010;
141
+ const word evrResNotFound = 0x0011;
142
+
143
+ // Async mode
144
+ const int amPolling = 0;
145
+ const int amEvent = 1;
146
+ const int amCallBack = 2;
147
+
148
+ //------------------------------------------------------------------------------
149
+ // PARAMS LIST
150
+ // Notes for Local/Remote Port
151
+ // If the local port for a server and remote port for a client is != 102 they
152
+ // will be *no more compatible with S7 IsoTCP*
153
+ // A good reason to change them could be inside a debug session under Unix.
154
+ // Increasing the port over 1024 avoids the need of be root.
155
+ // Obviously you need to work with the couple Snap7Client/Snap7Server and change
156
+ // both, or, use iptable and nat the port.
157
+ //------------------------------------------------------------------------------
158
+ const int p_u16_LocalPort = 1;
159
+ const int p_u16_RemotePort = 2;
160
+ const int p_i32_PingTimeout = 3;
161
+ const int p_i32_SendTimeout = 4;
162
+ const int p_i32_RecvTimeout = 5;
163
+ const int p_i32_WorkInterval = 6;
164
+ const int p_u16_SrcRef = 7;
165
+ const int p_u16_DstRef = 8;
166
+ const int p_u16_SrcTSap = 9;
167
+ const int p_i32_PDURequest = 10;
168
+ const int p_i32_MaxClients = 11;
169
+ const int p_i32_BSendTimeout = 12;
170
+ const int p_i32_BRecvTimeout = 13;
171
+ const int p_u32_RecoveryTime = 14;
172
+ const int p_u32_KeepAliveTime = 15;
173
+
174
+ // Bool param is passed as int32_t : 0->false, 1->true
175
+ // String param (only set) is passed as pointer
176
+
177
+ typedef int16_t *Pint16_t;
178
+ typedef uint16_t *Puint16_t;
179
+ typedef int32_t *Pint32_t;
180
+ typedef uint32_t *Puint32_t;
181
+ typedef int64_t *Pint64_t;
182
+ typedef uint64_t *Puint64_t;
183
+ typedef uintptr_t *Puintptr_t;
184
+ //-----------------------------------------------------------------------------
185
+ // INTERNALS CONSTANTS
186
+ //------------------------------------------------------------------------------
187
+
188
+ const word DBMaxName = 0xFFFF; // max number (name) of DB
189
+
190
+ const longword errS7Mask = 0xFFF00000;
191
+ const longword errS7Base = 0x000FFFFF;
192
+ const longword errS7notConnected = errS7Base+0x0001; // Client not connected
193
+ const longword errS7InvalidMode = errS7Base+0x0002; // Requested a connection to...
194
+ const longword errS7InvalidPDUin = errS7Base+0x0003; // Malformed input PDU
195
+
196
+ // S7 outcoming Error code
197
+ const word Code7Ok = 0x0000;
198
+ const word Code7AddressOutOfRange = 0x0005;
199
+ const word Code7InvalidTransportSize = 0x0006;
200
+ const word Code7WriteDataSizeMismatch = 0x0007;
201
+ const word Code7ResItemNotAvailable = 0x000A;
202
+ const word Code7ResItemNotAvailable1 = 0xD209;
203
+ const word Code7InvalidValue = 0xDC01;
204
+ const word Code7NeedPassword = 0xD241;
205
+ const word Code7InvalidPassword = 0xD602;
206
+ const word Code7NoPasswordToClear = 0xD604;
207
+ const word Code7NoPasswordToSet = 0xD605;
208
+ const word Code7FunNotAvailable = 0x8104;
209
+ const word Code7DataOverPDU = 0x8500;
210
+
211
+ // Result transport size
212
+ const byte TS_ResBit = 0x03;
213
+ const byte TS_ResByte = 0x04;
214
+ const byte TS_ResInt = 0x05;
215
+ const byte TS_ResReal = 0x07;
216
+ const byte TS_ResOctet = 0x09;
217
+
218
+ // Client Job status (lib internals, not S7)
219
+ const int JobComplete = 0;
220
+ const int JobPending = 1;
221
+
222
+ // Control codes
223
+ const word CodeControlUnknown = 0;
224
+ const word CodeControlColdStart = 1; // Cold start
225
+ const word CodeControlWarmStart = 2; // Warm start
226
+ const word CodeControlStop = 3; // Stop
227
+ const word CodeControlCompress = 4; // Compress
228
+ const word CodeControlCpyRamRom = 5; // Copy Ram to Rom
229
+ const word CodeControlInsDel = 6; // Insert in working ram the block downloaded
230
+ // Delete from working ram the block selected
231
+ // PDU Type
232
+ const byte PduType_request = 1; // family request
233
+ const byte PduType_response = 3; // family response
234
+ const byte PduType_userdata = 7; // family user data
235
+
236
+ // PDU Functions
237
+ const byte pduResponse = 0x02; // Response (when error)
238
+ const byte pduFuncRead = 0x04; // Read area
239
+ const byte pduFuncWrite = 0x05; // Write area
240
+ const byte pduNegotiate = 0xF0; // Negotiate PDU length
241
+ const byte pduStart = 0x28; // CPU start
242
+ const byte pduStop = 0x29; // CPU stop
243
+ const byte pduStartUpload = 0x1D; // Start Upload
244
+ const byte pduUpload = 0x1E; // Upload
245
+ const byte pduEndUpload = 0x1F; // EndUpload
246
+ const byte pduReqDownload = 0x1A; // Start Download request
247
+ const byte pduDownload = 0x1B; // Download request
248
+ const byte pduDownloadEnded = 0x1C; // Download end request
249
+ const byte pduControl = 0x28; // Control (insert/delete..)
250
+
251
+ // PDU SubFunctions
252
+ const byte SFun_ListAll = 0x01; // List all blocks
253
+ const byte SFun_ListBoT = 0x02; // List Blocks of type
254
+ const byte SFun_BlkInfo = 0x03; // Get Block info
255
+ const byte SFun_ReadSZL = 0x01; // Read SZL
256
+ const byte SFun_ReadClock = 0x01; // Read Clock (Date and Time)
257
+ const byte SFun_SetClock = 0x02; // Set Clock (Date and Time)
258
+ const byte SFun_EnterPwd = 0x01; // Enter password for this session
259
+ const byte SFun_CancelPwd = 0x02; // Cancel password for this session
260
+ const byte SFun_Insert = 0x50; // Insert block
261
+ const byte SFun_Delete = 0x42; // Delete block
262
+
263
+ typedef tm *PTimeStruct;
264
+
265
+ //==============================================================================
266
+ // HEADERS
267
+ //==============================================================================
268
+ #pragma pack(1)
269
+
270
+ // Tag Struct
271
+ typedef struct{
272
+ int Area;
273
+ int DBNumber;
274
+ int Start;
275
+ int Size;
276
+ int WordLen;
277
+ }TS7Tag, *PS7Tag;
278
+
279
+ // Incoming header, it will be mapped onto IsoPDU payload
280
+ typedef struct {
281
+ byte P; // Telegram ID, always 32
282
+ byte PDUType; // Header type 1 or 7
283
+ word AB_EX; // AB currently unknown, maybe it can be used for long numbers.
284
+ word Sequence; // Message ID. This can be used to make sure a received answer
285
+ word ParLen; // Length of parameters which follow this header
286
+ word DataLen; // Length of data which follow the parameters
287
+ }TS7ReqHeader;
288
+
289
+ typedef TS7ReqHeader* PS7ReqHeader;
290
+
291
+ // Outcoming 12 bytes header , response for Request type 1
292
+ typedef struct{
293
+ byte P; // Telegram ID, always 32
294
+ byte PDUType; // Header type 2 or 3
295
+ word AB_EX; // AB currently unknown, maybe it can be used for long numbers.
296
+ word Sequence; // Message ID. This can be used to make sure a received answer
297
+ word ParLen; // Length of parameters which follow this header
298
+ word DataLen; // Length of data which follow the parameters
299
+ word Error; // Error code
300
+ } TS7ResHeader23;
301
+
302
+ typedef TS7ResHeader23* PS7ResHeader23;
303
+
304
+ // Outcoming 10 bytes header , response for Request type 7
305
+ typedef struct{
306
+ byte P; // Telegram ID, always 32
307
+ byte PDUType; // Header type 1 or 7
308
+ word AB_EX; // AB currently unknown, maybe it can be used for long numbers.
309
+ word Sequence; // Message ID. This can be used to make sure a received answer
310
+ word ParLen; // Length of parameters which follow this header
311
+ word DataLen; // Length of data which follow the parameters
312
+ }TS7ResHeader17;
313
+
314
+ typedef TS7ResHeader17* PS7ResHeader17;
315
+
316
+ // Outcoming 10 bytes header , response for Request type 8 (server control)
317
+ typedef struct {
318
+ byte P; // Telegram ID, always 32
319
+ byte PDUType; // Header type 8
320
+ word AB_EX; // Zero
321
+ word Sequence; // Message ID. This can be used to make sure a received answer
322
+ word DataLen; // Length of data which follow this header
323
+ word Error; // Error code
324
+ } TS7ResHeader8;
325
+
326
+ typedef TS7ResHeader8* PS7ResHeader8;
327
+
328
+ // Outcoming answer buffer header type 2 or header type 3
329
+ typedef struct{
330
+ TS7ResHeader23 Header;
331
+ byte ResData [IsoPayload_Size - sizeof(TS7ResHeader23)];
332
+ } TS7Answer23;
333
+
334
+ typedef TS7Answer23* PS7Answer23;
335
+
336
+ // Outcoming buffer header type 1 or header type 7
337
+ typedef struct {
338
+ TS7ResHeader17 Header;
339
+ byte ResData [IsoPayload_Size - sizeof(TS7ResHeader17)];
340
+ } TS7Answer17;
341
+
342
+ typedef TS7Answer17* PS7Answer17;
343
+
344
+ typedef byte TTimeBuffer[8];
345
+ typedef byte *PTimeBuffer[8];
346
+
347
+ typedef struct{
348
+ byte bcd_year;
349
+ byte bcd_mon;
350
+ byte bcd_day;
351
+ byte bcd_hour;
352
+ byte bcd_min;
353
+ byte bcd_sec;
354
+ byte bcd_himsec;
355
+ byte bcd_dow;
356
+ }TS7Time, *PS7Time;
357
+
358
+ typedef byte TS7Buffer[65536];
359
+ typedef byte *PS7Buffer;
360
+
361
+ const int ReqHeaderSize = sizeof(TS7ReqHeader);
362
+ const int ResHeaderSize23 = sizeof(TS7ResHeader23);
363
+ const int ResHeaderSize17 = sizeof(TS7ResHeader17);
364
+
365
+ // Most used request type parameters record
366
+ typedef struct {
367
+ byte Head[3];// 0x00 0x01 0x12
368
+ byte Plen; // par len 0x04
369
+ byte Uk; // unknown
370
+ byte Tg; // type and group (4 bits type and 4 bits group)
371
+ byte SubFun; // subfunction
372
+ byte Seq; // sequence
373
+ }TReqFunTypedParams;
374
+
375
+ //==============================================================================
376
+ // FUNCTION NEGOTIATE
377
+ //==============================================================================
378
+ typedef struct {
379
+ byte FunNegotiate;
380
+ byte Unknown;
381
+ word ParallelJobs_1;
382
+ word ParallelJobs_2;
383
+ word PDULength;
384
+ }TReqFunNegotiateParams;
385
+
386
+ typedef TReqFunNegotiateParams* PReqFunNegotiateParams;
387
+
388
+ typedef struct {
389
+ byte FunNegotiate;
390
+ byte Unknown;
391
+ word ParallelJobs_1;
392
+ word ParallelJobs_2;
393
+ word PDULength;
394
+ }TResFunNegotiateParams;
395
+
396
+ typedef TResFunNegotiateParams* PResFunNegotiateParams;
397
+
398
+ //==============================================================================
399
+ // FUNCTION READ
400
+ //==============================================================================
401
+ typedef struct {
402
+ byte ItemHead[3];
403
+ byte TransportSize;
404
+ word Length;
405
+ word DBNumber;
406
+ byte Area;
407
+ byte Address[3];
408
+ }TReqFunReadItem, * PReqFunReadItem;
409
+
410
+ //typedef TReqFunReadItem;
411
+
412
+ typedef struct {
413
+ byte FunRead;
414
+ byte ItemsCount;
415
+ TReqFunReadItem Items[MaxVars];
416
+ }TReqFunReadParams;
417
+
418
+ typedef TReqFunReadParams* PReqFunReadParams;
419
+
420
+ typedef struct {
421
+ byte FunRead;
422
+ byte ItemCount;
423
+ }TResFunReadParams;
424
+
425
+ typedef TResFunReadParams* PResFunReadParams;
426
+
427
+ typedef struct {
428
+ byte ReturnCode;
429
+ byte TransportSize;
430
+ word DataLength;
431
+ byte Data[IsoPayload_Size - 17]; // 17 = header + params + data header - 1
432
+ }TResFunReadItem, *PResFunReadItem;
433
+
434
+ typedef PResFunReadItem TResFunReadData[MaxVars];
435
+
436
+ //==============================================================================
437
+ // FUNCTION WRITE
438
+ //==============================================================================
439
+ typedef struct {
440
+ byte ItemHead[3];
441
+ byte TransportSize;
442
+ word Length;
443
+ word DBNumber;
444
+ byte Area;
445
+ byte Address[3];
446
+ }TReqFunWriteItem, * PReqFunWriteItem;
447
+
448
+ typedef struct {
449
+ byte FunWrite;
450
+ byte ItemsCount;
451
+ TReqFunWriteItem Items[MaxVars];
452
+ }TReqFunWriteParams;
453
+
454
+ typedef TReqFunWriteParams* PReqFunWriteParams;
455
+
456
+ typedef struct {
457
+ byte ReturnCode;
458
+ byte TransportSize;
459
+ word DataLength;
460
+ byte Data [IsoPayload_Size - 17]; // 17 = header + params + data header -1
461
+ }TReqFunWriteDataItem, *PReqFunWriteDataItem;
462
+
463
+ typedef PReqFunWriteDataItem TReqFunWriteData[MaxVars];
464
+
465
+ typedef struct {
466
+ byte FunWrite;
467
+ byte ItemCount;
468
+ byte Data[MaxVars];
469
+ }TResFunWrite;
470
+
471
+ typedef TResFunWrite* PResFunWrite;
472
+
473
+ //==============================================================================
474
+ // GROUP UPLOAD
475
+ //==============================================================================
476
+ typedef struct {
477
+ byte FunSUpld; // function start upload 0x1D
478
+ byte Uk6 [6]; // Unknown 6 bytes
479
+ byte Upload_ID;
480
+ byte Len_1;
481
+ byte Prefix;
482
+ byte BlkPrfx; // always 0x30
483
+ byte BlkType;
484
+ byte AsciiBlk[5]; // BlockNum in ascii
485
+ byte A; // always 0x41 ('A')
486
+ }TReqFunStartUploadParams;
487
+
488
+ typedef TReqFunStartUploadParams* PReqFunStartUploadParams;
489
+
490
+ typedef struct {
491
+ byte FunSUpld; // function start upload 0x1D
492
+ byte Data_1[6];
493
+ byte Upload_ID;
494
+ byte Uk[3];
495
+ byte LenLoad[5];
496
+ }TResFunStartUploadParams;
497
+
498
+ typedef TResFunStartUploadParams* PResFunStartUploadParams;
499
+
500
+ typedef struct {
501
+ byte FunUpld; // function upload 0x1E
502
+ byte Uk6[6]; // Unknown 6 bytes
503
+ byte Upload_ID;
504
+ }TReqFunUploadParams;
505
+
506
+ typedef TReqFunUploadParams* PReqFunUploadParams;
507
+
508
+ typedef struct {
509
+ byte FunUpld; // function upload 0x1E
510
+ byte EoU; // 0 = End Of Upload, 1 = Upload in progress
511
+ }TResFunUploadParams;
512
+
513
+ typedef TResFunUploadParams* PResFunUploadParams;
514
+
515
+ typedef struct {
516
+ word Length; // Payload length - 4
517
+ byte Uk_00; // Unknown 0x00
518
+ byte Uk_FB; // Unknown 0xFB
519
+ // from here is the same of TS7CompactBlockInfo
520
+ word Cst_pp;
521
+ byte Uk_01; // Unknown 0x01
522
+ byte BlkFlags;
523
+ byte BlkLang;
524
+ byte SubBlkType;
525
+ word BlkNum;
526
+ u_int LenLoadMem;
527
+ u_int BlkSec;
528
+ u_int CodeTime_ms;
529
+ word CodeTime_dy;
530
+ u_int IntfTime_ms;
531
+ word IntfTime_dy;
532
+ word SbbLen;
533
+ word AddLen;
534
+ word LocDataLen;
535
+ word MC7Len;
536
+ }TResFunUploadDataHeaderFirst;
537
+
538
+ typedef TResFunUploadDataHeaderFirst* PResFunUploadDataHeaderFirst;
539
+
540
+ typedef struct {
541
+ word Length;// Payload length - 4
542
+ byte Uk_00; // Unknown 0x00
543
+ byte Uk_FB; // Unknown 0xFB
544
+ }TResFunUploadDataHeaderNext;
545
+
546
+ typedef TResFunUploadDataHeaderNext* PResFunUploadDataHeaderNext;
547
+
548
+ typedef struct {
549
+ word Length;// Payload length - 4
550
+ byte Uk_00; // Unknown 0x00
551
+ byte Uk_FB; // Unknown 0xFB
552
+ }TResFunUploadDataHeader;
553
+
554
+ typedef TResFunUploadDataHeader* PResFunUploadDataHeader;
555
+
556
+ typedef struct {
557
+ byte ID; // 0x65
558
+ word Seq; // Sequence
559
+ byte Const_1[10];
560
+ word Lo_bound;
561
+ word Hi_Bound;
562
+ byte u_shortLen;// 0x02 byte
563
+ // 0x04 word
564
+ // 0x05 int
565
+ // 0x06 dword
566
+ // 0x07 dint
567
+ // 0x08 real
568
+ byte c1, c2;
569
+ char Author[8];
570
+ char Family[8];
571
+ char Header[8];
572
+ byte B1; // 0x11
573
+ byte B2; // 0x00
574
+ word Chksum;
575
+ byte Uk_8[8];
576
+ }TArrayUpldFooter;
577
+
578
+ typedef TArrayUpldFooter* PArrayUpldFooter;
579
+
580
+ typedef struct {
581
+ byte FunEUpld; // function end upload 0x1F
582
+ byte Uk6[6]; // Unknown 6 bytes
583
+ byte Upload_ID;
584
+ }TReqFunEndUploadParams;
585
+
586
+ typedef TReqFunEndUploadParams* PReqFunEndUploadParams;
587
+
588
+ typedef struct {
589
+ byte FunEUpld; // function end upload 0x1F
590
+ }TResFunEndUploadParams;
591
+
592
+ typedef TResFunEndUploadParams* PResFunEndUploadParams;
593
+
594
+ //==============================================================================
595
+ // GROUP DOWNLOAD
596
+ //==============================================================================
597
+ typedef struct {
598
+ byte FunSDwnld; // function start Download 0x1A
599
+ byte Uk6[6]; // Unknown 6 bytes
600
+ byte Dwnld_ID;
601
+ byte Len_1; // 0x09
602
+ byte Prefix; // 0x5F
603
+ byte BlkPrfx; // always 0x30
604
+ byte BlkType;
605
+ byte AsciiBlk[5]; // BlockNum in ascii
606
+ byte P; // 0x50 ('P')
607
+ byte Len_2; // 0x0D
608
+ byte Uk1; // 0x01
609
+ byte AsciiLoad[6];// load memory size (MC7 size + 92)
610
+ byte AsciiMC7[6]; // Block size in bytes
611
+ }TReqStartDownloadParams;
612
+
613
+ typedef TReqStartDownloadParams* PReqStartDownloadParams;
614
+ typedef byte TResStartDownloadParams;
615
+ typedef TResStartDownloadParams* PResStartDownloadParams;
616
+
617
+ typedef struct {
618
+ byte Fun; // pduDownload or pduDownloadEnded
619
+ byte Uk7[7];
620
+ byte Len_1; // 0x09
621
+ byte Prefix; // 0x5F
622
+ byte BlkPrfx; // always 0x30
623
+ byte BlkType;
624
+ byte AsciiBlk[5]; // BlockNum in ascii
625
+ byte P; // 0x50 ('P')
626
+ }TReqDownloadParams;
627
+
628
+ typedef TReqDownloadParams* PReqDownloadParams;
629
+
630
+ typedef struct {
631
+ byte FunDwnld; // 0x1B
632
+ byte EoS; // End of sequence : 0x00 - Sequence in progress : 0x01
633
+ }TResDownloadParams;
634
+
635
+ typedef TResDownloadParams* PResDownloadParams;
636
+
637
+ typedef struct {
638
+ word DataLen;
639
+ word FB_00; // 0x00 0xFB
640
+ }TResDownloadDataHeader;
641
+
642
+ typedef TResDownloadDataHeader* PResDownloadDataHeader;
643
+ typedef byte TResEndDownloadParams;
644
+ typedef TResEndDownloadParams* PResEndDownloadParams;
645
+
646
+ typedef struct {
647
+ word Cst_pp;
648
+ byte Uk_01; // Unknown 0x01
649
+ byte BlkFlags;
650
+ byte BlkLang;
651
+ byte SubBlkType;
652
+ word BlkNum;
653
+ u_int LenLoadMem;
654
+ u_int BlkSec;
655
+ u_int CodeTime_ms;
656
+ word CodeTime_dy;
657
+ u_int IntfTime_ms;
658
+ word IntfTime_dy;
659
+ word SbbLen;
660
+ word AddLen;
661
+ word LocDataLen;
662
+ word MC7Len;
663
+ }TS7CompactBlockInfo;
664
+
665
+ typedef TS7CompactBlockInfo* PS7CompactBlockInfo;
666
+
667
+ typedef struct {
668
+ byte Uk_20[20];
669
+ byte Author[8];
670
+ byte Family[8];
671
+ byte Header[8];
672
+ byte B1; // 0x11
673
+ byte B2; // 0x00
674
+ word Chksum;
675
+ byte Uk_12[8];
676
+ }TS7BlockFooter;
677
+
678
+ typedef TS7BlockFooter* PS7BlockFooter;
679
+
680
+ //==============================================================================
681
+ // FUNCTION INSERT/DELETE
682
+ //==============================================================================
683
+ typedef struct {
684
+ byte Fun; // plc control 0x28
685
+ byte Uk7[7]; // unknown 7
686
+ word Len_1; // Length part 1 : 10
687
+ byte NumOfBlocks; // number of blocks to insert
688
+ byte ByteZero; // 0x00
689
+ byte AsciiZero; // 0x30 '0'
690
+ byte BlkType;
691
+ byte AsciiBlk[5]; // BlockNum in ascii
692
+ byte SFun; // 0x50 or 0x42
693
+ byte Len_2; // Length part 2 : 0x05 bytes
694
+ char Cmd[5]; // ascii '_INSE' or '_DELE'
695
+ }TReqControlBlockParams;
696
+
697
+ typedef TReqControlBlockParams* PReqControlBlockParams;
698
+
699
+ //==============================================================================
700
+ // FUNCTIONS START/STOP/COPY RAM TO ROM/COMPRESS
701
+ //==============================================================================
702
+ typedef struct {
703
+ byte Fun; // stop 0x29
704
+ byte Uk_5[5]; // unknown 5 bytes 0x00
705
+ byte Len_2; // Length part 2 : 0x09
706
+ char Cmd[9]; // ascii 'P_PROGRAM'
707
+ }TReqFunPlcStop;
708
+
709
+ typedef TReqFunPlcStop* PReqFunPlcStop;
710
+
711
+ typedef struct {
712
+ byte Fun; // start 0x28
713
+ byte Uk_7[7]; // unknown 7
714
+ word Len_1; // Length part 1 : 0x0000
715
+ byte Len_2; // Length part 2 : 0x09
716
+ char Cmd [9]; // ascii 'P_PROGRAM'
717
+ }TReqFunPlcHotStart;
718
+
719
+ typedef TReqFunPlcHotStart* PReqFunPlcHotStart;
720
+
721
+ typedef struct {
722
+ byte Fun; // start 0x28
723
+ byte Uk_7[7]; // unknown 7
724
+ word Len_1; // Length part 1 : 0x0002
725
+ word SFun; // 'C ' 0x4320
726
+ byte Len_2; // Length part 2 : 0x09
727
+ char Cmd[9]; // ascii 'P_PROGRAM'
728
+ }TReqFunPlcColdStart;
729
+
730
+ typedef TReqFunPlcColdStart* PReqFunPlcColdStart;
731
+
732
+ typedef struct {
733
+ byte Fun; // pduControl 0x28
734
+ byte Uk_7[7]; // unknown 7
735
+ word Len_1; // Length part 1 : 0x0002
736
+ word SFun; // 'EP' 0x4550
737
+ byte Len_2; // Length part 2 : 0x05
738
+ char Cmd[5]; // ascii '_MODU'
739
+ }TReqFunCopyRamToRom;
740
+
741
+ typedef TReqFunCopyRamToRom* PReqFunCopyRamToRom;
742
+
743
+ typedef struct {
744
+ byte Fun; // pduControl 0x28
745
+ byte Uk_7[7]; // unknown 7
746
+ word Len_1; // Length part 1 : 0x00
747
+ byte Len_2; // Length part 2 : 0x05
748
+ char Cmd[5]; // ascii '_GARB'
749
+ }TReqFunCompress;
750
+
751
+ typedef TReqFunCompress* PReqFunCompress;
752
+
753
+ typedef struct {
754
+ byte ResFun;
755
+ byte para;
756
+ }TResFunCtrl;
757
+
758
+ typedef TResFunCtrl* PResFunCtrl;
759
+
760
+ //==============================================================================
761
+ // FUNCTIONS USERDATA
762
+ //==============================================================================
763
+ typedef struct {
764
+ byte Head[3]; // Always 0x00 0x01 0x12
765
+ byte Plen; // par len 0x04 or 0x08
766
+ byte Uk; // unknown
767
+ byte Tg; // type and group (4 bits type and 4 bits group)
768
+ byte SubFun; // subfunction
769
+ byte Seq; // sequence
770
+ word resvd; // present if plen=0x08 (S7 manager online functions)
771
+ word Err; // present if plen=0x08 (S7 manager online functions)
772
+ }TS7Params7;
773
+
774
+ typedef TS7Params7* PS7ReqParams7;
775
+ typedef TS7Params7* PS7ResParams7;
776
+
777
+ // for convenience Hi order bit of type are included (0x4X)
778
+ const byte grProgrammer = 0x41;
779
+ const byte grCyclicData = 0x42;
780
+ const byte grBlocksInfo = 0x43;
781
+ const byte grSZL = 0x44;
782
+ const byte grPassword = 0x45;
783
+ const byte grBSend = 0x46;
784
+ const byte grClock = 0x47;
785
+ const byte grSecurity = 0x45;
786
+
787
+ //==============================================================================
788
+ // GROUP SECURITY
789
+ //==============================================================================
790
+ typedef TReqFunTypedParams TReqFunSecurity;
791
+ typedef TReqFunSecurity* PReqFunSecurity;
792
+
793
+ typedef char TS7Password[8];
794
+
795
+ typedef struct {
796
+ byte Ret; // 0xFF for request
797
+ byte TS; // 0x09 Transport size
798
+ word DLen; // Data len : 8 bytes
799
+ byte Pwd[8]; // Password encoded into "AG" format
800
+ }TReqDataSecurity;
801
+
802
+ typedef TReqDataSecurity* PReqDataSecurity;
803
+ typedef TS7Params7 TResParamsSecurity;
804
+ typedef TResParamsSecurity* PResParamsSecurity;
805
+
806
+ typedef struct {
807
+ byte Ret;
808
+ byte TS;
809
+ word DLen;
810
+ }TResDataSecurity;
811
+
812
+ typedef TResDataSecurity* PResDataSecurity;
813
+
814
+ //==============================================================================
815
+ // GROUP BLOCKS SZL
816
+ //==============================================================================
817
+ typedef TReqFunTypedParams TReqFunReadSZLFirst;
818
+ typedef TReqFunReadSZLFirst* PReqFunReadSZLFirst;
819
+
820
+ typedef struct {
821
+ byte Head[3]; // 0x00 0x01 0x12
822
+ byte Plen; // par len 0x04
823
+ byte Uk; // unknown
824
+ byte Tg; // type and group (4 bits type and 4 bits group)
825
+ byte SubFun; // subfunction
826
+ byte Seq; // sequence
827
+ word Rsvd; // Reserved 0x0000
828
+ word ErrNo; // Error Code
829
+ }TReqFunReadSZLNext;
830
+
831
+ typedef TReqFunReadSZLNext* PReqFunReadSZLNext;
832
+
833
+ typedef struct {
834
+ byte Ret; // 0xFF for request
835
+ byte TS; // 0x09 Transport size
836
+ word DLen; // Data len
837
+ word ID; // SZL-ID
838
+ word Index;// SZL-Index
839
+ }TS7ReqSZLData;
840
+
841
+ typedef TS7ReqSZLData* PS7ReqSZLData;
842
+
843
+ typedef struct {
844
+ byte Ret;
845
+ byte TS;
846
+ word DLen;
847
+ word ID;
848
+ word Index;
849
+ word ListLen;
850
+ word ListCount;
851
+ word Data[32747];
852
+ }TS7ResSZLDataFirst;
853
+
854
+ typedef TS7ResSZLDataFirst* PS7ResSZLDataFirst;
855
+
856
+ typedef struct {
857
+ byte Ret;
858
+ byte TS;
859
+ word DLen;
860
+ word Data[32751];
861
+ }TS7ResSZLDataNext;
862
+
863
+ typedef TS7ResSZLDataNext* PS7ResSZLDataNext;
864
+
865
+ typedef struct {
866
+ byte Ret;
867
+ byte OtherInfo[9];
868
+ word Count;
869
+ word Items[32747];
870
+ }TS7ResSZLData_0;
871
+
872
+ typedef TS7ResSZLData_0* PS7ResSZLData_0;
873
+
874
+ //==============================================================================
875
+ // GROUP CLOCK
876
+ //==============================================================================
877
+ typedef TReqFunTypedParams TReqFunDateTime;
878
+ typedef TReqFunDateTime* PReqFunDateTime;
879
+
880
+ typedef byte TReqDataGetDateTime[4];
881
+
882
+ typedef longword *PReqDataGetDateTime;
883
+
884
+ typedef struct {
885
+ byte RetVal;
886
+ byte TSize;
887
+ word Length;
888
+ byte Rsvd;
889
+ byte HiYear;
890
+ TTimeBuffer Time;
891
+ }TResDataGetTime;
892
+
893
+ typedef TResDataGetTime* PResDataGetTime;
894
+ typedef TResDataGetTime TReqDataSetTime;
895
+ typedef TReqDataSetTime* PReqDataSetTime;
896
+
897
+ typedef struct {
898
+ byte RetVal;
899
+ byte TSize;
900
+ word Length;
901
+ }TResDataSetTime;
902
+
903
+ typedef TResDataSetTime* PResDataSetTime;
904
+
905
+ //==============================================================================
906
+ // GROUP BLOCKS INFO
907
+ //==============================================================================
908
+ typedef TReqFunTypedParams TReqFunGetBlockInfo;
909
+ typedef TReqFunGetBlockInfo* PReqFunGetBlockInfo;
910
+
911
+ typedef byte TReqDataFunBlocks[4];
912
+ typedef u_char* PReqDataFunBlocks;
913
+
914
+ typedef struct {
915
+ byte Head[3]; // 0x00 0x01 0x12
916
+ byte Plen; // par len 0x04
917
+ byte Uk; // unknown
918
+ byte Tg; // type and group (4 bits type and 4 bits group)
919
+ byte SubFun; // subfunction
920
+ byte Seq; // sequence
921
+ word Rsvd; // Reserved 0x0000
922
+ word ErrNo; // Error Code
923
+ }TResFunGetBlockInfo;
924
+
925
+ typedef TResFunGetBlockInfo* PResFunGetBlockInfo;
926
+
927
+ typedef struct {
928
+ byte Zero; // always 0x30 -> Ascii 0
929
+ byte BType; // Block Type
930
+ word BCount; // Block count
931
+ }TResFunGetBlockItem;
932
+
933
+ typedef struct {
934
+ byte RetVal;
935
+ byte TRSize;
936
+ word Length;
937
+ TResFunGetBlockItem Blocks[7];
938
+ }TDataFunListAll;
939
+
940
+ typedef TDataFunListAll* PDataFunListAll;
941
+
942
+ typedef struct {
943
+ word BlockNum;
944
+ byte Unknown;
945
+ byte BlockLang;
946
+ }TDataFunGetBotItem;
947
+
948
+ typedef struct {
949
+ byte RetVal;
950
+ byte TSize;
951
+ word DataLen;
952
+ TDataFunGetBotItem Items[(IsoPayload_Size - 29 ) / 4];
953
+ }TDataFunGetBot;
954
+ // Note : 29 is the size of headers iso, COPT, S7 header, params, data
955
+
956
+ typedef TDataFunGetBot* PDataFunGetBot;
957
+
958
+ typedef struct {
959
+ byte RetVal; // 0xFF
960
+ byte TSize; // Octet (0x09)
961
+ word Length; // 0x0002
962
+ byte Zero; // Ascii '0' (0x30)
963
+ byte BlkType;
964
+ }TReqDataBlockOfType;
965
+
966
+ typedef TReqDataBlockOfType* PReqDataBlockOfType;
967
+
968
+ typedef struct {
969
+ byte RetVal;
970
+ byte TSize;
971
+ word DataLen;
972
+ byte BlkPrfx; // always 0x30
973
+ byte BlkType;
974
+ byte AsciiBlk[5]; // BlockNum in ascii
975
+ byte A; // always 0x41 ('A')
976
+ }TReqDataBlockInfo;
977
+
978
+ typedef TReqDataBlockInfo* PReqDataBlockInfo;
979
+
980
+ typedef struct {
981
+ byte RetVal;
982
+ byte TSize;
983
+ word Length;
984
+ byte Cst_b;
985
+ byte BlkType;
986
+ word Cst_w1;
987
+ word Cst_w2;
988
+ word Cst_pp;
989
+ byte Unknown_1;
990
+ byte BlkFlags;
991
+ byte BlkLang;
992
+ byte SubBlkType;
993
+ word BlkNumber;
994
+ u_int LenLoadMem;
995
+ byte BlkSec[4];
996
+ u_int CodeTime_ms;
997
+ word CodeTime_dy;
998
+ u_int IntfTime_ms;
999
+ word IntfTime_dy;
1000
+ word SbbLen;
1001
+ word AddLen;
1002
+ word LocDataLen;
1003
+ word MC7Len;
1004
+ byte Author[8];
1005
+ byte Family[8];
1006
+ byte Header[8];
1007
+ byte Version;
1008
+ byte Unknown_2;
1009
+ word BlkChksum;
1010
+ byte Resvd1[4];
1011
+ byte Resvd2[4];
1012
+ }TResDataBlockInfo;
1013
+
1014
+ typedef TResDataBlockInfo* PResDataBlockInfo;
1015
+
1016
+ //==============================================================================
1017
+ // BSEND / BRECV
1018
+ //==============================================================================
1019
+ typedef struct {
1020
+ int Size;
1021
+ longword R_ID;
1022
+ byte Data[65536];
1023
+ }TPendingBuffer;
1024
+
1025
+ typedef struct {
1026
+ TTPKT TPKT;
1027
+ TCOTP_DT COTP;
1028
+ byte P;
1029
+ byte PDUType;
1030
+ }TPacketInfo;
1031
+
1032
+ typedef struct {
1033
+ byte Head[3];// Always 0x00 0x01 0x12
1034
+ byte Plen; // par len 0x04 or 0x08
1035
+ byte Uk; // unknown (0x12)
1036
+ byte Tg; // type and group, 4 bits type and 4 bits group (0x46)
1037
+ byte SubFun; // subfunction (0x01)
1038
+ byte Seq; // sequence
1039
+ byte IDSeq; // ID Sequence (come from partner)
1040
+ byte EoS; // End of Sequence = 0x00 Sequence in progress = 0x01;
1041
+ word Err; //
1042
+ }TBSendParams;
1043
+
1044
+ typedef TBSendParams* PBSendReqParams;
1045
+ typedef TBSendParams* PBSendResParams;
1046
+
1047
+ // Data frame
1048
+
1049
+ typedef struct {
1050
+ byte FF; // 0xFF
1051
+ byte TRSize; // Transport Size 0x09 (octet)
1052
+ word Len; // This Telegram Length
1053
+ byte DHead[4];// sequence 0x12 0x06 0x13 0x00
1054
+ u_int R_ID; // R_ID
1055
+ }TBsendRequestData;
1056
+
1057
+ typedef TBsendRequestData* PBsendRequestData;
1058
+
1059
+ typedef struct {
1060
+ byte DHead[4]; // sequence 0x0A 0x00 0x00 0x00
1061
+ }TBSendResData;
1062
+
1063
+ typedef TBSendResData* PBSendResData;
1064
+
1065
+ #pragma pack()
1066
+ #endif // s7_types_h