From 287f6cfaeb9efcdf60a275ebb7158cfb9ea6d573 Mon Sep 17 00:00:00 2001 From: Reinhard Pfau Date: Mon, 25 Aug 2008 13:30:23 +0000 Subject: [PATCH] libsimpleio: (reinhard) renamed glue_t2n to simpleio_tn; added license file. --- LICENSE | 324 ++++++++++++++++ glue_t2n/Makefile.am | 4 +- glue_t2n/glue_t2n.cpp | 909 --------------------------------------------- glue_t2n/glue_t2n.hpp | 200 ---------- glue_t2n/simpleio_t2n.cpp | 909 +++++++++++++++++++++++++++++++++++++++++++++ glue_t2n/simpleio_t2n.hpp | 200 ++++++++++ libsimpleio.spec | 2 +- 7 files changed, 1436 insertions(+), 1112 deletions(-) create mode 100644 LICENSE delete mode 100644 glue_t2n/glue_t2n.cpp delete mode 100644 glue_t2n/glue_t2n.hpp create mode 100644 glue_t2n/simpleio_t2n.cpp create mode 100644 glue_t2n/simpleio_t2n.hpp diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..354dc3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,324 @@ +WICHTIG - BITTE SORGFÄLTIG LESEN BEVOR SIE DIE SOFTWARE INSTALLIEREN + +Intranator Software Lizenzvertrag + +Version 1.2 vom 17.07.2007 + +Dieser Lizenzvertrag räumt ein nicht ausschließliches Nutzungsrecht an dem von +der Intra2net AG entwickelten "Intranator System Manager" unter den +nachfolgenden Lizenzbedingungen ein. Mit der Installation der Software erklären +Sie sich mit folgenden Lizenzbedingungen einverstanden. + +§ 1 Vertragsgegenstand + +1) Die "Intranator Software" besteht aus dem "Intranator System Manager", der +"Linux Open-Source Distribution" sowie dem Virenscanner. Gegenstand dieses +Lizenzvertrages ist - vorbehaltlich der Regelung in § 2 dieses Vertrags - nur +der "Intranator System Manager". Die "Linux Open-Source Distribution" und der +Virenscanner unterliegen eigenen Lizenzbedingungen, die den entsprechenden +RPM-Paketen beigefügt sind. + +2) Der "Intranator System Manager" besteht aus komprimierten Dateien zzgl. +Installationsprogramm (RPM-Paket), die den lauffähigen Code der von der +Intra2net AG programmierten Software enthalten. Der "Intranator System Manager" +wird nicht als Open-Source Software vertrieben. Das Copyright und alle Rechte +verbleiben bei der Intra2net AG. Die Bestandteile des "Intranator System +Manager" sind in den RPM Paketen entsprechend gekennzeichnet. + +§ 2 andere Lizenzen + +1) Zusammen mit dem "Intranator System Manager" erhalten Sie sowohl einen +Virenscanner, als auch eine Programmkopie einer "Linux Open-Source +Distribution". Die Intra2net AG überlässt Ihnen die Programmkopie der "Linux +Open-Source Distribution" unentgeltlich, weshalb sich eine Haftung der Intra2net +AG nach §§ 521 ff. BGB richtet und folglich auf Vorsatz oder grobe +Fahrlässigkeit beschränkt ist. + +2) Die für eine Benutzung der "Linux Open-Source Distribution" zwingend +erforderlichen urheberrechtlichen Nutzungsrechte an der Distribution, bekommen +Sie nicht von der Intra2net AG eingeräumt, sondern direkt von den jeweiligen +Autoren der entsprechenden Programmteile. Der Umfang Ihrer Nutzungsrechte +bestimmt sich folglich ausschließlich nach den der "Linux Open-Source +Distribution" beigefügten Lizenzbedingungen und nicht nach diesem Vertrag. + +3) Die Lizenzbedingungen, die den Open-Source Programmpaketen von den jeweiligen +Autoren zugeordneten wurden, sind vom Nutzer bei der Nutzung der gesamten +"Intranator Software", neben den Vorschriften dieses Lizenzvertrages, im Rahmen +eines direkten Nutzungsvertrages mit den jeweiligen Softwareherstellers ohne +Zwischenschaltung der Intra2net AG zu beachten. Die entsprechenden +Lizenzbedingungen sind in elektronischer Form der zugehörigen Software +beigefügt. + +4) Soweit Quelltexte der unentgeltlich überlassenen "Linux Open-Source +Distribution" der GNU General Public License (GPL) oder der GNU Lesser General +Public License (LGPL) unterliegen, bietet Ihnen die Intra2net AG (Intra2net AG, +Mömpelgarder Weg 8, 72072 Tübingen, Deutschland) hiermit an, diese Quelltexte +gegen einen Selbstkostenersatz von 10,- EUR zzgl. MwSt. und Porto auf CD an Sie +zu liefern. Dieses Angebot gilt für 3 Jahre ab Auslieferung der Software durch +Intra2net. + +5) Soweit innerhalb der überlassenen Programme Libraries genutzt werden, die +unter der LGPL lizenziert sind, werden diese entweder als shared libraries +verwendet, oder Sie können - entsprechend der hierfür vorgesehenen Regelungen in +der LGPL - die jeweiligen Quellen zu den in 4) genannten Konditionen anfordern. + +§ 3 Installation + +1) Die "Intranator Software" läuft nicht parallel mit anderen Betriebssystemen +auf einem System. Insbesondere formatiert die "Intranator Software" bei +Installation die gesamte Festplatte und löscht alle bestehenden Daten. + +2) Die "Intranator Software" arbeitet nur mit dafür vom Lizenzgeber +freigegebenen Hardwarekomponenten zusammen. Diese sind in der Dokumentation +sowie auf der Webseite www.intranator.com aufgeführt und werden regelmäßig +aktualisiert. Der Lizenzgeber hat das Recht, die Freigabe für +Hardwarekomponenten für zukünftige Versionen zurückzuziehen, z.B. wenn diese von +zukünftigen Basissystemen nicht mehr mit Gerätetreibern unterstützt werden . +Alle beim Lizenzgeber registrierten Kunden werden per Email mindestens 3 Monate +vorher darüber in Kenntnis gesetzt (Abkündigung). + +§ 4 Vervielfältigungsrechte und Zugriffsschutz + +1) Der Lizenznehmer darf einen nicht modifizierten Originaldatenträger beliebig +vervielfältigen. Lizenzcodes und Lizenzdateien dürfen nicht vervielfältigt +werden. + +2) Eine Vervielfältigung der installierten Programme und Daten ist nur +gestattet, soweit die jeweilige Vervielfältigung für die Benutzung des Programms +notwendig ist. Zu den notwendigen Vervielfältigungen zählen die Installation des +Programms vom Originaldatenträger auf den Massenspeicher der eingesetzten +Hardware sowie das Laden des Programms in den Arbeitsspeicher. + +3) Ist aus Gründen der Datensicherheit oder der Sicherstellung einer schnellen +Reaktivierung des Computersystems nach einem Totalausfall die turnusmäßige +Sicherung des gesamten Datenbestands einschließlich der eingesetzten +Computerprogramme unerlässlich, darf der Lizenznehmer Sicherungskopien in der +zwingend erforderlichen Anzahl herstellen. Die betreffenden Datenträger sind +entsprechend zu kennzeichnen. Die Sicherungskopien dürfen nur zu rein +archivarischen Zwecken verwendet werden. + +4) Der Lizenznehmer ist verpflichtet, den unbefugten Zugriff Dritter auf die +installierten Programme und Daten durch geeignete Vorkehrungen zu verhindern. +Die gelieferten Lizenzcodes sind an einem gegen den unberechtigten Zugriff +Dritter gesicherten Ort aufzubewahren. + +5) Die Mitarbeiter des Lizenznehmers sind nachdrücklich auf die Einhaltung der +vorliegenden Vertragsbedingungen sowie der Bestimmungen des Urheberrechts +hinzuweisen. + +6) Der Lizenzgeber ist berechtigt, Lizenzcodes bei Verdacht auf Verstoß gegen +diese Lizenz zu sperren, nachdem der rechtmäßige Eigentümer gegen Vorlage des +Kaufbelegs kostenfrei einen neuen Lizenzcode ausgestellt bekommen hat oder +innerhalb von 2 Wochen nach entsprechender Information kein Kaufbeleg vorgelegt +wird. + +§ 5 Nutzungsbeschränkungen + +1) Der Lizenznehmer darf die Software auf einer ihm zur Verfügung stehenden +Hardware einsetzen. Wechselt der Lizenznehmer jedoch die Hardware, muss er die +Software von der bisher verwendeten Hardware löschen. + +2) Ein zeitgleiches Einspeichern, Vorrätighalten oder Benutzen ist nur in der +Zahl der im Lizenzschein angegebenen Anzahl von Instanzen zulässig. Möchte der +Lizenznehmer die Software in mehr Instanzen zeitgleich einsetzen, muss er eine +entsprechende Anzahl von weiteren Lizenzen erwerben. + +3) Der Lizenznehmer muss eine zeitgleiche Mehrfachnutzung über die Anzahl der +erworbenen Lizenzen hinaus durch Zugriffsschutzmechanismen unterbinden. + +4) Handelt es sich um eine Lizenz mit einer Beschränkung der Benutzeranzahl, +darf das System nur von der entsprechenden Anzahl an Benutzern genutzt werden. + +5) Die Anzahl der Benutzer errechnet sich aus der Summe der Anzahlen von den im +Menüpunkt "Benutzermanager" angelegten Benutzer, den Benutzerkonten auf +Zielservern, die für durch das System weitergeleitete Emails genutzt werden, +sowie den Benutzern, die nicht im Benutzermanager angelegt sind, aber die +Möglichkeit haben, den Proxy-Server des Systems zu nutzen. + +§ 6 Begleitende Dienstleistungen + +1) Wurde mit der Lizenz das Recht auf zeitlich beschränkte Dienstleistungen +(z.B. Update-Service) erworben, so beginnt deren Laufzeit mit Eingabe des +Lizenzcodes, Registrieren der Software oder der Prüfung auf vorhandene Updates. + +2) Wird das Recht auf diese Dienstleistungen verlängert, so beginnt die Laufzeit +der Verlängerung rückwirkend zum letzten Ablauftermin. + +§ 7 Evaluationslizenz + +1) Wurde von einem Endkunden keine Lizenz käuflich erworben, erhält er eine +Evaluationslizenz, d.h. für 30 Tage das Recht, die "Intranator Software" auf +einer Hardware zu installieren und zu Testzwecken unter diesen Lizenzbedingungen +zu nutzen. Mit der Eingabe eines nicht selbst erworbenen Lizenzkeys erlischt die +Evaluationslizenz sofort. + +2) Die Evaluationslizenz oder eine andere, zeitlich beschränkte Lizenz darf nur +für den entsprechenden Zeitraum ab Installation genutzt werden. Die verbleibende +Zeit wird auf der Bedienungsoberfläche der Software angezeigt. + +3) Nach Ablauf dieses Zeitraums stellt die Software die Funktion ein. Der Kunde +ist dafür verantwortlich, seine Daten rechtzeitig vorher zu sichern. + +4) Eine Evaluationslizenz berechtigt nicht zu Gewährleistungsansprüchen, außer +wenn etwaige Mängel durch die Intra2net AG vorsätzlich oder grob fahrlässig +verursacht wurden.. + +§ 8 Dekompilierung und Programmänderungen + +1) Die Rückübersetzung des überlassenen Programmcodes in andere Codeformen +(Dekompilierung) sowie sonstige Arten der Rückerschließung der verschiedenen +Herstellungsstufen der Software (Reverse-Engineering) einschließlich einer +Programmänderung sind nur in den nachfolgend genannten Fällen zulässig. + +2) Die Zustimmung des Rechtsinhabers ist nicht erforderlich, wenn die +Vervielfältigung des Codes oder die Übersetzung der Codeform unerlässlich ist, +um entweder a) die Bedingungen der LGPL zu erfüllen oder b) die erforderlichen +Informationen zur Herstellung der Interoperabilität eines unabhängig +geschaffenen Computerprogramms mit anderen Programmen zu erhalten, sofern +folgende Bedingungen erfüllt sind: + + 1. Die Handlungen werden von dem Lizenznehmer oder von einer anderen zur + Verwendung eines Vervielfältigungsstücks des Programms berechtigten Person oder + in deren Namen von einer hierzu ermächtigten Person vorgenommen; + 2. die für die Herstellung der Interoperabilität notwendigen Informationen sind + für die in Nummer 1 genannten Personen noch nicht ohne weiteres zugänglich + gemacht; + 3. die Handlungen beschränken sich auf die Teile des ursprünglichen Programms, + die zur Herstellung der Interoperabilität notwendig sind. + +Bei unter a) und b) genannten derartigen Handlungen gewonnene Informationen +dürfen nicht + + 1. zu anderen Zwecken als zur Herstellung der Interoperabilität des unabhängig + geschaffenen Programms verwendet werden, + 2. an Dritte weitergegeben werden, es sei denn, dass dies für die + Interoperabilität des unabhängig geschaffenen Programms notwendig ist, + 3. für die Entwicklung, Herstellung oder Vermarktung eines Programms mit im + Wesentlichen ähnlicher Ausdrucksform oder für irgendwelche anderen das + Urheberrecht verletzenden Handlungen verwendet werden. + +3) Urhebervermerke, Lizenzcodes, Seriennummern sowie sonstige der +Programmidentifikation dienende Merkmale dürfen auf keinen Fall entfernt oder +verändert werden. + +4) Wird auf dem System Software installiert, die nicht ausdrücklich vom +Lizenzgeber dafür freigegeben ist, oder wird die installierte Software +modifiziert, können Gewährleistungs- oder Garantieansprüche nur geltend gemacht +werden, wenn der Kunde nachweisen kann, dass die Mängel nicht mit den +Modifikationen in Zusammenhang stehen. + +§ 9 Weiterveräußerung und Weitervermietung + +1) Der Lizenznehmer darf die Software einschließlich des Benutzerhandbuchs und +des sonstigen Begleitmaterials auf Dauer an Dritte veräußern oder verschenken, +vorausgesetzt der erwerbende Dritte erklärt sich mit der Weitergeltung der +vorliegenden Vertragsbedingungen auch ihm gegenüber einverstanden. Im Falle der +Weitergabe muss der Lizenznehmer dem neuen Lizenznehmer sämtliche Programmkopien +einschließlich gegebenenfalls vorhandener Sicherheitskopien übergeben oder die +nicht übergebenen Kopien vernichten. Infolge der Weitergabe erlischt das Recht +des alten Lizenznehmers zur Programmnutzung. + +2) Der Lizenznehmer darf die Software einschließlich des Begleitmaterials +Dritten nicht vermieten. + +3) Der Lizenznehmer darf die Software Dritten nicht überlassen, wenn der +begründete Verdacht besteht, der Dritte werde die Vertragsbedingungen verletzen, +insbesondere unerlaubte Vervielfältigungen herstellen. Dies gilt auch im +Hinblick auf Mitarbeiter des Lizenznehmers. + +§ 10 Gewährleistung + +1) Mängel der von der Intra2net AG programmierten Software einschließlich +zugehöriger Unterlagen werden vom Lizenzgeber innerhalb der Gewährleistungsfrist +von 24 Monaten gegenüber Verbrauchern bzw. 12 Monaten gegenüber Unternehmern ab +Lieferung nach entsprechender Mitteilung durch den Lizenznehmer behoben. Dies +geschieht nach Wahl des Lizenzgebers durch Nachbesserung oder Ersatzlieferung. + +2) Bei einem zweimaligen Fehlschlagen der Nachbesserung oder Ersatzlieferung +kann der Lizenznehmer Wandelung oder Minderung geltend machen. + +§ 11 Haftung + +1) Für Schäden wegen Rechtsmängeln und Beschaffenheitsgarantien haftet der +Lizenzgeber unbeschränkt. Die Haftung für anfängliches Unvermögen wird auf das +Fünffache des Überlassungsentgelts sowie auf solche Schäden begrenzt, mit deren +Entstehung im Rahmen einer Softwareüberlassung typischerweise gerechnet werden +muss. + +2) Im Übrigen haftet der Lizenzgeber unbeschränkt nur für Vorsatz und grobe +Fahrlässigkeit auch seiner gesetzlichen Vertreter und Erfüllungsgehilfen. + +3) Für leichte Fahrlässigkeit haftet der Lizenzgeber nur, sofern eine Pflicht +verletzt wird, deren Einhaltung für die Erreichung des Vertragszwecks von +besonderer Bedeutung ist (Kardinalpflicht). Bei Verletzung einer Kardinalpflicht +ist die Haftungsbeschränkung für anfängliches Unvermögen nach Abs. 1 dieser +Haftungsreglung entsprechend heranzuziehen. + +4) Die Haftung für Datenverlust wird auf den typischen Wiederherstellungsaufwand +beschränkt, der bei regelmäßiger und gefahrentsprechender Anfertigung von +Sicherungskopien eingetreten wäre. + +5) Die vorstehenden Regelungen gelten auch zugunsten der Mitarbeiter des +Lizenzgebers. + +6) Die Haftung nach dem Produkthaftungsgesetz bleibt unberührt (§ 14 ProdHG). + +7) Für Mängel zusätzlich installierter Software wird eine Haftung nur bei +Lieferung und Installation durch die Intra2net AG übernommen. Auch dann ist +diese Haftung auf Vorsatz oder grobe Fahrlässigkeit des Lizenzgebers gemäß § 521 +BGB beschränkt. + +§ 12 Untersuchungs- und Rügepflicht + +1) Der Lizenznehmer wird die gelieferte Software einschließlich der +Dokumentation innerhalb von 8 Werktagen nach Lieferung untersuchen, insbesondere +im Hinblick auf die Vollständigkeit der Datenträger und Handbücher sowie der +Funktionsfähigkeit grundlegender Programmfunktionen. Mängel, die hierbei +festgestellt werden oder feststellbar sind, müssen dem Lizenzgeber innerhalb +weiterer 8 Werktage gemeldet werden. Die Mängelrüge muss eine nach Kräften zu +detaillierende Beschreibung der Mängel beinhalten. + +2) Mängel, die im Rahmen der beschriebenen ordnungsgemäßen Untersuchung nicht +feststellbar sind, müssen innerhalb von 8 Werktagen nach Entdeckung unter +Einhaltung der dargelegten Rügeanforderungen gerügt werden. + +3) Bei einer Verletzung der Untersuchungs- und Rügepflicht gilt die Software in +Ansehung des betreffenden Mangels als genehmigt. + +§ 13 Rücknahmepflicht nach dem ElektroG + +Der Kunde übernimmt die Pflicht, die gelieferte Ware nach Nutzungsbeendigung auf +eigene Kosten nach den gesetzlichen Vorschriften ordnungsgemäß zu entsorgen. +Insbesondere stellt der Kunde die Intra2net AG von den Verpflichtungen nach § 10 +Abs. 2 ElektroG (Rücknahmepflicht der Hersteller) und damit im Zusammenhang +stehenden Ansprüchen Dritter frei. + +§ 14 Schriftform + +Sämtliche Vereinbarungen, die eine Änderung, Ergänzung oder Konkretisierung +dieser Vertragsbedingungen beinhalten, sowie besondere Zusicherungen und +Abmachungen sind schriftlich niederzulegen. Werden sie von Vertretern oder +Hilfspersonen des Lizenzgebers erklärt, sind sie nur dann verbindlich, wenn der +Lizenzgeber hierfür seine schriftliche Zustimmung erteilt. + +§ 15 Rechtswahl + +Die Parteien vereinbaren im Hinblick auf sämtliche Rechtsbeziehungen aus diesem +Vertragsverhältnis die Anwendung des Rechts der Bundesrepublik Deutschland unter +Ausschluss des UN-Kaufrechts. + +§ 16 Gerichtsstand + +Sofern der Lizenznehmer Vollkaufmann im Sinne des Handelsgesetzbuchs, +juristische Person des öffentlichen Rechts oder öffentlich-rechtliches +Sondervermögen ist, wird für sämtliche Streitigkeiten, die im Rahmen der +Abwicklung dieses Vertragsverhältnisses entstehen, Tübingen als Gerichtsstand +vereinbart. + +§ 17 Schlussbestimmungen + +Sollten einzelne Bestimmungen nichtig, unwirksam oder anfechtbar sein oder +werden, sind sie so auszulegen bzw. zu ergänzen, dass der beabsichtigte +wirtschaftliche Zweck in rechtlich zulässiger Weise möglichst genau erreicht +wird; die übrigen Bestimmungen bleiben davon unberührt. Sinngemäß gilt dies auch +für ergänzungsbedürftige Lücken. diff --git a/glue_t2n/Makefile.am b/glue_t2n/Makefile.am index d7acfc6..8e45d69 100644 --- a/glue_t2n/Makefile.am +++ b/glue_t2n/Makefile.am @@ -2,8 +2,6 @@ INCLUDES = -I$(top_srcdir)/simpleio @LIBT2N_CFLAGS@ @BOOST_CPPFLAGS@ \ @LIBI2NCOMMON_CFLAGS@ METASOURCES = AUTO lib_LTLIBRARIES = libsimpleio_t2n.la -libsimpleio_t2n_la_SOURCES = glue_t2n.cpp -include_HEADERS = glue_t2n.hpp libsimpleio_t2n_la_LIBADD = $(top_builddir)/simpleio/libsimpleio.la \ @LIBT2N_LIBS@ @BOOST_LDFLAGS@ @BOOST_SIGNALS_LIB@ @LIBI2NCOMMON_LIBS@ @@ -11,3 +9,5 @@ libsimpleio_t2n_la_LDFLAGS = -version-info @LIBSIMPLEIO_LIB_VERSION@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA= libsimpleio_t2n.pc +include_HEADERS = simpleio_t2n.hpp +libsimpleio_t2n_la_SOURCES = simpleio_t2n.cpp diff --git a/glue_t2n/glue_t2n.cpp b/glue_t2n/glue_t2n.cpp deleted file mode 100644 index 21a946e..0000000 --- a/glue_t2n/glue_t2n.cpp +++ /dev/null @@ -1,909 +0,0 @@ -/** - * @file - * - * @author Reinhard Pfau \ - * - * @copyright © Copyright 2008 by Intra2net AG - * @license commercial - * @contact info@intra2net.com - */ - -#include "glue_t2n.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include - - - -namespace I2n -{ - -using namespace SimpleIo; - - -namespace -{ - - -Logger::PartLogger& module_logger() -{ - static Logger::PartLogger _module_logger(HERE); - return _module_logger; -} // eo module_logger(); - - - -/** - * @brief a class with some methods we like to have on our io classes. - * - * This class is to be used as second base in a wrapper class and needs it's methods to - * be redefined for "the real thing". - */ -class IOExportWrapperBase -{ - public: - - IOExportWrapperBase() - { - } - - virtual ~IOExportWrapperBase() - { - } - - virtual void sendData(const std::string& data) - { - } - - - virtual std::string receiveData() - { - return std::string(); - } - - virtual boost::signals::connection connectEof( const boost::function< void() >& func ) - { - return boost::signals::connection(); - } - - virtual boost::signals::connection connectRead( const boost::function< void() >& func ) - { - return boost::signals::connection(); - } - -}; // eo class IOExportWrapperBase - - -typedef boost::shared_ptr< IOExportWrapperBase > IOExportWrapperBasePtr; - - -/** - * @brief IO wrapper template. - * @tparam IOClass a type based on SimpleIo::IOImplementation - * - * The type is used as a public base for the resulting class; the second public base is our - * helper with the additional methods we need internally and which we (finally) define here. - */ -template< - class IOClass -> -class IOExportWrapper -: public IOClass -, public IOExportWrapperBase -{ - BOOST_STATIC_ASSERT(( boost::is_base_of< IOImplementation,IOClass >::value )); - - public: - IOExportWrapper() - { - } - - template< - typename Arg1 - > - IOExportWrapper(Arg1 arg1) - : IOClass(arg1) - {} - - - template< - typename Arg1, typename Arg2 - > - IOExportWrapper(Arg1 arg1, Arg2 arg2) - : IOClass(arg1,arg2) - {} - - - template< - typename Arg1, typename Arg2, typename Arg3 - > - IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3) - : IOClass(arg1,arg2,arg3) - {} - - - template< - typename Arg1, typename Arg2, typename Arg3, typename Arg4 - > - IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) - : IOClass(arg1,arg2,arg3,arg4) - {} - - - template< - typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5 - > - IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) - : IOClass(arg1,arg2,arg3,arg4,arg5) - {} - - - /** - * @brief exposed funtion for sending data. - * @param data the chunk to be send. - */ - virtual void sendData(const std::string& data) - { - IOClass::lowSend(data); - } - - /** - * @brief returns the new received data. - * @return the receievd data. - * - * Clears the receive buffer. - */ - virtual std::string receiveData() - { - std::string result; - result.swap(IOClass::m_input_buffer); - return result; - } - - /** - * @brief exposed connect to EOF signal. - * @param func the function which should be connected to the eof signal. - * @return signal connection handle. - */ - virtual boost::signals::connection connectEof( const boost::function< void() >& func ) - { - return IOClass::m_signal_eof.connect(func); - } - - /** - * @brief exposed connect to "read" signal. - * @param func the function which should be connected to the "read" signal. - * @return signal connection handle. - */ - virtual boost::signals::connection connectRead( const boost::function< void() >& func ) - { - return IOClass::m_signal_read.connect(func); - } - - protected: - -}; // eo class IOExportWrapper - - -/* -** specialized versions of io classes: -*/ - -/** - * @brief enhanced unix domain socket class with reconnect feature. - * - * Used for t2n client connections. - */ -class T2nUnixIOSocket -: public SimpleIo::UnixIOSocket -{ - typedef SimpleIo::UnixIOSocket inherited; - public: - T2nUnixIOSocket( const std::string& path ); - - virtual void close(SimpleIo::Direction direction = SimpleIo::Direction::both); - - bool reopen(bool force= false); - - protected: - - virtual void doRead(); - - - protected: - - bool m_in_do_read; - bool m_may_reconnect; - -}; // T2nUnixIOSocket - - -T2nUnixIOSocket::T2nUnixIOSocket(const std::string& path) -: inherited(path) -, m_in_do_read(false) -, m_may_reconnect(false) -{ -} // eo T2nUnixIOSocket::T2nUnixIOSocket(const std::string&) - - -void T2nUnixIOSocket::close(SimpleIo::Direction direction) -{ - bool was_open= opened(); - inherited::close(direction); - if (m_in_do_read and not opened()) - { - m_may_reconnect= was_open; - } -} // eo T2nUnixIOSocket::close(SimpleIo::Direction) - - -bool T2nUnixIOSocket::reopen(bool force) -{ - if (m_path.empty()) - { - return false; - } - if (m_may_reconnect || force) - { - return inherited::open( m_path ); - } - return false; -} // eo T2nUnixIOSocket::reopen() - - -void T2nUnixIOSocket::doRead() -{ - m_in_do_read= true; - try - { - inherited::doRead(); - } - catch (...) - { - m_in_do_read= false; - throw; - } - m_in_do_read= false; -} // eo T2nUnixIOSocket::doRead() - - -/** - * @brief server class for libt2n using unix domain sockets. - * - * well, it's enough to provide an appropriate constructor. - * (did i mention that templates are really cool stuff? :-) ) - */ -class T2NUnixServer -: public T2NServerBase -{ - public: - - T2NUnixServer(const std::string& path, int mode=0600) - : T2NServerBase( ServerSocketBaseImplementationPtr( - new UnixServerSocket< - IOExportWrapper< UnixIOSocket > - >(path, mode) - ) ) - { - } // eo T2NServerBase - -}; // eo T2NUnixServer - - - -class RealT2NClientConnection -: public T2NClientConnection -{ - public: - RealT2NClientConnection( SimpleIo::IOImplementationPtr connection ) - : T2NClientConnection(connection) - { - } -}; // eo class T2NClient - -} // eo namespace - - - -/* -** implementation of T2NClientConnection -*/ - - -T2NClientConnection::T2NClientConnection( - IOImplementationPtr connection -) -: libt2n::client_connection() -, m_real_connection(connection) -, m_got_new_data(false) -{ - SCOPETRACKER(); - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(connection); - if (!ptr) - { - module_logger().error(HERE) << "illegal pointer passed"; - close(); - return; - } - if (!connection->opened()) - { - module_logger().warning(HERE) << "connection not open, either failed or already closed"; - close(); - return; - } - - ptr->connectRead( boost::bind(&T2NClientConnection::newDataSlot, this) ); - ptr->connectEof( boost::bind(&T2NClientConnection::eofSlot, this) ); - -} // eo T2NClientConnection::T2NClientConnection(IOImplementationPtr) - - -T2NClientConnection::~T2NClientConnection() -{ - SCOPETRACKER(); -} // eo T2NClientConnection::~T2NClientConnection - - -/** - * @brief returns if the connection is open. - * @return @a true if the connection is open. - */ -bool T2NClientConnection::isOpen() -{ - return m_real_connection and m_real_connection->opened(); -} // eo T2NClientConnection::isOpen() - - -/** - * @brief try to reopen a connection. - * @return @a true if the connection was reopened. - */ -bool T2NClientConnection::reopen(bool force) -{ - if (not m_real_connection) - { - return false; - } - boost::shared_ptr< T2nUnixIOSocket > t2n_socket= - boost::shared_dynamic_cast< T2nUnixIOSocket >(m_real_connection); - if (t2n_socket) - { - return t2n_socket->reopen(force); - } - return false; -} // eo T2NClientConnection::reopen() - - -/** - * @brief closes the connection. - * - * This closes the underlying IO connection and calls libt2n::server_connection::close() to - * mark the connection as closed for libt2n. - */ -void T2NClientConnection::close() -{ - SCOPETRACKER(); - if (m_real_connection) - { - m_real_connection->close(); - m_real_connection.reset(); - } - libt2n::client_connection::close(); -} // eo T2NClientConnection::close() - - -/** - * @brief sends a raw data chunk on the connection. - * - * @param data the /raw) data chunk which should be sended. - */ -void T2NClientConnection::real_write(const std::string& data) -{ - SCOPETRACKER(); - if (is_closed()) - { - module_logger().warning(HERE) << "attempt to write data on closed connection"; - return; - } - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - // should never happen... - module_logger().error(HERE)<< "illegal io pointer"; - close(); - //TODO: throw an error?! - NOT_REACHED(); - return; - } - ptr->sendData(data); -} // eo T2NClientConnection::real_write(const std::string) - - -/** - * @brief called to fill the connection buffer. - * - * Since this class uses the asnychronous SimpleIo framework, new data may already be read when - * this method is called. - * - * @param usec_timeout - * @param usec_timeout_remaining - * @return @a true if new data is available. - */ -bool T2NClientConnection::fill_buffer(long long usec_timeout,long long* usec_timeout_remaining) -{ - SCOPETRACKER(); - if (is_closed()) - { - module_logger().debug(HERE) << "fill_buffer() called on closed connection"; - return false; - } - SimpleIo::MilliTime t0,t1; - SimpleIo::get_current_monotonic_time(t0); - if (!m_got_new_data) - { - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - module_logger().error(HERE) << "illegal io pointer"; - close(); - return false; - } - // try to fetch data (call the backend) - int timeout= 0; - - if (usec_timeout<0) - { - timeout= -1; - } - else if (usec_timeout > 0) - { - long long msec_timeout= (usec_timeout + 500)/1000; - - if (msec_timeout >= INT_MAX) - { - timeout= INT_MAX; - } - else - { - timeout= (int)msec_timeout; - } - } - Backend::getBackend()->doOneStep( timeout ); - } - SimpleIo::get_current_monotonic_time(t1); - if (usec_timeout_remaining) - { - long long delta= ((long long)(t1 - t0).get_milliseconds())* 1000L; - *usec_timeout_remaining= (usec_timeout > delta ) ? (usec_timeout - delta) : 0L; - module_logger().debug() << "timeout: " << usec_timeout << " -> " << *usec_timeout_remaining; - } - if (m_got_new_data) - { - m_got_new_data= false; - return true; - } - return false; -} // eo T2NClientConnection::fill_buffer(long long,long long*) - - -/** - * @brief called when new data arrived on this connection. - * - * reads the new data from the underlying IO object and stores it in the connection buffer. - * Also remembers (in the bool member var @a m_got_new_data) that new data was received. - */ -void T2NClientConnection::newDataSlot() -{ - SCOPETRACKER(); - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - //TODO: throw an error?! - NOT_REACHED(); - return; - } - std::string new_data= ptr->receiveData(); - module_logger().debug() << "got " << new_data.size() << " bytes of new data"; - buffer+= new_data; - m_got_new_data= true; -} // eo T2NClientConnection::newDataSlot() - - -/** - * @brief called when an EOF was detected by the underlying IO object (i.e. the connection - * was closed by the peer side). - * - * Calls close(). - */ -void T2NClientConnection::eofSlot() -{ - SCOPETRACKER(); - close(); -} // eo T2NClientConnection::eofSlot() - - -/* -** implementation of T2NServerConnection -*/ - - -T2NServerConnection::T2NServerConnection( - T2NServerBasePtr server, - IOImplementationPtr connection, - int timeout -) -: libt2n::server_connection(timeout) -, m_real_connection(connection) -, m_server_weak_ptr(server) -, m_got_new_data(false) -{ - SCOPETRACKER(); - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(connection); - if (!ptr) - { - module_logger().error(HERE) << "illegal pointer passed"; - close(); - return; - } - if (!connection->opened()) - { - module_logger().warning(HERE) << "connection not open, either failed or already closed"; - close(); - return; - } - - ptr->connectRead( boost::bind(&T2NServerConnection::newDataSlot, this) ); - ptr->connectEof( boost::bind(&T2NServerConnection::eofSlot, this) ); - -} // eo T2NServerConnection::T2NServerConnection(IOImplementationPtr) - - -T2NServerConnection::~T2NServerConnection() -{ - SCOPETRACKER(); -} // eo T2NServerConnection::~T2NServerConnection - - -/** - * @brief closes the connection. - * - * This closes the underlying IO connection and calls libt2n::server_connection::close() to - * mark the connection as closed for libt2n. - */ -void T2NServerConnection::close() -{ - SCOPETRACKER(); - if (m_real_connection) - { - m_real_connection->close(); - m_real_connection.reset(); - } - libt2n::server_connection::close(); -} // eo T2NServerConnection::close() - - -/** - * @brief sends a raw data chunk on the connection. - * - * @param data the (raw) data chunk which should be sended. - */ -void T2NServerConnection::real_write(const std::string& data) -{ - SCOPETRACKER(); - if (is_closed()) - { - module_logger().warning(HERE) << "attempt to write data on closed connection"; - return; - } - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - // should never happen... - module_logger().error(HERE)<< "illegal io pointer"; - close(); - //TODO: throw an error?! - NOT_REACHED(); - return; - } - ptr->sendData(data); -} // eo T2NServerConnection::real_write(const std::string) - - -/** - * @brief called to fill the connection buffer. - * - * Since this class uses the asnychronous SimpleIo framework, new data may already be read when - * this method is called. - * - * @param usec_timeout - * @param usec_timeout_remaining - * @return @a true if new data is available. - */ -bool T2NServerConnection::fill_buffer(long long usec_timeout,long long* usec_timeout_remaining) -{ - SCOPETRACKER(); - if (is_closed()) - { - module_logger().debug(HERE) << "fill_buffer() called on closed connection"; - return false; - } - SimpleIo::MilliTime t0,t1; - SimpleIo::get_current_monotonic_time(t0); - if (!m_got_new_data) - { - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - module_logger().error(HERE) << "illegal io pointer"; - close(); - return false; - } - // try to fetch data (call the backend) - int timeout= 0; - - if (usec_timeout<0) - { - timeout= -1; - } - else if (usec_timeout > 0) - { - long long msec_timeout= (usec_timeout + 500)/1000; - - if (msec_timeout >= INT_MAX) - { - timeout= INT_MAX; - } - else - { - timeout= (int)msec_timeout; - } - } - Backend::getBackend()->doOneStep( timeout ); - } - SimpleIo::get_current_monotonic_time(t1); - if (usec_timeout_remaining) - { - long long delta= ((long long)(t1 - t0).get_milliseconds())* 1000L; - *usec_timeout_remaining= (usec_timeout > delta ) ? (usec_timeout - delta) : 0L; - } - if (m_got_new_data) - { - m_got_new_data= false; - return true; - } - return false; -} // eo T2NServerConnection::fill_buffer(long long,long long*) - - -/** - * @brief called when new data arrived on this connection. - * - * reads the new data from the underlying IO object and stores it in the connection buffer. - * Also remembers (in the bool member var @a m_got_new_data that new data was received. - */ -void T2NServerConnection::newDataSlot() -{ - SCOPETRACKER(); - IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); - if (!ptr) - { - //TODO:throw an error?! - NOT_REACHED(); - return; - } - buffer+= ptr->receiveData(); - m_got_new_data= true; - reset_timeout(); - - T2NServerBasePtr server =m_server_weak_ptr.lock(); - if (server) - { - server->m_signal_client_got_new_data(); - } -} // eo T2NServerConnection::newDataSlot() - - -/** - * @brief called when an EOF was detected by the underlying IO object (i.e. the connection - * was closed by the peer side). - * - * Calls close(). - */ -void T2NServerConnection::eofSlot() -{ - SCOPETRACKER(); - close(); -} // eo T2NServerConnection::eofSlot() - - - -/* -** implementation of T2NServerBase -*/ - - -/** - * @brief constructs a libt2n server object. - * - * @param server_port shared pointer to a (SimpleIo) port server object which - * is used as underlying port handler. - */ -T2NServerBase::T2NServerBase( ServerSocketBaseImplementationPtr server_port) -: m_server_port(server_port) -{ - SCOPETRACKER(); - // register our callback for new incoming conncetions. - server_port->setNewConnectionBaseCallback( - boost::bind(&T2NServerBase::newConnectionSlot, this, _1) - ); -} // eo T2NServerBase::T2NServerBase(ServerSocketBaseImplementationPtr) - - -/** - * @brief destructor. - * - */ -T2NServerBase::~T2NServerBase() -{ - SCOPETRACKER(); -} // eo T2NServerBase::~T2NServerBase() - - -/** - * @brief returns wether the server port is opened. - * - * @return @a true iff the server port is open. - */ -bool T2NServerBase::isOpen() -{ - return (m_server_port && m_server_port->opened()); -} // eo T2NServerBase - - - -/** - * @brief callback for the port server object when a new connection is established. - * - * @param io_ptr the (shared) pointer to the new connection. - */ -void T2NServerBase::newConnectionSlot(IOImplementationPtr io_ptr) -{ - SCOPETRACKER(); - add_connection( new T2NServerConnection( get_ptr_as< T2NServerBase >(), io_ptr, get_default_timeout() ) ); -} // eo T2NServerBase::newConnectionSlot(IOImplementationPtr) - - -/** - * @brief try to fill the buffers of the managed connections. - * - * will be called by T2NServerBase::fill_buffer(). - * - * @return @a true if at least one connection buffer has new data. - */ -bool T2NServerBase::fill_connection_buffers() -{ - SCOPETRACKER(); - Backend::getBackend()->doOneStep(0); - bool result= false; - for(std::map::iterator it=connections.begin(); - it != connections.end(); - ++it) - { - T2NServerConnection *conn = dynamic_cast(it->second); - if (!conn) - { - if (it->second) - { - // react somehow if (it->second) is not NULL... - module_logger().error(HERE) << "illegal connection pointer"; - it->second->close(); - } - continue; - } - result= result or conn->fill_buffer(0); - } - return result; -} // eo T2NServerBase::fill_connection_buffers() - - -/** - * @brief fills the connection buffers. - * - * Uses the SimpleIo Backend to wait for new data. - * - * @param usec_timeout the maximum time period to wait for new data (in microseconds). - * 0 returns immediately, -1 waits until some event occurred. - * @param timeout_remaining ignored! - * @return @a true if new data for at least one connection arrived. - * - * @note since this method uses the SimpleIo backend, the timeout will have only milli second - * resolution. - */ -bool T2NServerBase::fill_buffer(long long usec_timeout, long long* timeout_remaining) -{ - SCOPETRACKER(); - int timeout= 0; - - if (usec_timeout<0) - { - timeout= -1; - } - else if (usec_timeout > 0) - { - long long msec_timeout= (usec_timeout + 500)/1000; - - if (msec_timeout >= INT_MAX) - { - timeout= INT_MAX; - } - else - { - timeout= (int)msec_timeout; - } - } - // not really.. but it shouldn't be used either... - if (timeout_remaining) *timeout_remaining= 0L; - - if (! fill_connection_buffers() && timeout>0) - { - bool had_activity= Backend::getBackend()->doOneStep( timeout ); - return fill_connection_buffers(); - } - return true; -} // to T2NServerBase::fill_buffer(long long,long long*) - - - -/* -** creator functions: -*/ - - -/** - * @brief creates a server object with unix domain server socket. - * @param path path of the unix domain socket. - * @param mode mode for the socket. - * @return shared pointer with the new server object; empty if none could be created.. - */ -T2NServerBasePtr createT2NUnixServerPort(const std::string& path, int mode) -{ - SCOPETRACKER(); - boost::shared_ptr< T2NUnixServer > result( new T2NUnixServer(path,mode) ); - if (!result->isOpen()) - { - module_logger().error(HERE) - << "failed to open unix domain server socket on \"" << path << "\""; - } - return result; -} // eo createT2NUnixServerPort(const std::string&,int) - - -/** - * @brief creates a client object connected to a server via unix daomain socket. - * @param path path of cthe unix domain socket. - * @return shared pointer with the new client object; empty if none could be created.. - */ -T2NClientConnectionPtr createT2NUnixClientConnection(const std::string& path) -{ - typedef IOExportWrapper< SimpleIo::UnixIOSocket > MyIo; - typedef boost::shared_ptr< MyIo > MyIoPtr; - SCOPETRACKER(); - MyIoPtr connection( new MyIo(path) ); - boost::shared_ptr< RealT2NClientConnection > result( new RealT2NClientConnection( connection ) ); - if (not result->isOpen()) - { - module_logger().error(HERE) - << "failed to open unix domain client socket on \"" << path << "\""; - return T2NClientConnectionPtr(); - } - return result; -} // eo createT2NUnixClientConnection(const std::string&) - - -} // eo namespace I2n diff --git a/glue_t2n/glue_t2n.hpp b/glue_t2n/glue_t2n.hpp deleted file mode 100644 index 24b3594..0000000 --- a/glue_t2n/glue_t2n.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/** - * @file - * @brief the "glue" between libt2n and SimpleIo framework. - * - * contains our own server and cleint class which should fit into the asnychronous way of "SimpleIo". - * We use our own classes since the libt2n socket classes are made for synchronous operation - * which can lead to problems even if we import the connection fd's into "SimpleIo"... - * - * @author Reinhard Pfau \ - * - * @copyright © Copyright 2008 by Intra2net AG - * @license commercial - * @contact info@intra2net.com - * - * @todo support for TCP/IP connections. - */ - -#ifndef __CONND_GLUE_T2N_HPP__ -#define __CONND_GLUE_T2N_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace I2n -{ - - - -/** - * @brief specialized version of the libt2n client connection which fits into the SimpleIo framework. - * - */ -class T2NClientConnection -: public libt2n::client_connection -{ - public: - - T2NClientConnection(); - virtual ~T2NClientConnection(); - - bool isOpen(); - - bool reopen(bool force= false); - - - /* - ** overloaded methods from libt2n classes: - */ - - virtual void close(); - - protected: - - T2NClientConnection( SimpleIo::IOImplementationPtr connection ); - - void newDataSlot(); - - void eofSlot(); - - /* - ** overloaded methods from t2n classes: - */ - - virtual void real_write(const std::string& data); - - virtual bool fill_buffer(long long usec_timeout=-1,long long* usec_timeout_remaining=NULL); - - protected: - - SimpleIo::IOImplementationPtr m_real_connection; - - bool m_got_new_data; - -}; // eo class T2NClientConnection - - -typedef boost::shared_ptr< T2NClientConnection > T2NClientConnectionPtr; - - -class T2NServerBase; - -typedef boost::shared_ptr< T2NServerBase > T2NServerBasePtr; -typedef boost::weak_ptr< T2NServerBase > T2NServerBaseWeakPtr; - -/** - * @brief specialized version of the libt2n server connection which fits into the SimpleIo framework. - * - */ -class T2NServerConnection -: public libt2n::server_connection -{ - friend class T2NServerBase; - public: - - T2NServerConnection(); - virtual ~T2NServerConnection(); - - - /* - ** overloaded methods from libt2n classes: - */ - - virtual void close(); - - protected: - - T2NServerConnection( - T2NServerBasePtr server, - SimpleIo::IOImplementationPtr connection, - int timeout); - - void newDataSlot(); - - void eofSlot(); - - /* - ** overloaded methods from t2n classes: - */ - - virtual void real_write(const std::string& data); - - virtual bool fill_buffer(long long usec_timeout=-1,long long* usec_timeout_remaining=NULL); - - protected: - - SimpleIo::IOImplementationPtr m_real_connection; - T2NServerBaseWeakPtr m_server_weak_ptr; - - bool m_got_new_data; - -}; // eo class T2NServerConnection - - - -/** - * @brief base server class for handling server ports for libt2n. - * - * Needs to be derived for the real type of connection (unix, IPv4, etc.). - * - * Does all necessary connection handling and realizes the abstract methods from - * the libt2n::server class. - */ -class T2NServerBase -: public libt2n::server -, virtual public SharedBase -{ - public: - virtual ~T2NServerBase(); - - bool isOpen(); - - /* - ** overloaded methods from t2n classes: - */ - - virtual bool fill_buffer(long long usec_timeout=-1, long long* timeout_remaining=NULL); - - public: - - boost::signal< void() > m_signal_client_got_new_data; - - protected: - - T2NServerBase( SimpleIo::ServerSocketBaseImplementationPtr server_port); - - void newConnectionSlot(SimpleIo::IOImplementationPtr io_ptr); - - /* - ** overloaded methods from t2n classes: - */ - - virtual bool fill_connection_buffers(void); - - - protected: - - SimpleIo::ServerSocketBaseImplementationPtr m_server_port; - -}; // eo T2NServerBase - - -typedef boost::shared_ptr< T2NServerBase > T2NServerBasePtr; - - -T2NServerBasePtr createT2NUnixServerPort(const std::string& path, int mode= 0600); - -T2NClientConnectionPtr createT2NUnixClientConnection(const std::string& path); - - -} // eo namespace I2n - -#endif diff --git a/glue_t2n/simpleio_t2n.cpp b/glue_t2n/simpleio_t2n.cpp new file mode 100644 index 0000000..6dfeacb --- /dev/null +++ b/glue_t2n/simpleio_t2n.cpp @@ -0,0 +1,909 @@ +/** + * @file + * + * @author Reinhard Pfau \ + * + * @copyright © Copyright 2008 by Intra2net AG + * @license commercial + * @contact info@intra2net.com + */ + +#include "simpleio_t2n.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include + + + +namespace I2n +{ + +using namespace SimpleIo; + + +namespace +{ + + +Logger::PartLogger& module_logger() +{ + static Logger::PartLogger _module_logger(HERE); + return _module_logger; +} // eo module_logger(); + + + +/** + * @brief a class with some methods we like to have on our io classes. + * + * This class is to be used as second base in a wrapper class and needs it's methods to + * be redefined for "the real thing". + */ +class IOExportWrapperBase +{ + public: + + IOExportWrapperBase() + { + } + + virtual ~IOExportWrapperBase() + { + } + + virtual void sendData(const std::string& data) + { + } + + + virtual std::string receiveData() + { + return std::string(); + } + + virtual boost::signals::connection connectEof( const boost::function< void() >& func ) + { + return boost::signals::connection(); + } + + virtual boost::signals::connection connectRead( const boost::function< void() >& func ) + { + return boost::signals::connection(); + } + +}; // eo class IOExportWrapperBase + + +typedef boost::shared_ptr< IOExportWrapperBase > IOExportWrapperBasePtr; + + +/** + * @brief IO wrapper template. + * @tparam IOClass a type based on SimpleIo::IOImplementation + * + * The type is used as a public base for the resulting class; the second public base is our + * helper with the additional methods we need internally and which we (finally) define here. + */ +template< + class IOClass +> +class IOExportWrapper +: public IOClass +, public IOExportWrapperBase +{ + BOOST_STATIC_ASSERT(( boost::is_base_of< IOImplementation,IOClass >::value )); + + public: + IOExportWrapper() + { + } + + template< + typename Arg1 + > + IOExportWrapper(Arg1 arg1) + : IOClass(arg1) + {} + + + template< + typename Arg1, typename Arg2 + > + IOExportWrapper(Arg1 arg1, Arg2 arg2) + : IOClass(arg1,arg2) + {} + + + template< + typename Arg1, typename Arg2, typename Arg3 + > + IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3) + : IOClass(arg1,arg2,arg3) + {} + + + template< + typename Arg1, typename Arg2, typename Arg3, typename Arg4 + > + IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) + : IOClass(arg1,arg2,arg3,arg4) + {} + + + template< + typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5 + > + IOExportWrapper(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) + : IOClass(arg1,arg2,arg3,arg4,arg5) + {} + + + /** + * @brief exposed funtion for sending data. + * @param data the chunk to be send. + */ + virtual void sendData(const std::string& data) + { + IOClass::lowSend(data); + } + + /** + * @brief returns the new received data. + * @return the receievd data. + * + * Clears the receive buffer. + */ + virtual std::string receiveData() + { + std::string result; + result.swap(IOClass::m_input_buffer); + return result; + } + + /** + * @brief exposed connect to EOF signal. + * @param func the function which should be connected to the eof signal. + * @return signal connection handle. + */ + virtual boost::signals::connection connectEof( const boost::function< void() >& func ) + { + return IOClass::m_signal_eof.connect(func); + } + + /** + * @brief exposed connect to "read" signal. + * @param func the function which should be connected to the "read" signal. + * @return signal connection handle. + */ + virtual boost::signals::connection connectRead( const boost::function< void() >& func ) + { + return IOClass::m_signal_read.connect(func); + } + + protected: + +}; // eo class IOExportWrapper + + +/* +** specialized versions of io classes: +*/ + +/** + * @brief enhanced unix domain socket class with reconnect feature. + * + * Used for t2n client connections. + */ +class T2nUnixIOSocket +: public SimpleIo::UnixIOSocket +{ + typedef SimpleIo::UnixIOSocket inherited; + public: + T2nUnixIOSocket( const std::string& path ); + + virtual void close(SimpleIo::Direction direction = SimpleIo::Direction::both); + + bool reopen(bool force= false); + + protected: + + virtual void doRead(); + + + protected: + + bool m_in_do_read; + bool m_may_reconnect; + +}; // T2nUnixIOSocket + + +T2nUnixIOSocket::T2nUnixIOSocket(const std::string& path) +: inherited(path) +, m_in_do_read(false) +, m_may_reconnect(false) +{ +} // eo T2nUnixIOSocket::T2nUnixIOSocket(const std::string&) + + +void T2nUnixIOSocket::close(SimpleIo::Direction direction) +{ + bool was_open= opened(); + inherited::close(direction); + if (m_in_do_read and not opened()) + { + m_may_reconnect= was_open; + } +} // eo T2nUnixIOSocket::close(SimpleIo::Direction) + + +bool T2nUnixIOSocket::reopen(bool force) +{ + if (m_path.empty()) + { + return false; + } + if (m_may_reconnect || force) + { + return inherited::open( m_path ); + } + return false; +} // eo T2nUnixIOSocket::reopen() + + +void T2nUnixIOSocket::doRead() +{ + m_in_do_read= true; + try + { + inherited::doRead(); + } + catch (...) + { + m_in_do_read= false; + throw; + } + m_in_do_read= false; +} // eo T2nUnixIOSocket::doRead() + + +/** + * @brief server class for libt2n using unix domain sockets. + * + * well, it's enough to provide an appropriate constructor. + * (did i mention that templates are really cool stuff? :-) ) + */ +class T2NUnixServer +: public T2NServerBase +{ + public: + + T2NUnixServer(const std::string& path, int mode=0600) + : T2NServerBase( ServerSocketBaseImplementationPtr( + new UnixServerSocket< + IOExportWrapper< UnixIOSocket > + >(path, mode) + ) ) + { + } // eo T2NServerBase + +}; // eo T2NUnixServer + + + +class RealT2NClientConnection +: public T2NClientConnection +{ + public: + RealT2NClientConnection( SimpleIo::IOImplementationPtr connection ) + : T2NClientConnection(connection) + { + } +}; // eo class T2NClient + +} // eo namespace + + + +/* +** implementation of T2NClientConnection +*/ + + +T2NClientConnection::T2NClientConnection( + IOImplementationPtr connection +) +: libt2n::client_connection() +, m_real_connection(connection) +, m_got_new_data(false) +{ + SCOPETRACKER(); + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(connection); + if (!ptr) + { + module_logger().error(HERE) << "illegal pointer passed"; + close(); + return; + } + if (!connection->opened()) + { + module_logger().warning(HERE) << "connection not open, either failed or already closed"; + close(); + return; + } + + ptr->connectRead( boost::bind(&T2NClientConnection::newDataSlot, this) ); + ptr->connectEof( boost::bind(&T2NClientConnection::eofSlot, this) ); + +} // eo T2NClientConnection::T2NClientConnection(IOImplementationPtr) + + +T2NClientConnection::~T2NClientConnection() +{ + SCOPETRACKER(); +} // eo T2NClientConnection::~T2NClientConnection + + +/** + * @brief returns if the connection is open. + * @return @a true if the connection is open. + */ +bool T2NClientConnection::isOpen() +{ + return m_real_connection and m_real_connection->opened(); +} // eo T2NClientConnection::isOpen() + + +/** + * @brief try to reopen a connection. + * @return @a true if the connection was reopened. + */ +bool T2NClientConnection::reopen(bool force) +{ + if (not m_real_connection) + { + return false; + } + boost::shared_ptr< T2nUnixIOSocket > t2n_socket= + boost::shared_dynamic_cast< T2nUnixIOSocket >(m_real_connection); + if (t2n_socket) + { + return t2n_socket->reopen(force); + } + return false; +} // eo T2NClientConnection::reopen() + + +/** + * @brief closes the connection. + * + * This closes the underlying IO connection and calls libt2n::server_connection::close() to + * mark the connection as closed for libt2n. + */ +void T2NClientConnection::close() +{ + SCOPETRACKER(); + if (m_real_connection) + { + m_real_connection->close(); + m_real_connection.reset(); + } + libt2n::client_connection::close(); +} // eo T2NClientConnection::close() + + +/** + * @brief sends a raw data chunk on the connection. + * + * @param data the /raw) data chunk which should be sended. + */ +void T2NClientConnection::real_write(const std::string& data) +{ + SCOPETRACKER(); + if (is_closed()) + { + module_logger().warning(HERE) << "attempt to write data on closed connection"; + return; + } + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + // should never happen... + module_logger().error(HERE)<< "illegal io pointer"; + close(); + //TODO: throw an error?! + NOT_REACHED(); + return; + } + ptr->sendData(data); +} // eo T2NClientConnection::real_write(const std::string) + + +/** + * @brief called to fill the connection buffer. + * + * Since this class uses the asnychronous SimpleIo framework, new data may already be read when + * this method is called. + * + * @param usec_timeout + * @param usec_timeout_remaining + * @return @a true if new data is available. + */ +bool T2NClientConnection::fill_buffer(long long usec_timeout,long long* usec_timeout_remaining) +{ + SCOPETRACKER(); + if (is_closed()) + { + module_logger().debug(HERE) << "fill_buffer() called on closed connection"; + return false; + } + SimpleIo::MilliTime t0,t1; + SimpleIo::get_current_monotonic_time(t0); + if (!m_got_new_data) + { + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + module_logger().error(HERE) << "illegal io pointer"; + close(); + return false; + } + // try to fetch data (call the backend) + int timeout= 0; + + if (usec_timeout<0) + { + timeout= -1; + } + else if (usec_timeout > 0) + { + long long msec_timeout= (usec_timeout + 500)/1000; + + if (msec_timeout >= INT_MAX) + { + timeout= INT_MAX; + } + else + { + timeout= (int)msec_timeout; + } + } + Backend::getBackend()->doOneStep( timeout ); + } + SimpleIo::get_current_monotonic_time(t1); + if (usec_timeout_remaining) + { + long long delta= ((long long)(t1 - t0).get_milliseconds())* 1000L; + *usec_timeout_remaining= (usec_timeout > delta ) ? (usec_timeout - delta) : 0L; + module_logger().debug() << "timeout: " << usec_timeout << " -> " << *usec_timeout_remaining; + } + if (m_got_new_data) + { + m_got_new_data= false; + return true; + } + return false; +} // eo T2NClientConnection::fill_buffer(long long,long long*) + + +/** + * @brief called when new data arrived on this connection. + * + * reads the new data from the underlying IO object and stores it in the connection buffer. + * Also remembers (in the bool member var @a m_got_new_data) that new data was received. + */ +void T2NClientConnection::newDataSlot() +{ + SCOPETRACKER(); + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + //TODO: throw an error?! + NOT_REACHED(); + return; + } + std::string new_data= ptr->receiveData(); + module_logger().debug() << "got " << new_data.size() << " bytes of new data"; + buffer+= new_data; + m_got_new_data= true; +} // eo T2NClientConnection::newDataSlot() + + +/** + * @brief called when an EOF was detected by the underlying IO object (i.e. the connection + * was closed by the peer side). + * + * Calls close(). + */ +void T2NClientConnection::eofSlot() +{ + SCOPETRACKER(); + close(); +} // eo T2NClientConnection::eofSlot() + + +/* +** implementation of T2NServerConnection +*/ + + +T2NServerConnection::T2NServerConnection( + T2NServerBasePtr server, + IOImplementationPtr connection, + int timeout +) +: libt2n::server_connection(timeout) +, m_real_connection(connection) +, m_server_weak_ptr(server) +, m_got_new_data(false) +{ + SCOPETRACKER(); + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(connection); + if (!ptr) + { + module_logger().error(HERE) << "illegal pointer passed"; + close(); + return; + } + if (!connection->opened()) + { + module_logger().warning(HERE) << "connection not open, either failed or already closed"; + close(); + return; + } + + ptr->connectRead( boost::bind(&T2NServerConnection::newDataSlot, this) ); + ptr->connectEof( boost::bind(&T2NServerConnection::eofSlot, this) ); + +} // eo T2NServerConnection::T2NServerConnection(IOImplementationPtr) + + +T2NServerConnection::~T2NServerConnection() +{ + SCOPETRACKER(); +} // eo T2NServerConnection::~T2NServerConnection + + +/** + * @brief closes the connection. + * + * This closes the underlying IO connection and calls libt2n::server_connection::close() to + * mark the connection as closed for libt2n. + */ +void T2NServerConnection::close() +{ + SCOPETRACKER(); + if (m_real_connection) + { + m_real_connection->close(); + m_real_connection.reset(); + } + libt2n::server_connection::close(); +} // eo T2NServerConnection::close() + + +/** + * @brief sends a raw data chunk on the connection. + * + * @param data the (raw) data chunk which should be sended. + */ +void T2NServerConnection::real_write(const std::string& data) +{ + SCOPETRACKER(); + if (is_closed()) + { + module_logger().warning(HERE) << "attempt to write data on closed connection"; + return; + } + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + // should never happen... + module_logger().error(HERE)<< "illegal io pointer"; + close(); + //TODO: throw an error?! + NOT_REACHED(); + return; + } + ptr->sendData(data); +} // eo T2NServerConnection::real_write(const std::string) + + +/** + * @brief called to fill the connection buffer. + * + * Since this class uses the asnychronous SimpleIo framework, new data may already be read when + * this method is called. + * + * @param usec_timeout + * @param usec_timeout_remaining + * @return @a true if new data is available. + */ +bool T2NServerConnection::fill_buffer(long long usec_timeout,long long* usec_timeout_remaining) +{ + SCOPETRACKER(); + if (is_closed()) + { + module_logger().debug(HERE) << "fill_buffer() called on closed connection"; + return false; + } + SimpleIo::MilliTime t0,t1; + SimpleIo::get_current_monotonic_time(t0); + if (!m_got_new_data) + { + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + module_logger().error(HERE) << "illegal io pointer"; + close(); + return false; + } + // try to fetch data (call the backend) + int timeout= 0; + + if (usec_timeout<0) + { + timeout= -1; + } + else if (usec_timeout > 0) + { + long long msec_timeout= (usec_timeout + 500)/1000; + + if (msec_timeout >= INT_MAX) + { + timeout= INT_MAX; + } + else + { + timeout= (int)msec_timeout; + } + } + Backend::getBackend()->doOneStep( timeout ); + } + SimpleIo::get_current_monotonic_time(t1); + if (usec_timeout_remaining) + { + long long delta= ((long long)(t1 - t0).get_milliseconds())* 1000L; + *usec_timeout_remaining= (usec_timeout > delta ) ? (usec_timeout - delta) : 0L; + } + if (m_got_new_data) + { + m_got_new_data= false; + return true; + } + return false; +} // eo T2NServerConnection::fill_buffer(long long,long long*) + + +/** + * @brief called when new data arrived on this connection. + * + * reads the new data from the underlying IO object and stores it in the connection buffer. + * Also remembers (in the bool member var @a m_got_new_data that new data was received. + */ +void T2NServerConnection::newDataSlot() +{ + SCOPETRACKER(); + IOExportWrapperBasePtr ptr = boost::dynamic_pointer_cast< IOExportWrapperBase >(m_real_connection); + if (!ptr) + { + //TODO:throw an error?! + NOT_REACHED(); + return; + } + buffer+= ptr->receiveData(); + m_got_new_data= true; + reset_timeout(); + + T2NServerBasePtr server =m_server_weak_ptr.lock(); + if (server) + { + server->m_signal_client_got_new_data(); + } +} // eo T2NServerConnection::newDataSlot() + + +/** + * @brief called when an EOF was detected by the underlying IO object (i.e. the connection + * was closed by the peer side). + * + * Calls close(). + */ +void T2NServerConnection::eofSlot() +{ + SCOPETRACKER(); + close(); +} // eo T2NServerConnection::eofSlot() + + + +/* +** implementation of T2NServerBase +*/ + + +/** + * @brief constructs a libt2n server object. + * + * @param server_port shared pointer to a (SimpleIo) port server object which + * is used as underlying port handler. + */ +T2NServerBase::T2NServerBase( ServerSocketBaseImplementationPtr server_port) +: m_server_port(server_port) +{ + SCOPETRACKER(); + // register our callback for new incoming conncetions. + server_port->setNewConnectionBaseCallback( + boost::bind(&T2NServerBase::newConnectionSlot, this, _1) + ); +} // eo T2NServerBase::T2NServerBase(ServerSocketBaseImplementationPtr) + + +/** + * @brief destructor. + * + */ +T2NServerBase::~T2NServerBase() +{ + SCOPETRACKER(); +} // eo T2NServerBase::~T2NServerBase() + + +/** + * @brief returns wether the server port is opened. + * + * @return @a true iff the server port is open. + */ +bool T2NServerBase::isOpen() +{ + return (m_server_port && m_server_port->opened()); +} // eo T2NServerBase + + + +/** + * @brief callback for the port server object when a new connection is established. + * + * @param io_ptr the (shared) pointer to the new connection. + */ +void T2NServerBase::newConnectionSlot(IOImplementationPtr io_ptr) +{ + SCOPETRACKER(); + add_connection( new T2NServerConnection( get_ptr_as< T2NServerBase >(), io_ptr, get_default_timeout() ) ); +} // eo T2NServerBase::newConnectionSlot(IOImplementationPtr) + + +/** + * @brief try to fill the buffers of the managed connections. + * + * will be called by T2NServerBase::fill_buffer(). + * + * @return @a true if at least one connection buffer has new data. + */ +bool T2NServerBase::fill_connection_buffers() +{ + SCOPETRACKER(); + Backend::getBackend()->doOneStep(0); + bool result= false; + for(std::map::iterator it=connections.begin(); + it != connections.end(); + ++it) + { + T2NServerConnection *conn = dynamic_cast(it->second); + if (!conn) + { + if (it->second) + { + // react somehow if (it->second) is not NULL... + module_logger().error(HERE) << "illegal connection pointer"; + it->second->close(); + } + continue; + } + result= result or conn->fill_buffer(0); + } + return result; +} // eo T2NServerBase::fill_connection_buffers() + + +/** + * @brief fills the connection buffers. + * + * Uses the SimpleIo Backend to wait for new data. + * + * @param usec_timeout the maximum time period to wait for new data (in microseconds). + * 0 returns immediately, -1 waits until some event occurred. + * @param timeout_remaining ignored! + * @return @a true if new data for at least one connection arrived. + * + * @note since this method uses the SimpleIo backend, the timeout will have only milli second + * resolution. + */ +bool T2NServerBase::fill_buffer(long long usec_timeout, long long* timeout_remaining) +{ + SCOPETRACKER(); + int timeout= 0; + + if (usec_timeout<0) + { + timeout= -1; + } + else if (usec_timeout > 0) + { + long long msec_timeout= (usec_timeout + 500)/1000; + + if (msec_timeout >= INT_MAX) + { + timeout= INT_MAX; + } + else + { + timeout= (int)msec_timeout; + } + } + // not really.. but it shouldn't be used either... + if (timeout_remaining) *timeout_remaining= 0L; + + if (! fill_connection_buffers() && timeout>0) + { + bool had_activity= Backend::getBackend()->doOneStep( timeout ); + return fill_connection_buffers(); + } + return true; +} // to T2NServerBase::fill_buffer(long long,long long*) + + + +/* +** creator functions: +*/ + + +/** + * @brief creates a server object with unix domain server socket. + * @param path path of the unix domain socket. + * @param mode mode for the socket. + * @return shared pointer with the new server object; empty if none could be created.. + */ +T2NServerBasePtr createT2NUnixServerPort(const std::string& path, int mode) +{ + SCOPETRACKER(); + boost::shared_ptr< T2NUnixServer > result( new T2NUnixServer(path,mode) ); + if (!result->isOpen()) + { + module_logger().error(HERE) + << "failed to open unix domain server socket on \"" << path << "\""; + } + return result; +} // eo createT2NUnixServerPort(const std::string&,int) + + +/** + * @brief creates a client object connected to a server via unix daomain socket. + * @param path path of cthe unix domain socket. + * @return shared pointer with the new client object; empty if none could be created.. + */ +T2NClientConnectionPtr createT2NUnixClientConnection(const std::string& path) +{ + typedef IOExportWrapper< SimpleIo::UnixIOSocket > MyIo; + typedef boost::shared_ptr< MyIo > MyIoPtr; + SCOPETRACKER(); + MyIoPtr connection( new MyIo(path) ); + boost::shared_ptr< RealT2NClientConnection > result( new RealT2NClientConnection( connection ) ); + if (not result->isOpen()) + { + module_logger().error(HERE) + << "failed to open unix domain client socket on \"" << path << "\""; + return T2NClientConnectionPtr(); + } + return result; +} // eo createT2NUnixClientConnection(const std::string&) + + +} // eo namespace I2n diff --git a/glue_t2n/simpleio_t2n.hpp b/glue_t2n/simpleio_t2n.hpp new file mode 100644 index 0000000..24b3594 --- /dev/null +++ b/glue_t2n/simpleio_t2n.hpp @@ -0,0 +1,200 @@ +/** + * @file + * @brief the "glue" between libt2n and SimpleIo framework. + * + * contains our own server and cleint class which should fit into the asnychronous way of "SimpleIo". + * We use our own classes since the libt2n socket classes are made for synchronous operation + * which can lead to problems even if we import the connection fd's into "SimpleIo"... + * + * @author Reinhard Pfau \ + * + * @copyright © Copyright 2008 by Intra2net AG + * @license commercial + * @contact info@intra2net.com + * + * @todo support for TCP/IP connections. + */ + +#ifndef __CONND_GLUE_T2N_HPP__ +#define __CONND_GLUE_T2N_HPP__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace I2n +{ + + + +/** + * @brief specialized version of the libt2n client connection which fits into the SimpleIo framework. + * + */ +class T2NClientConnection +: public libt2n::client_connection +{ + public: + + T2NClientConnection(); + virtual ~T2NClientConnection(); + + bool isOpen(); + + bool reopen(bool force= false); + + + /* + ** overloaded methods from libt2n classes: + */ + + virtual void close(); + + protected: + + T2NClientConnection( SimpleIo::IOImplementationPtr connection ); + + void newDataSlot(); + + void eofSlot(); + + /* + ** overloaded methods from t2n classes: + */ + + virtual void real_write(const std::string& data); + + virtual bool fill_buffer(long long usec_timeout=-1,long long* usec_timeout_remaining=NULL); + + protected: + + SimpleIo::IOImplementationPtr m_real_connection; + + bool m_got_new_data; + +}; // eo class T2NClientConnection + + +typedef boost::shared_ptr< T2NClientConnection > T2NClientConnectionPtr; + + +class T2NServerBase; + +typedef boost::shared_ptr< T2NServerBase > T2NServerBasePtr; +typedef boost::weak_ptr< T2NServerBase > T2NServerBaseWeakPtr; + +/** + * @brief specialized version of the libt2n server connection which fits into the SimpleIo framework. + * + */ +class T2NServerConnection +: public libt2n::server_connection +{ + friend class T2NServerBase; + public: + + T2NServerConnection(); + virtual ~T2NServerConnection(); + + + /* + ** overloaded methods from libt2n classes: + */ + + virtual void close(); + + protected: + + T2NServerConnection( + T2NServerBasePtr server, + SimpleIo::IOImplementationPtr connection, + int timeout); + + void newDataSlot(); + + void eofSlot(); + + /* + ** overloaded methods from t2n classes: + */ + + virtual void real_write(const std::string& data); + + virtual bool fill_buffer(long long usec_timeout=-1,long long* usec_timeout_remaining=NULL); + + protected: + + SimpleIo::IOImplementationPtr m_real_connection; + T2NServerBaseWeakPtr m_server_weak_ptr; + + bool m_got_new_data; + +}; // eo class T2NServerConnection + + + +/** + * @brief base server class for handling server ports for libt2n. + * + * Needs to be derived for the real type of connection (unix, IPv4, etc.). + * + * Does all necessary connection handling and realizes the abstract methods from + * the libt2n::server class. + */ +class T2NServerBase +: public libt2n::server +, virtual public SharedBase +{ + public: + virtual ~T2NServerBase(); + + bool isOpen(); + + /* + ** overloaded methods from t2n classes: + */ + + virtual bool fill_buffer(long long usec_timeout=-1, long long* timeout_remaining=NULL); + + public: + + boost::signal< void() > m_signal_client_got_new_data; + + protected: + + T2NServerBase( SimpleIo::ServerSocketBaseImplementationPtr server_port); + + void newConnectionSlot(SimpleIo::IOImplementationPtr io_ptr); + + /* + ** overloaded methods from t2n classes: + */ + + virtual bool fill_connection_buffers(void); + + + protected: + + SimpleIo::ServerSocketBaseImplementationPtr m_server_port; + +}; // eo T2NServerBase + + +typedef boost::shared_ptr< T2NServerBase > T2NServerBasePtr; + + +T2NServerBasePtr createT2NUnixServerPort(const std::string& path, int mode= 0600); + +T2NClientConnectionPtr createT2NUnixClientConnection(const std::string& path); + + +} // eo namespace I2n + +#endif diff --git a/libsimpleio.spec b/libsimpleio.spec index 4c83b29..a905f1f 100644 --- a/libsimpleio.spec +++ b/libsimpleio.spec @@ -89,5 +89,5 @@ rm -fr $RPM_BUILD_ROOT %defattr(-,root,root) %{prefix}/lib/libsimpleio_t2n.*a* %{prefix}/lib/pkgconfig/libsimpleio_t2n.pc -%{prefix}/include/glue_t2n*.hpp +%{prefix}/include/simpleio_t2n*.hpp -- 1.7.1