共 15 篇文章
显示摘要每页显示  条
ip(struct)struct ip { unsigned int ip_hl:4;IP header length expressed as a multiple of 32-bit octets or DWORDS (i.e. header length in bytes = value set in ip_hl x 4 [each # counts for 4 octets]).The first 3 bits are the fragment flags, the first one always 0, the second the do-not-fragment bit (set by ip_off |= 0x4000...
struct ethhdr、ether_header、iphdr、tcphdr、udphdr.// destination eth addr u_int8_t ether_shost[ETH_ALEN];***********************IP的结构***********************************struct iphdr{#if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ihl:4; unsigned int version:4;#elif __BYTE_ORDER == __BIG_ENDIAN unsigned int version...
1高级套接字函数 getsockopt和setsockopt.SO_OOBINLINE 带外数据放入正常数据流 int SO_RCVBUF 接收缓冲区大小 int SO_SNDBUF 发送缓冲区大小 int SO_RCVLOWAT 接收缓冲区下限 int SO_SNDLOWAT 发送缓冲区下限 int SO_RCVTIMEO 接收超时 struct timeval SO_SNDTIMEO 发送超时 struct timeval SO_REUSERADDR 允许重用本地地址和端口 int SO_TYPE...
ai_flags:AI_PASSIVE,AI_CANONNAME,AI_NUMERICHOST.在getaddrinfo函数之前通常需要对以下6个参数进行以下设置:nodename、servname、hints的ai_flags、ai_family、ai_socktype、ai_protocol.而ai_family只是有地址为v4地址或v6地址的区别。其中ai_flags、ai_family、ai_socktype说明如下:如上表所示,ai_flagsde值范围为0~7,取决于程序如何设...
#include "unistd.h"#include "sys/types.h"#include "sys/socket.h"#include "netinet/in.h"#include "netinet/ip.h"#include "netinet/ip_icmp.h"#include "netdb.h"#include "errno.h"#include "arpa/inet.h"#include "signal.h"#inc...
#define icmp_otime icmp_dun.id_ts.its_otime#define icmp_rtime icmp_dun.id_ts.its_rtime#define icmp_ttime icmp_dun.id_ts.its_ttime#define icmp_ip icmp_dun.id_ip.idi_ip#define icmp_radv icmp_dun.id_radv#define icmp_mask icmp_dun.id_mask#define icmp_data icmp_dun.id_data};顺序号?D?Dping命令的icmp_seq便由这里读出,代表ICM...
} addr.sin_addr=*(struct in_addr *)(host->h_addr_list[0]);/** 你不知道我是从那里来的,慢慢的去等吧! **/ ip->ip_src.s_addr=random(); /** 什么都让系统做了,也没有多大的意思,还是让我们自己来校验头部吧 */ /** 下面这条可有可无 */ tcp->check=check_sum((unsigned short *)tcp, sizeof(struct tcphdr)); sendto(sockfd,buffe...
注意:sockaddr和sockaddr_in之间的强制类型转换职能通过指针来转换.(原因:两个内存大小相同而结构体重的数据类型不同)sockaddr向sockaddr_in转换时:sockaddr sa(sockaddr_in*)&sa;sockaddr_in向sockaddr转换时:sokcaddr_in sai; (sockaddr*)&sai++++++++++++++++++++++++++++++++++++++++++++++++++in_addr结构:The in_addr structure ...
addrinfo,getaddrinfoaddrinfo.//length of ai_addrchar* ai_canonname;//addr of hoststruct addrinfo* ai_next;定义函数: int getaddrinfo( const char *hostname, const char *service, const struct addrinfo *hints, struct addrinfo **result );定义函数: void freeaddrinfo( struct addrinfo *ai );函数说明: 由getaddrinfo返回的所有存...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部