aboutsummaryrefslogtreecommitdiffstats
path: root/vmime
diff options
context:
space:
mode:
Diffstat (limited to 'vmime')
-rw-r--r--vmime/net/connectionInfos.hpp60
-rw-r--r--vmime/net/defaultConnectionInfos.hpp58
-rw-r--r--vmime/net/imap/IMAPConnection.hpp7
-rw-r--r--vmime/net/imap/IMAPStore.hpp5
-rw-r--r--vmime/net/maildir/maildirStore.hpp3
-rw-r--r--vmime/net/pop3/POP3Store.hpp6
-rw-r--r--vmime/net/securedConnectionInfos.hpp47
-rw-r--r--vmime/net/sendmail/sendmailTransport.hpp3
-rw-r--r--vmime/net/service.hpp13
-rw-r--r--vmime/net/smtp/SMTPTransport.hpp6
-rw-r--r--vmime/net/tls/TLSSecuredConnectionInfos.hpp76
11 files changed, 283 insertions, 1 deletions
diff --git a/vmime/net/connectionInfos.hpp b/vmime/net/connectionInfos.hpp
new file mode 100644
index 00000000..ee02eb16
--- /dev/null
+++ b/vmime/net/connectionInfos.hpp
@@ -0,0 +1,60 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
+//
+// 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 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, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Linking this library statically or dynamically with other modules is making
+// a combined work based on this library. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+//
+
+#ifndef VMIME_NET_CONNECTIONINFOS_HPP_INCLUDED
+#define VMIME_NET_CONNECTIONINFOS_HPP_INCLUDED
+
+
+#include "vmime/object.hpp"
+
+
+namespace vmime {
+namespace net {
+
+
+/** Information about the connection used by a service.
+ */
+class connectionInfos : public object
+{
+public:
+
+ /** Return the host to which the service is connected.
+ *
+ * @return server host name or address
+ */
+ virtual const string getHost() const = 0;
+
+ /** Return the port to which the service is connected.
+ *
+ * @return server port
+ */
+ virtual const port_t getPort() const = 0;
+};
+
+
+} // net
+} // vmime
+
+
+#endif // VMIME_NET_CONNECTIONINFOS_HPP_INCLUDED
+
diff --git a/vmime/net/defaultConnectionInfos.hpp b/vmime/net/defaultConnectionInfos.hpp
new file mode 100644
index 00000000..39530f18
--- /dev/null
+++ b/vmime/net/defaultConnectionInfos.hpp
@@ -0,0 +1,58 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
+//
+// 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 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, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Linking this library statically or dynamically with other modules is making
+// a combined work based on this library. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+//
+
+#ifndef VMIME_NET_DEFAULTCONNECTIONINFOS_HPP_INCLUDED
+#define VMIME_NET_DEFAULTCONNECTIONINFOS_HPP_INCLUDED
+
+
+#include "vmime/net/connectionInfos.hpp"
+
+
+namespace vmime {
+namespace net {
+
+
+/** Information about the connection used by a service.
+ */
+class defaultConnectionInfos : public connectionInfos
+{
+public:
+
+ defaultConnectionInfos(const string& host, const port_t port);
+
+ const string getHost() const;
+ const port_t getPort() const;
+
+private:
+
+ string m_host;
+ port_t m_port;
+};
+
+
+} // net
+} // vmime
+
+
+#endif // VMIME_NET_DEFAULTCONNECTIONINFOS_HPP_INCLUDED
+
diff --git a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
index f01236f2..3ca9b007 100644
--- a/vmime/net/imap/IMAPConnection.hpp
+++ b/vmime/net/imap/IMAPConnection.hpp
@@ -30,6 +30,7 @@
#include "vmime/net/socket.hpp"
#include "vmime/net/timeoutHandler.hpp"
#include "vmime/net/session.hpp"
+#include "vmime/net/connectionInfos.hpp"
#include "vmime/net/imap/IMAPParser.hpp"
@@ -92,6 +93,9 @@ public:
ref <security::authenticator> getAuthenticator();
+ const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
private:
void authenticate();
@@ -120,6 +124,9 @@ private:
ref <timeoutHandler> m_timeoutHandler;
+ bool m_secured;
+ ref <connectionInfos> m_cntInfos;
+
void internalDisconnect();
diff --git a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
index 26810b9d..ce38190b 100644
--- a/vmime/net/imap/IMAPStore.hpp
+++ b/vmime/net/imap/IMAPStore.hpp
@@ -78,7 +78,10 @@ public:
const int getCapabilities() const;
+ const bool isIMAPS() const;
+
const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
protected:
@@ -95,7 +98,7 @@ protected:
std::list <IMAPFolder*> m_folders;
- bool m_secured; // Use IMAPS
+ const bool m_isIMAPS; // Use IMAPS
static IMAPServiceInfos sm_infos;
diff --git a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.hpp
index f2792403..a229ae8c 100644
--- a/vmime/net/maildir/maildirStore.hpp
+++ b/vmime/net/maildir/maildirStore.hpp
@@ -79,6 +79,9 @@ public:
const int getCapabilities() const;
+ const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
private:
void registerFolder(maildirFolder* folder);
diff --git a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
index 2839d198..98d2e380 100644
--- a/vmime/net/pop3/POP3Store.hpp
+++ b/vmime/net/pop3/POP3Store.hpp
@@ -77,6 +77,9 @@ public:
const int getCapabilities() const;
+ const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
private:
enum ResponseCode
@@ -123,7 +126,10 @@ private:
ref <timeoutHandler> m_timeoutHandler;
+ const bool m_isPOP3S;
+
bool m_secured;
+ ref <connectionInfos> m_cntInfos;
// Service infos
diff --git a/vmime/net/securedConnectionInfos.hpp b/vmime/net/securedConnectionInfos.hpp
new file mode 100644
index 00000000..2af7b970
--- /dev/null
+++ b/vmime/net/securedConnectionInfos.hpp
@@ -0,0 +1,47 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
+//
+// 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 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, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Linking this library statically or dynamically with other modules is making
+// a combined work based on this library. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+//
+
+#ifndef VMIME_NET_SECUREDCONNECTIONINFOS_HPP_INCLUDED
+#define VMIME_NET_SECUREDCONNECTIONINFOS_HPP_INCLUDED
+
+
+#include "vmime/net/connectionInfos.hpp"
+
+
+namespace vmime {
+namespace net {
+
+
+/** Information about the secured connection used by a service.
+ */
+class securedConnectionInfos : public connectionInfos
+{
+};
+
+
+} // net
+} // vmime
+
+
+#endif // VMIME_NET_SECUREDCONNECTIONINFOS_HPP_INCLUDED
+
diff --git a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendmailTransport.hpp
index 75a7c704..9a362179 100644
--- a/vmime/net/sendmail/sendmailTransport.hpp
+++ b/vmime/net/sendmail/sendmailTransport.hpp
@@ -65,6 +65,9 @@ public:
void send(const mailbox& expeditor, const mailboxList& recipients, utility::inputStream& is, const utility::stream::size_type size, utility::progressListener* progress = NULL);
+ const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
private:
void internalDisconnect();
diff --git a/vmime/net/service.hpp b/vmime/net/service.hpp
index ec165462..8104cd50 100644
--- a/vmime/net/service.hpp
+++ b/vmime/net/service.hpp
@@ -31,6 +31,7 @@
#include "vmime/net/session.hpp"
#include "vmime/net/serviceInfos.hpp"
+#include "vmime/net/connectionInfos.hpp"
#include "vmime/net/socket.hpp"
#include "vmime/net/timeoutHandler.hpp"
@@ -191,6 +192,18 @@ public:
m_session->getProperties()[getInfos().getPropertyPrefix() + name] = value;
}
+ /** Check whether the connection is secured.
+ *
+ * @return true if the connection is secured, false otherwise
+ */
+ virtual const bool isSecuredConnection() const = 0;
+
+ /** Get information about the connection.
+ *
+ * @return information about the connection
+ */
+ virtual ref <connectionInfos> getConnectionInfos() const = 0;
+
private:
ref <session> m_session;
diff --git a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
index d42288b7..8269fe3f 100644
--- a/vmime/net/smtp/SMTPTransport.hpp
+++ b/vmime/net/smtp/SMTPTransport.hpp
@@ -65,6 +65,9 @@ public:
void send(const mailbox& expeditor, const mailboxList& recipients, utility::inputStream& is, const utility::stream::size_type size, utility::progressListener* progress = NULL);
+ const bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
private:
void sendRequest(const string& buffer, const bool end = true);
@@ -89,7 +92,10 @@ private:
ref <timeoutHandler> m_timeoutHandler;
+ const bool m_isSMTPS;
+
bool m_secured;
+ ref <connectionInfos> m_cntInfos;
// Service infos
diff --git a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
new file mode 100644
index 00000000..77fc5ddb
--- /dev/null
+++ b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
@@ -0,0 +1,76 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
+//
+// 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 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, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Linking this library statically or dynamically with other modules is making
+// a combined work based on this library. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+//
+
+#ifndef VMIME_NET_TLSSECUREDCONNECTIONINFOS_HPP_INCLUDED
+#define VMIME_NET_TLSSECUREDCONNECTIONINFOS_HPP_INCLUDED
+
+
+#include "vmime/net/securedConnectionInfos.hpp"
+
+#include "vmime/security/cert/certificateChain.hpp"
+
+
+namespace vmime {
+namespace net {
+namespace tls {
+
+
+class TLSSession;
+class TLSSocket;
+
+
+/** Information about a TLS-secured connection used by a service.
+ */
+class TLSSecuredConnectionInfos : public securedConnectionInfos
+{
+public:
+
+ TLSSecuredConnectionInfos(const string& host, const port_t port,
+ ref <TLSSession> tlsSession, ref <TLSSocket> tlsSocket);
+
+ const string getHost() const;
+ const port_t getPort() const;
+
+ /** Return the peer's certificate (chain) as sent by the peer.
+ *
+ * @return server certificate chain
+ */
+ ref <const security::cert::certificateChain> getPeerCertificates() const;
+
+private:
+
+ string m_host;
+ port_t m_port;
+
+ ref <TLSSession> m_tlsSession;
+ ref <TLSSocket> m_tlsSocket;
+};
+
+
+} // tls
+} // net
+} // vmime
+
+
+#endif // VMIME_NET_TLSSECUREDCONNECTIONINFOS_HPP_INCLUDED
+