Revision: 13486
http://harbour-project.svn.sourceforge.net/harbour-project/?rev=13486&view=rev
Author: druzus
Date: 2010-01-06 06:27:38 +0000 (Wed, 06 Jan 2010)
Log Message:
-----------
2010-01-06 07:27 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtwin/gtwin.c
+ added support for HB_GTI_ISUNICODE
* harbour/include/hbapifs.h
* added missing 'extern' in some declarations
* harbour/include/hbzlib.ch
+ added HB_ZLIB_STRATEGY_* constants
+ added HB_ZLIB_COMPRESSION_DISABLE
* harbour/include/Makefile
+ harbour/include/hbznet.h
* harbour/include/hbextern.ch
* harbour/src/rtl/Makefile
* harbour/src/rtl/hbinet.c
+ harbour/src/rtl/hbznet.c
+ added support for ZLIB compression in stream sockets.
+ added .prg function:
HB_INETCOMPRESS( <pSocket>, [<nCompressionLevel>], [<nStrategy>] )
which enables ZLIB compression for given HB_INET*() socket.
<pSocket> is a socket created by one of HB_INET*() functions
<nCompressionLevel> is compression factor between 1 (fastest) and
9 (best) (see HB_ZLIB_COMPRESSION_*)
0 (none) disable compression on output data
but decompression is still working.
<nStrategy> is used to tune compression algorithm,
see HB_ZLIB_STRATEGY_*
The compression must be enabled on both connection sides, i.e.
on the server side:
conn := hb_inetAccept( sock )
hb_inetCompress( conn )
and on the client side:
sock := hb_inetConnect( cServer, nPort )
hb_inetCompress( sock )
in the same moment but it's not necessary to enable it at the
beginning of connection. It can be done later, i.e. when both
sides agree to enable connection using some custom protocol.
The compression has effect only on stream connections, i.e.
TCP and it's ignored in datagram connections like UDP.
This function can be executed more then once changing the compression
parameters but it causes that all data in readahead decompression
buffer is discarded. When called with HB_ZLIB_COMPRESSION_DISABLE
as <nCompressionLevel> then support for stream compression is removed
and sockets works again in raw mode.
The compression level and strategy do not have to be the same on both
connection sides. Each side can chose the best settings for data it's
going to send.
This code was written in a way which allows to easy implement
alternative compression methods or other extensions like encryption
in existing HB_INET*() sockets also by non core code. The public C
functions declared in hbznet.h allows to use this extension with raw
harbour sockets two.
Modified Paths:
--------------
trunk/harbour/ChangeLog
trunk/harbour/include/Makefile
trunk/harbour/include/hbapifs.h
trunk/harbour/include/hbextern.ch
trunk/harbour/include/hbzlib.ch
trunk/harbour/src/rtl/Makefile
trunk/harbour/src/rtl/gtwin/gtwin.c
trunk/harbour/src/rtl/hbinet.c
Added Paths:
-----------
trunk/harbour/include/hbznet.h
trunk/harbour/src/rtl/hbznet.c
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour