1998-12-31 15:43:48 +00:00
|
|
|
/*
|
|
|
|
* Server-side change notification management
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Alexandre Julliard
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-12-31 15:43:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2002-12-10 22:56:43 +00:00
|
|
|
#include "windef.h"
|
1999-05-15 10:48:19 +00:00
|
|
|
|
|
|
|
#include "handle.h"
|
|
|
|
#include "thread.h"
|
1999-06-22 17:26:53 +00:00
|
|
|
#include "request.h"
|
1998-12-31 15:43:48 +00:00
|
|
|
|
|
|
|
struct change
|
|
|
|
{
|
|
|
|
struct object obj; /* object header */
|
|
|
|
int subtree; /* watch all the subtree */
|
|
|
|
int filter; /* notification filter */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void change_dump( struct object *obj, int verbose );
|
|
|
|
static int change_signaled( struct object *obj, struct thread *thread );
|
|
|
|
|
|
|
|
static const struct object_ops change_ops =
|
|
|
|
{
|
2000-01-01 00:56:27 +00:00
|
|
|
sizeof(struct change), /* size */
|
|
|
|
change_dump, /* dump */
|
|
|
|
add_queue, /* add_queue */
|
|
|
|
remove_queue, /* remove_queue */
|
|
|
|
change_signaled, /* signaled */
|
|
|
|
no_satisfied, /* satisfied */
|
2000-12-19 02:12:45 +00:00
|
|
|
no_get_fd, /* get_fd */
|
2000-01-01 00:56:27 +00:00
|
|
|
no_destroy /* destroy */
|
1998-12-31 15:43:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-06-26 08:43:26 +00:00
|
|
|
static struct change *create_change_notification( int subtree, int filter )
|
1998-12-31 15:43:48 +00:00
|
|
|
{
|
|
|
|
struct change *change;
|
2003-02-19 00:33:32 +00:00
|
|
|
if ((change = alloc_object( &change_ops )))
|
1999-06-26 08:43:26 +00:00
|
|
|
{
|
|
|
|
change->subtree = subtree;
|
|
|
|
change->filter = filter;
|
|
|
|
}
|
|
|
|
return change;
|
1998-12-31 15:43:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void change_dump( struct object *obj, int verbose )
|
|
|
|
{
|
|
|
|
struct change *change = (struct change *)obj;
|
|
|
|
assert( obj->ops == &change_ops );
|
1999-01-03 11:55:56 +00:00
|
|
|
fprintf( stderr, "Change notification sub=%d filter=%08x\n",
|
|
|
|
change->subtree, change->filter );
|
1998-12-31 15:43:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int change_signaled( struct object *obj, struct thread *thread )
|
|
|
|
{
|
|
|
|
/* struct change *change = (struct change *)obj;*/
|
|
|
|
assert( obj->ops == &change_ops );
|
|
|
|
return 0; /* never signaled for now */
|
|
|
|
}
|
|
|
|
|
1999-05-15 10:48:19 +00:00
|
|
|
/* create a change notification */
|
|
|
|
DECL_HANDLER(create_change_notification)
|
|
|
|
{
|
1999-06-26 08:43:26 +00:00
|
|
|
struct change *change;
|
1999-05-15 10:48:19 +00:00
|
|
|
|
2001-11-30 18:46:42 +00:00
|
|
|
reply->handle = 0;
|
1999-06-26 08:43:26 +00:00
|
|
|
if ((change = create_change_notification( req->subtree, req->filter )))
|
1999-05-15 10:48:19 +00:00
|
|
|
{
|
2001-11-30 18:46:42 +00:00
|
|
|
reply->handle = alloc_handle( current->process, change,
|
|
|
|
STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE, 0 );
|
1999-06-26 08:43:26 +00:00
|
|
|
release_object( change );
|
1999-05-15 10:48:19 +00:00
|
|
|
}
|
|
|
|
}
|