Exemplo n.º 1
0
switchlink_db_status_t
switchlink_db_bridge_delete(uint32_t ifindex) {
    switchlink_db_bridge_obj_t * obj;
    obj = tommy_trie_inplace_remove(&switchlink_db_bridge_obj_map, ifindex);
    if (!obj) {
        return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND;
    }
    switchlink_free(obj);
    return SWITCHLINK_DB_STATUS_SUCCESS;
}
Exemplo n.º 2
0
switchlink_db_status_t switchlink_db_interface_delete(uint32_t ifindex) {
  switchlink_db_intf_obj_t *obj;
  obj = tommy_trie_inplace_remove(&switchlink_db_interface_obj_map, ifindex);
  if (!obj) {
    return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND;
  }
  tommy_trie_inplace_remove_existing(&switchlink_db_handle_obj_map,
                                     &obj->handle_node);
  switchlink_free(obj);
  return SWITCHLINK_DB_STATUS_SUCCESS;
}
Exemplo n.º 3
0
switchlink_db_status_t switchlink_db_oifl_delete(switchlink_handle_t oifl_h) {
  switchlink_db_oifl_obj_t *obj;
  obj = switchlink_db_handle_get_obj(oifl_h);
  if (!obj) {
    return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND;
  }
  assert(obj->ref_count == 0);
  tommy_trie_inplace_remove_existing(&switchlink_db_handle_obj_map,
                                     &obj->handle_node);
  tommy_list_remove_existing(&switchlink_db_oifl_obj_list, &obj->list_node);
  switchlink_free(obj);
  return SWITCHLINK_DB_STATUS_SUCCESS;
}
Exemplo n.º 4
0
switchlink_db_status_t switchlink_db_mac_intf_delete(
    switchlink_handle_t intf_h) {
  tommy_node *node = tommy_list_head(&switchlink_db_mac_obj_list);
  while (node) {
    switchlink_db_mac_obj_t *obj = node->data;
    node = node->next;
    if (obj->intf_h == intf_h) {
      tommy_hashlin_remove_existing(&switchlink_db_mac_obj_hash,
                                    &obj->hash_node);
      tommy_list_remove_existing(&switchlink_db_mac_obj_list, &obj->list_node);
      switchlink_free(obj);
    }
  }
  return SWITCHLINK_DB_STATUS_SUCCESS;
}
Exemplo n.º 5
0
switchlink_db_status_t
switchlink_db_route_delete(switchlink_db_route_info_t *route_info) {
    tommy_node * node = tommy_list_head(&switchlink_db_route_obj_list);
    while (node) {
        switchlink_db_route_obj_t * obj = node->data;
        node = node->next;
        if ((obj->route_info.vrf_h == route_info->vrf_h) &&
                (memcmp(&(obj->route_info.ip_addr), &(route_info->ip_addr),
                        sizeof(switchlink_ip_addr_t)) == 0)) {
            tommy_list_remove_existing(&switchlink_db_route_obj_list,
                                       &obj->list_node);
            switchlink_free(obj);
            return SWITCHLINK_DB_STATUS_SUCCESS;
        }
    }
    return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND;
}
Exemplo n.º 6
0
switchlink_db_status_t switchlink_db_mac_delete(switchlink_mac_addr_t mac_addr,
                                                switchlink_handle_t bridge_h) {
  switchlink_db_mac_obj_t *obj;
  uint32_t hash;
  uint8_t key[SWITCHLINK_MAC_KEY_LEN];
  switchlink_db_mac_key_hash(mac_addr, bridge_h, key, &hash);

  obj = tommy_hashlin_search(
      &switchlink_db_mac_obj_hash, switchlink_db_mac_cmp, key, hash);
  if (!obj) {
    return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND;
  }
  tommy_hashlin_remove_existing(&switchlink_db_mac_obj_hash, &obj->hash_node);
  tommy_list_remove_existing(&switchlink_db_mac_obj_list, &obj->list_node);
  switchlink_free(obj);
  return SWITCHLINK_DB_STATUS_SUCCESS;
}