void query_ip(const UN_CTX *ctx,uint32_t ip) { ITF *itf; ENTRY *entry; NOTIFY *notifier; int result; diag(COMPONENT,DIAG_DEBUG,"query for %d.%d.%d.%d", ((unsigned char *) &ip)[0],((unsigned char *) &ip)[1], ((unsigned char *) &ip)[2],((unsigned char *) &ip)[3]); if (!(itf = lookup_itf_by_ip(ip))) { diag(COMPONENT,DIAG_WARN,"itf for %d.%d.%d.%d not found", ((unsigned char *) &ip)[0],((unsigned char *) &ip)[1], ((unsigned char *) &ip)[2],((unsigned char *) &ip)[3]); // brcm notify2(ctx,ip,NULL); return; } result = resolve(itf,ip,&entry,0); if (result < 0) { // brcm notify2(ctx,ip,NULL); return; } if (!result) { // brcm notify2(ctx,ip,entry); return; } notifier = alloc_t(NOTIFY); notifier->ctx = *ctx; notifier->next = entry->notify; entry->notify = notifier; }
static void send_notifications(ENTRY *entry,int success) { NOTIFY *this; while ((this = entry->notify)) { entry->notify = this->next; // brcm notify2(&this->ctx,entry->ip,success ? entry : NULL); free(this); } }
void quit(CClientSock* client) { CNotify notify2(10000,0,1); client->send_notify(notify2); }