![]() |
GetTimestamp() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: ICMPCrafter.h |
char * GetTimestamp( BOOL bReply, unsigned short usIdentifier, unsigned short usSequence, unsigned long ulOriginateTimestamp, unsigned long ulReceiveTimestamp, unsigned long ulTransmitTimestamp, unsigned short& usTotalSize) const;
try { //Create the header LPICMPHeader lpHead; lpHead=ConstructICMP(); if (!lpHead) { ReportError("GetTimestamp","Failed to construct ICMP header!"); return FALSE; } //Protect it std::auto_ptr<ICMPHeader> pProtection(lpHead); //Check if echo or reply if (bReply) lpHead->ucICMPType=ICMP_Timestamp_Reply; else lpHead->ucICMPType=ICMP_Timestamp; lpHead->ucICMPCode=0; lpHead->sICMP.sUS.us1=htons(usIdentifier); lpHead->sICMP.sUS.us2=htons(usSequence); lpHead->ulICMP_Originate_Timestamp=htonl(ulOriginateTimestamp); lpHead->ulICMP_Receive_Timestamp=htonl(ulReceiveTimestamp); lpHead->ulICMP_Transmit_Timestamp=htonl(ulTransmitTimestamp); //And the checksum lpHead->usICMPChecksum=CalculateChecksum((unsigned short*)lpHead,ICMPHeaderLength); //Create the packet return CreateFinal(lpHead, usTotalSize); } ERROR_HANDLER_RETURN("GetTimestamp",NULL)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |