############################################################################
##
## Copyright (c) 2000-2001 BalaBit IT Ltd, Budapest, Hungary
## All rights reserved.
##
## $Id: Stream.py,v 1.9.2.2.2.1 2001/05/11 14:19:10 bazsi Exp $
##
## Author  : Bazsi
## Auditor : kisza
## Last version: 1.4
## Notes:
##
############################################################################

"""Module exporting an interface to the Zorp.Stream component.

This module defines the Stream class, encapsulating a file descriptor and
related functions. 
"""

class Stream:
	"""Class encapsulating a file descriptor and related functions.
	
	This class encapsulates a data tunnel, represented by a UNIX 
	file descriptor. It's implemented and exported by the Zorp core.
	
	Attributes
	
	  none
	"""
	
	def __init__(self, fd, name):
		"""Constructor to initialize a stream.
		
		This constructor initializes a Stream instance setting its
		attributes according to arguments.
		
		Arguments
		
		  self -- this instance
		  
		  fd -- the fd to encapsulate
		  
		  name -- name to use in logs
		"""
		pass

	def read(self, count):
		"""Method reading up to count bytes from the stream.
		
		This method reads up to count bytes from the stream
		and returns it as a string.
		
		Arguments
		
		  self -- this instance
		  
		  count -- maximum number of bytes to read
		"""
		pass
		
	def write(self, buf):
		"""Method writing a buffer to the stream.
		
		This method writes the contents of the given buffer to
		the stream.
		
		Arguments
		
		  self -- this instance
		  
		  buf -- buffer to write
		"""
