1 #ifndef __MURPHY_DECISION_TYPES_H__
2 #define __MURPHY_DECISION_TYPES_H__
4 #include <murphy/common/list.h>
5 #include <murphy/common/mainloop.h>
6 #include <murphy/common/transport.h>
7 #include <murphy/common/hashtbl.h>
8 #include <murphy/core/context.h>
12 typedef struct pep_proxy_s pep_proxy_t;
13 typedef struct pep_table_s pep_table_t;
14 typedef struct pep_watch_s pep_watch_t;
15 typedef struct pdp_s pdp_t;
19 * a policy enforcement point (on the client side)
23 char *name; /* enforcment point name */
24 mrp_mainloop_t *ml; /* main loop */
25 mrp_transport_t *t; /* transport towards murphy */
26 int connected; /* transport is up */
27 mrp_pep_table_t *owned; /* owned tables */
28 int nowned; /* number of owned tables */
29 mrp_pep_table_t *watched; /* watched tables */
30 int nwatched; /* number of watched tables */
31 mrp_pep_connect_cb_t connect_cb; /* connection state change callback */
32 mrp_pep_data_cb_t data_cb; /* watched data change callback */
33 void *user_data; /* opqaue user data for callbacks */
34 int busy; /* non-zero if a callback is active */
35 int destroyed : 1; /* non-zero if destroy pending */
36 uint32_t seqno; /* request sequence number */
37 mrp_list_hook_t pending; /* queue of outstanding requests */
42 * a table associated with or tracked by an enforcement point
46 char *name; /* table name */
47 mrp_list_hook_t hook; /* to list of tables */
48 mqi_handle_t h; /* MDB table handle */
49 mqi_column_def_t *columns; /* column definitions */
50 mqi_column_desc_t *coldesc; /* column descriptors */
51 int ncolumn; /* number of columns */
52 int idx_col; /* column index of index column */
53 mrp_list_hook_t watches; /* watches for this table */
54 uint32_t notify_stamp; /* current table stamp */
55 mrp_pep_value_t *notify_data; /* notification data */
56 int notify_nrow; /* number of rows to notify */
57 int notify_fail : 1; /* notification failure */
58 int notify_all : 1; /* notify all watches */
67 pep_table_t *table; /* table being watched */
68 pep_proxy_t *proxy; /* enforcement point */
69 int id; /* table id within proxy */
70 uint32_t stamp; /* last notified update stamp */
71 mrp_list_hook_t tbl_hook; /* hook to table watch list */
72 mrp_list_hook_t pep_hook; /* hook to proxy watch list */
77 * a policy enforcement point (on the server side)
81 char *name; /* enforcement point name */
82 pdp_t *pdp; /* decision point context */
83 mrp_transport_t *t; /* associated transport */
84 mrp_list_hook_t hook; /* to list of all enforcement points */
85 pep_table_t *tables; /* tables owned by this */
86 int ntable; /* number of tables */
87 mrp_list_hook_t watches; /* tables watched by this */
88 mrp_msg_t *notify_msg; /* notification being built */
89 int notify_ntable; /* number of changed tables */
90 int notify_ncolumn; /* total columns in notification */
91 int notify_fail : 1; /* notification failure */
92 int notify_all : 1; /* notify all watches */
97 * policy decision point context
101 mrp_context_t *ctx; /* murphy context */
102 const char *address; /* external transport address */
103 mrp_transport_t *ext; /* external transport */
104 mrp_list_hook_t proxies; /* list of enforcement points */
105 mrp_list_hook_t tables; /* list of tables we track */
106 mrp_htbl_t *watched; /* tracked tables by name */
107 mrp_deferred_t *notify; /* deferred notification */
108 int notify_scheduled; /* is notification scheduled? */
119 * common table data for tracking and proxying
122 typedef struct table_s table_t;
123 typedef struct tracked_table_s tracked_table_t;
124 typedef struct proxied_table_s proxied_table_t;
127 char *name; /* table name */
128 mqi_handle_t h; /* table handle */
129 mqi_column_def_t *columns; /* column definitions */
130 mqi_column_desc_t *coldesc; /* column descriptors */
131 int ncolumn; /* number of columns */
139 struct tracked_table_s {
140 table_t *t; /* actual table data */
141 mrp_list_hook_t watches; /* watches for this table */
142 mrp_pep_value_t *notify_data; /* collected data for notification */
143 int notify_nrow; /* number of rows in notification */
144 int notify_failed:1; /* notification failure */
145 int notify_all:1; /* notify all watches */
153 struct proxied_table_s {
154 table_t *t; /* actual table data */
155 int id; /* id for enforcement point */
156 int idx_col; /* column index of index column */
162 #endif /* __MURPHY_DECISION_TYPES_H__ */