smsprotocols/smsstack/smsu/src/smsustrm.cpp
branchopencode
changeset 24 6638e7f4bd8f
parent 20 244d7c5f118e
--- a/smsprotocols/smsstack/smsu/src/smsustrm.cpp	Mon May 03 13:37:20 2010 +0300
+++ b/smsprotocols/smsstack/smsu/src/smsustrm.cpp	Thu May 06 15:10:38 2010 +0100
@@ -1,146 +1,146 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// This file contains the implementation of the RSmsSocket class
-// 
-//
-
-/**
- @file
-*/
-
-#include "smsustrm.h"
-#include "smsumain.h"
-#include <es_sock.h>
-#include "smsstacklog.h"
-
-
-/**
- *  Constructor
- *  @param aSocket representing the socket the buffer reads and writes to.
- */
-RSmsSocketBuf::RSmsSocketBuf(RSocket& aSocket)
-	:iSocket(aSocket)
-	{
-	SetBuf(ERead|EWrite,iBuffer,iBuffer);
-	} // RSmsSocketBuf::RSmsSocketBuf
-
-
-/**
- *  Fills the buffer's read area from the socket.
- *  
- *  @leave The function panics if the socket is not readable.
- *  @param aMaxLength Unused
- *  @return The length of the buffer
- */
-TInt RSmsSocketBuf::UnderflowL(TInt)
-//Leaves if the Request Status (s) is in error
-//Panics if ERead==0
-//
-	{
-	LOGSMSU1("RSmsSocketBuf::UnderflowL()");
-
-	__ASSERT_ALWAYS(Avail(ERead)==0,SmsuPanic(KSsmuPanicStreamReadUnavailable));
-	SocketWriteL();
-	SetBuf(EWrite,iBuffer,iBuffer);
-//
-	TRequestStatus s;
-	TSockXfrLength l;
-	TPtr8 ptr(iBuffer,sizeof(iBuffer));
-//	iSocket.RecvOneOrMore(ptr,0,s,l);
-	iSocket.Recv(ptr,0,s,l);
-	User::WaitForRequest(s); 
-	User::LeaveIfError(s.Int());
-	TInt len=ptr.Length();
-	SetBuf(ERead,iBuffer,iBuffer+len);
-	return len;
-	} // RSmsSocketBuf::UnderflowL
-
-
-/**
- *  Empties the buffer and sets up the buffer's write area.
- *  
- *  The function panics if the socket is not writable. 
- */
-void RSmsSocketBuf::OverflowL()
-//Panics if EWrite == 0
-	{
-	LOGSMSU1("RSmsSocketBuf::OverflowL()");
-
-	__ASSERT_ALWAYS(Avail(EWrite)==0,SmsuPanic(KSsmuPanicStreamWriteUnavailable));
-	SetBuf(ERead,iBuffer,iBuffer);
-//
-	SocketWriteL();
-	SetBuf(EWrite,iBuffer,iBuffer+sizeof(iBuffer));
-	} // RSmsSocketBuf::OverflowL
-
-
-/**
- *  Synchronises the stream buffer with the stream, leaving if any error occurs.
- */
-void RSmsSocketBuf::DoSynchL()
-	{
-	LOGSMSU1("RSmsSocketBuf::DoSynchL()");
-
-	SocketWriteL();
-	SetBuf(ERead|EWrite,iBuffer,iBuffer);
-	} // RSmsSocketBuf::DoSynchL
-
-
-/**
- *  Writes the buffered data to the socket.
- */
-void RSmsSocketBuf::SocketWriteL()
-	{
-	LOGSMSU1("RSmsSocketBuf::SocketWriteL()");
-
-	TInt length=Lag(EWrite);
-	if (length==0)
-		return;
-//
-	TRequestStatus s;
-	iSocket.Write(TPtrC8(iBuffer,length),s);
-	User::WaitForRequest(s);  
-	User::LeaveIfError(s.Int());
-	} // RSmsSocketBuf::SocketWriteL
-
-
-/**
- *  Constructor.
- *  
- *  @param aSocket RSmsSocketBuf through which to read data
- *  @capability None
- */
-EXPORT_C RSmsSocketReadStream::RSmsSocketReadStream(RSocket& aSocket)
-	:RReadStream(&iBuf),
-	iBuf(aSocket)
-	{
-	LOGSMSU1("RSmsSocketReadStream::RSmsSocketReadStream()");
-
-	} // RSmsSocketReadStream::RSmsSocketReadStream
-
-
-/**
- *  Constructor.
- *  
- *  @param aSocket RSmsSocketBuf through which to write data
- *  @capability None
- */
-EXPORT_C RSmsSocketWriteStream::RSmsSocketWriteStream(RSocket& aSocket)
-	:RWriteStream(&iBuf),
-	iBuf(aSocket)
-	{
-	LOGSMSU1("RSmsSocketWriteStream::RSmsSocketWriteStream()");
-
-	} // RSmsSocketWriteStream::RSmsSocketWriteStream
-
+// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the implementation of the RSmsSocket class
+// 
+//
+
+/**
+ @file
+*/
+
+#include "smsustrm.h"
+#include "smsumain.h"
+#include <es_sock.h>
+#include "smsstacklog.h"
+
+
+/**
+ *  Constructor
+ *  @param aSocket representing the socket the buffer reads and writes to.
+ */
+RSmsSocketBuf::RSmsSocketBuf(RSocket& aSocket)
+	:iSocket(aSocket)
+	{
+	SetBuf(ERead|EWrite,iBuffer,iBuffer);
+	} // RSmsSocketBuf::RSmsSocketBuf
+
+
+/**
+ *  Fills the buffer's read area from the socket.
+ *  
+ *  @leave The function panics if the socket is not readable.
+ *  @param aMaxLength Unused
+ *  @return The length of the buffer
+ */
+TInt RSmsSocketBuf::UnderflowL(TInt)
+//Leaves if the Request Status (s) is in error
+//Panics if ERead==0
+//
+	{
+	LOGSMSU1("RSmsSocketBuf::UnderflowL()");
+
+	__ASSERT_ALWAYS(Avail(ERead)==0,SmsuPanic(KSsmuPanicStreamReadUnavailable));
+	SocketWriteL();
+	SetBuf(EWrite,iBuffer,iBuffer);
+//
+	TRequestStatus s;
+	TSockXfrLength l;
+	TPtr8 ptr(iBuffer,sizeof(iBuffer));
+//	iSocket.RecvOneOrMore(ptr,0,s,l);
+	iSocket.Recv(ptr,0,s,l);
+	User::WaitForRequest(s); 
+	User::LeaveIfError(s.Int());
+	TInt len=ptr.Length();
+	SetBuf(ERead,iBuffer,iBuffer+len);
+	return len;
+	} // RSmsSocketBuf::UnderflowL
+
+
+/**
+ *  Empties the buffer and sets up the buffer's write area.
+ *  
+ *  The function panics if the socket is not writable. 
+ */
+void RSmsSocketBuf::OverflowL()
+//Panics if EWrite == 0
+	{
+	LOGSMSU1("RSmsSocketBuf::OverflowL()");
+
+	__ASSERT_ALWAYS(Avail(EWrite)==0,SmsuPanic(KSsmuPanicStreamWriteUnavailable));
+	SetBuf(ERead,iBuffer,iBuffer);
+//
+	SocketWriteL();
+	SetBuf(EWrite,iBuffer,iBuffer+sizeof(iBuffer));
+	} // RSmsSocketBuf::OverflowL
+
+
+/**
+ *  Synchronises the stream buffer with the stream, leaving if any error occurs.
+ */
+void RSmsSocketBuf::DoSynchL()
+	{
+	LOGSMSU1("RSmsSocketBuf::DoSynchL()");
+
+	SocketWriteL();
+	SetBuf(ERead|EWrite,iBuffer,iBuffer);
+	} // RSmsSocketBuf::DoSynchL
+
+
+/**
+ *  Writes the buffered data to the socket.
+ */
+void RSmsSocketBuf::SocketWriteL()
+	{
+	LOGSMSU1("RSmsSocketBuf::SocketWriteL()");
+
+	TInt length=Lag(EWrite);
+	if (length==0)
+		return;
+//
+	TRequestStatus s;
+	iSocket.Write(TPtrC8(iBuffer,length),s);
+	User::WaitForRequest(s);  
+	User::LeaveIfError(s.Int());
+	} // RSmsSocketBuf::SocketWriteL
+
+
+/**
+ *  Constructor.
+ *  
+ *  @param aSocket RSmsSocketBuf through which to read data
+ *  @capability None
+ */
+EXPORT_C RSmsSocketReadStream::RSmsSocketReadStream(RSocket& aSocket)
+	:RReadStream(&iBuf),
+	iBuf(aSocket)
+	{
+	LOGSMSU1("RSmsSocketReadStream::RSmsSocketReadStream()");
+
+	} // RSmsSocketReadStream::RSmsSocketReadStream
+
+
+/**
+ *  Constructor.
+ *  
+ *  @param aSocket RSmsSocketBuf through which to write data
+ *  @capability None
+ */
+EXPORT_C RSmsSocketWriteStream::RSmsSocketWriteStream(RSocket& aSocket)
+	:RWriteStream(&iBuf),
+	iBuf(aSocket)
+	{
+	LOGSMSU1("RSmsSocketWriteStream::RSmsSocketWriteStream()");
+
+	} // RSmsSocketWriteStream::RSmsSocketWriteStream
+