Files
harbour-core/harbour/include/hbzlib.ch
Przemyslaw Czerpak 86c9511f2f 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.
2010-01-06 06:27:38 +00:00

72 lines
2.8 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* ZIP header file
*
* Copyright 2008 Mindaugas Kavaliauskas <dbtopas.at.dbtopas.lt>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef HB_ZLIB_CH_
#define HB_ZLIB_CH_
#define HB_ZLIB_METHOD_STORE 0
#define HB_ZLIB_METHOD_DEFLATED 8
#define HB_ZLIB_COMPRESSION_NONE 0
#define HB_ZLIB_COMPRESSION_SPEED 1
#define HB_ZLIB_COMPRESSION_SIZE 9
#define HB_ZLIB_COMPRESSION_DEFAULT (-1)
#define HB_ZLIB_COMPRESSION_DISABLE (-2)
#define HB_ZLIB_STRATEGY_DEFAULT 0
#define HB_ZLIB_STRATEGY_FILTERED 1
#define HB_ZLIB_STRATEGY_HUFFMAN_ONLY 2
#define HB_ZLIB_STRATEGY_RLE 3
#define HB_ZLIB_STRATEGY_FIXED 4
#endif /* HB_ZLIB_CH_ */