t_xml *get_entry_beg(char *entry, t_xml *xml) { t_xml *ret; while (!entry_cmp(entry, xml->data)) { xml = xml->next; if (xml == xml->beg) { err_miss(entry, 1); return (NULL); } } ret = xml; while (!is_entry_end(entry, xml->data)) { xml = xml->next; if (xml == xml->beg) { err_miss(entry, 0); return (NULL); } } return (ret); }
Bool hash_has_entry(const Hash* hash, const Tuple* tuple) { unsigned int hcode = tuple_hash(tuple) % hash->size; HElem* he; assert(hash_is_valid(hash)); assert(tuple_is_valid(tuple)); for(he = hash->bucket[hcode]; he != NULL; he = he->next) if (!entry_cmp(he->value.entry, tuple)) break; return he != NULL; }
/*----------------------------------------------------------------------------*/ void add_entry(entry_t* e){ entry_t* tmp; entry_t* found = NULL; for(tmp = list_head(flowtable); tmp != NULL; tmp = tmp->next) { if (entry_cmp(e,tmp)){ found = tmp; } } if (found == NULL){ list_add(flowtable,e); PRINTF("[FLT]: Entry added\n"); } else { /* TODO rewrite the actions*/ PRINTF("[FLT]: Entry already exists\n"); } }