/*
 *      Home-agents list header file      
 *
 *      Authors:
 *      Antti Tuominen          <ajtuomin@tml.hut.fi>
 *      Jani Rönkkönen          <ronkkone@lut.fi>
 *
 *
 *      This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 *
 */

#ifndef _HALIST_H
#define _HALIST_H

#include "hashlist.h"

struct mipv6_halist_entry {
	struct hashlist_entry e;
	int ifindex;			 /* Link identifier		*/
	struct in6_addr link_local_addr; /* HA's link-local address	*/
	struct in6_addr global_addr;	 /* HA's Global address 	*/
	long preference;		 /* The preference for this HA	*/
	unsigned long expire;		 /* expiration time (jiffies)	*/
};

/* 
 * Initialize Home Agents List.  Size is maximum number of home agents
 * stored in the list.
 */
int mipv6_halist_init(__u32 size);

/*
 * Free Home Agents List.
 */
void mipv6_halist_exit(void);

/* 
 * Add new home agent to Home Agents List
 */
int mipv6_halist_add(
	int ifindex,
	struct in6_addr *glob_addr,
	struct in6_addr *ll_addr,
	int pref,
	__u32 lifetime);

/*
 * Delete home agent from Home Agents List
 */
int mipv6_halist_delete(struct in6_addr *glob_addr);

/*
 * Store min(max, total) number of HA addresses (ordered by
 * preference, preferred first) in addrs.  Return actual number of
 * addresses.  Remember to kfree addrs after use.
 */
int mipv6_ha_get_pref_list(int ifindex, struct in6_addr **addrs, int max);

/*
 * Get Home Agent Address for given interface.  If node is not serving
 * as a HA for this interface returns negative error value.
 */
int mipv6_ha_get_addr(int ifindex, struct in6_addr *addr);

#endif /* _HALIST_H */
