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