(**************************************************************************)
(*                                                                        *)
(*  Transport Layer Security                                              *)
(*  Copyright (C) 2025   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 TLSAlerts;

        (********************************************************)
        (*                                                      *)
        (*                Transport Layer Security              *)
        (*                     Alert messages                   *)
        (*                                                      *)
        (*  Programmer:         P. Moylan                       *)
        (*  Started:            3  December 2024                *)
        (*  Last edited:        4 April 2025                    *)
        (*  Status:             OK                              *)
        (*                                                      *)
        (********************************************************)


FROM TransLog IMPORT TransactionLogID;
FROM TLSBase IMPORT TextType;


PROCEDURE LogAlert (ID: TransactionLogID;  VAR (*INOUT*) buffer: TextType;
                    VAR (*OUT*) done, ConnectionLost: BOOLEAN): BOOLEAN;

    (* Returns TRUE iff not a fatal alert. *)

PROCEDURE CreateAlert (alerttype: CARDINAL;  fatal: BOOLEAN;
                            VAR (*OUT*) buffer: TextType);

    (* Fills buffer with the details of an alert, ready to send to the peer. *)


END TLSAlerts.

