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); } } }
public unsafe void SetCoreEndpoint(CoreEndpoint *_ep) { ep = _ep; }
public static extern unsafe void ice_core_endpoint_set_flag( CoreEndpoint *ep, string name, bool value );
public static extern unsafe int ice_core_endpoint_get_id(CoreEndpoint *ep);