/**
 * @file service_util.h
 *
 * @brief Service utility functions (header).
 *
 * Copyright 2007-2008, Freie Universitaet Berlin. All rights reserved.
 * Please refer to the COPYING file for detailed licensing information.
 *
 * @author Georg Wittenburg
 *
 * $Id: service_util.h 2685 2008-06-25 16:38:56Z wittenbu $
 */

#ifndef SERVICE_UTIL_H
#define SERVICE_UTIL_H

#include "../types.h"
#include "../util/list.h"
#include "../slp-light/slp-light_types.h"
#include "service_types.h"

void copy_service_id(SERVICE_id_t* dest_service_id, const SERVICE_id_t* src_service_id);
bool same_service_id(const SERVICE_id_t* service_id_1, const SERVICE_id_t* service_id_2);

C_addr_t selectBestServer(const list_t* service_instances);

// Client-side cache for results of SLP queries.
void cache_set(const SERVICE_id_t* service_id, C_addr_t server);
void cache_remove(const SERVICE_id_t* service_id);
uint8_t cache_lookup(const SERVICE_id_t* service_id, C_addr_t* server);
void cache_increment_age(const SERVICE_id_t* service_id);
void cache_reset_age(const SERVICE_id_t* service_id);
void cache_tag_not_reachable(const SERVICE_id_t* service_id);

#endif	// SERVICE_UTIL_H
