ua_server_internal.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef UA_SERVER_INTERNAL_H_
  2. #define UA_SERVER_INTERNAL_H_
  3. #include "ua_util.h"
  4. #include "ua_server.h"
  5. #include "ua_session_manager.h"
  6. #include "ua_securechannel_manager.h"
  7. #include "ua_nodestore.h"
  8. #ifdef ENABLE_SUBSCRIPTIONS
  9. #include "ua_subscription_manager.h"
  10. #endif
  11. #ifdef ENABLE_METHODCALLS
  12. #include "ua_methodcall_manager.h"
  13. #endif
  14. #define PRODUCT_URI "http://open62541.org"
  15. #define ANONYMOUS_POLICY "open62541-anonymous-policy"
  16. #define USERNAME_POLICY "open62541-username-policy"
  17. /** Mapping of namespace-id and url to an external nodestore. For namespaces
  18. that have no mapping defined, the internal nodestore is used by default. */
  19. typedef struct UA_ExternalNamespace {
  20. UA_UInt16 index;
  21. UA_String url;
  22. UA_ExternalNodeStore externalNodeStore;
  23. } UA_ExternalNamespace;
  24. struct UA_Server {
  25. /* Config */
  26. UA_ServerConfig config;
  27. UA_Logger logger;
  28. UA_UInt32 random_seed;
  29. /* Meta */
  30. UA_DateTime startTime;
  31. UA_DateTime buildDate;
  32. UA_ApplicationDescription description;
  33. UA_Int32 endpointDescriptionsSize;
  34. UA_EndpointDescription *endpointDescriptions;
  35. /* Communication */
  36. size_t networkLayersSize;
  37. UA_ServerNetworkLayer *networkLayers;
  38. /* Security */
  39. UA_ByteString serverCertificate;
  40. UA_SecureChannelManager secureChannelManager;
  41. UA_SessionManager sessionManager;
  42. /* Address Space */
  43. UA_NodeStore *nodestore;
  44. size_t namespacesSize;
  45. UA_String *namespaces;
  46. size_t externalNamespacesSize;
  47. UA_ExternalNamespace *externalNamespaces;
  48. /* Jobs with a repetition interval */
  49. LIST_HEAD(RepeatedJobsList, RepeatedJobs) repeatedJobs;
  50. /* Method hooks */
  51. #ifdef ENABLE_METHODCALLS
  52. UA_MethodCall_Manager *methodCallManager;
  53. #endif
  54. #ifdef UA_MULTITHREADING
  55. /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
  56. struct cds_wfcq_head dispatchQueue_head;
  57. UA_Boolean *running;
  58. UA_UInt16 nThreads;
  59. UA_UInt32 **workerCounters;
  60. pthread_t *thr;
  61. struct cds_lfs_stack mainLoopJobs; /* Work that shall be executed only in the main loop and not
  62. by worker threads */
  63. struct DelayedJobs *delayedJobs;
  64. pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */
  65. /* Dispatch queue tail for the worker threads */
  66. struct cds_wfcq_tail dispatchQueue_tail;
  67. #endif
  68. };
  69. void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, UA_ByteString *msg);
  70. UA_AddNodesResult UA_Server_addNodeWithSession(UA_Server *server, UA_Session *session, UA_Node *node,
  71. const UA_ExpandedNodeId parentNodeId,
  72. const UA_NodeId referenceTypeId);
  73. UA_AddNodesResult UA_Server_addNode(UA_Server *server, UA_Node *node, const UA_ExpandedNodeId parentNodeId,
  74. const UA_NodeId referenceTypeId);
  75. UA_StatusCode UA_Server_addReferenceWithSession(UA_Server *server, UA_Session *session,
  76. const UA_AddReferencesItem *item);
  77. UA_StatusCode addOneWayReferenceWithSession(UA_Server *server, UA_Session *session,
  78. const UA_AddReferencesItem *item);
  79. UA_StatusCode UA_Server_addDelayedJob(UA_Server *server, UA_Job job);
  80. void UA_Server_deleteAllRepeatedJobs(UA_Server *server);
  81. #endif /* UA_SERVER_INTERNAL_H_ */