ua_job.h 2.0 KB

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