|
1 /* |
|
2 * Copyright (c) 2008 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 #include "mcenatstateinitializing.h" |
|
22 #include "mcenatevents.h" |
|
23 #include "mcenatactions.h" |
|
24 #include "mcesrvlogs.h" |
|
25 |
|
26 #include "mcenatsipsession.h" |
|
27 #include "mceactionset.h" |
|
28 #include "mceclientserver.h" |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CMceNatStateInitializing::CMceNatStateInitializing |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CMceNatStateInitializing::CMceNatStateInitializing() |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceNatStateInitializing::~CMceNatStateInitializing |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceNatStateInitializing::~CMceNatStateInitializing() |
|
44 { |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CMceNatStateInitializing::Accept |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 TBool CMceNatStateInitializing::Accept( TMceNatStateTransitionEvent& aEvent ) |
|
52 { |
|
53 switch ( aEvent.NatCode() ) |
|
54 { |
|
55 case EMceNatInitialized: |
|
56 case EMceNatUpdated: |
|
57 return ETrue; |
|
58 |
|
59 default: |
|
60 return EFalse; |
|
61 } |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CMceNatStateInitializing::EntryL |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CMceNatStateInitializing::EntryL( TMceNatStateTransitionEvent& /*aEvent*/ ) |
|
69 { |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CMceNatStateInitializing::ExitL |
|
74 // When either EMceNatInitialized or EMceNatUpdated is received, enter state |
|
75 // KMceNatStateCreateOfferRequested, and wait there for the other event, before |
|
76 // entering KMceNatStateIdle. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CMceNatStateInitializing::ExitL( TMceNatStateTransitionEvent& aEvent ) |
|
80 { |
|
81 MCESRV_DEBUG( "*** CMceNatStateInitializing::ExitL, Entry" ); |
|
82 |
|
83 #if 0 |
|
84 TMceNatStateIndex nextState( KMceNatStateIdle ); |
|
85 |
|
86 if ( aEvent.NatCode() == EMceNatUpdated ) |
|
87 { |
|
88 // Media is now ready, but must wait for NAT plugin to get initialized. |
|
89 nextState = KMceNatStateCreateOfferRequested; |
|
90 } |
|
91 aEvent.NatActions().StateChangedL( aEvent, nextState ); |
|
92 |
|
93 #else |
|
94 |
|
95 if ( ( CMceComSession::TType(aEvent.Session().Type()) == CMceComSession::EInSession ) |
|
96 && ( &aEvent.Session().Request()) |
|
97 && ( !MceSip::HasContent( aEvent.Session().Request() ))) |
|
98 { |
|
99 aEvent.NatActions().StateChangedL( aEvent, |
|
100 KMceNatStateIdle ); |
|
101 } |
|
102 |
|
103 else |
|
104 { |
|
105 |
|
106 aEvent.NatActions().StateChangedL( aEvent, |
|
107 KMceNatStateCreateOfferRequested ); |
|
108 } |
|
109 |
|
110 #endif |
|
111 |
|
112 MCESRV_DEBUG( "*** CMceNatStateInitializing::ExitL, Exit" ); |
|
113 } |