ua_server_internal.h 3.2 KB

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