natfw/natfwunsaf_protocols/unsaf_codec/inc/natfwunsaflifetimeattribute.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 CNATFWUNSAFLIFETIMEATTRIBUTE_H
       
    22 #define CNATFWUNSAFLIFETIMEATTRIBUTE_H
       
    23 
       
    24 #include "natfwunsafattribute.h"
       
    25 
       
    26 /**
       
    27  * Class for LIFETIME attribute.
       
    28  *
       
    29  *  @lib natfwunsafprotocols.lib
       
    30  *  @since S60 3.2
       
    31  */
       
    32 class CNATFWUNSAFLifetimeAttribute : public CNATFWUNSAFAttribute
       
    33     {
       
    34 public: // Constructors and destructor
       
    35     /**
       
    36     * Creates a new instance of CNATFWUNSAFLifetimeAttribute
       
    37     * @param aLifetime Lifetime
       
    38     * @return A new instance of CNATFWUNSAFLifetimeAttribute
       
    39     *          ownership is transferred.
       
    40     */
       
    41     IMPORT_C static CNATFWUNSAFLifetimeAttribute*
       
    42         NewL(TInt aLifetime);
       
    43 
       
    44     /**
       
    45     * Creates a new instance of CNATFWUNSAFLifetimeAttribute and
       
    46     * pushes it to the CleanupStack.
       
    47     * @param aLifetime Lifetime
       
    48     * @return A new instance of CNATFWUNSAFLifetimeAttribute,
       
    49     *          ownership is transferred.
       
    50     */
       
    51     IMPORT_C static CNATFWUNSAFLifetimeAttribute*
       
    52         NewLC(TInt aLifetime);
       
    53 
       
    54     /**
       
    55     * Decodes a UNSAF attribute from a byte stream.
       
    56     * This version is for lookup table.
       
    57     * @param aByteStream Byte stream, containing attribute type, length and
       
    58     *    value.
       
    59     * @return Decoded UNSAF attribute, ownership is transferred.
       
    60     */
       
    61     static CNATFWUNSAFAttribute* DecodeAttributeL(
       
    62         const TDesC8& aByteStream);
       
    63 
       
    64     /**
       
    65     * Destructor, deletes the resources of CNATFWUNSAFLifetimeAttribute.
       
    66     */
       
    67     ~CNATFWUNSAFLifetimeAttribute();
       
    68 
       
    69 public: // From CNATFWUNSAFAttribute
       
    70 
       
    71     CNATFWUNSAFAttribute::TType Type() const;
       
    72 
       
    73     HBufC8* EncodeValueL() const;
       
    74 
       
    75 public: // New functions
       
    76 
       
    77     /**
       
    78     * Returns the Lifetime.
       
    79     * @return Lifetime
       
    80     */
       
    81     IMPORT_C TInt Lifetime() const;
       
    82 
       
    83 
       
    84 private:
       
    85 
       
    86     enum TEncodedValue
       
    87         {
       
    88         //Size in bytes of the attribute value
       
    89         EAttributeValueSize = 4
       
    90         };
       
    91 
       
    92 private: // Constructors
       
    93 
       
    94     CNATFWUNSAFLifetimeAttribute();
       
    95 
       
    96     void ConstructL(TInt aLifetime);
       
    97 
       
    98 private: // Data
       
    99 
       
   100     TInt iLifetime;
       
   101 
       
   102     };
       
   103 
       
   104 #endif // CNATFWUNSAFLIFETIMEATTRIBUTE_H
       
   105 
       
   106