|
1 // Copyright (c) 1997-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 // This file contains the header file of the Sms socket Buffers. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 |
|
23 #if !defined (__SMSUSTRM_H__) |
|
24 #define __SMSUSTRM_H__ |
|
25 |
|
26 #if !defined(__E32STD_H__) |
|
27 #include <e32std.h> |
|
28 #endif |
|
29 |
|
30 #if !defined(__S32BUF_H__) |
|
31 #include <s32buf.h> |
|
32 #endif |
|
33 |
|
34 #if !defined(__S32STRM_H__) |
|
35 #include <s32strm.h> |
|
36 #endif |
|
37 |
|
38 |
|
39 class RSocket; |
|
40 |
|
41 /** |
|
42 * @publishedAll |
|
43 * @released |
|
44 */ |
|
45 const TInt KSmsMaxSegmentLength=0x100; |
|
46 |
|
47 |
|
48 /** |
|
49 * An SMS stream buffer to read and write over a socket. |
|
50 * @publishedAll |
|
51 * @released |
|
52 */ |
|
53 class RSmsSocketBuf : public TStreamBuf |
|
54 { |
|
55 public: |
|
56 RSmsSocketBuf(RSocket& aSocket); |
|
57 private: |
|
58 // from TStreamBuf |
|
59 TInt UnderflowL(TInt aMaxLength); |
|
60 void OverflowL(); |
|
61 void DoSynchL(); |
|
62 private: |
|
63 void SocketWriteL(); |
|
64 // |
|
65 inline TInt Lag(TRead) const; |
|
66 inline TInt Lag(TWrite) const; |
|
67 private: |
|
68 RSocket& iSocket; |
|
69 TUint8 iBuffer[KSmsMaxSegmentLength]; |
|
70 }; |
|
71 |
|
72 |
|
73 /** |
|
74 * Stream that reads a CSmsMessage object across a socket. |
|
75 * @publishedAll |
|
76 * @released |
|
77 */ |
|
78 class RSmsSocketReadStream : public RReadStream |
|
79 { |
|
80 public: |
|
81 IMPORT_C RSmsSocketReadStream(RSocket& aSocket); |
|
82 private: |
|
83 RSmsSocketBuf iBuf; |
|
84 }; |
|
85 |
|
86 /** |
|
87 * Stream that writes a CSmsMessage object across a socket. |
|
88 * @publishedAll |
|
89 * @released |
|
90 */ |
|
91 class RSmsSocketWriteStream : public RWriteStream |
|
92 { |
|
93 public: |
|
94 IMPORT_C RSmsSocketWriteStream(RSocket& aSocket); |
|
95 private: |
|
96 RSmsSocketBuf iBuf; |
|
97 }; |
|
98 |
|
99 #include "smsustrm.inl" |
|
100 |
|
101 #endif // !defined __SMSUSTRM_H__ |