bool LLlog::checkSysGroupAddress(eibaddr_t addr) { bool x = master->checkSysGroupAddress(addr); tr()->TracePrintf (0, "Known Addr %s: %s", FormatGroupAddr(addr), x ? "yes" : "no"); return x; }
bool LogFilter::checkGroupAddress (eibaddr_t addr) { bool res = Filter::checkGroupAddress(addr); if (log_addr) t->TracePrintf (0, "Addr Check %s: %s", FormatGroupAddr(addr), res ? "yes" : "no"); return res; }
void GroupCache::remove (eibaddr_t addr) { TRACEPRINTF (t, 4, this, "GroupCacheRemove %s", FormatGroupAddr (addr)()); int l = 0, r = cache () - 1; while (l <= r) { int p = (l + r) / 2; if (cache[p]->dst == addr) { delete cache[p]; cache.deletepart (p, 1); return; } if (addr > cache[p]->dst) l = p + 1; else r = p - 1; } return; }
GroupCacheEntry GroupCache::Read (eibaddr_t addr, unsigned Timeout, uint16_t age) { TRACEPRINTF (t, 4, this, "GroupCacheRead %s %d %d", FormatGroupAddr (addr)(), Timeout, age); bool rm = false; GroupCacheEntry *c; if (!enable) { GroupCacheEntry f; f.src = 0; f.dst = 0; TRACEPRINTF (t, 4, this, "GroupCache not enabled"); return f; } c = find (addr); if (c && age && c->recvtime + age < time (0)) rm = true; if (c && !rm) { TRACEPRINTF (t, 4, this, "GroupCache found: %s", FormatEIBAddr (c->src)()); return *c; } if (!Timeout) { GroupCacheEntry f; f.src = 0; f.dst = addr; TRACEPRINTF (t, 4, this, "GroupCache no entry"); return f; } A_GroupValue_Read_PDU apdu; T_DATA_XXX_REQ_PDU tpdu; L_Data_PDU *l; pth_event_t timeout = pth_event (PTH_EVENT_RTIME, pth_time (Timeout, 0)); tpdu.data = apdu.ToPacket (); l = new L_Data_PDU (FakeL2); l->data = tpdu.ToPacket (); l->source = 0; l->dest = addr; l->AddrType = GroupAddress; layer3->send_L_Data (l); do { c = find (addr); rm = false; if (c && age && c->recvtime + age < time (0)) rm = true; if (c && !rm) { TRACEPRINTF (t, 4, this, "GroupCache found: %s", FormatEIBAddr (c->src)()); pth_event_free (timeout, PTH_FREE_THIS); return *c; } if (pth_event_status (timeout) == PTH_STATUS_OCCURRED && c) { GroupCacheEntry gc; gc.src = 0; gc.dst = addr; TRACEPRINTF (t, 4, this, "GroupCache reread timeout"); pth_event_free (timeout, PTH_FREE_THIS); return gc; } if (pth_event_status (timeout) == PTH_STATUS_OCCURRED) { c = new GroupCacheEntry; c->src = 0; c->dst = addr; c->recvtime = time (0); add (c); TRACEPRINTF (t, 4, this, "GroupCache timeout"); pth_event_free (timeout, PTH_FREE_THIS); return *c; } pth_mutex_acquire (&mutex, 0, 0); pth_cond_await (&cond, &mutex, timeout); pth_mutex_release (&mutex); } while (1); }