Exemple #1
0
        public void Route(string[] methods, string path, EndpointHandler cb, string[] flags)
        {
            unsafe {
                int         epId = 0;
                HandlerInfo target;

                if (endpointIds.TryGetValue(path, out epId))
                {
                    target = handlers[epId];
                }
                else
                {
                    CoreEndpoint *ep = Core.ice_server_router_add_endpoint(inst, path);
                    epId = Core.ice_core_endpoint_get_id(ep);

                    target = new HandlerInfo();
                    target.SetCoreEndpoint(ep);

                    handlers[epId]    = target;
                    endpointIds[path] = epId;
                }

                foreach (string flag in flags)
                {
                    Core.ice_core_endpoint_set_flag(target.GetCoreEndpoint(), flag, true);
                }

                foreach (string m in methods)
                {
                    target.AddTargetForMethod(m, cb);
                }
            }
        }
Exemple #2
0
 public unsafe void SetCoreEndpoint(CoreEndpoint *_ep)
 {
     ep = _ep;
 }
Exemple #3
0
 public static extern unsafe void ice_core_endpoint_set_flag(
     CoreEndpoint *ep,
     string name,
     bool value
     );
Exemple #4
0
 public static extern unsafe int ice_core_endpoint_get_id(CoreEndpoint *ep);