📄 agentadv.h
字号:
/* $Id: agentadv.h,v 1.29 2001/09/08 15:30:41 jm Exp $ * ICMP Agent Advertisement/Solicitation routines * * 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 AGENTADV_H#define AGENTADV_H#include "config.h"#ifdef DYN_TARGET_LINUX#include <features.h> /* for the glibc version number */#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1#include <netpacket/packet.h>#include <net/ethernet.h> /* the L2 protocols */#include <netinet/if_ether.h>#else#include <linux/if_packet.h>#include <linux/if_ether.h> /* The L2 protocols */#endif#include <netinet/ip.h>#endif /* DYN_TARGET_LINUX */#ifdef DYN_TARGET_WINDOWS#include "windows_extra.h"#endif /* DYN_TARGET_WINDOWS */#include "message.h"#ifndef ICMP_ROUTERADVERT#define ICMP_ROUTERADVERT 9#endif#ifndef ICMP_ROUTERSOLICIT#define ICMP_ROUTERSOLICIT 10#endif#define MAX_ADV_MSG 2048/* ICMP_FILTER data for the filter argument of open_agent_icmp_socket() *//* FA: accept: router sol. */#define ICMP_FILTER_FA ~(1 << 10)/* HA: accept: router sol. */#define ICMP_FILTER_HA ~(1 << 10)/* MN: accept: router adv. */#define ICMP_FILTER_MN ~(1 << 9)/* agent data needed in agent advertisement messages * must be initialized with set_agent_adv_data() at least once before sending * advertisements */struct agentadv_setup_data { __u16 max_lifetime; /* max lifetime for bindings, * in network byte order */ __u16 adv_lifetime; /* lifetime for advertisements, * in network byte order */ __u32 highest_fa_addr; __u32 agent_own_addr; __u16 agent_adv_opt; /* options in network byte order */ __u8 own_agent_adv_opt; unsigned char *hfa_pubkey_hash; int hfa_pubkey_hash_len; struct fa_nai_ext *fa_nai_extension; struct challenge_ext *challenge;#ifdef INCLUDE_IPAY __u32 timePrice; __u32 bytePrice;#endif};/* parsed agent advertisement message; parsing function: handle_icmp_adv() */struct adv_extensions { char *start; int len;#ifdef DYN_TARGET_LINUX struct sockaddr_ll from;#else struct sockaddr_in from; struct ethhdr *eth;#endif struct iphdr *ip; struct router_adv *radv; struct agent_adv_ext *ext; struct prefix_len_ext *prefix; struct agent_adv_dynamics *own_ext; struct msg_key *pubkey_hash; struct fa_nai_ext *fa_nai; struct challenge_ext *challenge; int coaddrs; /* number of care-of addresses in adv. extension */};void set_agent_adv_data(__u16 _max_lifetime, struct in_addr _highest_fa_addr, struct in_addr _agent_own_addr, __u16 _agent_adv_opt, __u8 _own_agent_adv_opt, __u16 _adv_lifetime, unsigned char *hfa_pubkey_hash, int hfa_pubkey_hash_len);void set_agent_adv_nai(struct fa_nai_ext *nai_ext);void set_agent_adv_challenge(struct challenge_ext *challenge);#ifdef INCLUDE_IPAYvoid set_agent_adv_ipay(__u32 timePrice, __u32 bytePrice);#endifint open_agent_icmp_socket(char *dev, __u32 filter);enum { AGENTADV_FILTER_NONE, AGENTADV_FILTER_ADV, AGENTADV_FILTER_SOL, UDP_FILTER_PORT434 };int open_agent_icmp_adv_socket(char *dev, int filter);int send_agent_solicitation(int s);#ifdef DYN_TARGET_LINUXint send_agent_advertisement(int s, struct sockaddr *dest, struct in_addr *destaddr, int ifindex);int check_icmp_sol(int s, struct sockaddr_ll *from, struct in_addr *dstaddr, struct in_addr *srcaddr);int handle_icmp_sol(int s);#endif /* DYN_TARGET_LINUX */int handle_icmp_adv(int s, char *msg, int maxlen, struct adv_extensions *ext);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -