Browse Source

Added management functions/structs for individual method hooks.

ichrispa 9 years ago
parent
commit
83205b3db3
2 changed files with 42 additions and 2 deletions
  1. 30 1
      src/server/ua_methodcall_manager.c
  2. 12 1
      src/server/ua_methodcall_manager.h

+ 30 - 1
src/server/ua_methodcall_manager.c

@@ -1,5 +1,34 @@
 #include "ua_methodcall_manager.h"
 
 UA_MethodCall_Manager *UA_MethodCallManager_new(void) {
-    return UA_NULL;
+    UA_MethodCall_Manager *manager = (UA_MethodCall_Manager *) UA_malloc(sizeof(UA_MethodCall_Manager));
+    LIST_INIT(&manager->attachedMethods);
+    return manager;
+}
+
+void UA_MethodCallManager_deleteMembers(UA_MethodCall_Manager *manager) {
+    UA_NodeAttachedMethod *attMethod;
+    
+    while (manager->attachedMethods.lh_first != NULL) {
+        attMethod = manager->attachedMethods.lh_first;
+        LIST_REMOVE(attMethod, listEntry);
+        UA_free(attMethod);
+    }
+    
+    return;
+}
+
+void UA_MethodCallManager_destroy(UA_MethodCall_Manager *manager) {
+    UA_MethodCallManager_deleteMembers(manager);
+    UA_free(manager);
+    
+    return;
+}
+
+UA_StatusCode UA_Server_detachMethod_fromNode(UA_Server *server, UA_NodeId methodNodeId) {
+    return UA_STATUSCODE_GOOD;
+}
+
+UA_StatusCode UA_Server_attachMethod_toNode(UA_Server *server, UA_NodeId methodNodeId, UA_Variant* *method){
+    return UA_STATUSCODE_GOOD;
 }

+ 12 - 1
src/server/ua_methodcall_manager.h

@@ -6,9 +6,20 @@
 #include "ua_types_generated.h"
 #include "ua_nodes.h"
 
+typedef struct UA_NodeAttachedMethod_s {
+    UA_Node methodNodeId;
+    UA_Variant* (*method)(UA_Node *object, UA_UInt32 InputArgumentsSize, UA_Variant *InputArguments, UA_UInt32 *OutputArgumentsSize);
+    LIST_ENTRY(UA_NodeAttachedMethod_s) listEntry;
+} UA_NodeAttachedMethod;
+
 typedef struct UA_MethodCall_Manager_s {
-    UA_Int32 placeHolder;
+    LIST_HEAD(UA_ListOfUAAttachedMethods, UA_NodeAttachedMethod_s) attachedMethods;
 } UA_MethodCall_Manager;
 
 UA_MethodCall_Manager *UA_MethodCallManager_new(void);
+void UA_MethodCallManager_deleteMembers(UA_MethodCall_Manager *manager);
+void UA_MethodCallManager_destroy(UA_MethodCall_Manager *manager);
+
+UA_StatusCode UA_Server_detachMethod_fromNode(UA_Server *server, UA_NodeId methodNodeId);
+UA_StatusCode UA_Server_attachMethod_toNode(UA_Server *server, UA_NodeId methodNodeId, UA_Variant* *method);
 #endif