Ejemplo n.º 1
0
        /// <summary>
        /// Create a binding between a special web page and the server result
        /// </summary>
        /// <param name="pathRegex">A regular expression that is matched with
        /// the URI path</param>
        /// <param name="handler">The function that is called when a match is
        /// found</param>
        public void CreateBinding(string pathRegex, mg_callback_t handler)
        {
            // Create the binding
            PageBinding binding;

            binding.Path      = pathRegex;
            binding.ptrPath   = Marshal.StringToHGlobalAnsi(pathRegex);
            binding.cbHandler = new mg_callback_t(handler);
//            binding.cbHandler = Marshal.GetFunctionPointerForDelegate( new mg_callback_t(handler) );

            // Add the binding to the array
            this.Bindings.Add(binding);
            // Add the binding to mongoose
            mg_bind_to_uri(this.ServerContext, binding.ptrPath, binding.cbHandler, IntPtr.Zero);
        }
Ejemplo n.º 2
0
 private static extern void mg_bind_to_uri(IntPtr ctx, IntPtr uri_regex, mg_callback_t func, IntPtr user_data);
Ejemplo n.º 3
0
 private static extern void mg_bind_to_uri(IntPtr ctx, IntPtr uri_regex, mg_callback_t func, IntPtr user_data );
Ejemplo n.º 4
0
        /// <summary>
        /// Create a binding between a special web page and the server result
        /// </summary>
        /// <param name="pathRegex">A regular expression that is matched with
        /// the URI path</param>
        /// <param name="handler">The function that is called when a match is 
        /// found</param>
        public void CreateBinding(string pathRegex, mg_callback_t handler)
        {
            // Create the binding
            PageBinding binding;
            binding.Path = pathRegex;
            binding.ptrPath = Marshal.StringToHGlobalAnsi(pathRegex);
            binding.cbHandler = new mg_callback_t(handler);
            //            binding.cbHandler = Marshal.GetFunctionPointerForDelegate( new mg_callback_t(handler) );

            // Add the binding to the array
            this.Bindings.Add(binding);
            // Add the binding to mongoose
            mg_bind_to_uri(this.ServerContext, binding.ptrPath, binding.cbHandler, IntPtr.Zero);
        }