ua_job.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2014 the contributors as stated in the AUTHORS file
  3. *
  4. * This file is part of open62541. open62541 is free software: you can
  5. * redistribute it and/or modify it under the terms of the GNU Lesser General
  6. * Public License, version 3 (as published by the Free Software Foundation) with
  7. * a static linking exception as stated in the LICENSE file provided with
  8. * open62541.
  9. *
  10. * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
  11. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. #ifndef UA_JOB_H_
  16. #define UA_JOB_H_
  17. #include "ua_connection.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. struct UA_Server;
  22. typedef struct UA_Server UA_Server;
  23. typedef void (*UA_ServerCallback)(UA_Server *server, void *data);
  24. /* Jobs describe work that is executed once or repeatedly in the server */
  25. typedef struct {
  26. enum {
  27. UA_JOBTYPE_NOTHING,
  28. UA_JOBTYPE_DETACHCONNECTION, /* Detach the connection from the secure channel (but don't delete it) */
  29. UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER, /* The binary message is memory managed by the networklayer */
  30. UA_JOBTYPE_BINARYMESSAGE_ALLOCATED, /* The binary message was relocated away from the networklayer */
  31. UA_JOBTYPE_METHODCALL, /* Call the method as soon as possible */
  32. UA_JOBTYPE_METHODCALL_DELAYED, /* Call the method as soon as all previous jobs have finished */
  33. } type;
  34. union {
  35. UA_Connection *closeConnection;
  36. struct {
  37. UA_Connection *connection;
  38. UA_ByteString message;
  39. } binaryMessage;
  40. struct {
  41. void *data;
  42. UA_ServerCallback method;
  43. } methodCall;
  44. } job;
  45. } UA_Job;
  46. #ifdef __cplusplus
  47. } // extern "C"
  48. #endif
  49. #endif /* UA_JOB_H_ */