3
#include "../util/orbit-purify.h"
4
#include "orbit-policy.h"
5
#include "orbit-debug.h"
6
#include "orbit-object.h"
7
#include "orbit/GIOP/giop.h"
10
ORBit_policy_ex_get_type (void)
12
return 0; /* FIXME: maybe use GObject some day ? */
16
ORBit_policy_free_fn (ORBit_RootObject obj)
18
ORBitPolicy *p = (ORBitPolicy *) obj;
19
g_ptr_array_free (p->allowed_poas, TRUE);
20
p_free (p, ORBitPolicy);
23
static const ORBit_RootObject_Interface ORBit_Policy_epv = {
24
ORBIT_ROT_CLIENT_POLICY,
29
ORBit_policy_new (GType type,
30
const char *first_prop,
35
ORBitPolicy *policy = g_new0 (ORBitPolicy, 1);
36
ORBit_RootObject_init (&policy->parent, &ORBit_Policy_epv);
38
policy->allowed_poas = g_ptr_array_sized_new (1);
40
va_start (args, first_prop);
41
for (name = first_prop; name; name = va_arg (args, char *)) {
42
if (!strcmp (name, "allow")) {
43
gpointer poa = va_arg (args, void *);
44
g_ptr_array_add (policy->allowed_poas, poa);
50
return ORBit_RootObject_duplicate_T (policy);
54
ORBit_policy_ref (ORBitPolicy *p)
56
return ORBit_RootObject_duplicate (p);
60
ORBit_policy_unref (ORBitPolicy *p)
62
ORBit_RootObject_release (p);
66
ORBit_object_set_policy (CORBA_Object obj,
69
if (obj == CORBA_OBJECT_NIL)
71
ORBit_policy_unref (obj->invoke_policy);
72
obj->invoke_policy = ORBit_policy_ref (p);
76
ORBit_object_get_policy (CORBA_Object obj)
78
if (obj == CORBA_OBJECT_NIL)
79
return CORBA_OBJECT_NIL;
81
return ORBit_policy_ref (obj->invoke_policy);
85
ORBit_policy_push (ORBitPolicy *p)
87
GIOPThread *tdata = giop_thread_self ();
89
if (!tdata->invoke_policies)
90
tdata->invoke_policies = g_queue_new ();
92
g_queue_push_head (tdata->invoke_policies, ORBit_policy_ref (p));
96
ORBit_policy_pop (void)
98
GIOPThread *tdata = giop_thread_self ();
100
if (!tdata->invoke_policies)
101
g_warning ("No policy queue to pop from");
104
p = g_queue_pop_head (tdata->invoke_policies);
105
ORBit_policy_unref (p);
110
ORBit_policy_validate (ORBitPolicy *policy)