Re: re-enterancy ...



Hi Mark,

On Tue, 2003-05-13 at 15:50, Mark McLoughlin wrote:
> 	No, I was opposed to adding a non-standard IDL keyword ...
...
> 	Sounds fine to me. Although, I haven't given any real thought to it :-)

	So the window for objections is closing fast; with the API freeze only
a couple of days away; can you check over this API; It seems relatively
extensible and supportable (to me).

	I want to add a "only allow this POA's children to re-enter" type
policy - so that we can isolate eg. 'accessibility' - so that only that
traffic can re-enter in a given context only to local a11y impls
during outgoing a11y calls.

	HTH,

		Michael.

-- 
 michael@ximian.com  <><, Pseudo Engineer, itinerant idiot
? autom4te-2.53.cache
? test/everything/core.20895
? test/everything/core.22462
? test/poa/poatest-basic11
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.511
diff -u -p -u -r1.511 ChangeLog
--- ChangeLog	5 Jun 2003 10:41:53 -0000	1.511
+++ ChangeLog	5 Jun 2003 12:08:03 -0000
@@ -1,5 +1,9 @@
 2003-06-05  Michael Meeks  <michael@ximian.com>
 
+	* src/orb/orb-core/orbit-policy.[ch]: stub.
+
+2003-06-05  Michael Meeks  <michael@ximian.com>
+
 	* test/everything/Makefile.am: use check_PROGRAMS
 	instead of noinst_PROGRAMS - Mac people have
 	problems with their static libraries it seems.
Index: include/orbit/orb-core/corba-object.h
===================================================================
RCS file: /cvs/gnome/ORBit2/include/orbit/orb-core/corba-object.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 corba-object.h
--- include/orbit/orb-core/corba-object.h	29 Apr 2003 11:43:19 -0000	1.17
+++ include/orbit/orb-core/corba-object.h	5 Jun 2003 12:08:03 -0000
@@ -34,6 +34,22 @@ extern ORBit_IMethod    CORBA_Object__im
 
 #define CORBA_Object_IMETHODS_LEN 12
 
+typedef struct _ORBitPolicy ORBitPolicy;
+
+/* An extended policy - blocks re-enterancy by default */
+#define ORBIT_TYPE_POLICY_EX (ORBit_policy_ex_get_type ())
+
+GType        ORBit_policy_ex_get_type (void) G_GNUC_CONST;
+ORBitPolicy *ORBit_policy_new         (GType        type,
+				       const char  *first_prop,
+				       ...);
+ORBitPolicy *ORBit_policy_ref         (ORBitPolicy *p);
+void         ORBit_policy_unref       (ORBitPolicy *p);
+void         ORBit_object_set_policy  (CORBA_Object obj,
+				       ORBitPolicy *p);
+void         ORBit_policy_push        (ORBitPolicy *p);
+void         ORBit_policy_pop         (void);
+
 G_END_DECLS
 
 #endif /* CORBA_OBJECT_H */
Index: src/orb/orb-core/Makefile.am
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/Makefile.am,v
retrieving revision 1.46
diff -u -p -u -r1.46 Makefile.am
--- src/orb/orb-core/Makefile.am	30 May 2003 15:55:09 -0000	1.46
+++ src/orb/orb-core/Makefile.am	5 Jun 2003 12:08:04 -0000
@@ -28,6 +28,8 @@ main_src = \
 	orbit-trace.c \
 	corba-object.c \
 	corba-policy.c \
+	orbit-policy.c \
+	orbit-policy.h \
 	corba-env.c \
 	corba-string.c \
 	allocators.c \
Index: src/orb/orb-core/orbit-policy.c
===================================================================
RCS file: src/orb/orb-core/orbit-policy.c
diff -N src/orb/orb-core/orbit-policy.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/orb/orb-core/orbit-policy.c	5 Jun 2003 12:08:04 -0000
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include "orbit-policy.h"
+#include "orbit-debug.h"
+
+GType
+ORBit_policy_ex_get_type (void)
+{
+	return 0;
+}
+
+ORBitPolicy *
+ORBit_policy_new (GType        type,
+		  const char  *first_prop,
+		  ...)
+{
+	return NULL;
+}
+
+ORBitPolicy *
+ORBit_policy_ref (ORBitPolicy *p)
+{
+	if (p) {
+		LINK_MUTEX_LOCK (ORBit_RootObject_lifecycle_lock);
+		g_object_ref (p);
+		LINK_MUTEX_UNLOCK (ORBit_RootObject_lifecycle_lock);
+	}
+
+	return p;
+}
+
+void
+ORBit_policy_unref (ORBitPolicy *p)
+{
+	if (!p)
+		return;
+
+	LINK_MUTEX_LOCK (ORBit_RootObject_lifecycle_lock);
+	g_object_unref (p);
+	LINK_MUTEX_UNLOCK (ORBit_RootObject_lifecycle_lock);
+}
+
+void
+ORBit_object_set_policy (CORBA_Object obj,
+			 ORBitPolicy *p)
+{
+	if (obj == CORBA_OBJECT_NIL)
+		return;
+}
+
+static GStaticPrivate policy_private = G_STATIC_PRIVATE_INIT;
+
+static void
+policy_queue_free (gpointer data)
+{
+	ORBitPolicy *p;
+	GQueue *queue = data;
+
+	if (queue->length)
+		dprintf (MESSAGES, "Leaked %d policies\n", queue->length);
+
+	while ((p = g_queue_pop_head (queue)))
+		ORBit_policy_unref (p);
+
+	g_queue_free (queue);
+}
+
+void
+ORBit_policy_push (ORBitPolicy *p)
+{
+	GQueue *queue;
+
+	if (!(queue = g_static_private_get (&policy_private))) {
+		queue = g_queue_new ();
+		/* FIXME: should check the queue on free */
+		g_static_private_set (&policy_private, queue,
+				      policy_queue_free);
+	}
+	
+	g_queue_push_head (queue, ORBit_policy_ref (p));
+}
+
+void
+ORBit_policy_pop (void)
+{
+	GQueue *queue;
+
+	if (!(queue = g_static_private_get (&policy_private)))
+		g_warning ("No policy queue to pop from");
+	else {
+		ORBitPolicy *p;
+
+		p = g_queue_pop_head (queue);
+		ORBit_policy_unref (p);
+	}
+}
+
+gboolean
+ORBit_policy_validate (ORBitPolicy *policy)
+{
+	return TRUE;
+}
Index: src/orb/orb-core/orbit-policy.h
===================================================================
RCS file: src/orb/orb-core/orbit-policy.h
diff -N src/orb/orb-core/orbit-policy.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/orb/orb-core/orbit-policy.h	5 Jun 2003 12:08:04 -0000
@@ -0,0 +1,39 @@
+/**
+ * orbit-policy.h: re-enterancy policy object for client invocations
+ *
+ * Author:
+ *   Michael Meeks (michael@ximian.com)
+ *
+ * Copyright 2003 Ximian, Inc.
+ */
+#ifndef _ORBIT_POLICY_H_
+#define _ORBIT_POLICY_H_
+
+#include <glib-object.h>
+#include <orbit/orbit.h>
+
+G_BEGIN_DECLS
+
+#define ORBIT_TYPE_POLICY_EX        (ORBit_policy_ex_get_type ())
+#define ORBIT_POLICY_EX(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), ORBIT_TYPE_POLICY, ORBitPolicy))
+#define ORBIT_POLICY_EX_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), ORBIT_TYPE_POLICY, ORBitPolicyClass))
+#define ORBIT_IS_POLICY_EX(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), ORBIT_TYPE_POLICY))
+#define ORBIT_IS_POLICY_EX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ORBIT_TYPE_POLICY))
+
+struct _ORBitPolicy {
+	GObject parent;
+
+	PortableServer_POA poa_only;
+};
+
+typedef struct {
+	GObjectClass parent_class;
+
+	/* FIXME: virtualize 'verify policy' */
+} ORBitPolicyClass;
+
+gboolean ORBit_policy_validate (ORBitPolicy *policy);
+
+G_END_DECLS
+
+#endif /* _ORBIT_POLICY_H_ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]