00001 /* $Id: mn_handler.h,v 1.9 2001/09/29 16:06:39 jm Exp $ 00002 * Header files for Mobile Node handler module 00003 * 00004 * Dynamic hierarchial IP tunnel 00005 * Copyright (C) 1998-2000, 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_HANDLER_H 00014 #define MN_HANDLER_H 00015 00016 #include <time.h> 00017 #include "mn_agentadv.h" 00018 #include "mn.h" 00019 #include "hashtable.h" 00020 00021 #ifndef TRUE 00022 #define TRUE 1 00023 #endif 00024 00025 #ifndef FALSE 00026 #define FALSE 0 00027 #endif 00028 00029 #define MICRO_SECONDS_TO_WAIT_INFO_REPLY 500000 00030 00031 /* handler structure */ 00032 struct handler { 00033 struct node listnode; 00034 int (*func)(void *data); 00035 }; 00036 00037 /* Foreign Agent related events */ 00038 #define FA_ADV_EXPIRE 0 00039 #define FA_ADV_RECEIVE 1 00040 #define FA_GET 2 00041 00042 struct event_FA { 00043 struct agentadv_data *adv; 00044 struct hashtable *hash; /* all advertisements */ 00045 }; 00046 00047 /* Interface handling events */ 00048 #define INTERFACE_INIT 3 00049 #define INTERFACE_DOWN 4 00050 00051 struct event_INTERFACE { 00052 struct interface_data *iface; 00053 char *ifname; /* iface->device */ 00054 int *index; /* &iface->index */ 00055 int *priority; /* &iface->priority */ 00056 int *icmp_sock; /* &iface->s */ 00057 int *icmp_sock_adv; /* &iface->s_adv */ 00058 struct timeval *last_reg_send_time; /* &mn.last_reg_send_time */ 00059 struct agentadv_data **current_adv; /* &mn.current_adv */ 00060 struct idxmap *idx; 00061 }; 00062 00063 /* Handler functions */ 00064 int handler_unregister(int event_type, int (*func)(void *data)); 00065 int handler_register(int event_type, int (*func)(void *data)); 00066 int handler_unregister_all(int event_type); 00067 int handler_call_all(int event_type, void *data); 00068 int mn_handlers_init(void); 00069 00070 #endif