📄 mn.h
字号:
int replay_meth; int udp_port; int enable_fa_decapsulation; int tunneling_mode; __u16 mn_default_tunnel_lifetime; int wlan_ap_poll_interval; /* interval in usec or -1 = disabled */ int solicitation_interval; /* interval in usec or -1 = disabled */ int syslog_facility; char mn_api_read_socket_path[MAXFILENAMELEN + 1]; char mn_api_read_socket_group[MAXGROUPNAMELEN + 1]; char mn_api_read_socket_owner[MAXOWNERNAMELEN + 1]; int mn_api_read_socket_permissions; char mn_api_admin_socket_path[MAXFILENAMELEN + 1]; char mn_api_admin_socket_group[MAXGROUPNAMELEN + 1]; char mn_api_admin_socket_owner[MAXOWNERNAMELEN + 1]; int mn_api_admin_socket_permissions; int socket_priority; struct list fa_spi_list; struct list ignore_iflist; struct list dev_prio_list; int enforce_routes; struct in_addr priv_ha_ip_addr; __u32 priv_ha; char mn_nai[MAX_NAI_LEN + 1]; int mn_nai_len; char ha_nai[MAX_NAI_LEN + 1]; int ha_nai_len; /* RFC 3012 */ int use_aaa; int mn_aaa_spi; unsigned char mn_aaa_shared_secret[MAXSHAREDSECRETLEN]; int mn_aaa_shared_secret_len; int mn_aaa_auth_alg; int mn_aaa_keygen_alg; time_t mn_ha_key_timestamp; /* timestamp for MN-HA key generation * using material from AAA */ int mn_ha_key_lifetime; /* lifetime for MN-HA key generated by AAA, * 0 = infinite */ int allow_home_addr_from_foreign_net;#ifdef BIND_UDP_SOCKET struct in_addr bind_addr; unsigned short bind_port;#endif#ifdef INCLUDE_IPAY struct in_addr ipay_mn_addr; int ipay_mn_port; struct in_addr ipay_buyer_addr; int ipay_buyer_port; int ipay_fa_port;#endif};struct interface_data { int s; /* socket */ int s_adv; int index; int handlers_off; int priority; char device[IFNAMSIZ]; struct timeval last_solicitation;};#ifdef INCLUDE_IPAYstruct nai_data { int len; char *nai;};#endifstruct mn_data { /* Is tunnel up? */ int tunnel_up; /* if tunneling is working, i.e. if connection is working. Mainly for get_mobile_status */ int opt_connect; /* 1 = try to connect immediately */ int registration_socket; /* Socket for registration requests and * replies */ struct interface_data iface[MAX_INTERFACES]; int device_count; /* number of available interfaces in the iface list */ int api_ro_socket, api_rw_socket; /* sockets for api calls */ int rtnetlink_socket; /* socket for rtnetlink monitoring */ int dev_info_sock; /* socket for device information query daemon */ struct sockaddr_un dev_info_addr; __u32 registration_id[2]; /* id field of last sent registration request */ __u32 last_nonce; /* last nonce received in a reply */ int clock_correction; /* time difference to home agent's clock */ struct current_route_info cur_route_info; struct timeval last_reg_send_time; /* time of last registration * sending */ struct in_addr local_addr; /* address of mobile in connected network */ struct in_addr co_addr; /* current care-of address of the MN */ struct in_addr force_fa_addr; /* only accept this FA if != 0.0.0.0 */ __u16 req_lifetime; /* lifetime to be requested */ unsigned char *session_key; /* session key */ unsigned int session_key_len; /* length of session key */ /* State variables */ enum mobile_state state; /* current state */ struct in_addr fa_addr; /* address of current mobility agent (FA/HA), * for signalling, routing, tunneling */ int expire_check; /* is it ok to monitor agent adv. expiring; * set when received accepted registration * in handle_reg_accept(), and used in * get_next_timeout() */ /* the data of the Dynamics extension, if it was sent */ struct agent_adv_dynamics fa_dynamics_ext; struct agentadv_data *current_adv; /* advertisement matching the lowest mobilty agent we are currently using */ int ha_error_count; /* errors during registration with ha */ __u8 last_reply_code; time_t last_reply_rcvd; time_t last_request_sent; /* tunneling variables */ struct in_addr tunnel_addr; /* address used in tunnel FA endpoint */ int tunnel_mode; /* API_TUNNEL_{NONE,FULL,TRIANGLE,FULL_HA} */ int use_auth_alg; /* currently used authentication algorithm, * same as config.auth_alg if HA is using standard * method */ struct hashtable *agentadv; char start_default_device[IFNAMSIZ]; /* device that was used when the * MN daemon was started */ char *info_str; /* information text to the user */ char *warn_str; /* warning text to the user */ int prev_req_replied; /* whether the MN has received a reply to its * previous request */ struct fa_nai_ext *last_req_FA_NAI; unsigned long discarded_msgs; int HA_reg_retry_time; /* like adv->reg_retry_time but for direct * HA registrations (that do not usually * have received an agentadv) */ struct challenge_ext *last_challenge_ext; struct timeval last_challenge_time; int try_to_fix_sec_assoc; /* whether MN should try to fix a dynamic * security association by reregistering */ /* dynamic home address added by Dynamics MN (or 0 if not used); * this address will be removed when the binding expires/is removed */ struct in_addr dynamic_home_addr; char dynamic_home_addr_dev[IFNAMSIZ]; int aaa_rekey; /* 1 = try to rekey AAA-based security assoc. */ int home_net_route_set_via_fa; /* whether home net is set via FA; * currently used only with Windows */ struct timeval last_scheduled_solicitation; int policy_bits; /* Handoff policy */ pid_t pcap_capturer;#ifdef MN_LOCUPD_PROFILER FILE *profile; struct timeval last_api;#endif#ifdef INCLUDE_IPAY int ipay_sock; int ipay_sock_fa; struct nai_data nai; int ipay_in_use;#endif};/* policy bit field operations */#define POLICY_SET_BIT(bits, bit) (bits |= bit)#define POLICY_CLR_BIT(bits, bit) (bits &= ~bit)#define POLICY_BIT(bits, bit) (bits & bit)#define POLICY(bit) POLICY_BIT(mn.policy_bits, bit)#define POLICY_SET(bit) POLICY_SET_BIT(mn.policy_bits, bit)#define POLICY_CLR(bit) POLICY_CLR_BIT(mn.policy_bits, bit)/* POLICIES: */#define DEFAULT_POLICY_BIT 0 /* average and treshold */#define EARLY_EXPIRE_BIT 1 /* use own aging for agent advertisements */#define NEWEST_FA_BIT 2 /* Use FA with newest agent advert. (infra mode) */#define EAGER_SWITCH_BIT 4 /* no average nor treshold */#define NEWEST_ADV_BIT 8 /* use newest agent adv.; like NEWEST_FA, but * without limiting threshold etc. */#define EARLY_EXPIRE_STR "Early-expire "#define NEWEST_FA_STR "Newest-FA "#define EAGER_SWITCH_STR "Eager-switching "#define NEWEST_ADV_STR "Newest-ADV "/* Policy variables */struct policy_vars { char *name; /* name of the policy */ int bit; /* the bit used for this policy in policy_bits */};/* function prototypes *//* mn.c */void request_tunnel(int entry, int forced, int check_timer);void close_for_home(int entry);void at_home(void);void passive_find(void);void find_agent(int entry);void disconnect(void);void connected(int type, __u16 lifetime);int degrade_current_fa_priority(void);/* mn_util.c */struct fa_spi_entry* get_fa_spi(int spi, struct in_addr addr);int add_fa_spi(struct fa_spi_entry *spi, int replace_any_spi);void remove_fa_spi(struct fa_spi_entry *spi);void send_gratuitous_arp(struct in_addr route_addr, struct in_addr gratuitous_addr);#ifdef MN_LOCUPD_PROFILERvoid write_profiler(char *msg);#endifint check_interfaces(struct interface_data *iface, int iface_n);int create_registration_socket(void);int mn_parse_command_line(int argc, char *argv[]);int restart_tunneling(void);int start_tunneling(void);int stop_tunneling(void);int mn_init(void);void clean_up(int sig);void add_fa_host_route(char *dev, struct hashtable *adv_hash, int ifindex, struct in_addr addr);void remove_fa_host_routes(int all);void check_old_tunnel_expiration(void);int is_coloc_addr_foreign(void);int device_up(int ifindex);char *event_type_str(int event_type);int update_fa_decaps_routes(const char *ifname, int ifindex, struct in_addr fa_addr, struct in_addr home_net_addr, int home_net_addr_plen);int mn_remove_dynamic_home_addr(void);int monitor_check_policy(int bit);int copy_str(char *buffer, int len, int *curr, char *str, char *attr);/* mn_config.c */int load_mn(struct mn_config *cfg, char *program_name, char *config_file);/* mn_api.c */void handle_api(int sock, int admin);void reply_waiting_api(int code, unsigned char *data, int datalen);/* mn_reg.c */int send_registration(int request_type);int handle_registration(int s);/* mn_agentadv.c */int adv_ok_fa(struct agentadv_data *adv);int check_expired_agent_advs(void);/* win_adv_capture.c */pid_t init_pcap_for_advs(void);#endif /* MN_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -