(**************************************************************************)
(*                                                                        *)
(*  Web server input stream handler                                       *)
(*  Copyright (C) 2024   Peter Moylan                                     *)
(*                                                                        *)
(*  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 3 of the License, 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 program.  If not, see <http://www.gnu.org/licenses/>. *)
(*                                                                        *)
(*  To contact author:   http://www.pmoylan.org   peter@pmoylan.org       *)
(*                                                                        *)
(**************************************************************************)

DEFINITION MODULE TLSCompression;

        (********************************************************)
        (*                                                      *)
        (* Interface between TLS and the compression algorithms *)
        (*                                                      *)
        (*  Programmer:         P. Moylan                       *)
        (*  Started:            5 April 2018                    *)
        (*  Last edited:        18 August 2024                  *)
        (*  Status:             OK                              *)
        (*                                                      *)
        (********************************************************)


FROM TLSBase IMPORT TextType;


TYPE CompressionMethod = (nocompression, other);


PROCEDURE CompressionSupported (N: CARDINAL): CompressionMethod;

    (* Returns the compression method if method N supported,    *)
    (* otherwise returns nocompression.                         *)

PROCEDURE Compress (method: CompressionMethod;
                        VAR (*INOUT*) buffer: TextType);

    (* Replaces buffer with a compressed version. *)

PROCEDURE Decompress (method: CompressionMethod;
                        VAR (*INOUT*) buffer: TextType);

    (* Reverses the compression. *)

END TLSCompression.

