ua_job.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 UA_JOB_H_
  5. #define UA_JOB_H_
  6. #include "ua_connection.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. struct UA_Server;
  11. typedef struct UA_Server UA_Server;
  12. typedef void (*UA_ServerCallback)(UA_Server *server, void *data);
  13. /* Jobs describe work that is executed once or repeatedly in the server */
  14. typedef struct {
  15. enum {
  16. UA_JOBTYPE_NOTHING,
  17. UA_JOBTYPE_DETACHCONNECTION, /* Detach the connection from the secure channel (but don't delete it) */
  18. UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER, /* The binary message is memory managed by the networklayer */
  19. UA_JOBTYPE_BINARYMESSAGE_ALLOCATED, /* The binary message was relocated away from the networklayer */
  20. UA_JOBTYPE_METHODCALL, /* Call the method as soon as possible */
  21. UA_JOBTYPE_METHODCALL_DELAYED, /* Call the method as soon as all previous jobs have finished */
  22. } type;
  23. union {
  24. UA_Connection *closeConnection;
  25. struct {
  26. UA_Connection *connection;
  27. UA_ByteString message;
  28. } binaryMessage;
  29. struct {
  30. void *data;
  31. UA_ServerCallback method;
  32. } methodCall;
  33. } job;
  34. } UA_Job;
  35. #ifdef __cplusplus
  36. } // extern "C"
  37. #endif
  38. #endif /* UA_JOB_H_ */