ua_job.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. typedef enum {
  25. UA_JOBTYPE_NOTHING,
  26. UA_JOBTYPE_DETACHCONNECTION, /* Detach the connection from the secure channel (but don't delete it) */
  27. UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER, /* The binary message is memory managed by the networklayer */
  28. UA_JOBTYPE_BINARYMESSAGE_ALLOCATED, /* The binary message was relocated away from the networklayer */
  29. UA_JOBTYPE_METHODCALL, /* Call the method as soon as possible */
  30. UA_JOBTYPE_METHODCALL_DELAYED, /* Call the method as soon as all previous jobs have finished */
  31. } UA_JobType;
  32. /* Jobs describe work that is executed once or repeatedly in the server */
  33. typedef struct {
  34. UA_JobType type;
  35. union {
  36. UA_Connection *closeConnection;
  37. struct {
  38. UA_Connection *connection;
  39. UA_ByteString message;
  40. } binaryMessage;
  41. struct {
  42. void *data;
  43. UA_ServerCallback method;
  44. } methodCall;
  45. } job;
  46. } UA_Job;
  47. #ifdef __cplusplus
  48. } // extern "C"
  49. #endif
  50. #endif /* UA_JOB_H_ */