+/*
+ * conf_add_crule - Create expression tree from connect rule and add it
+ * to the crule list
+ */
+void conf_add_crule(const char* const* fields, int count, int type)
+{
+ struct CRuleNode* node;
+ assert(0 != fields);
+
+ if (count < 4 || EmptyString(fields[1]) || EmptyString(fields[3]))
+ return;
+
+ if ((node = crule_parse(fields[3]))) {
+ struct CRuleConf* p = (struct CRuleConf*) MyMalloc(sizeof(struct CRuleConf));
+ assert(0 != p);
+
+ DupString(p->hostmask, fields[1]);
+ collapse(p->hostmask);
+
+ DupString(p->rule, fields[3]);
+
+ p->type = type;
+ p->node = node;
+ p->next = cruleConfList;
+ cruleConfList = p;
+ }
+}
+
+void conf_erase_crule_list(void)
+{
+ struct CRuleConf* next;
+ struct CRuleConf* p = cruleConfList;
+
+ for ( ; p; p = next) {
+ next = p->next;
+ crule_free(&p->node);
+ MyFree(p->hostmask);
+ MyFree(p->rule);
+ MyFree(p);
+ }
+ cruleConfList = 0;
+}
+
+const struct CRuleConf* conf_get_crule_list(void)
+{
+ return cruleConfList;
+}
+