|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef M_SEN_TRANSPORT_H |
|
26 #define M_SEN_TRANSPORT_H |
|
27 |
|
28 // INCLUDES |
|
29 #include <e32std.h> |
|
30 |
|
31 #include "msenservicesession.h" |
|
32 #include "msenremoteserviceconsumer.h" |
|
33 #include "msenlayeredproperties.h" |
|
34 |
|
35 #include "MSenElement.h" |
|
36 |
|
37 // CONSTANTS |
|
38 const TInt KErrSenTransactionComplete = 20; |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CSenFragment; |
|
42 class CSenTransportProperties; |
|
43 |
|
44 // DATA TYPES |
|
45 typedef RPointerArray<CSenFragment> RTransportProperties; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 class MSenTransport |
|
49 { |
|
50 public: |
|
51 |
|
52 // New functions |
|
53 |
|
54 /** |
|
55 * Method for sending synchronous request to a known endpoint (URI). This method |
|
56 * will block the current ActiveScheduler until the response from service is received. |
|
57 * |
|
58 * @param aEndpoint is the endpoint, typically an URI of the service being invoked |
|
59 * @param aMessage is the actual message to the service behind known endpoint |
|
60 * @param aTransportProperties containts the transport related request properties |
|
61 * @param aResponse will contain the response after this synchronous call returns. |
|
62 * @param aConsumer is the underlying caller invoking this request. |
|
63 * @return KErrSenNoEndpoint if aEndpoint lenght is zero or negative. |
|
64 */ |
|
65 virtual TInt SubmitL(const TDesC8& aEndpoint, |
|
66 const TDesC8& aMessage, |
|
67 const TDesC8& aTransportProperties, |
|
68 HBufC8*& aResponse, |
|
69 MSenRemoteServiceConsumer& aConsumer) = 0; |
|
70 |
|
71 /** |
|
72 * Method for sending asynchronous request to a known endpoint (URI). |
|
73 * @param aEndpoint is the endpoint, typically an URI of the service being invoked |
|
74 * @param aMessage is the actual message to the service behind known endpoint |
|
75 * @param aTransportProperties containts the transport related request properties |
|
76 * @param aReplyTo is the session session performing this request for the caller |
|
77 * @param aConsumer is the underlying caller invoking this request (addressee) |
|
78 * @param aTxnId will be set to refer to the new transaction id of this request |
|
79 * @return KErrNone or some error, if the method fails. Error code can be either some |
|
80 * system-wide constnat, or a WSF specific KErrSenNoEndpoint if aEndpoint lenght is zero |
|
81 * or negative. |
|
82 */ |
|
83 virtual TInt SendL(const TDesC8& aEndpoint, |
|
84 const TDesC8& aMessage, |
|
85 const TDesC8& aTransportProperties, |
|
86 MSenServiceSession& aReplyTo, |
|
87 MSenRemoteServiceConsumer& aConsumer, |
|
88 TInt& aTxnId) = 0; |
|
89 |
|
90 /** |
|
91 * Method parses and applies the given properties on top of current properties |
|
92 * (state) of the transport. This means, that all spesified property entries |
|
93 * override existing ones |
|
94 */ |
|
95 virtual TInt SetPropertiesL(const TDesC8& aProperties, |
|
96 MSenLayeredProperties::TSenPropertiesLayer aTargetLayer, |
|
97 MSenRemoteServiceConsumer* aConsumer) = 0; |
|
98 |
|
99 virtual TInt PropertiesL(HBufC8*& aProperties) = 0; |
|
100 |
|
101 /** |
|
102 * Cancels the transaction from the transport, removing interested pending |
|
103 * consumers from list of response receivers, preventing any callbacks |
|
104 * being performed even though transport itself may still receive response |
|
105 * from some (network stack) server. |
|
106 * @return KErrNone, if cancel was performed |
|
107 * KErrNotFound if transaction was not found |
|
108 */ |
|
109 virtual TInt CancelTransaction(const TInt aTxnId) = 0; |
|
110 |
|
111 /** |
|
112 * Method requests the transport plug-in implementation to complete |
|
113 * a pending transaction. Typically, service provider sessions |
|
114 * (like MSenRemoteHostlet) implementations call this method to |
|
115 * signalize, that certain pending, asynchronous transaction |
|
116 * issued earlier by some consumer has been completed. |
|
117 * @param aTxnId is the id of the transaction to be completed |
|
118 * @param aStatus is an optional, additinal status code, which |
|
119 * transport plug-in should pass to the "addressee", the consumer, |
|
120 * who originated this transaction. |
|
121 * @return KErrNone if transaction was completed successfully |
|
122 * KErrNotFound if pending transaction, matching with |
|
123 * given aTxnId was not found. |
|
124 */ |
|
125 virtual TInt CompleteTransaction(const TInt aTxnId, |
|
126 const TInt aStatus = KErrNone) = 0; |
|
127 |
|
128 /** |
|
129 * Getter for the URI scheme of this transport plug-in implementation, |
|
130 * Examples of such scheme are: http, tcp, udp and local. |
|
131 * @return the scheme of this transport |
|
132 */ |
|
133 virtual TPtrC8 UriSchemeL() = 0; |
|
134 |
|
135 |
|
136 |
|
137 virtual MSenProperties& PropertiesL() = 0; |
|
138 |
|
139 inline virtual TInt SubscribeEventListenerL(MSenRemoteServiceConsumer& /*aConsumer*/) |
|
140 { |
|
141 return KErrNotSupported; |
|
142 } |
|
143 inline virtual TInt UnsubscribeEventListenerL(MSenRemoteServiceConsumer& /*aConsumer*/) |
|
144 { |
|
145 return KErrNotSupported; |
|
146 } |
|
147 }; |
|
148 |
|
149 #endif // SEN_MTRANSPORT_H |
|
150 |
|
151 // End of File |