stru.cpp

来自「linux 上http email 协议分析程序 主要能够处理大数据量的主干网」· C++ 代码 · 共 46 行

CPP
46
字号
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "Stru.h"



bool operator==(TKey & lhs,TKey & rhs)
{
	struct in_addr inaddr;
	char filename[128];

	inaddr.s_addr = lhs.src_ip;
	//printf("l%s::%d--",inet_ntoa(inaddr),ntohs(lhs.src_port));
	inaddr.s_addr = lhs.dst_ip;
	//printf("%s::%d--\n",inet_ntoa(inaddr),ntohs(lhs.dst_port));

	
	inaddr.s_addr = rhs.src_ip;
	//printf("r%s::%d--",inet_ntoa(inaddr),ntohs(rhs.src_port));
	inaddr.s_addr = rhs.dst_ip;
	//printf("%s::%d--\n",inet_ntoa(inaddr),ntohs(rhs.dst_port));


	//printf("proctocl [%x-%x]\n",lhs.protocol,rhs.protocol);
	if( lhs.protocol!=rhs.protocol)
		return false;
	//printf("src-ip[%x-%x]\n",lhs.src_ip,rhs.src_ip);
	if( lhs.src_ip!=rhs.src_ip)
		return false;
	//printf("src-port[%x-%x]\n",lhs.src_port,rhs.src_port);
	if( lhs.src_port!=rhs.src_port)
		return false;
	//printf("dst_ip[%x-%x]\n",lhs.dst_ip,rhs.dst_ip);
	if( lhs.dst_ip!=rhs.dst_ip)
		return false;
	//printf("dst-port[%x-%x]\n",lhs.dst_port,rhs.dst_port);
	if( lhs.dst_port!=rhs.dst_port)
		return false;
	//printf("is identical\n");	
	return true;
}

⌨️ 快捷键说明

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