cs101_asdu.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2016, 2017 MZ Automation GmbH
  3. *
  4. * This file is part of lib60870-C
  5. *
  6. * lib60870-C is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * lib60870-C is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with lib60870-C. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * See COPYING file for the complete license text.
  20. */
  21. #ifndef SRC_INC_INTERNAL_CS101_ASDU_INTERNAL_H_
  22. #define SRC_INC_INTERNAL_CS101_ASDU_INTERNAL_H_
  23. #include <stdbool.h>
  24. #include <stdint.h>
  25. #include "iec60870_common.h"
  26. //#include "information_objects_internal.h"
  27. //#include "apl_types_internal.h"
  28. #include "lib_memory.h"
  29. #include "iec_include.h"
  30. struct sCS101_ASDU {
  31. CS101_AppLayerParameters parameters;
  32. uint8_t* asdu;
  33. int asduHeaderLength;
  34. uint8_t* payload;
  35. int payloadSize;
  36. };
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. void
  41. CS101_ASDU_encode(CS101_ASDU self, Frame frame);
  42. bool
  43. CS101_ASDU_addInformationObject(CS101_ASDU self, InformationObject io);
  44. bool
  45. CS101_ASDU_isSequence(CS101_ASDU self);
  46. int
  47. CS101_ASDU_getNumberOfElements(CS101_ASDU self);
  48. CS101_ASDU
  49. CS101_ASDU_initializeStatic(CS101_StaticASDU self, CS101_AppLayerParameters parameters, bool isSequence, CS101_CauseOfTransmission cot, int oa, int ca,
  50. bool isTest, bool isNegative);
  51. /**
  52. * \brief create a new (read-only) instance
  53. *
  54. * NOTE: Do not try to append information objects to the instance!
  55. */
  56. CS101_ASDU
  57. CS101_ASDU_createFromBuffer(CS101_AppLayerParameters parameters, uint8_t* msg, int msgLength);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* SRC_INC_INTERNAL_CS101_ASDU_INTERNAL_H_ */