⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mn.h

📁 mobile ip 在linux下的一种实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/* $Id: mn.h,v 1.95 2001/09/30 09:00:48 jm Exp $ * Header files for Mobile Node module * * Dynamic hierarchial IP tunnel * Copyright (C) 1998-2001, Dynamics group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. */#ifndef MN_H#define MN_H#include "config.h"#include <stdio.h>#include <syslog.h>#include <asm/types.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/time.h>#include <sys/un.h>#ifdef DYN_TARGET_LINUX#if 1/* linux/wireless.h does not like net/if.h and wireless.h is not available * from glibc :( */#include <linux/if.h>#else#include <net/if.h>#endif#endif#ifdef DYN_TARGET_WINDOWS#include "windows_extra.h"#endif#include "message.h"#include "list.h"#include "mn_agentadv.h"#include "dyn_api.h"#include "dyn_ip.h"/* defines */#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define DEBUG_MESSAGES 'M'#define DEBUG_STATES 'S'#define DEBUG_INFO 'I'#define DEBUG_API 'A'#define DEBUG_AGENTADV '1'#define DEBUG_HANDLERS '2'#define DEBUG_TIMERS 't'/* Comment this out, if you do not want to mess your * routing table during testing. (for example remotely) */#define MN_ENABLE_TUNNELING/* Comment out for running tests without message validation */#define MN_ENABLE_VALIDATION/* minimum time that must pass between two registration requests/solicitations * in microseconds (default: 1000000 usec = 1 sec) * Location update signal with API call clears the timers, so this does not * limit the locupd frequency */#define MIN_REGISTRATION_DELAY 1000000#define MIN_SOLICITATION_DELAY 1000000#define ASSERT assert#define MIN(x, y) (((x) < (y)) ? (x) : (y))#define MAX(x, y) (((x) > (y)) ? (x) : (y))#define LOG2(lev, fmt, args...) { DEBUG(DEBUG_INFO, fmt, ## args); \  syslog(lev, fmt, ## args); }/* Maximum message length */#define MAXMSG 2048#define MAX_INTERFACES 10#define DEFAULT_INTERFACE_PRIORITY 100#define SYSLOG_IDENT                        "mobile node"#define SYSLOG_OPTIONS                      LOG_PID | LOG_CONS/* general timer */#define TIMER_GEN                           0/* tunnel lifetime */#define TIMER_LIFETIME                      1/* lifetime of last advertisement */#define TIMER_ADV                           2/* time when last registration request was sent */#define TIMER_REQUEST                       3/* timer for next reregistration */#define TIMER_REREG                         4/* timer for wireless LAN AP handoff detection */#define TIMER_WLAN_AP_POLL                  5/* timer for agent solicitation sending */#define TIMER_SOLICITATION                  6#define TIMER_COUNT                         7/* registration request types */#define REG_DISC       0#define REG_CONNECT    1#define REG_REREG      2/* connect types:*   CON_HA: Connection approved by Home Agent*   CON_FA: Connection approved by Foreign Agent */#define CON_HA 0#define CON_FA 1/* state entry types */#define STATE_INIT    0#define STATE_TIMEOUT 1/* number of seconds that the tunnel to the old FA is kept alive */#define OLD_TUNNEL_EXTRA_TIME 3/* Registration retry interval in seconds * Min interval is used as initial reply interval, but for each * successive retry, the timeout is doubled until * max time is reached */#define MIN_REGISTRATION_TIME  1#define MAX_REGISTRATION_TIME  32#define DEREGISTRATION_INTERVAL 8/* 10% priority degrade when first registration request fails */#define DEFAULT_PRIO_DEGRADE_INITIAL 10    /* Additional degrades: multiply last one.    E.g. 10%, 20%, 40%, 80%, 100% */#define DEFAULT_PRIO_DEGRADE_FACTOR 2 /* When agent advertisements are heard, degrade the priority   degradation value by 10% (0.9) */#define DEFAULT_PRIO_DEGRADE_DEGRADE 0.9  /* Additional degrade percentage if mobility agent does not reply to a periodic * solicitation (add this to adv->prio_degrade_percent) */#define SOLICITATION_PRIO_DEGRADE 10/* Number of microseconds to wait for agent advertisement before considering * mobility agent not to have replied to agent solicitation */#define MAX_AGENTSOL_REPLY_WAIT 1500000/* Solicitation intervals in seconds (see RFC 2002, sec. 2.4) */#define SOLICITATION_INTERVALS {1, 1, 1, 2, 4, 8, 16, 32, 64}/* Randomized delay added to solicitation interval in usecs * (0 .. MAX_RANDOM_SOLICITATION_DELAY usecs is added to the delay) */#define MAX_RANDOM_SOLICITATION_DELAY 500000/* Normal reregistration time in seconds before tunnel lifetime ends */#define NORMAL_REREGISTRATION_TIME  32/* Re-register via AAA MN_AAA_REG_TIME seconds before expiration of dynamic * security association */#define MN_AAA_REG_TIME 15/* Max number of deregistration messages sent to HA in state Close for home */#define MAX_DEREGISTRATION_TO_HA 5/* Minimum allowed lifetime (in seconds) */#define MIN_ALLOWED_LIFETIME  1/* Maximum errors allowed during registration with HA */#define MAX_HA_ERRORS 5#define MN_CONF_FILE         "dynmnd.conf"#define MN_LOCAL_CONF_FILE   MN_CONF_FILE#define MN_GLOBAL_CONF_FILE  SYSCONFDIR "/" MN_CONF_FILE/* The process id of the daemon is saved here to make it easier to   kill the correct daemon when necessary. */#define MN_PID_FILE           PIDDIR "/dynmnd.pid"#define MAXFILENAMELEN                      256#define MAXSHAREDSECRETLEN                  32#define MAXDEVICENAMELEN                    80#define MAXOWNERNAMELEN                     8#define MAXGROUPNAMELEN                     8#define MAXROUTELEN                         256#define MN_DEFAULT_TUNNEL_LIFETIME          400#define MN_DEFAULT_SYSLOG_FACILITY          LOG_LOCAL0/* Uncomment this to bind UDP socket to a configurable * (dynmnd.conf: BindAddress, BindPort) address. * This can be used for testing several MNs on one machine with multiple alias * addressed. *//* #define BIND_UDP_SOCKET */#define MNDECAPS_ROUTE_DEFAULT 0#define MNDECAPS_ROUTE_HOME_NET 1#define MNDECAPS_ROUTE_NONE 2#define TUNMODE_AUTO_REVERSE 1#define TUNMODE_AUTO_TRIANGLE 2#define TUNMODE_REVERSE 3#define TUNMODE_TRIANGLE 4/* States */enum mobile_state {	MN_STARTUP,	MN_DISCONNECTED,	MN_FIND_AGENT,	MN_PASSIVE_FIND,	MN_REQUEST_TUNNEL,	MN_CONNECTED,	MN_CLOSE_FOR_HOME,	MN_AT_HOME,	MN_ERROR,	MN_STOP,	MN_STATE_COUNT};/* structures */struct fa_spi_entry {	struct node node;	int spi;	struct in_addr addr;	int alg;	unsigned char shared_secret[MAXSHAREDSECRETLEN];	int shared_secret_len;	time_t created; /* 0:  static security association,			 * != 0: timestamp of dynamic security association */	unsigned int lifetime; /* for dynamic security associations:				* lifetime of the key in seconds */};struct ignore_iflist_entry {	struct node node;	char ifname[IFNAMSIZ];};struct dev_prio_entry {	struct node node;	int priority;	unsigned char name[MAXDEVICENAMELEN];};struct alt_ha_entry {	struct node node;	struct in_addr addr;};struct mn_config {	struct in_addr mn_home_ip_addr, mn_home_ip_addr_orig;	struct in_addr ha_ip_addr, ha_ip_addr_orig;	struct list alt_ha_ip_addrs;	int use_hadisc;	struct in_addr home_net_addr;	int home_net_addr_plen;	struct in_addr home_net_subnet_bc; /* from home_net_addr/plen */	struct in_addr home_net_gateway;	int mndecaps_route_handling;	unsigned char shared_secret[MAXSHAREDSECRETLEN];	int shared_secret_len;	int spi;	int auth_alg;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -