natfw/natfwunsaf_protocols/unsaf_codec/inc/natfwunsafchangerequestattribute.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CNATFWUNSAFCHANGEREQUESTATTRIBUTE_H
       
    22 #define CNATFWUNSAFCHANGEREQUESTATTRIBUTE_H
       
    23 
       
    24 // INCLUDES
       
    25 #include "natfwunsafattribute.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31  * Class for NATFWUNSAF CHANGE-REQUEST attribute.
       
    32  */
       
    33 class CNATFWUNSAFChangeRequestAttribute : public CNATFWUNSAFAttribute
       
    34     {
       
    35     public: // Constructors and destructor
       
    36         /**
       
    37         * Creates a new instance of CNATFWUNSAFChangeRequestAttribute
       
    38         * @param aChangeIP Change IP flag
       
    39         * @param aChangePort Change port flag
       
    40         * @return A new instance of CNATFWUNSAFChangeRequestAttribute
       
    41         *          ownership is transferred.
       
    42         */
       
    43         static CNATFWUNSAFChangeRequestAttribute*
       
    44             NewL(TBool aChangeIP, TBool aChangePort);
       
    45 
       
    46         /**
       
    47         * Creates a new instance of CNATFWUNSAFChangeRequestAttribute and
       
    48         * pushes it to the CleanupStack.
       
    49         * @param aChangeIP Change IP flag
       
    50         * @param aChangePort Change port flag
       
    51         * @return A new instance of CNATFWUNSAFChangeRequestAttribute,
       
    52         *          ownership is transferred.
       
    53         */
       
    54         static CNATFWUNSAFChangeRequestAttribute*
       
    55             NewLC(TBool aChangeIP, TBool aChangePort);
       
    56 
       
    57         /**
       
    58         * Decodes a UNSAF attribute from a byte stream.
       
    59         * This version is for lookup table.
       
    60         * @param aByteStream Byte stream, containing attribute type, length and
       
    61         *    value.
       
    62         * @return Decoded UNSAF attribute, ownership is transferred.
       
    63         */
       
    64         static CNATFWUNSAFAttribute* DecodeAttributeL(
       
    65             const TDesC8& aByteStream);
       
    66 
       
    67         /**
       
    68         * Destructor, deletes the resources of
       
    69         * CNATFWUNSAFChangeRequestAttribute.
       
    70         */
       
    71         ~CNATFWUNSAFChangeRequestAttribute();
       
    72 
       
    73     public: // From CNATFWUNSAFAttribute
       
    74 
       
    75         CNATFWUNSAFAttribute::TType Type() const;
       
    76 
       
    77         HBufC8* EncodeValueL() const;
       
    78 
       
    79     public: // New functions
       
    80 
       
    81         /**
       
    82         * Returns the change IP flag.
       
    83         * @return Flag value
       
    84         */
       
    85         TBool ChangeIP() const;
       
    86 
       
    87         /**
       
    88         * Returns the change port flag.
       
    89         * @return Flag value
       
    90         */
       
    91         TBool ChangePort() const;
       
    92 
       
    93     private:
       
    94 
       
    95         enum TEncodedValue
       
    96             {
       
    97             //Bit masks for obtaining the flag bits
       
    98             EChangeIPMask = 0x4,
       
    99             EChangePortMask = 0x2,
       
   100             //Size in bytes of the attribute value
       
   101             EAttributeValueSize = 4
       
   102             };
       
   103 
       
   104     private: // Constructors
       
   105 
       
   106         CNATFWUNSAFChangeRequestAttribute(TBool aChangeIP, TBool aChangePort);
       
   107 
       
   108     private: // Data
       
   109 
       
   110         TBool iChangeIP;
       
   111         TBool iChangePort;
       
   112 
       
   113     private: // For testing purposes
       
   114 
       
   115         __DECLARE_TEST;
       
   116     };
       
   117 
       
   118 #endif // CNATFWUNSAFCHANGEREQUESTATTRIBUTE_H
       
   119 
       
   120