00001 /* $Id: mn_agentadv.h,v 1.32 2001/09/23 16:07:14 jm Exp $ 00002 * Header files for Mobile Node agentadv module 00003 * 00004 * Dynamic hierarchial IP tunnel 00005 * Copyright (C) 1998-2001, Dynamics group 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License version 2 as 00009 * published by the Free Software Foundation. See README and COPYING for 00010 * more details. 00011 */ 00012 00013 #ifndef MN_AGENTADV_H 00014 #define MN_AGENTADV_H 00015 00016 #include "agentadv.h" 00017 #include "list.h" 00018 #include "sys/time.h" 00019 #include "hashtable.h" 00020 00021 /* keep agentadv data for x seconds after the expiration */ 00022 #define ADV_EXTRA_TIME 10 00023 /* check agentadv data for expired entries every x seconds */ 00024 #define ADV_CLEANUP_FREQ 10 00025 00026 00027 /* get_fa() return values: */ 00028 #define FA_GET_NO 0 00029 #define FA_GET_CHANGED 1 00030 #define FA_GET_SAME 2 00031 00032 #define MAX_FA_NAI_LEN (sizeof(struct fa_nai_ext) + 255) 00033 00034 enum { 00035 MN_ADV_TYPE_UNKNOWN = 0, 00036 MN_ADV_TYPE_FA /* FA (and possibly unknown HA) */, 00037 MN_ADV_TYPE_HA /* unknown HA */, 00038 MN_ADV_TYPE_OWN_HA /* our own HA (and possibly FA) */ 00039 }; 00040 00041 /* key for the agentadv_data hashtable */ 00042 struct agentadv_key { 00043 struct in_addr addr; 00044 int ifindex; 00045 }; 00046 00047 struct agentadv_data { 00048 struct node node; /* entry hashed into the hashtable */ 00049 00050 struct in_addr addr; /* address of the FA sending this advertisement */ 00051 int ifindex; /* interface that received the last agentadv */ 00052 char ifname[IFNAMSIZ]; 00053 struct timeval last; /* time when this advertisement was received */ 00054 struct timeval expire; /* expiration time for this entry 00055 * (last + radv->lifetime + 1); i.e. this 00056 * _may_ be removed after this timestamp */ 00057 00058 char buf[MAX_ADV_MSG]; /* the last received agent advertisement */ 00059 struct adv_extensions adv; 00060 00061 int adv_type; /* MN_ADV_TYPE_* */ 00062 int arpentry; /* 1 = own ARP entry used */ 00063 int in_use; /* 1 = currently registered to this FA or trying to 00064 * register to this FA (i.e. do not expire the entry) */ 00065 int priority; /* This is modified by FA_GET handlers */ 00066 int priority_degraded; /* priority*(100-degrade) / 100 */ 00067 int prio_degrade_percent; /* degrade priority this much percents */ 00068 struct monitor_address *mon; /* monitor data */ 00069 int routeentry; /* 1 = own host route entry used */ 00070 unsigned long int counter; /* the number of received advs */ 00071 long last_heard_seqn; /* sequence number of last heard advertisement */ 00072 int reg_failed; /* 1 = reg. failed to this FA */ 00073 int reg_retry_time; /* number of seconds to wait until the next 00074 * registration request is sent */ 00075 }; 00076 00077 struct interface_data; 00078 00079 int handle_icmp(struct interface_data *iface); 00080 struct agentadv_data *get_ok_fa(void); 00081 int clean_agentadv(struct node *node, void *data); 00082 int get_fa(struct agentadv_data *adv); 00083 struct agentadv_data *adv_fetch(struct hashtable *adv_hash, 00084 struct in_addr *addr, int ifindex); 00085 #endif