Source

h323ac / nullchan.cxx

/***************************************************************************
    nullchan.cxx

    Copyright (c) 2002-2003  Vladimir Toncar

    The contents of this file are subject to the Mozilla Public License
    Version 1.1 (the "License"); you may not use this file except in
    compliance with the License. You may obtain a copy of the License at
    http://www.mozilla.org/MPL/

    Software distributed under the License is distributed on an "AS IS"
    basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
    See the License for the specific language governing rights and
    limitations under the License.

    The Original Code is oh323tut.

    The Initial Developer of the Original Code is Vladimir Toncar.
    All Rights Reserved.

    Contributor(s): ______________________________________.

 ***************************************************************************/

#include "nullchan.h"


// ***********************************************************************

NullChannel::NullChannel(): isOpen(true)
{
	PTRACE(1, "Creating NULL channel");
}


// ***********************************************************************

NullChannel::~NullChannel()
{
	PTRACE(1, "Deleting NULL channel");
}


// ***********************************************************************

BOOL NullChannel::Close()
{
	isOpen = false;
	return true;
}


// ***********************************************************************

BOOL NullChannel::Write(const void * /*buf*/, PINDEX len)
{
	lastWriteCount = len;
	writeDelay.Delay(len/2/8);
	return true;
}


// ***********************************************************************

BOOL NullChannel::Read(void *buf, PINDEX len)
{
	memset(buf, 0, len);
	lastReadCount = len;
	readDelay.Delay(len/2/8);
	return true;	
}


// ***********************************************************************