Remove need for remote def of TR_FLINE that won't compile on Centos.
[trust_router.git] / include / tr_filter.h
index 9d5dc25..8efdbc4 100644 (file)
 #ifndef TR_FILTER_H
 #define TR_FILTER_H
 
-int tr_prefix_wildcard_match (char *str, char *wc_str);
+#include <trust_router/tr_name.h>
+#include <trust_router/tr_constraint.h>
+#include <jansson.h>
+
+#define TR_MAX_FILTERS 5
+#define TR_MAX_FILTER_LINES 8
+#define TR_MAX_FILTER_SPECS 8
+
+/* Filter actions */
+#define TR_FILTER_ACTION_REJECT 0
+#define TR_FILTER_ACTION_ACCEPT 1
+
+/* Match codes */
+#define TR_FILTER_MATCH 0
+#define TR_FILTER_NO_MATCH 1
 
+/* Filter types */
+#define TR_FILTER_TYPE_RP_PERMITTED 0
+/* Other types TBD */
+
+typedef struct tr_fspec {
+  TR_NAME *field;
+  TR_NAME *match;
+} TR_FSPEC;
+
+typedef struct tr_fline {
+  int action;
+  TR_FSPEC *specs[TR_MAX_FILTER_SPECS];
+  TR_CONSTRAINT *realm_cons;
+  TR_CONSTRAINT *domain_cons;
+} TR_FLINE;
+  
+typedef struct tr_filter {
+  int type;
+  TR_FLINE *lines[TR_MAX_FILTER_LINES];
+} TR_FILTER;
+
+void tr_filter_free (TR_FILTER *filt);
+int tr_prefix_wildcard_match (char *str, char *wc_str);
+int tr_filter_process_rp_permitted (TR_NAME *rp_realm, TR_FILTER *rpp_filter, TR_CONSTRAINT_SET *in_constraints, TR_CONSTRAINT_SET **out_constraints, int *out_action);
+TR_CONSTRAINT_SET *tr_constraint_set_from_fline (TR_FLINE *fline);
 #endif