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