linklayerprotocols/pppnif/SVJCOMP/VJ.CPP
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <networking/vj.h>
       
    17 
       
    18 
       
    19 // Force export of non-mangled name
       
    20 extern "C"
       
    21     {
       
    22 
       
    23 EXPORT_C CVJCompFactory* NewVJCompFactoryL(void)
       
    24 	{
       
    25 	return new (ELeave) CVJFactory;
       
    26 	}
       
    27 
       
    28 	}
       
    29 	
       
    30 //
       
    31 // CVJFactory definitions
       
    32 //
       
    33 
       
    34 CVJFactory::CVJFactory()
       
    35 	{}
       
    36 
       
    37 void CVJFactory::InstallL()
       
    38 	{}
       
    39 
       
    40 CVJCompressorIf* CVJFactory::NewVJCompressorL( TInt aSlots, TInt aCompressConnId)
       
    41 /**
       
    42 Create and construct a new CVJCompressor object.
       
    43 
       
    44 @param aSlots Maximum number of VJ connections
       
    45 @param aCompressConnId Whether to compress the connection number 
       
    46 
       
    47 @return New CVJCompressor object
       
    48 */
       
    49 	{
       
    50 	CVJCompressor* Comp = new (ELeave) CVJCompressor();
       
    51 
       
    52 	CleanupStack::PushL(TCleanupItem(CNifFactory::Cleanup, Comp));
       
    53 	Comp->ConstructL(this, aSlots, aCompressConnId);
       
    54 	CleanupStack::Pop();
       
    55 
       
    56 	return Comp;
       
    57 	}
       
    58 
       
    59 CVJDeCompressorIf* CVJFactory::NewVJDeCompressorL( TInt aSlots )
       
    60 /**
       
    61 Create and construct a new CVJDeCompressor object.
       
    62 
       
    63 @param aSlots Value of the highest VJ connection number to be received
       
    64 
       
    65 @return New CVJDeCompressor object
       
    66 */
       
    67 	{
       
    68 	CVJDeCompressor* DeComp = new (ELeave) CVJDeCompressor();
       
    69 
       
    70 	CleanupStack::PushL(TCleanupItem(CNifFactory::Cleanup, DeComp));
       
    71 	DeComp->ConstructL(this, aSlots);
       
    72 	CleanupStack::Pop();
       
    73 
       
    74 	return DeComp;
       
    75 	}
       
    76 
       
    77 //
       
    78 // TVJCompHdr definitions
       
    79 //
       
    80 
       
    81 TVJCompHdr::TVJCompHdr()
       
    82 	:
       
    83 	iNextPtr(NULL), iConnectionId(0)
       
    84 	{
       
    85 	    // Ignore lint "not initialized" warning about iIPHeader and iTCPHeader
       
    86 	}
       
    87 
       
    88 void TVJCompHdr::StoreTCPIPHeader(ThdrIP* aHeader)
       
    89 /**
       
    90 Stores the TCP/IP header.
       
    91 
       
    92 @param aHeader TCP/IP packet header
       
    93 */
       
    94 	{
       
    95 	iIPHeader = *aHeader;
       
    96 	iTCPHeader = *(ThdrTCP::NetPtr(aHeader));
       
    97 	iTCPHeader.NetSetChecksum(0);
       
    98 	MarkValid();
       
    99 	}
       
   100 
       
   101 void TVJCompHdr::RetrieveTCPIPHeader(ThdrIP* aIPHeader, ThdrTCP* aTCPHeader)
       
   102 /**
       
   103 Retrieves the TCP/IP header.
       
   104 
       
   105 @param aIPHeader Returns the IP packet header
       
   106 @param aTCPHeader Returns the TCP packet header
       
   107 */
       
   108 	{
       
   109 	*aIPHeader = iIPHeader;
       
   110 	*aTCPHeader = iTCPHeader;
       
   111 	}