+void CtdlRegisterTDAPVetoHook(int (*fcn_ptr) (StrBuf*), int EventType, int Priority)
+{
+ TDAPVetoHookFunctionHook *newfcn;
+
+ newfcn = (TDAPVetoHookFunctionHook *)
+ malloc(sizeof(TDAPVetoHookFunctionHook));
+ newfcn->Priority = Priority;
+ newfcn->h_function_pointer = fcn_ptr;
+ newfcn->eventtype = EventType;
+
+ TDAPVetoHookFunctionHook **pfcn;
+ pfcn = &TDAPVetoHookTable;
+ while ((*pfcn != NULL) &&
+ ((*pfcn)->Priority < newfcn->Priority) &&
+ ((*pfcn)->next != NULL))
+ pfcn = &(*pfcn)->next;
+
+ newfcn->next = *pfcn;
+ *pfcn = newfcn;
+
+ MOD_syslog(LOG_DEBUG, "Registered a new TDAP Veto function (type %d Priority %d)\n",
+ EventType, Priority);
+}
+
+
+void CtdlUnregisterTDAPVetoHook(int (*fcn_ptr) (StrBuf*), int EventType)
+{
+ TDAPVetoHookFunctionHook *cur, *p, *last;
+ last = NULL;
+ cur = TDAPVetoHookTable;
+ while (cur != NULL) {
+ if ((fcn_ptr == cur->h_function_pointer) &&
+ (EventType == cur->eventtype))
+ {
+ MOD_syslog(LOG_DEBUG, "Unregistered TDAP Veto function (type %d)\n",
+ EventType);
+ p = cur->next;
+
+ free(cur);
+ cur = NULL;
+
+ if (last != NULL)
+ last->next = p;
+ else
+ TDAPVetoHookTable = p;
+ cur = p;
+ }
+ else {
+ last = cur;
+ cur = cur->next;
+ }
+ }
+}
+
+void CtdlDestroyTDAPVetoHooks(void)
+{
+ TDAPVetoHookFunctionHook *cur, *p;
+
+ cur = TDAPVetoHookTable;
+ while (cur != NULL)
+ {
+ MODM_syslog(LOG_DEBUG, "Destroyed TDAP Veto function\n");
+ p = cur->next;
+ free(cur);
+ cur = p;
+ }
+ TDAPVetoHookTable = NULL;
+}
+