testing_networklayers.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef TESTING_NETWORKLAYERS_H_
  5. #define TESTING_NETWORKLAYERS_H_
  6. #include <open62541/server_config.h>
  7. _UA_BEGIN_DECLS
  8. /**
  9. * Create the TCP networklayer and listen to the specified port
  10. *
  11. * @param sendBufferSize The send buffer is reused. This is the max chunk size
  12. * @param verificationBuffer the send function will copy the data that is sent
  13. * to this buffer, so that it is possible to check what the send function
  14. * received. */
  15. UA_Connection createDummyConnection(size_t sendBufferSize,
  16. UA_ByteString *verificationBuffer);
  17. extern UA_UInt32 UA_Client_recvSleepDuration;
  18. extern UA_StatusCode (*UA_Client_recv)(UA_Connection *connection, UA_ByteString *response,
  19. UA_UInt32 timeout);
  20. extern UA_StatusCode UA_Client_recvTesting_result;
  21. /* Override the client recv method to increase the simulated clock after the first recv.
  22. * UA_Client_recvSleepDuration is set to zero after the first recv.
  23. * UA_Client_recvTesting_result can be used to simulate an error */
  24. UA_StatusCode
  25. UA_Client_recvTesting(UA_Connection *connection, UA_ByteString *response,
  26. UA_UInt32 timeout);
  27. _UA_END_DECLS
  28. #endif /* TESTING_NETWORKLAYERS_H_ */