trace.h

来自「unix下基于IP协议的TRACE ROUTE 代码程序;C/C++语言」· C头文件 代码 · 共 57 行

H
57
字号
#include	"unp.h"#include	<netinet/in_systm.h>#include	<netinet/ip.h>#include	<netinet/ip_icmp.h>#include	<netinet/udp.h>#define	BUFSIZE		1500struct rec {					/* format of outgoing UDP data */  u_short	rec_seq;			/* sequence number */  u_short	rec_ttl;			/* TTL packet left with */  struct timeval	rec_tv;		/* time packet left */};			/* globals */char	 recvbuf[BUFSIZE];char	 sendbuf[BUFSIZE];int		 datalen;			/* #bytes of data, following ICMP header */char	*host;u_short	 sport, dport;int		 nsent;				/* add 1 for each sendto() */pid_t	 pid;				/* our PID */int		 probe, nprobes;int		 sendfd, recvfd;	/* send on UDP sock, read on raw ICMP sock */int		 ttl, max_ttl;int		 verbose;			/* function prototypes */char	*icmpcode_v4(int);char	*icmpcode_v6(int);int		 recv_v4(int, struct timeval *);int		 recv_v6(int, struct timeval *);void	 sig_alrm(int);void	 traceloop(void);void	 tv_sub(struct timeval *, struct timeval *);struct proto {  char	*(*icmpcode)(int);  int	 (*recv)(int, struct timeval *);  struct sockaddr  *sasend;	/* sockaddr{} for send, from getaddrinfo */  struct sockaddr  *sarecv;	/* sockaddr{} for receiving */  struct sockaddr  *salast;	/* last sockaddr{} for receiving */  struct sockaddr  *sabind;	/* sockaddr{} for binding source port */  socklen_t   		salen;	/* length of sockaddr{}s */  int			icmpproto;	/* IPPROTO_xxx value for ICMP */  int	   ttllevel;		/* setsockopt() level to set TTL */  int	   ttloptname;		/* setsockopt() name to set TTL */} *pr;#ifdef	IPV6#include	"ip6.h"			/* should be <netinet/ip6.h> */#include	"icmp6.h"		/* should be <netinet/icmp6.h> */#endif

⌨️ 快捷键说明

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