1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __WAPMESSAGE_H__
17 #define __WAPMESSAGE_H__
29 * The WAP Messaging API.
31 * Four interfaces are defined that provide bound and fully-specified versions of WDP and Connectionless Push.
32 * An instantiation of each may be obtained using the CreateImplementationL() function, and must be released
33 * using Release() when no longer required. Release() causes the instantiation to be deleted.
35 * For error codes returned by methods in this API, see <wapmsgerr.h>. Most methods can return a set of general
36 * errors, with some returning additional specific errors.
39 * @released since v7.0
43 * Defines WAP-related types and error codes.
47 // Bearer type definition
49 /** Type definition for an enum defining WAP bearer types. */
53 /** Internet Protocol. */
59 /** 7-bit SMS. The bearers WAPSMS and WAPSMS7 are intended for WAP browsing where
60 delivery reports are not required and the validity period is much shorter (5 minutes). */
66 // Port number definition
68 typedef TUint16 TPort;
71 /** Encapsulates an interface name and address. */
74 /** Interface name. */
76 /** Interface IP address. */
83 * The WSP status type definition.
86 typedef TUint8 TWSPStatus;
89 class CWapBoundDatagramService : public CBase
91 * Sends and receives datagrams over WDP using a specified local port.
93 * The class is an ECom plug-in interface. Clients use NewL() to request an implementation
94 * of the interface, and then call the interface's virtual functions to access
95 * the implementation's services.
97 * The use of the plug-in architecture allows different implementations to use
98 * different underlying WAP stacks.
100 * Functions can return system wide error codes, and also API-specific errors
101 * as defined in wapmsgerr.h.
105 public: // creation/deletion
106 IMPORT_C static CWapBoundDatagramService* NewL();
107 IMPORT_C static CWapBoundDatagramService* NewL(const TUid& aImplementation);
108 IMPORT_C virtual ~CWapBoundDatagramService();
110 public: // API methods
113 * Connects to the WAP stack, opening an endpoint that can be used to listen for
114 * subsequent incoming datagrams.
116 * This overload of Connect() allows an IP address associated with a network
117 * interface to be specified. In multihomed systems, this can be used to specify
118 * the network interface to which the endpoint should be bound.
120 * All CWapBoundDatagramService implementations must automatically close this
121 * endpoint upon destruction.
123 * @param aBearer The bearer to listen on. Use EAll to specify all bearers.
124 * @param aPort The port to listen on. If set to 0, a local port will be chosen
125 * for the client's first SendTo()
126 * @param aInetAddr The IP address of the network interface that should be used
127 * in a multihomed system.
128 * @return KErrNone on successful completion, or one of the system error codes
131 virtual TInt Connect(Wap::TBearer aBearer, Wap::TPort aPort,TInetAddr aInetAddr)=0;
134 * Connects to the WAP stack, opening an endpoint that can be used to listen for
135 * subsequent incoming datagrams.
137 * All CWapBoundDatagramService implementations must automatically close this
138 * endpoint upon destruction.
140 * @param aBearer The bearer to listen on. Use EAll to specify all bearers.
141 * @param aPort The port to listen on. If set to 0, a local port will be chosen
142 * for the client's first SendTo()
143 * @return KErrNone on successful completion, or one of the system error codes
146 virtual TInt Connect(Wap::TBearer aBearer,Wap::TPort aPort)=0;
148 /** Sends data to a remote endpoint.
150 * @param aRemoteHost The address of the remote host to which to send the data.
151 * The format of the address is bearer-specific.
152 * @param aRemotePort The port on the remote host to which the data will be sent
153 * @param aBuffer The data buffer to be sent
154 * @param aBearer The bearer to be used, if the bound connection was opened with EAll
155 * @return KErrNone on successful completion, or one of the system error codes
158 virtual TInt SendTo(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, const TDesC8& aBuffer, Wap::TBearer aBearer)=0;
161 * Waits for a datagram to be received, and discovers the size of buffer required
164 * This asynchronous method waits for a datagram to be received and will then
165 * complete allowing the client to discover how large a buffer is needed to retrieve
166 * the entire datagram that has been received. A later call to RecvFrom() with
167 * a buffer of sufficient size will then allow the client to retrieve the datagram
170 * @param aDataSizePckg On completion, the size of data received, in bytes
171 * @param aReqStatus Asynchonrous status word, used to signal when a data size is known
172 * @return KErrNone on successful completion, or one of the system error codes
175 virtual TInt AwaitRecvDataSize(TPckg<TUint16>& aDataSizePckg, TRequestStatus& aReqStatus)=0;
178 * Receives data on a bound port.
180 * An asynchronous notification is sent to the client when data arrives.
182 * @param aRemoteHost On completion, the bearer-dependent address of the remote
183 * host from which the data was received
184 * @param aRemotePort On completion, the port on the remote host from which the
186 * @param aBuffer A client-allocated data buffer that on completion is filled
187 * with data received. Data that overflows the buffer is discarded.
188 * @param aTruncated On completion, indicates whether the received datagram was
189 * truncated to fit in the client's supplied buffer
190 * @param aReqStatus Asynchronous status word, used to notify the client that
191 * a datagram was received
192 * @param aTimeout An optional millisecond time-out which allows a timed read
193 * to be made. If no data is received within the timeout period, the request
194 * completes with KErrTimedOut. If a value of 0 is supplied, the timeout is infinite.
195 * @return KErrNone on successful completion, or one of the system error codes on failure.
197 virtual TInt RecvFrom(TDes8& aRemoteHost, Wap::TPort& aRemotePort, TDes8& aBuffer, TBool& aTruncated,
198 TRequestStatus& aReqStatus, TUint32 aTimeout)=0;
201 * Cancels a previously asynchronous RecvFrom() or AwaitRecvDataSize() request.
203 * If a datagram arrives at the local host, it will be discarded.
206 virtual void CancelRecv()=0;
209 * Gets the local port of this endpoint.
211 * This is useful if the port was chosen automatically.
213 * @param aPort On return, the port number
214 * @return KErrNone on successful completion, or one of the system error codes on failure.
216 virtual TInt GetLocalPort(Wap::TPort& aPort)=0;
219 * Gets the local address of this endpoint.
221 * @param aLocalHost On return, the address of the local host. Clients must pass
222 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
223 * buffer to hold the address, and passes ownership of the buffer to the client.
224 * @return KErrNone on successful completion, or one of the system error codes on failure.
226 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0;
229 * Gets the bearer on which a received datagram arrived.
231 * This is useful when EAll was specified as the bearer in Connect().
233 * @param aBearer On return, the bearer
234 * @return KErrNone on successful completion, or one of the system error codes on failure.
236 virtual TInt GetBearer(Wap::TBearer& aBearer)=0;
239 * Queries the WDP bearer for its maximum datagram size and its nominal datagram size.
241 * The nominal size is the size within which a datagram won't have to be split
242 * into smaller individual messages and then re-assembled at the other end.
244 * The function will fail for a stream connection.
246 * @param aMaxSize On return, the maximum datagram size
247 * @param aNominalSize On return, the nominal datagram size
248 * @return KErrNone on successful completion, or one of the system error codes
251 virtual TInt GetDatagramSizes(TUint16& aMaxSize, TUint16& aNominalSize)=0;
253 protected: // methods
254 IMPORT_C CWapBoundDatagramService();
255 IMPORT_C void ConstructL();
257 private: // attributes
258 /// D'tor Key identification required for ECOM
262 /** Fully-Specified WDP
264 class CWapFullySpecDatagramService : public CBase
266 * Sends and receives datagrams over WDP using a specified local port and a single,
269 * The class is an ECom plug-in interface. Clients use NewL() to request an implementation
270 * of the interface, and then call the interface's virtual functions to access
271 * the implementation's services.
273 * The use of the plug-in architecture allows different implementations to use
274 * different underlying WAP stacks.
276 * Functions can return system wide error codes, and also API-specific errors
277 * as defined in wapmsgerr.h.
280 public: // creation/deletion
281 IMPORT_C static CWapFullySpecDatagramService* NewL();
282 IMPORT_C static CWapFullySpecDatagramService* NewL(const TUid& aImplementation);
283 IMPORT_C virtual ~CWapFullySpecDatagramService();
285 public: // API methods
287 // Connect to the wapstack, opening an endpoint which is to be used only with a single, named remote host.
289 * Connects to the WAP stack, opening an endpoint that can be used to listen for
290 * subsequent incoming datagrams.
292 * This overload of Connect() allows an IP address associated with a network
293 * interface to be specified. In multihomed systems, this can be used to specify
294 * the network interface to which the endpoint should be bound.
296 * All CWapFullySpecDatagramService implementations must automatically close
297 * this endpoint upon destruction.
299 * @param aRemoteHost The bearer-dependent address of the remote host with which
300 * the data will be exchanged
301 * @param aRemotePort The port on the remote host to which data will be sent
302 * @param aBearer The bearer to use. EAll cannot be used.
303 * @param aInetAddr The IP address of the network interface that should be used
304 * in a multihomed system.
305 * @return KErrNone on successful completion, or one of the system error codes on failure.
307 virtual TInt Connect(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, Wap::TBearer aBearer, TInetAddr aInetAddr)=0;
309 // Connect to the wapstack, opening an endpoint which is to be used only with a single, named remote host.
311 * Connects to the WAP stack, opening an endpoint that can be used to listen for
312 * subsequent incoming datagrams.
314 * All CWapFullySpecDatagramService implementations must automatically close
315 * this endpoint upon destruction.
317 * @param aRemoteHost The bearer-dependent address of the remote host with which
318 * the data will be exchanged
319 * @param aRemotePort The port on the remote host to which data will be sent
320 * @param aBearer The bearer to use. EAll cannot be used.
321 * @return KErrNone on successful completion, or one of the system error codes on failure.
323 virtual TInt Connect(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, Wap::TBearer aBearer)=0;
326 * Sends data on a fully-specified connection.
328 * @param aBuffer The data buffer to be written over the connection
329 * @return KErrNone on successful completion, or one of the system error codes on failure.
331 virtual TInt Send(const TDesC8& aBuffer)=0;
334 * Waits for a datagram to be received, and discover how large a buffer is required
337 * This asynchronous request waits for a datagram to be received and will then
338 * complete allowing the client to discover how large a buffer is needed to retrieve
339 * the entire datagram that has been received. A later call to Recv() with a
340 * buffer of sufficent size will then allow the client to retrieve the datagram
343 * @param aDataSizePckg On completion, the size of data received, in bytes
344 * @param aReqStatus Asynchonrous status word, used to signal when a data size is known
345 * @return KErrNone on successful completion, or one of the system error codes on failure.
347 virtual TInt AwaitRecvDataSize(TPckg<TUint16>& aDataSizePckg, TRequestStatus& aReqStatus)=0;
350 * Receives data on a bound port.
352 * An asynchronous notification is sent to the client when data arrives.
354 * @param aBuffer A client-allocated data buffer that, on completion, is filled
355 * with data received. Data that overflows the buffer is discarded.
356 * @param aTruncated On completion, indicates whether the received datagram was
357 * truncated to fit in the client's supplied buffer
358 * @param aReqStatus Asynchronous status word, used to notify the client that
359 * a datagram was received
360 * @param aTimeout An optional millisecond time-out which allows a timed read
361 * to be made. If no data is received within the timeout period, the request
362 * completes with KErrTimedOut. If a value of 0 is supplied, the timeout is infinite.
363 * @return KErrNone on successful completion, or one of the system error codes on failure.
365 virtual TInt Recv(TDes8& aBuffer, TBool& aTruncated, TRequestStatus& aReqStatus, TUint32 aTimeout)=0;
368 * Cancels a previously asynchronous Recv() or AwaitRecvDataSize() request.
370 * If a datagram arrives at the local host, it will be discarded.
373 virtual void CancelRecv()=0;
376 * Gets the local port of this endpoint.
378 * This is useful if the port was chosen automatically.
380 * @param aPort On return, the port number
381 * @return KErrNone on successful completion, or one of the system error codes on failure.
383 virtual TInt GetLocalPort(Wap::TPort& aPort)=0;
386 * Gets the local address of this endpoint.
388 * @param aLocalHost On return, the address of the local host. Clients must pass
389 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
390 * buffer to hold the address, and passes ownership of the buffer to the client.
391 * @return KErrNone on successful completion, or one of the system error codes on failure.
393 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0;
396 * Queries the WDP bearer for its maximum datagram size and its nominal datagram size.
398 * The nominal size is the size within which a datagram won't have to be split
399 * into smaller individual messages and then re-assembled at the other end.
401 * @param aMaxSize On return, the maximum datagram size
402 * @param aNominalSize On return, the nominal datagram size
403 * @return KErrNone on successful completion, or one of the system error codes on failure.
405 virtual TInt GetDatagramSizes(TUint16& aMaxSize, TUint16& aNominalSize)=0;
407 protected: // methods
408 IMPORT_C CWapFullySpecDatagramService();
409 IMPORT_C void ConstructL();
412 // D'tor Key identification required for ECOM
416 /** Bound Connectionless Push
418 class CWapBoundCLPushService : public CBase
420 * Listens for WAP Push messages from any sender.
422 * The class is an ECom plug-in interface. Clients use NewL() to request an implementation
423 * of the interface, and then call the interface's virtual functions to access
424 * the implementation's services.
426 * The use of the plug-in architecture allows different implementations to use
427 * different underlying WAP stacks.
429 * Functions can return system wide error codes, and also API-specific errors
430 * as defined in wapmsgerr.h.
434 public: // creation/deletion
435 IMPORT_C static CWapBoundCLPushService* NewL();
436 IMPORT_C static CWapBoundCLPushService* NewL(const TUid& aImplementation);
437 IMPORT_C virtual ~CWapBoundCLPushService();
439 public: // API methods
442 // Opens a socket which is to be used to listen for subsequent incoming Push messages from any sender;
443 // i.e. it has only been 'bound' to the local address
445 * Connects to the WAP stack, opening an endpoint that can be used to listen for
446 * Push messages from any sender.
448 * This overload of Connect() allows an IP address associated with a network
449 * interface to be specified. In multihomed systems, this can be used to specify
450 * the network interface to which the endpoint should be bound.
452 * All CWapBoundCLPushService implementations must automatically close this endpoint
455 * @param aBearer The bearer to listen on. Use EAll to specify all bearers.
456 * @param aPort The port to listen on. If set to 0, a local port will be chosen
457 * for the client's first SendTo()
458 * @param aSecure Security flag to indicate whether WTLS should be used or not
459 * @param aInetAddr The address of the adapter to use
460 * @return KErrNone on successful completion, or one of the system error codes on failure.
462 virtual TInt Connect(Wap::TBearer aBearer, Wap::TPort aPort, TBool aSecure, TInetAddr aInetAddr)=0;
465 // Opens a socket which is to be used to listen for subsequent incoming Push messages from any sender;
466 // i.e. it has only been 'bound' to the local address
468 * Connects to the WAP stack, opening an endpoint that can be used to listen for
469 * Push messages from any sender.
471 * All CWapBoundCLPushService implementations must automatically close this endpoint
474 * @param aBearer The bearer to listen on. Use EAll to specify all bearers.
475 * @param aPort The port to listen on. If set to 0, a local port will be chosen
476 * for the client's first SendTo()
477 * @param aSecure Security flag to indicate whether WTLS should be used or not
478 * @return KErrNone on successful completion, or one of the system error codes on failure.
480 virtual TInt Connect(Wap::TBearer aBearer, Wap::TPort aPort, TBool aSecure)=0;
483 * Requests an asynchronous notification upon arrival of the next push message
484 * on the listening connection.
486 * The request completes upon receipt of the message, filling the buffers with
487 * as much received data as possible. A return code indicates whether further
488 * data remains. The call must be re-issued for subsequent messages or to receive
489 * remaining data from a previous push message.
491 * @param aPushHeaders A client-allocated buffer that, on completion, is filled
492 * with the push message's header data
493 * @param aPushBody A client-allocated buffer that, on completion, is filled with
494 * the push message's body data
495 * @param aPushIdPckg On completion, an integer ID that uniquely specifies the
497 * @param aReqStatus Asynchonrous status word, used by the service provider to
498 * notify the client when a push message has arrived.
499 * EMoreData is returned if more pushed data is available.
500 * @return KErrNone on successful completion, or one of the system error codes on failure.
502 virtual TInt AwaitPush(TDes8& aPushHeaders, TDes8& aPushBody, TPckgBuf<TUint8>& aPushIdPckg, TRequestStatus& aReqStatus)=0;
505 * Cancels a previous push message request.
507 * If a push message arrives, the client will not be notified.
510 virtual void CancelAwaitPush()=0;
513 * Gets the local port of this endpoint.
515 * This is useful if the port was chosen automatically.
517 * @param aPort On return, the port number
518 * @return KErrNone on successful completion, or one of the system error codes on failure.
520 virtual TInt GetLocalPort(Wap::TPort& aPort)=0;
523 * Gets the local address of this endpoint.
525 * @param aLocalHost On return, the address of the local host. Clients must pass
526 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
527 * buffer to hold the address, and passes ownership of the buffer to the client.
528 * @return KErrNone on successful completion, or one of the system error codes on failure.
530 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0;
533 * Gets the bearer on which a received datagram arrived.
535 * This is useful when EAll was specified as the bearer in Connect().
537 * @param aBearer On return, the bearer
538 * @return KErrNone on successful completion, or one of the system error codes on failure.
540 virtual TInt GetBearer(Wap::TBearer& aBearer)=0;
543 * Gets the address of the remote server.
545 * This function cannot be called when there is an outstanding AwaitPush().
547 * @param aRemoteHost On return, the address of the remote host. Clients must pass
548 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
549 * buffer to hold the address, and passes ownership of the buffer to the client.
550 * @return KErrNone on successful completion, KErrNotSupported if not implemented,
551 * or one of the system error codes on failure.
553 virtual TInt GetServerAddress(HBufC8*& aRemoteHost)=0;
555 protected: // methods
556 IMPORT_C CWapBoundCLPushService();
557 IMPORT_C void ConstructL();
560 // D'tor Key identification required for ECOM
564 /** Fully-Specified Connectionless Push
566 class CWapFullySpecCLPushService : public CBase
568 * Listens for WAP Push messages from a single, named remote host.
570 * The class is an ECom plug-in interface. Clients use NewL() to request an implementation
571 * of the interface, and then call the interface's virtual functions to access
572 * the implementation's services.
574 * The use of the plug-in architecture allows different implementations to use
575 * different underlying WAP stacks.
577 * Functions can return system wide error codes, and also API-specific errors
578 * as defined in wapmsgerr.h.
581 public: // creation/deletion
582 IMPORT_C static CWapFullySpecCLPushService* NewL();
583 IMPORT_C static CWapFullySpecCLPushService* NewL(const TUid& aImplementation);
584 IMPORT_C virtual ~CWapFullySpecCLPushService();
586 public: // API methods
588 // Opens a socket which is to be used only with a single, named remote host.
590 * Connects to the WAP stack, opening an endpoint that can be used to listen for
591 * Push messages from a specified remote host.
593 * This overload of Connect() allows an IP address associated with a network
594 * interface to be specified. In multihomed systems, this can be used to specify
595 * the network interface to which the endpoint should be bound.
597 * All CWapFullySpecCLPushService implementations must automatically close this
598 * endpoint upon destruction.
600 * @param aRemoteHost The bearer-dependent address of the remote host with which
601 * the data will be exchanged
602 * @param aRemotePort The port on the remote host to which data will be sent
603 * @param aBearer The bearer to listen on. You cannot use EAll.
604 * @param aSecure Security flag to indicate whether WTLS should be used or not
605 * @param aInetAddr The address of the adapter to use
606 * @return KErrNone on successful completion, or one of the system error codes on failure.
608 virtual TInt Connect(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, Wap::TBearer aBearer, TBool aSecure, TInetAddr aInetAddr)=0;
610 // Opens a socket which is to be used only with a single, named remote host.
612 * Connects to the WAP stack, opening an endpoint that can be used to listen for
613 * Push messages from a specified remote host.
615 * All CWapFullySpecCLPushService implementations must automatically close this
616 * endpoint upon destruction.
618 * @param aRemoteHost The bearer-dependent address of the remote host with which
619 * the data will be exchanged
620 * @param aRemotePort The port on the remote host to which data will be sent
621 * @param aBearer The bearer to listen on. You cannot use EAll.
622 * @param aSecure Security flag to indicate whether WTLS should be used or not
623 * @return KErrNone on successful completion, or one of the system error codes on failure.
625 virtual TInt Connect(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, Wap::TBearer aBearer, TBool aSecure)=0;
628 * Requests an asynchronous notification upon arrival of the next push message
629 * on the listening connection.
631 * The request completes upon receipt of the message, filling the buffers with
632 * as much received data as possible. A return code indicates whether further
633 * data remains. The call must be re-issued for subsequent messages or to receive
634 * remaining data from a previous push message.
636 * @param aPushHeaders A client-allocated buffer that, on completion, is filled
637 * with the push message's header data
638 * @param aPushBody A client-allocated buffer that, on completion, is filled with
639 * the push message's body data
640 * @param aPushIdPckg On completion, an integer ID that uniquely specifies the
642 * @param aReqStatus Asynchronous status word, used by the service provider to
643 * notify the client when a push message has arrived.
644 * EMoreData is returned if more pushed data is available.
645 * @return KErrNone on successful completion, or one of the system error codes on failure.
647 virtual TInt AwaitPush(TDes8& aPushHeaders, TDes8& aPushBody, TPckgBuf<TUint8>& aPushIdPckg, TRequestStatus& aReqStatus)=0;
650 * Cancels a previous push message request.
652 * If a push message arrives, the client will not be notified.
655 virtual void CancelAwaitPush()=0;
659 * Gets the local port of this endpoint.
661 * This is useful if the port was chosen automatically.
663 * @param aPort On return, the port number
664 * @return KErrNone on successful completion, or one of the system error codes on failure.
666 virtual TInt GetLocalPort(Wap::TPort& aPort)=0; // /// (out) the port number
670 * Gets the local address of this endpoint.
672 * @param aLocalHost On return, the address of the local host. Clients must pass
673 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
674 * buffer to hold the address, and passes ownership of the buffer to the client.
675 * @return KErrNone on successful completion, or one of the system error codes on failure.
677 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0; // /// (out) the address of the local host
679 protected: // methods
680 IMPORT_C CWapFullySpecCLPushService();
681 IMPORT_C void ConstructL();
684 // D'tor Key identification required for ECOM
688 /** Bound Connectionless WSP
689 * @released since v8.0
691 class CWapBoundCLWSPService : public CBase
693 public: // creation/deletion
694 IMPORT_C static CWapBoundCLWSPService* NewL();
695 IMPORT_C static CWapBoundCLWSPService* NewL(const TUid& aImplementation);
696 IMPORT_C virtual ~CWapBoundCLWSPService();
698 public: // API methods
701 * Connects to the WAP stack, opening an endpoint that can be used for S-Unit-MethodInvoke and
702 * S-Unit-MethodResult primitives.
704 * @param aBearer The bearer to listen on (use EAll for all bearers)
705 * @param aPort The port to listen on. If set to 0, a local port will be chosen for the
706 * client's first MethodInvoke()
707 * @return KErrNone on successful completion, or one of the system error codes on failure.
709 virtual TInt Connect(Wap::TBearer aBearer,Wap::TPort aPort, TBool aSecure)=0;
712 * Sends a request to a remote endpoint.
714 * @param aBearer The bearer to be used, if the bound connection was opened with EAll
715 * @param aRemoteHost The address of the remote host to which to send the request.
716 * The format of the address is bearer-specific.
717 * @param aRemotePort The port on the remote host to which the request will be sent
722 * @param aTransactionId
723 * @return KErrNone on successful completion, or one of the system error codes on failure.
725 virtual TInt MethodInvoke(Wap::TBearer aBearer, const TDesC8& aRemoteHost, Wap::TPort aRemotePort, TUint aMethod, const TDesC& aURI, const TDesC8& aReqHeaders, const TDesC8& aReqBody, const TUint8 aTransactionId)=0;
728 * Waits for a datagram to be received.
732 * @param aTransactionIdPckg
734 * @param aReqStatus Asynchonrous status word, used to signal when a data size is known
736 * @return KErrNone on successful completion, or one of the system error codes on failure.
738 virtual TInt MethodResult(TDes8& aReqHeaders, TDes8& aReqBody, TPckgBuf<TUint8>& aTransactionIdPckg, TWSPStatus& aWspStatus, TRequestStatus& aReqStatus, TUint32 aTimeout)=0;
741 * Cancels a previously requested asynchronous MethodResult() notification.
743 * If a datagram arrives at the local host, it will be discarded.
746 virtual void CancelReq()=0;
750 * Gets the local port of this endpoint.
752 * This is useful if the port was chosen automatically.
754 * @param aPort On return, the port number
755 * @return KErrNone on successful completion, or one of the system error codes on failure.
757 virtual TInt GetLocalPort(Wap::TPort& aPort)=0; // /// (out) the port number
760 * Gets the local address of this endpoint.
762 * @param aLocalHost On return, the address of the local host. Clients must pass
763 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
764 * buffer to hold the address, and passes ownership of the buffer to the client.
765 * @return KErrNone on successful completion, or one of the system error codes on failure.
767 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0; // /// (out) the address of the local host
770 * Gets the bearer on which a received datagram arrived.
772 * Useful when EAll was specified in Connect()
774 * @param aBearer On return, the bearer
775 * @return KErrNone on successful completion, or one of the system error codes on failure.
777 virtual TInt GetBearer(Wap::TBearer& /*aBearer*/)=0;
780 * Gets the remote server address.
782 * @param aServerAddress On return, the address of the remote server. Clients must pass
783 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
784 * buffer to hold the address, and passes ownership of the buffer to the client.
785 * @return KErrNone on successful completion, or one of the system error codes on failure.
787 virtual TInt GetServerAddress(HBufC8*& aServerAddress)=0; // /// (out) the address of the remote server
789 protected: // methods
790 IMPORT_C CWapBoundCLWSPService();
791 IMPORT_C void ConstructL();
794 // D'tor Key identification required for ECOM
799 * Fully-Specified Connectionless WSP
800 * @released since v8.0
802 class CWapFullySpecCLWSPService : public CBase
804 public: // creation/deletion
805 IMPORT_C static CWapFullySpecCLWSPService* NewL();
806 IMPORT_C static CWapFullySpecCLWSPService* NewL(const TUid& aImplementation);
807 IMPORT_C virtual ~CWapFullySpecCLWSPService();
809 public: // API methods
811 // Opens a socket which is to be used only with a single, named remote host.
813 * Connects to the WAP stack, opening an endpoint that can be used to listen for
814 * Push messages from a specified remote host.
816 * All CWapFullySpecCLWSPService implementations must automatically close this
817 * endpoint upon destruction.
819 * @param aRemoteHost The bearer-dependent address of the remote host with which
820 * the data will be exchanged
821 * @param aRemotePort The port on the remote host to which data will be sent
822 * @param aBearer The bearer to listen on. You cannot use EAll.
823 * @param aSecure Security flag to indicate whether WTLS should be used or not
824 * @return KErrNone on successful completion, or one of the system error codes on failure.
826 virtual TInt Connect(const TDesC8& aRemoteHost, Wap::TPort aRemotePort, Wap::TBearer aBearer, TBool aSecure)=0;
829 * Sends a request to a remote endpoint.
835 * @param aTransactionId
836 * @return KErrNone on successful completion, or one of the system error codes on failure.
838 virtual TInt MethodInvoke(TUint aMethod, const TDesC& aURI, const TDesC8& aReqHeaders, const TDesC8& aReqBody, TUint8 aTransactionId)=0;
841 * Waits for a datagram to be received
845 * @param aTransactionIdPckg
847 * @param aReqStatus Asynchonrous status word, used to signal when a data size is known
849 * @return KErrNone on successful completion, or one of the system error codes on failure.
851 virtual TInt MethodResult(TDes8& aReqHeaders, TDes8& aReqBody, TPckgBuf<TUint8>& aTransactionIdPckg, TWSPStatus& aWspStatus, TRequestStatus& aReqStatus, TUint32 aTimeout)=0;
855 * Cancels a previously-requested MethodResult() notification.
857 * If a message arrives the client will not be notified.
860 virtual void CancelReq()=0;
863 * Gets the local port of this endpoint.
865 * This is useful if the port was chosen automatically.
867 * @param aPort On return, the port number
868 * @return KErrNone on successful completion, or one of the system error codes on failure.
870 virtual TInt GetLocalPort(Wap::TPort& aPort)=0; // /// (out) the port number
873 * Gets the local address of this endpoint.
875 * @param aLocalHost On return, the address of the local host. Clients must pass
876 * in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8
877 * buffer to hold the address, and passes ownership of the buffer to the client.
878 * @return KErrNone on successful completion, or one of the system error codes on failure.
880 virtual TInt GetLocalAddress(HBufC8*& aLocalHost)=0; // /// (out) the address of the local host
882 protected: // methods
883 IMPORT_C CWapFullySpecCLWSPService();
884 IMPORT_C void ConstructL();
887 // D'tor Key identification required for ECOM
892 // Utility class for client/implementation use.
893 class CWapMessageUtils : public CBase
894 /** Utility functions for use with WAP Messaging. */
897 // /// Return a list of all the addresses that are available
898 IMPORT_C static TInt GetLocalAddressesL(RArray<Wap::TAddressInfo>& aAddressInfo);
902 #endif // __WAPMESSAGE_H__