networkcontrol/qoslib/inc/qos_extension.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2003-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 //
       
    15 
       
    16 #ifndef __QOS_EXTENSION_H__
       
    17 #define __QOS_EXTENSION_H__
       
    18 
       
    19 /**
       
    20  * @file qos_extension.h 
       
    21  * This file defines the base class for QoS extensions that can be added to CQoSParameters.
       
    22  */
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <in_sock.h>
       
    26 //#include <networking/qosparameters.h>
       
    27 
       
    28 
       
    29 /**
       
    30  * Base class for extension policies.
       
    31  *
       
    32  * @publishedPartner
       
    33  * @released
       
    34  */
       
    35 class CExtensionBase : public CBase
       
    36 {
       
    37 public:
       
    38     IMPORT_C CExtensionBase();
       
    39     IMPORT_C ~CExtensionBase();
       
    40     
       
    41     /** 
       
    42     Extension must implement this function to allow qoslib to create 
       
    43     extensions.
       
    44      
       
    45     @publishedPartner
       
    46     @released
       
    47     @capability NetworkServices Restrict QoS operations in similar way as 
       
    48     normal socket operations.
       
    49     @leave If no memory is available.
       
    50     @return A pointer to extension object. 
       
    51     */
       
    52     virtual CExtensionBase* CreateL()=0;
       
    53 
       
    54     /** 
       
    55     Gets the type of the extension. 
       
    56      
       
    57     @publishedPartner
       
    58     @released
       
    59     @capability NetworkServices Restrict QoS operations in similar way as 
       
    60     normal socket operations.
       
    61     @return Extension type. 
       
    62     */
       
    63     inline TInt Type() const { return iType; }
       
    64 
       
    65     /** 
       
    66     Gets the extension data in a descriptor.
       
    67      
       
    68     The extension must implement this function to allow qoslib to fetch the 
       
    69     extension data.  
       
    70      
       
    71     @publishedPartner
       
    72     @released
       
    73     @capability NetworkServices Restrict QoS operations in similar way as 
       
    74     normal socket operations.
       
    75     @return Extension data. 
       
    76     */
       
    77     virtual TDesC8& Data()=0;
       
    78 
       
    79     /**
       
    80     Parses the extension data received as a parameter.
       
    81      
       
    82     The extension must implement this function to allow qoslib give the 
       
    83     extension data to the extension object.  
       
    84     
       
    85     @publishedPartner
       
    86     @released
       
    87     @capability NetworkServices Restrict QoS operations in similar way as 
       
    88     normal socket operations.
       
    89     @param aData Extension data.
       
    90     @return KErrNone, if aData contains a valid extension; otherwise, error 
       
    91     code. 
       
    92     */
       
    93     virtual TInt ParseMessage(const TDesC8& aData)=0;
       
    94 
       
    95     /**
       
    96     Copies aExtension into this object.
       
    97      
       
    98     The extension must implement this function to allow copying of 
       
    99     extensions.  
       
   100      
       
   101     @publishedPartner
       
   102     @released
       
   103     @capability NetworkServices Restrict QoS operations in similar way as 
       
   104     normal socket operations.
       
   105     @param aExtension Extension data.
       
   106     @return KErrNone, if copying succeeded; otherwise, error code. 
       
   107     */
       
   108     virtual TInt Copy(const CExtensionBase& aExtension)=0;
       
   109 
       
   110 
       
   111 public:
       
   112     TSglQueLink iLink; //iLink needs to be accessible for setting offset!
       
   113 
       
   114 protected:
       
   115     /** The extension type. */
       
   116     TInt iType;
       
   117     /** Buffer for extension data. */
       
   118     HBufC8* iData; 
       
   119     /** Pointer to next item in an extension queue. */
       
   120 };
       
   121 
       
   122 /** A typedef for a queue of extensions. */
       
   123 typedef TSglQue<CExtensionBase> TQoSExtensionQueue;
       
   124 /** A typedef for an iterator to a queue of extensions. */
       
   125 typedef TSglQueIter<CExtensionBase> TQoSExtensionQueueIter;
       
   126 
       
   127 #endif