ua_job.h 2.0 KB

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