natplugins/natpnatfwsdpprovider/inc/nspsessiondata.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 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:  Session Sdp related storage, class description.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NSPSESSIONDATA_H
       
    19 #define NSPSESSIONDATA_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "natfwconnectivityapidefs.h"
       
    23 
       
    24 class CSdpDocument;
       
    25 class CSdpConnectionField;
       
    26 class CNATFWCandidate;
       
    27 class CNATFWCredentials;
       
    28 
       
    29 /**
       
    30  *  Data container for all Sdp related data.
       
    31  *
       
    32  *  All session related Sdp data is stored in here, 
       
    33  *  for later use.
       
    34  *
       
    35  *  @lib natfwsdpprovider.dll
       
    36  *  @since S60 3.2
       
    37  */
       
    38 class CNSPSessionData : public CBase
       
    39     {
       
    40 public: // Enumerations
       
    41 
       
    42     /**
       
    43      * Substate signals special situation in session peer.
       
    44      */
       
    45     enum TSubState
       
    46         {
       
    47         ESubNone,
       
    48         ESubMismatch,
       
    49         ESubRemoteLite,
       
    50         ESubAll
       
    51         };
       
    52 
       
    53 public: // Constructors and destructor
       
    54 
       
    55     /**
       
    56      * A two-phase constructor.
       
    57      */
       
    58     static CNSPSessionData* NewL();
       
    59     
       
    60     /**
       
    61      * A two-phase constructor.
       
    62      */
       
    63     static CNSPSessionData* NewLC();
       
    64     
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     virtual ~CNSPSessionData();
       
    69 
       
    70 
       
    71 private: // Constructors and destructor
       
    72 
       
    73     CNSPSessionData();
       
    74     
       
    75     void ConstructL();
       
    76 
       
    77 
       
    78 public: // New functions
       
    79 
       
    80     /**
       
    81      * Sdp offer stored here for state machine to use.
       
    82      * 
       
    83      * @since       S60 3.2
       
    84      * @param       aOffer              Sdp offer document, ownership changed.
       
    85      */
       
    86     void SetOffer( CSdpDocument* aOffer );
       
    87     
       
    88     /**
       
    89      * Sdp offer used in state machine via this method.
       
    90      * 
       
    91      * @since       S60 3.2
       
    92      * @return      Pointer to Sdp offer document, ownership not changed.
       
    93      */
       
    94     CSdpDocument& Offer();
       
    95     
       
    96     /**
       
    97      * Sdp offer from the data container is released with this method.
       
    98      * 
       
    99      * @since       S60 3.2
       
   100      * @return      Pointer to Sdp offer document, ownership changed.
       
   101      */
       
   102     CSdpDocument* ReleaseOffer();
       
   103     
       
   104     /**
       
   105      * Sdp answer stored here for state machine to use.
       
   106      * 
       
   107      * @since       S60 3.2
       
   108      * @param       aAnswer             Sdp offer document, ownership changed.
       
   109      */
       
   110     void SetAnswer( CSdpDocument* aAnswer );
       
   111     
       
   112     /**
       
   113      * Sdp answer used in state machine via this method.
       
   114      * 
       
   115      * @since       S60 3.2
       
   116      * @return      Pointer to Sdp answer document, ownership not changed.
       
   117      */
       
   118     CSdpDocument& Answer();
       
   119     
       
   120     /**
       
   121      * Sdp answer from the data container is released with this method.
       
   122      * 
       
   123      * @since       S60 3.2
       
   124      * @return      Pointer to Sdp offer document, ownership changed.
       
   125      */
       
   126     CSdpDocument* ReleaseAnswer();
       
   127     
       
   128     /**
       
   129      * Used to set role flag, either Controlling or Controlled.
       
   130      *
       
   131      * @since       S60 3.2
       
   132      * @param       aRole      Role enumeration.
       
   133      */
       
   134     void SetRole( TNATFWIceRole aRole );
       
   135     
       
   136     /**
       
   137      * Used to check role flag.
       
   138      *
       
   139      * @since       S60 3.2
       
   140      * @return      The role enumeration.
       
   141      */
       
   142     TNATFWIceRole Role() const;
       
   143     
       
   144     /**
       
   145      * Used to set session substate.
       
   146      *
       
   147      * @since       S60 3.2
       
   148      * @return      Reference to the sub state
       
   149      */
       
   150     void SetSubState( TSubState aSubState );
       
   151     
       
   152     /**
       
   153      * Used to access session substate.
       
   154      *
       
   155      * @since       S60 3.2
       
   156      * @return      Reference to the sub state
       
   157      */
       
   158     TSubState SubState() const;
       
   159     
       
   160     /**
       
   161      * Used to set flag incidicating whether to use Ice Sdp grammar.
       
   162      *
       
   163      * @since       S60 3.2
       
   164      * @param       aUseIce             Flag indicating Ice support.
       
   165      */
       
   166     void SetUseIce( TBool aUseIce );
       
   167     
       
   168     /**
       
   169      * Used to check flag incidicating whether to use Ice Sdp grammar.
       
   170      *
       
   171      * @since       S60 3.2
       
   172      * @return      ETrue if Ice grammar is supported.
       
   173      */
       
   174     TBool UseIce() const;
       
   175     
       
   176     /**
       
   177      * Returns a reference to array, which has all remote candidates for
       
   178      * this session.
       
   179      *
       
   180      * @since       S60 3.2
       
   181      * @return      Reference to array, which contains all remote candidates.
       
   182      */
       
   183     RPointerArray<CNATFWCandidate>& RemoteCandidates();
       
   184     
       
   185     /**
       
   186      * Returns session level credentials, in a credentials - object.
       
   187      *
       
   188      * @since       S60 3.2
       
   189      * @return      Session credentials reference
       
   190      */
       
   191     CNATFWCredentials& Credentials();
       
   192     
       
   193     /**
       
   194      * Initial Sdp in O/A.
       
   195      *
       
   196      * @since       S60 3.2
       
   197      * @return      Local Sdp document reference, ownership not changed.
       
   198      */
       
   199     CSdpDocument& UpdatedSdp();
       
   200     
       
   201     /**
       
   202      * Initial Sdp stored here incase updated O/A is needed.
       
   203      *
       
   204      * @since       S60 3.2
       
   205      * @param       aDocument           Sdp document object, ownership changed.
       
   206      */
       
   207     void SetUpdatedSdp( CSdpDocument* aDocument );
       
   208     
       
   209     /**
       
   210      * Release initial local Sdp
       
   211      * 
       
   212      * @since		S60 3.2
       
   213      * @return		Local Sdp document pointer, ownership changed.
       
   214      */
       
   215     CSdpDocument* ReleaseUpdatedSdp();
       
   216     
       
   217     
       
   218 private: // data
       
   219 
       
   220     /**
       
   221      * Pointer to a SDP Offer.
       
   222      * Own.
       
   223      */
       
   224     CSdpDocument* iOffer;
       
   225     
       
   226     /**
       
   227      * Pointer to a SDP Answer.
       
   228      * Own.
       
   229      */
       
   230     CSdpDocument* iAnswer;
       
   231     
       
   232     /**
       
   233      * Flag indicating whether this terminal is controlling, or controlled.
       
   234      */
       
   235     TNATFWIceRole iRole;
       
   236     
       
   237     /**
       
   238      * Sub state which is used signal special situation in session peer.
       
   239      */
       
   240     TSubState iSubState;
       
   241     
       
   242     /**
       
   243      * Flag indicating whether to Ice grammar in SDP.
       
   244      */
       
   245     TBool iUseIce;
       
   246     
       
   247     /**
       
   248      * Array containing remote candidates received from O/A exchange.
       
   249      * Own.
       
   250      */
       
   251     RPointerArray<CNATFWCandidate> iRemoteCandidates;
       
   252     
       
   253     /**
       
   254      * Object containing peer session level credentials.
       
   255      * Own.
       
   256      */
       
   257     CNATFWCredentials* iCredentials;
       
   258     
       
   259     /**
       
   260      * Local Sdp that is used incase ICE protocol requires updated 
       
   261      * O/A exchange. Own.
       
   262      */
       
   263     CSdpDocument* iUpdatedSdp;
       
   264 
       
   265     };
       
   266 
       
   267 #endif // NSPSESSIONDATA_H
       
   268 
       
   269 // end of file