tcpiputils/dhcp/include/DHCPIP6MsgSender.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2004-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 // DHCP IP6 Message sender header file
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file DHCPIP6MsgSender.h
       
    20 */
       
    21 
       
    22 #ifndef DHCPIP6MSGSENDER_H
       
    23 #define DHCPIP6MSGSENDER_H
       
    24 
       
    25 #include "MsgSender.h"
       
    26 
       
    27 const TInt KIP6RndMin = -KMicrosecondsInSecs / 1000;
       
    28 const TInt KIP6RndMax = KMicrosecondsInSecs / 1000;
       
    29 const TInt KIP6MaxSecs = 0xFF;
       
    30 
       
    31 class CDHCPIP6MessageSender : public CMessageSender
       
    32 	{
       
    33 public:
       
    34 	CDHCPIP6MessageSender( MMSListener* aMMSListener, RSocket& aSocket, TTime *aTaskStart, const TUint aFamily);
       
    35 
       
    36    void SetListener( MMSListener* aMMSListener );
       
    37    MMSListener* EventListener() const;
       
    38    void SetMaxRetryTimeout( TInt aSeconds );
       
    39    void SetMaxRetryCount( TInt aCount );
       
    40    void SetMaxRetryDuration( TInt aSeconds );
       
    41    void SetInitialRetryTimeout( TInt aSeconds );
       
    42    void SetFirstSendDelay( TInt aSeconds );
       
    43 
       
    44 protected:
       
    45    virtual TBool SendingContinues() const;
       
    46    virtual TBool CalculateDelay();
       
    47 
       
    48 protected:
       
    49    TDhcpRnd iXid;
       
    50    //the following values are stored in microsecods
       
    51    TInt iInitialRetryTimeout;  //initial timeout between two subsequent retransmission
       
    52    TInt iMaxRetryTimeout;  //max timeout between two subsequent retransmission
       
    53    TInt iMaxRetryCount;    //upper limit of the number of times to retransmit the message
       
    54    TInt iMaxRetryDuration; //upper limit of the time to retransmit the message
       
    55                            //if iMaxRetryDuration == MAX_INT than the retransmission ends
       
    56                            //when RT > MRT || RC > MRC
       
    57    TInt iFirstSendDelay;
       
    58 	};
       
    59 
       
    60 inline CDHCPIP6MessageSender::CDHCPIP6MessageSender( MMSListener* aMMSListener, RSocket& aSocket, TTime *aTaskStartedAtCopy, const TUint aFamily) :
       
    61       CMessageSender( aMMSListener, aSocket, aTaskStartedAtCopy, aFamily ),
       
    62       iMaxRetryTimeout( static_cast<TInt>(KWaitForResponseTime) ),
       
    63       iMaxRetryCount( INT_MAX ),
       
    64       iMaxRetryDuration( INT_MAX )
       
    65       {
       
    66       }
       
    67 
       
    68 #endif