|
1 // Copyright (c) 2004-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 // Name : CSIPResolvingResult.cpp |
|
15 // Part of : ServerResolver |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "sipstrings.h" |
|
22 #include "sipstrconsts.h" |
|
23 #include "CSIPResolvingResult.h" |
|
24 |
|
25 // ---------------------------------------------------------------------------- |
|
26 // CSIPResolvingResult::CSIPResolvingResult |
|
27 // ---------------------------------------------------------------------------- |
|
28 // |
|
29 CSIPResolvingResult::CSIPResolvingResult( TInetAddr aAddr, |
|
30 RStringF aProtocol, |
|
31 TBool aForceUDP ) |
|
32 : iProtocol( aProtocol ), |
|
33 iAddr( aAddr ), |
|
34 iFailed( EFalse ), |
|
35 iForceUDP( aForceUDP ) |
|
36 { |
|
37 } |
|
38 |
|
39 // ---------------------------------------------------------------------------- |
|
40 // CSIPResolvingResult::NewLC |
|
41 // ---------------------------------------------------------------------------- |
|
42 // |
|
43 CSIPResolvingResult* CSIPResolvingResult::NewLC( TInetAddr aAddr, |
|
44 RStringF aProtocol, |
|
45 TBool aForceUDP ) |
|
46 { |
|
47 if ( aForceUDP && aProtocol != SIPStrings::StringF( SipStrConsts::EUDP ) ) |
|
48 { |
|
49 User::Leave( KErrArgument ); |
|
50 } |
|
51 CSIPResolvingResult* self = new ( ELeave ) CSIPResolvingResult( aAddr, |
|
52 aProtocol, |
|
53 aForceUDP ); |
|
54 CleanupStack::PushL( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 // CSIPResolvingResult::~CSIPResolvingResult |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 CSIPResolvingResult::~CSIPResolvingResult() |
|
63 { |
|
64 iProtocol.Close(); |
|
65 } |
|
66 |
|
67 // ---------------------------------------------------------------------------- |
|
68 // CSIPResolvingResult::Address |
|
69 // ---------------------------------------------------------------------------- |
|
70 // |
|
71 TInetAddr& CSIPResolvingResult::Address() |
|
72 { |
|
73 return iAddr; |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CSIPResolvingResult::Protocol |
|
78 // ---------------------------------------------------------------------------- |
|
79 // |
|
80 RStringF CSIPResolvingResult::Protocol() |
|
81 { |
|
82 return iProtocol; |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CSIPResolvingResult::SetProtocol |
|
87 // ---------------------------------------------------------------------------- |
|
88 // |
|
89 TInt CSIPResolvingResult::SetProtocol( RStringF aProtocol ) |
|
90 { |
|
91 if ( ForceUDP() && aProtocol != SIPStrings::StringF( SipStrConsts::EUDP ) ) |
|
92 { |
|
93 return KErrArgument; |
|
94 } |
|
95 |
|
96 iProtocol.Close(); |
|
97 iProtocol = aProtocol.Copy(); |
|
98 return KErrNone; |
|
99 } |
|
100 |
|
101 // ---------------------------------------------------------------------------- |
|
102 // CSIPResolvingResult::SetFailed |
|
103 // ---------------------------------------------------------------------------- |
|
104 // |
|
105 void CSIPResolvingResult::SetFailed( TBool aFailed ) |
|
106 { |
|
107 iFailed = aFailed; |
|
108 } |
|
109 |
|
110 // ---------------------------------------------------------------------------- |
|
111 // CSIPResolvingResult::Failed |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 TBool CSIPResolvingResult::Failed() |
|
115 { |
|
116 return iFailed; |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // CSIPResolvingResult::ForceUDP |
|
121 // ---------------------------------------------------------------------------- |
|
122 // |
|
123 TBool CSIPResolvingResult::ForceUDP() |
|
124 { |
|
125 return iForceUDP; |
|
126 } |