• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PrintData函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PrintData函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintData函数的具体用法?C++ PrintData怎么用?C++ PrintData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PrintData函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PrintUdpPacket

void PrintUdpPacket(unsigned char *Buffer,int Size)
{
	unsigned short iphdrlen;
		
	iphdr = (IPV4_HDR *)Buffer;
	iphdrlen = iphdr->ip_header_len*4;
	
	udpheader = (UDP_HDR *)(Buffer + iphdrlen);
	
	fprintf(logfile,"\n\n***********************UDP Packet*************************\n");
	
	PrintIpHeader(Buffer,Size);			
	
	fprintf(logfile,"\nUDP Header\n");
	fprintf(logfile,"   |-Source Port      : %d\n",ntohs(udpheader->source_port));
	fprintf(logfile,"   |-Destination Port : %d\n",ntohs(udpheader->dest_port));
	fprintf(logfile,"   |-UDP Length       : %d\n",ntohs(udpheader->udp_length));
	fprintf(logfile,"   |-UDP Checksum     : %d\n",ntohs(udpheader->udp_checksum));
	
	fprintf(logfile,"\n");
	fprintf(logfile,"IP Header\n");
	PrintData(Buffer,iphdrlen);
		
	fprintf(logfile,"UDP Header\n");
	PrintData(Buffer+iphdrlen,sizeof(UDP_HDR));
		
	fprintf(logfile,"Data Payload\n");	
	PrintData(Buffer+iphdrlen+sizeof(UDP_HDR)
		,(Size - sizeof(UDP_HDR) - iphdr->ip_header_len*4));
	
	fprintf(logfile,"\n###########################################################");
}
开发者ID:CodeAsm,项目名称:tedabyss,代码行数:32,代码来源:winsock2.cpp


示例2: alignPrinterData

static QList<PrintLine> alignPrinterData(DirectPrintContext *print_context, const ReceiptsPrinterOptions &printer_options)
{
	QList<PrintLine> ret;
	int line_length = printer_options.characterPrinterLineLength();
	PrintLine line;
	{
		line << PrintData(PrintData::Command::Init);
		ret.insert(ret.length(), line);
	}
	line.clear();
	for (int i = 0; i < print_context->line.count(); ++i) {
		const PrintData &pd = print_context->line[i];
		bool is_eol = (pd.command == PrintData::Command::Eoln) || (i == (print_context->line.count() - 1));
		if(pd.command != PrintData::Command::Eoln) {
			line << pd;
		}
		if(is_eol) {
			int fixed_text_len = 0;
			int spring_cnt = 0;
			for (int j = 0; j < line.length(); ++j) {
				const PrintData &pd2 = line[j];
				if(pd2.width < 0)
					spring_cnt++;
				else if(pd2.width > 0)
					fixed_text_len += pd2.width;
				else
					fixed_text_len += pd2.textLength();
			}
			for (int j = 0; j < line.length(); ++j) {
				PrintData &pd2 = line[j];
				if(pd2.isCommand())
					continue;
				int w = pd2.width;
				if(w < 0)
					w = (line_length - fixed_text_len) / spring_cnt;
				if(w > 0) {
					int w_rest = w - pd2.textLength();
					if(w_rest > 0) {
						if(pd2.alignment == Qt::AlignLeft)
							pd2.data = pd2.data + QByteArray(w_rest, ' ');
						else if(pd2.alignment == Qt::AlignRight)
							pd2.data = QByteArray(w_rest, ' ') + pd2.data;
						else if(pd2.alignment == Qt::AlignHCenter)
							pd2.data = QByteArray(w_rest/2+1, ' ') + pd2.data + QByteArray(w_rest/2+1, ' ');
					}
					pd2.data = pd2.data.mid(0, w);
					pd2.width = 0;
				}
			}
			ret.insert(ret.length(), line);
			line.clear();
		}
	}
	{
		line.clear();
		line << PrintData(PrintData::Command::Cut);
		ret.insert(ret.length(), line);
	}
	return ret;
}
开发者ID:mezkov,项目名称:quickbox,代码行数:60,代码来源:receiptsprinter.cpp


示例3: print_udp_packet

void print_udp_packet(unsigned char *Buffer , int Size)
{
     
    unsigned short iphdrlen;
     
    struct iphdr *iph = (struct iphdr *)Buffer;
    iphdrlen = iph->ihl*4;
     
    struct udphdr *udph = (struct udphdr*)(Buffer + iphdrlen);
     
    fprintf(logfile,"\n\n***********************UDP Packet*************************\n");
     
    print_ip_header(Buffer,Size);           
     
    fprintf(logfile,"\nUDP Header\n");
    fprintf(logfile,"   |-Source Port      : %d\n" , ntohs(udph->source));
    fprintf(logfile,"   |-Destination Port : %d\n" , ntohs(udph->dest));
    fprintf(logfile,"   |-UDP Length       : %d\n" , ntohs(udph->len));
    fprintf(logfile,"   |-UDP Checksum     : %d\n" , ntohs(udph->check));
     
    fprintf(logfile,"\n");
    fprintf(logfile,"IP Header\n");
    PrintData(Buffer , iphdrlen);
         
    fprintf(logfile,"UDP Header\n");
    PrintData(Buffer+iphdrlen , sizeof udph);
         
    fprintf(logfile,"Data Payload\n");  
    PrintData(Buffer + iphdrlen + sizeof udph ,( Size - sizeof udph - iph->ihl * 4 ));
     
    fprintf(logfile,"\n###########################################################");
}
开发者ID:saitej3,项目名称:CN,代码行数:32,代码来源:newclient.c


示例4: print_udp_packet

/*
Print the UDP header for UDP packets
*/
void print_udp_packet(u_char *Buffer, int Size)
{
	int iphdrlen = 0, data_size = 0;

	iphdr = (IPV4_HDR *)(Buffer + sizeof(ETHER_HDR));
	iphdrlen = iphdr->ip_header_len * 4;

	udpheader = (UDP_HDR*)(Buffer + iphdrlen + sizeof(ETHER_HDR));

	data = (Buffer + sizeof(ETHER_HDR)+iphdrlen + sizeof(UDP_HDR));
	data_size = (Size - sizeof(ETHER_HDR)-iphdrlen - sizeof(UDP_HDR));

	fprintf(logfile, "\n\n***********************UDP Packet*************************\n");

	PrintIpHeader(Buffer, Size);

	fprintf(logfile, "\nUDP Header\n");
	fprintf(logfile, " |-Source Port : %d\n", ntohs(udpheader->source_port));
	fprintf(logfile, " |-Destination Port : %d\n", ntohs(udpheader->dest_port));
	fprintf(logfile, " |-UDP Length : %d\n", ntohs(udpheader->udp_length));
	fprintf(logfile, " |-UDP Checksum : %d\n", ntohs(udpheader->udp_checksum));

	fprintf(logfile, "\n");

	fprintf(logfile, "IP Header\n");
	PrintData((u_char*)iphdr, iphdrlen);

	fprintf(logfile, "UDP Header\n");
	PrintData((u_char*)udpheader, sizeof(UDP_HDR));

	fprintf(logfile, "Data Payload\n");
	PrintData(data, data_size);

	fprintf(logfile, "\n###########################################################\n");
}
开发者ID:desideri,项目名称:proyectoRedes,代码行数:38,代码来源:main.c


示例5: PrintNode

void PrintNode(PNode *Tree){
	if (*Tree){
		printf("Элемент: ");
		PrintData(&(*Tree)->data);
		if ((*Tree)->left){
			printf(" Л: ");
			PrintData(&(*Tree)->left->data);
		}
		else
			printf(" Л: *");
		
		if ((*Tree)->right){
			printf(" П: ");
			PrintData(&(*Tree)->right->data);
		}
		else 
			printf(" П: *");
		printf("\n");
		if ((*Tree)->left){
			PrintNode(&(*Tree)->left);
		}
		if ((*Tree)->right){
			PrintNode(&((*Tree)->right));
		}
	}
}
开发者ID:CheretaevIvan,项目名称:VisualStudioProjects,代码行数:26,代码来源:search_tree.cpp


示例6: SetInitialConditions

//Methods
void CFDRunClass::Run()
{
SetInitialConditions();
bool velcheck;
UpdateFluidFlag();
SetPreliminaryGuessValues();
float t=0;
int m=0;
do
{
 	RunNavierStokes();
	velcheck=UpdateVelocity();
	RunFreeSurfaceCalc();
	t+=dt;
	m+=1;
	vector<float> timevec;
	timevec.push_back(0.02);timevec.push_back(0.05);timevec.push_back(0.1);timevec.push_back(0.2);timevec.push_back(0.3);timevec.push_back(0.4);timevec.push_back(0.5);timevec.push_back(0.6);timevec.push_back(0.7);timevec.push_back(0.8);timevec.push_back(0.9);timevec.push_back(1.0);
	//timevec.push_back(0.01);timevec.push_back(0.02);timevec.push_back(0.05);timevec.push_back(0.1);timevec.push_back(0.2);timevec.push_back(0.3);timevec.push_back(0.4);
	for(int mit=0;mit<=11;mit++)
	{
	if(t==timevec[mit] || ((t-dt)<timevec[mit] && t>timevec[mit]))
	{
	PrintData(m,t);
	PrintFreeSurfaceData(m);
	}
	}
}while((t<tmax)&&(velcheck==true));
PrintData(m,t);
}
开发者ID:nmcmullin,项目名称:poly,代码行数:30,代码来源:CFDRunClass.cpp


示例7: main

int main()
{
    SList s,s1,s2;
    s1=Created();
    s2=Created();
    PrintData(s1);
    PrintData(s2);
    s=Merge(s1,s2);
    printf("\t");
    PrintData(s);
}
开发者ID:dreamer2018,项目名称:DataStructure,代码行数:11,代码来源:ToLinkAdd.c


示例8: __FLOG_STATIC0

void CUdpProcess::RunL()
    {
    __FLOG_STATIC0(KSubSys, KLogComponent , _L8("CUdpProcess::RunL"));
    switch (iProcessState)
        {
        case EDataSending:
            //As a client, send data first.
            iSendBuf.SetLength(iSize);
            iSendBuf.Repeat(KSendData());
            iConsole.Printf(_L("Send data.."));
            PrintData(iSendBuf);
            iConsole.Printf(_L("In RunL, port=%d"), iAddr.Port());
            TInt sendLen = SendDataL(iSendBuf, iAddr, iSize);
            
            if (sendLen != iSize)
                {
                iConsole.Printf(
                        _L("The length of data sent is not equal to requested! requested[%d], sent[%d]"),
                        iSize, sendLen);
                }
            break;

        case EDataTransfer:
            //In data transfer, some data is received
            iConsole.Printf(_L("recv Package, size[%d], status[%d]\n"),
                    iRecvSize(), iStatus.Int());
            if (KErrNone == iStatus.Int())
                {
                iConsole.Printf(_L("Receive data."));
                PrintData(iRecvBuf);

                if (iMode)
                    {
                    //As a server, send back the data received
                    TInt len = SendDataL(iRecvBuf, iPeerAddr, iRecvBuf.Length());
                    iConsole.Printf(_L("Send back the data. len[%d]"), len);
                    }
                }
            else
                {
                iConsole.Printf(_L("Something is wrong..."));
                return;
                }

            iRecvBuf.SetLength(0);
            iRecvSize = iSize;
            //iListenSocket.RecvFrom(iRecvBuf, iPeerAddr, 0, iStatus);
            iSocket.RecvFrom(iRecvBuf, iPeerAddr, 0, iStatus);
            SetActive();
            iConsole.Printf(_L("\nWait for UDP incoming data at port[%d]...\n"),iPort);
            break;
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:53,代码来源:tcptest.cpp


示例9: main

int main()
{
  double V0[] = {1,0,0,1,0,0};
  std::vector<double> Vertices0(V0, V0+6);
  Triangle<2>::SetGlobalCoordinatesArray(Vertices0);
  Triangle<2> P10(1,2,3);
  ShapesP12D::Bulk P10Shapes(&P10);
  
  std::cout << "Parametric triangle\n";
  PrintData(P10Shapes);

  std::cout << "\nTwice Parametric triangle\n";

  double V1[] = {2,0,0,2,0,0};
  std::vector<double> Vertices1(V1, V1+6);
  Triangle<2>::SetGlobalCoordinatesArray(Vertices1);
  Triangle<2> P11(1,2,3);
  ShapesP12D::Bulk P11Shapes(&P11);

  PrintData(P11Shapes);

  std::cout << "\nReordered nodes of  twice parametric triangle\n";

  double V2[] = {0,0,2,0,0,2};
  std::vector<double> Vertices2(V2, V2+6);
  Triangle<2>::SetGlobalCoordinatesArray(Vertices2);
  Triangle<2> P12(1,2,3);
  ShapesP12D::Bulk P12Shapes(&P12);

  PrintData(P12Shapes);

  std::cout << "\n Equilateral triangle with area sqrt(3)\n";

  double V3[] = {0,0,2,0,1,sqrt(3)};
  std::vector<double> Vertices3(V3, V3+6);
  Triangle<2>::SetGlobalCoordinatesArray(Vertices3);
  Triangle<2> P13(1,2,3);
  ShapesP12D::Bulk P13Shapes(&P13);

  PrintData(P13Shapes);

  std::cout << "\n Irregular triangle with area sqrt(3)\n";

  double V4[] = {0,0,2,0,2.5,sqrt(3)};
  std::vector<double> Vertices4(V4, V4+6);
  Triangle<2>::SetGlobalCoordinatesArray(Vertices4);
  Triangle<2> P14(1,2,3);
  ShapesP12D::Bulk P14Shapes(&P14);

  PrintData(P14Shapes);

}
开发者ID:Surtr04,项目名称:UT_Internship,代码行数:52,代码来源:testLinearSE.cpp


示例10: PrintTcpPacket

/*
Print the TCP header for TCP packets
*/
void PrintTcpPacket(u_char* Buffer, int Size)
{
	unsigned short iphdrlen;
	int header_size = 0, tcphdrlen, data_size;

	iphdr = (IPV4_HDR *)(Buffer + sizeof(ETHER_HDR));
	iphdrlen = iphdr->ip_header_len * 4;

	tcpheader = (TCP_HDR*)(Buffer + iphdrlen + sizeof(ETHER_HDR));
	tcphdrlen = tcpheader->data_offset * 4;

	data = (Buffer + sizeof(ETHER_HDR)+iphdrlen + tcphdrlen);
	data_size = (Size - sizeof(ETHER_HDR)-iphdrlen - tcphdrlen);

	fprintf(logfile, "\n\n***********************TCP Packet*************************\n");

	PrintIpHeader(Buffer, Size);

	fprintf(logfile, "\n");
	fprintf(logfile, "TCP Header\n");
	fprintf(logfile, " |-Source Port : %u\n", ntohs(tcpheader->source_port));
	fprintf(logfile, " |-Destination Port : %u\n", ntohs(tcpheader->dest_port));
	fprintf(logfile, " |-Sequence Number : %u\n", ntohl(tcpheader->sequence));
	fprintf(logfile, " |-Acknowledge Number : %u\n", ntohl(tcpheader->acknowledge));
	fprintf(logfile, " |-Header Length : %d DWORDS or %d BYTES\n", (unsigned int)tcpheader->data_offset, (unsigned int)tcpheader->data_offset * 4);
	fprintf(logfile, " |-CWR Flag : %d\n", (unsigned int)tcpheader->cwr);
	fprintf(logfile, " |-ECN Flag : %d\n", (unsigned int)tcpheader->ecn);
	fprintf(logfile, " |-Urgent Flag : %d\n", (unsigned int)tcpheader->urg);
	fprintf(logfile, " |-Acknowledgement Flag : %d\n", (unsigned int)tcpheader->ack);
	fprintf(logfile, " |-Push Flag : %d\n", (unsigned int)tcpheader->psh);
	fprintf(logfile, " |-Reset Flag : %d\n", (unsigned int)tcpheader->rst);
	fprintf(logfile, " |-Synchronise Flag : %d\n", (unsigned int)tcpheader->syn);
	fprintf(logfile, " |-Finish Flag : %d\n", (unsigned int)tcpheader->fin);
	fprintf(logfile, " |-Window : %d\n", ntohs(tcpheader->window));
	fprintf(logfile, " |-Checksum : %d\n", ntohs(tcpheader->checksum));
	fprintf(logfile, " |-Urgent Pointer : %d\n", tcpheader->urgent_pointer);
	fprintf(logfile, "\n");
	fprintf(logfile, " DATA Dump ");
	fprintf(logfile, "\n");

	fprintf(logfile, "IP Header\n");
	PrintData((u_char*)iphdr, iphdrlen);

	fprintf(logfile, "TCP Header\n");
	PrintData((u_char*)tcpheader, tcphdrlen);

	fprintf(logfile, "Data Payload\n");
	PrintData(data, data_size);

	fprintf(logfile, "\n###########################################################\n");
}
开发者ID:desideri,项目名称:proyectoRedes,代码行数:54,代码来源:main.c


示例11: sizeof

void CPacket::ProcessTCPPacket(const unsigned char* pBuffer, int nSize)
{
	unsigned short iphdrlen;

	struct iphdr *iph = (struct iphdr *)( pBuffer  + sizeof(struct ethhdr) );
	iphdrlen = iph->ihl*4;

	struct tcphdr *tcph=(struct tcphdr*)(pBuffer + iphdrlen + sizeof(struct ethhdr));

	int header_size =  sizeof(struct ethhdr) + iphdrlen + tcph->doff*4;

	fprintf(m_pLogfile , "\n\n***********************TCP Packet*************************\n");  

	//print_ip_header(pBuffer, nSize);
	ProcessIPHeader(pBuffer, nSize);

	fprintf(m_pLogfile , "\n");
	fprintf(m_pLogfile , "TCP Header\n");
	fprintf(m_pLogfile , "   |-Source Port      : %u\n",ntohs(tcph->source));
	fprintf(m_pLogfile , "   |-Destination Port : %u\n",ntohs(tcph->dest));
	fprintf(m_pLogfile , "   |-Sequence Number    : %u\n",ntohl(tcph->seq));
	fprintf(m_pLogfile , "   |-Acknowledge Number : %u\n",ntohl(tcph->ack_seq));
	fprintf(m_pLogfile , "   |-Header Length      : %d DWORDS or %d BYTES\n" ,(unsigned int)tcph->doff,(unsigned int)tcph->doff*4);
	//fprintf(m_pLogfile , "   |-CWR Flag : %d\n",(unsigned int)tcph->cwr);
	//fprintf(m_pLogfile , "   |-ECN Flag : %d\n",(unsigned int)tcph->ece);
	fprintf(m_pLogfile , "   |-Urgent Flag          : %d\n",(unsigned int)tcph->urg);
	fprintf(m_pLogfile , "   |-Acknowledgement Flag : %d\n",(unsigned int)tcph->ack);
	fprintf(m_pLogfile , "   |-Push Flag            : %d\n",(unsigned int)tcph->psh);
	fprintf(m_pLogfile , "   |-Reset Flag           : %d\n",(unsigned int)tcph->rst);
	fprintf(m_pLogfile , "   |-Synchronise Flag     : %d\n",(unsigned int)tcph->syn);
	fprintf(m_pLogfile , "   |-Finish Flag          : %d\n",(unsigned int)tcph->fin);
	fprintf(m_pLogfile , "   |-Window         : %d\n",ntohs(tcph->window));
	fprintf(m_pLogfile , "   |-Checksum       : %d\n",ntohs(tcph->check));
	fprintf(m_pLogfile , "   |-Urgent Pointer : %d\n",tcph->urg_ptr);
	fprintf(m_pLogfile , "\n");
	fprintf(m_pLogfile , "                        DATA Dump                         ");
	fprintf(m_pLogfile , "\n");

	fprintf(m_pLogfile , "IP Header\n");
	PrintData(pBuffer,iphdrlen);

	fprintf(m_pLogfile , "TCP Header\n");
	PrintData(pBuffer+iphdrlen,tcph->doff*4);

	fprintf(m_pLogfile , "Data Payload\n");    
	PrintData(pBuffer + header_size , nSize - header_size );

	fprintf(m_pLogfile , "\n###########################################################");


}
开发者ID:decash,项目名称:pmamca,代码行数:51,代码来源:packet.cpp


示例12: print_icmp_packet

void print_icmp_packet(const u_char * Buffer , int Size)
{
    unsigned short iphdrlen;

    struct iphdr *iph = (struct iphdr *)(Buffer  + sizeof(struct ethhdr));
    iphdrlen = iph->ihl * 4;

    struct icmphdr *icmph = (struct icmphdr *)(Buffer + iphdrlen  + sizeof(struct ethhdr));

    int header_size =  sizeof(struct ethhdr) + iphdrlen + sizeof icmph;

    fprintf(logfile , "\n\n***********************ICMP Packet*************************\n");

    print_ip_header(Buffer , Size);

    fprintf(logfile , "\n");

    fprintf(logfile , "ICMP Header\n");
    fprintf(logfile , "   |-Type : %d",(unsigned int)(icmph->type));

    if((unsigned int)(icmph->type) == 11)
    {
        fprintf(logfile , "  (TTL Expired)\n");
    }
    else if((unsigned int)(icmph->type) == ICMP_ECHOREPLY)
    {
        fprintf(logfile , "  (ICMP Echo Reply)\n");
    }

    fprintf(logfile , "   |-Code : %d\n",(unsigned int)(icmph->code));
    fprintf(logfile , "   |-Checksum : %d\n",ntohs(icmph->checksum));
    //fprintf(logfile , "   |-ID       : %d\n",ntohs(icmph->id));
    //fprintf(logfile , "   |-Sequence : %d\n",ntohs(icmph->sequence));
    fprintf(logfile , "\n");

    fprintf(logfile , "IP Header\n");
    PrintData(Buffer,iphdrlen);

    fprintf(logfile , "UDP Header\n");
    PrintData(Buffer + iphdrlen , sizeof icmph);

    fprintf(logfile , "Data Payload\n");

    //Move the pointer ahead and reduce the size of string
    PrintData(Buffer + header_size , (Size - header_size) );

    fprintf(logfile , "\n###########################################################");
}
开发者ID:prabhakarniraula,项目名称:snort-openappid-machinelearning,代码行数:48,代码来源:pkt_snf.c


示例13: PrintAttributes

/* Checks for attributes and outputs their values */
void PrintAttributes(NXhandle fileId)
{
    int status, attrLen, attrType;
    NXname attrName;
    void *attrBuffer;

    do {
        status = NXgetnextattr(fileId, attrName, &attrLen, &attrType);
        if (status == NX_ERROR)
            return;
        if (status == NX_OK) {
            attrLen++;	/* Add space for string termination */
            if (NXmalloc
                    ((void **)&attrBuffer, 1, &attrLen,
                     attrType) != NX_OK)
                return;
            if (NXgetattr
                    (fileId, attrName, attrBuffer, &attrLen,
                     &attrType) != NX_OK)
                return;
            printf("    %s = ", attrName);
            PrintData(attrBuffer, attrType, attrLen);
            printf("\n");
            if (NXfree((void **)&attrBuffer) != NX_OK)
                return;
        }
    } while (status != NX_EOD);
    return;
}
开发者ID:ebknudsen,项目名称:code,代码行数:30,代码来源:NXbrowse.c


示例14: OnReceiveCB

static void OnReceiveCB(EVENTHUBRECEIVER_RESULT result, EVENTDATA_HANDLE eventDataHandle, void* userContext)
{
    (void)userContext;

    switch (result)
    {
        case EVENTHUBRECEIVER_TIMEOUT:
        {
            timeoutCounter++;
            (void)printf("INFO: Timeout Seen# %d\r\n", timeoutCounter);
            break;
        }
        case EVENTHUBRECEIVER_OK:
        {
            EVENTDATA_RESULT eventDataResult;
            MAP_HANDLE map;
            size_t dataSize;
            const unsigned char *dataBuffer;

            if ((eventDataResult = EventData_GetData(eventDataHandle, &dataBuffer, &dataSize)) == EVENTDATA_OK)
            {
                PrintData(dataBuffer, dataSize);
            }
            if ((map = EventData_Properties(eventDataHandle)) != NULL)
            {
                PrintProperties(map);
            }
            PrintEventDataReceiveParams(eventDataHandle);
            break;
        }
        default:
            (void)printf("ERROR: Result code %u.\r\n", result);
    };
}
开发者ID:Azure,项目名称:azure-event-hubs,代码行数:34,代码来源:receive.c


示例15: sizeof

void CPacket::DumpTCPPacket(const unsigned char* pBuffer, int nSize)
{
	unsigned short iphdrlen;

	//+ struct iphdr *iph = (struct iphdr *)( pBuffer  + sizeof(struct ethhdr) );
	struct ip *iph = (struct ip*)(pBuffer + sizeof(struct ether_header)); 
	//+ iphdrlen = iph->ihl*4;
	iphdrlen = iph->ip_hl;

	//+ struct tcphdr *tcph=(struct tcphdr*)(pBuffer + iphdrlen + sizeof(struct ethhdr));
	struct tcphdr *tcph=(struct tcphdr*)(pBuffer + iphdrlen + sizeof(struct ether_header));

	//+ int header_size =  sizeof(struct ethhdr) + iphdrlen + tcph->doff*4;
	int header_size =  sizeof(struct ether_header) + iphdrlen + tcph->th_off;// check th_off : data offset
	
	fprintf(m_fPrintType , "\n[+]TCP Header\n");
	//+ fprintf(m_fPrintType , "   |-Source Port      : %u\n",ntohs(tcph->source));
	fprintf(m_fPrintType , "   |-Source Port      : %u\n",ntohs(tcph->th_sport));
	//+ fprintf(m_fPrintType , "   |-Destination Port : %u\n",ntohs(tcph->dest));
	fprintf(m_fPrintType , "   |-Destination Port : %u\n",ntohs(tcph->th_dport));
	//+ fprintf(m_fPrintType , "   |-Sequence Number    : %u\n",ntohl(tcph->seq));
	fprintf(m_fPrintType , "   |-Sequence Number    : %u\n",ntohl(tcph->th_seq));
	//+ fprintf(m_fPrintType , "   |-Acknowledge Number : %u\n",ntohl(tcph->ack_seq));
	fprintf(m_fPrintType , "   |-Acknowledge Number : %u\n",ntohl(tcph->th_ack));
	//+ fprintf(m_fPrintType , "   |-Header Length      : %d DWORDS or %d BYTES\n" ,(unsigned int)tcph->doff,(unsigned int)tcph->doff*4);
	fprintf(m_fPrintType , "   |-Header Length      : %d DWORDS or %d BYTES\n" , (unsigned int)tcph->th_off,(unsigned int)tcph->th_off*4);// check th_off : data offset



	// 1. "netinet/tcp.h"
	// 2. struct tcphdr
	// 3. unsigned char th_flags 
	//    #define TH_FIN  0x01
	//    #define TH_SYN  0x02
	//    #define TH_RST  0x04
	//    #define TH_PUSH 0x08
	//    #define TH_ACK  0x10
	//    #define TH_URG  0x20
	//    #define TH_ECE  0x40
	//    #define TH_CWR  0x80
	//    #define TH_FLAGS        (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)

	// fprintf(m_fPrintType , "   |-Urgent Flag          : %d\n",(unsigned int)tcph->urg);
	// fprintf(m_fPrintType , "   |-Acknowledgement Flag : %d\n",(unsigned int)tcph->ack);
	// fprintf(m_fPrintType , "   |-Push Flag            : %d\n",(unsigned int)tcph->psh);
	// fprintf(m_fPrintType , "   |-Reset Flag           : %d\n",(unsigned int)tcph->rst);
	// fprintf(m_fPrintType , "   |-Synchronise Flag     : %d\n",(unsigned int)tcph->syn);
	// fprintf(m_fPrintType , "   |-Finish Flag          : %d\n",(unsigned int)tcph->fin);
	
	// fprintf(m_fPrintType , "   |-Window         : %d\n",ntohs(tcph->window));
	// fprintf(m_fPrintType , "   |-Checksum       : %d\n",ntohs(tcph->check));
	// fprintf(m_fPrintType , "   |-Urgent Pointer : %d\n",tcph->urg_ptr);
	// fprintf(m_fPrintType , "\n");

	fprintf(m_fPrintType , "[+]Data Payload\n");    
	PrintData(pBuffer + header_size , nSize - header_size );

	fprintf(m_fPrintType , "\n###########################################################\n");
}
开发者ID:decash,项目名称:pmamci2,代码行数:59,代码来源:packet.cpp


示例16: PrintTree

void PrintTree(BinNode *p)
{
  if (p != NULL){
    PrintTree(p->left);
    PrintData(p->data);
    PrintTree(p->right);
  }
}
开发者ID:hzd02765,项目名称:meikai,代码行数:8,代码来源:10-04.c


示例17: PrintIcmpPacket

void PrintIcmpPacket(u_char* Buffer, int Size)
{
	int iphdrlen = 0, icmphdrlen = 0, data_size = 0;

	iphdr = (IPV4_HDR *)(Buffer + sizeof(ETHER_HDR));
	iphdrlen = iphdr->ip_header_len * 4;

	icmpheader = (ICMP_HDR*)(Buffer + iphdrlen + sizeof(ETHER_HDR));

	data = (Buffer + sizeof(ETHER_HDR)+iphdrlen + sizeof(ICMP_HDR));
	data_size = (Size - sizeof(ETHER_HDR)-iphdrlen - sizeof(ICMP_HDR));

	fprintf(logfile, "\n\n***********************ICMP Packet*************************\n");
	PrintIpHeader(Buffer, Size);

	fprintf(logfile, "\n");

	fprintf(logfile, "ICMP Header\n");
	fprintf(logfile, " |-Type : %d", (unsigned int)(icmpheader->type));

	if ((unsigned int)(icmpheader->type) == 11)
	{
		fprintf(logfile, " (TTL Expired)\n");
	}
	else if ((unsigned int)(icmpheader->type) == 0)
	{
		fprintf(logfile, " (ICMP Echo Reply)\n");
	}

	fprintf(logfile, " |-Code : %d\n", (unsigned int)(icmpheader->code));
	fprintf(logfile, " |-Checksum : %d\n", ntohs(icmpheader->checksum));
	fprintf(logfile, " |-ID : %d\n", ntohs(icmpheader->id));
	fprintf(logfile, " |-Sequence : %d\n", ntohs(icmpheader->seq));
	fprintf(logfile, "\n");

	fprintf(logfile, "IP Header\n");
	PrintData((u_char*)iphdr, iphdrlen);

	fprintf(logfile, "ICMP Header\n");
	PrintData((u_char*)icmpheader, sizeof(ICMP_HDR));

	fprintf(logfile, "Data Payload\n");
	PrintData(data, data_size);

	fprintf(logfile, "\n###########################################################\n");
}
开发者ID:desideri,项目名称:proyectoRedes,代码行数:46,代码来源:main.c


示例18: PrintCrntNode

void PrintCrntNode(List *list)
{
  if (list->crnt == NULL){
    puts("着目要素はありません。");
  }else{
    PrintData(list->crnt->data);
  }
}
开发者ID:hzd02765,项目名称:meikai,代码行数:8,代码来源:09-11.c


示例19: print_tcp_packet

void print_tcp_packet(unsigned char* Buffer, int Size)
{
    unsigned short iphdrlen;

    struct iphdr *iph = (struct iphdr *)Buffer;
    iphdrlen = iph->ihl*4;

    struct tcphdr *tcph=(struct tcphdr*)(Buffer + iphdrlen);

    fprintf(logfile,"\n\n***********************TCP Packet*************************\n");

    print_ip_header(Buffer,Size);

    fprintf(logfile,"\n");
    fprintf(logfile,"TCP Header\n");
    fprintf(logfile,"   |-Source Port      : %u\n",ntohs(tcph->source));
    fprintf(logfile,"   |-Destination Port : %u\n",ntohs(tcph->dest));
    fprintf(logfile,"   |-Sequence Number    : %u\n",ntohl(tcph->seq));
    fprintf(logfile,"   |-Acknowledge Number : %u\n",ntohl(tcph->ack_seq));
    fprintf(logfile,"   |-Header Length      : %d DWORDS or %d BYTES\n" ,(unsigned int)tcph->doff,(unsigned int)tcph->doff*4);
    //fprintf(logfile,"   |-CWR Flag : %d\n",(unsigned int)tcph->cwr);
    //fprintf(logfile,"   |-ECN Flag : %d\n",(unsigned int)tcph->ece);
    fprintf(logfile,"   |-Urgent Flag          : %d\n",(unsigned int)tcph->urg);
    fprintf(logfile,"   |-Acknowledgement Flag : %d\n",(unsigned int)tcph->ack);
    fprintf(logfile,"   |-Push Flag            : %d\n",(unsigned int)tcph->psh);
    fprintf(logfile,"   |-Reset Flag           : %d\n",(unsigned int)tcph->rst);
    fprintf(logfile,"   |-Synchronise Flag     : %d\n",(unsigned int)tcph->syn);
    fprintf(logfile,"   |-Finish Flag          : %d\n",(unsigned int)tcph->fin);
    fprintf(logfile,"   |-Window         : %d\n",ntohs(tcph->window));
    fprintf(logfile,"   |-Checksum       : %d\n",ntohs(tcph->check));
    fprintf(logfile,"   |-Urgent Pointer : %d\n",tcph->urg_ptr);
    fprintf(logfile,"\n");
    fprintf(logfile,"                        DATA Dump                         ");
    fprintf(logfile,"\n");

    fprintf(logfile,"IP Header\n");
    PrintData(Buffer,iphdrlen);

    fprintf(logfile,"TCP Header\n");
    PrintData(Buffer+iphdrlen,tcph->doff*4);

    fprintf(logfile,"Data Payload\n");
    PrintData(Buffer + iphdrlen + tcph->doff*4 , (Size - tcph->doff*4-iph->ihl*4) );

    fprintf(logfile,"\n###########################################################");
}
开发者ID:bprashanth,项目名称:tmp,代码行数:46,代码来源:sniffer.c


示例20: main

int main()
{
	int iData[MAX_CNT];
	SetData(iData,MAX_CNT);
	time_t sTmp = clock();
	//선택 정렬
	SelectSort(iData,MAX_CNT);
	time_t eTmp = clock();
	printf("\n%s : %8.3f[%ld]\n","선택 정렬",(eTmp-sTmp)/(double)CLK_TCK,eTmp-sTmp);
	PrintData(iData, 10);

	SetData(iData, MAX_CNT);
	sTmp = clock();
	//거품 정렬
	BubbleSort(iData, MAX_CNT);
	eTmp = clock();
	printf("\n%s : %8.3f[%ld]\n", "거품 정렬", (eTmp - sTmp) / (double)CLK_TCK, eTmp - sTmp);
	PrintData(iData, 10);

	SetData(iData, MAX_CNT);
	sTmp = clock();
	//삽입 정렬
	InsertSort(iData, MAX_CNT);
	eTmp = clock();
	printf("\n%s : %8.3f[%ld]\n", "삽입 정렬", (eTmp - sTmp) / (double)CLK_TCK, eTmp - sTmp);
	PrintData(iData, 10);

	SetData(iData, MAX_CNT);
	sTmp = clock();
	//쉘 정렬
	ShellSort(iData, MAX_CNT);
	eTmp = clock();
	printf("\n%s : %8.3f[%ld]\n", "쉘 정렬", (eTmp - sTmp) / (double)CLK_TCK, eTmp - sTmp);
	PrintData(iData, 10);

	SetData(iData, MAX_CNT);
	sTmp = clock();
	//퀵 정렬
	QuickSort(iData,0, MAX_CNT-1);
	eTmp = clock();
	printf("\n%s : %8.3f[%ld]\n", "퀵 정렬", (eTmp - sTmp) / (double)CLK_TCK, eTmp - sTmp);
	PrintData(iData, 10);
     return 0;
}
开发者ID:cyh065,项目名称:FirstProject,代码行数:44,代码来源:Note_0.cpp



注:本文中的PrintData函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PrintDebug函数代码示例发布时间:2022-05-30
下一篇:
C++ PrintCurrentFunction函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap