Class CICMPCrafter::
CreateFinal()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: CreateFinalNext page: FinalICMPHeader    Show member index
Private Function Declared in:
ICMPCrafter.h

'Declaration' icon -- Shortcut to top of page. Declaration

char * CreateFinal(
    const LPICMPHeader pHeader,
    unsigned short& usTotalSize) const;

'Description' icon -- Shortcut to top of page. Description

Create the memory

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    //Do we have a send buffer
    if (GetSendBuffer())
    {
        //Calculate the new size
        unsigned long ulNewSize;
        ulNewSize=GetBufferSize()+ICMPHeaderLength;

        //Create a new buffer for it
        char* pBuffer;
        pBuffer=new char[ulNewSize];

        //Protect it
        CArray_ptr<char> pProtection(pBuffer);

        //Copy the data
        memcpy(pBuffer,pHeader,ICMPHeaderLength);
        memcpy(pBuffer+ICMPHeaderLength,
               GetSendBuffer(),
               GetBufferSize());

        //And create the crafted packet
        return CIPCrafter::GetCraftedPacket(this,
                                            m_aDestinationAddress,
                                            pBuffer,
                                            ulNewSize,
                                            usTotalSize);
    }
    else
        return CIPCrafter::GetCraftedPacket(this,
                                            m_aDestinationAddress,
                                            (char*)pHeader,
                                            ICMPHeaderLength,
                                            usTotalSize);
}
ERROR_HANDLER_RETURN("CreateFinal",NULL)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CIPCrafter  |  Public base class CICMPSocket  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.