E-MailRelay

genvelope.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file genvelope.h
19///
20
21#ifndef G_SMTP_ENVELOPE_H
22#define G_SMTP_ENVELOPE_H
23
24#include "gdef.h"
25#include "gstrings.h"
26#include "gexception.h"
27#include <iostream>
28
29 namespace GSmtp
30{
31 class Envelope ;
32}
33
34//| \class GSmtp::Envelope
35/// A structure containing the contents of an envelope file, with
36/// support for file reading, writing and copying.
37///
38 class GSmtp::Envelope
39{
40 public:
41 G_EXCEPTION( ReadError , "cannot read envelope file" ) ;
42
43 public:
44 static void read( std::istream & , Envelope & ) ;
45 ///< Reads an envelope from a stream. Throws on error.
46 ///< Input lines can be newline delimited, in which case
47 ///< 'm_crlf' is set false.
48
49 static std::size_t write( std::ostream & , const Envelope & ) ;
50 ///< Writes an envelope to a stream. Returns the new endpos
51 ///< value. Returns zero on error. Output lines are CR-LF
52 ///< delimited. The structure 'm_crlf' and 'm_endpos' fields
53 ///< should normally be updated after using write().
54
55 static void copy( std::istream & , std::ostream & ) ;
56 ///< A convenience function to copy lines from an input
57 ///< stream to an output stream. Input lines can be newline
58 ///< delimited, but output is always CR-LF. Throws on input
59 ///< error; output errors are not checked.
60
61 public:
62 bool m_crlf{true} ;
63 int m_eight_bit{-1} ;
64 std::string m_from ;
65 G::StringArray m_to_local ;
66 G::StringArray m_to_remote ;
67 std::string m_authentication ;
68 std::string m_client_socket_address ;
69 std::string m_client_certificate ;
70 std::string m_from_auth_in ;
71 std::string m_from_auth_out ;
72 std::size_t m_endpos{0U} ;
73} ;
74
75#endif
GSmtp::Envelope
A structure containing the contents of an envelope file, with support for file reading,...
Definition: genvelope.h:39
GSmtp::Envelope::read
static void read(std::istream &, Envelope &)
Reads an envelope from a stream.
Definition: genvelope.cpp:102
GSmtp::Envelope::write
static std::size_t write(std::ostream &, const Envelope &)
Writes an envelope to a stream.
Definition: genvelope.cpp:50
GSmtp::Envelope::copy
static void copy(std::istream &, std::ostream &)
A convenience function to copy lines from an input stream to an output stream.
Definition: genvelope.cpp:84
gexception.h
gstrings.h
GSmtp
SMTP and message-store classes.
Definition: gadminserver.h:39
G::StringArray
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstrings.h:31