Esempio n. 1
0
        public NodeRef _register_node_api(String caller_id, String caller_api, ref bool rtn)
        {
            NodeRef node_ref = null;

            if (nodes.ContainsKey(caller_id))
            {
                node_ref = nodes[caller_id];
            }

            String bumped_api = "";

            if (node_ref != null)
            {
                if (node_ref.api == caller_api)
                {
                    rtn = false;
                    return(node_ref);
                }
                else
                {
                    bumped_api = node_ref.api;
                    //thread_pool.queue_task(bumped_api, shutdown_node_task, (bumped_api, caller_id, "new node registered with same name"))
                }
            }
            node_ref         = new NodeRef(caller_id, caller_api);
            nodes[caller_id] = node_ref;

            rtn = (bumped_api.Length > 0);
            return(node_ref);
        }
Esempio n. 2
0
            public String lookupNode(String caller_id, String node_name)
            {
                NodeRef node = reg_manager.get_node(caller_id);

                if (node == null)
                {
                    return("");
                }
                return(node.api);
            }
Esempio n. 3
0
        public void _register(Registrations r, String key, String caller_id, String caller_api, String service_api = null)
        {
            bool    changed  = false;
            NodeRef node_ref = _register_node_api(caller_id, caller_api, ref changed);

            node_ref.add(r.type, key);

            if (changed)
            {
                publishers.unregister_all(caller_id);
                subscribers.unregister_all(caller_id);
                services.unregister_all(caller_id);
                param_subscribers.unregister_all(caller_id);
            }
            r.register(key, caller_id, caller_api, service_api);
        }
Esempio n. 4
0
        public ReturnStruct _unregister(Registrations r, String key, String caller_id, String caller_api, String service_api = null)
        {
            ReturnStruct ret;

            if (nodes.ContainsKey(caller_id))
            {
                NodeRef node_ref = nodes[caller_id];
                ret = r.unregister(key, caller_id, caller_api, service_api);
                if (ret.statusCode == 1)
                {
                    node_ref.remove(r.type, key);
                }
                if (node_ref.is_empty())
                {
                    nodes.Remove(caller_id);
                }
            }
            else
            {
                ret = new ReturnStruct(0, String.Format("[{0}] is not a registered node", caller_id), new XmlRpc_Wrapper.XmlRpcValue(1));
            }
            return(ret); // new ReturnStruct(code, msg, new XmlRpc_Wrapper.XmlRpcValue(ret));
        }
Esempio n. 5
0
        public NodeRef _register_node_api(String caller_id, String caller_api, ref bool rtn)
        {
            NodeRef node_ref = null;
                if(nodes.ContainsKey(caller_id))
                 node_ref= nodes[caller_id];

            String bumped_api = "";
            if (node_ref != null)
            {
                if (node_ref.api == caller_api)
                {
                    rtn = false;
                    return node_ref;
                }
                else
                {
                    bumped_api = node_ref.api;
                    //thread_pool.queue_task(bumped_api, shutdown_node_task, (bumped_api, caller_id, "new node registered with same name"))
                }
            }
            node_ref = new NodeRef(caller_id, caller_api);
            nodes[caller_id] = node_ref;

            rtn = (bumped_api.Length > 0);
            return node_ref;
        }