ua_server_internal.h 3.4 KB

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