]> git.stg.codes - stg.git/commitdiff
TUT framework updated to svn version
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 19 Sep 2011 08:57:52 +0000 (11:57 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 19 Sep 2011 08:57:52 +0000 (11:57 +0300)
Libs headers moved to its own folders

181 files changed:
stglibs/common.lib/common.h [deleted file]
stglibs/common.lib/include/stg/common.h [new file with mode: 0644]
stglibs/conffiles.lib/conffiles.h [deleted file]
stglibs/conffiles.lib/include/stg/conffiles.h [new file with mode: 0644]
stglibs/crypto.lib/ag_md5.h [deleted file]
stglibs/crypto.lib/blowfish.h [deleted file]
stglibs/crypto.lib/include/stg/ag_md5.h [new file with mode: 0644]
stglibs/crypto.lib/include/stg/blowfish.h [new file with mode: 0644]
stglibs/dotconfpp.lib/dotconfpp.h [deleted file]
stglibs/dotconfpp.lib/include/stg/dotconfpp.h [new file with mode: 0644]
stglibs/ia.lib/ia.h [deleted file]
stglibs/ia.lib/include/stg/ia.h [new file with mode: 0644]
stglibs/ibpp.lib/ibpp.h [deleted file]
stglibs/ibpp.lib/include/stg/ibpp.h [new file with mode: 0644]
stglibs/locker.lib/include/stg/locker.h [new file with mode: 0644]
stglibs/locker.lib/locker.h [deleted file]
stglibs/logger.lib/include/stg/logger.h [new file with mode: 0644]
stglibs/logger.lib/logger.h [deleted file]
stglibs/pinger.lib/include/stg/pinger.h [new file with mode: 0644]
stglibs/pinger.lib/pinger.h [deleted file]
stglibs/scriptexecuter.lib/include/stg/scriptexecuter.h [new file with mode: 0644]
stglibs/scriptexecuter.lib/scriptexecuter.h [deleted file]
stglibs/smux.lib/ANY.h [deleted file]
stglibs/smux.lib/ApplicationSyntax.h [deleted file]
stglibs/smux.lib/AtEntry.h [deleted file]
stglibs/smux.lib/BIT_STRING.h [deleted file]
stglibs/smux.lib/BOOLEAN.h [deleted file]
stglibs/smux.lib/ClosePDU.h [deleted file]
stglibs/smux.lib/Counter.h [deleted file]
stglibs/smux.lib/DisplayString.h [deleted file]
stglibs/smux.lib/EgpNeighEntry.h [deleted file]
stglibs/smux.lib/Gauge.h [deleted file]
stglibs/smux.lib/GetNextRequest-PDU.h [deleted file]
stglibs/smux.lib/GetRequest-PDU.h [deleted file]
stglibs/smux.lib/GetResponse-PDU.h [deleted file]
stglibs/smux.lib/INTEGER.h [deleted file]
stglibs/smux.lib/IfEntry.h [deleted file]
stglibs/smux.lib/IpAddrEntry.h [deleted file]
stglibs/smux.lib/IpAddress.h [deleted file]
stglibs/smux.lib/IpNetToMediaEntry.h [deleted file]
stglibs/smux.lib/IpRouteEntry.h [deleted file]
stglibs/smux.lib/Message.h [deleted file]
stglibs/smux.lib/NULL.h [deleted file]
stglibs/smux.lib/NativeEnumerated.h [deleted file]
stglibs/smux.lib/NativeInteger.h [deleted file]
stglibs/smux.lib/NetworkAddress.h [deleted file]
stglibs/smux.lib/OBJECT_IDENTIFIER.h [deleted file]
stglibs/smux.lib/OCTET_STRING.h [deleted file]
stglibs/smux.lib/ObjectName.h [deleted file]
stglibs/smux.lib/ObjectSyntax.h [deleted file]
stglibs/smux.lib/Opaque.h [deleted file]
stglibs/smux.lib/OpenPDU.h [deleted file]
stglibs/smux.lib/PDU.h [deleted file]
stglibs/smux.lib/PDUs.h [deleted file]
stglibs/smux.lib/PhysAddress.h [deleted file]
stglibs/smux.lib/RReqPDU.h [deleted file]
stglibs/smux.lib/RRspPDU.h [deleted file]
stglibs/smux.lib/SMUX-PDUs.h [deleted file]
stglibs/smux.lib/SOutPDU.h [deleted file]
stglibs/smux.lib/SetRequest-PDU.h [deleted file]
stglibs/smux.lib/SimpleOpen.h [deleted file]
stglibs/smux.lib/SimpleSyntax.h [deleted file]
stglibs/smux.lib/TcpConnEntry.h [deleted file]
stglibs/smux.lib/TimeTicks.h [deleted file]
stglibs/smux.lib/Trap-PDU.h [deleted file]
stglibs/smux.lib/UdpEntry.h [deleted file]
stglibs/smux.lib/VarBind.h [deleted file]
stglibs/smux.lib/VarBindList.h [deleted file]
stglibs/smux.lib/asn_SEQUENCE_OF.h [deleted file]
stglibs/smux.lib/asn_SET_OF.h [deleted file]
stglibs/smux.lib/asn_application.h [deleted file]
stglibs/smux.lib/asn_codecs.h [deleted file]
stglibs/smux.lib/asn_codecs_prim.h [deleted file]
stglibs/smux.lib/asn_internal.h [deleted file]
stglibs/smux.lib/asn_system.h [deleted file]
stglibs/smux.lib/ber_decoder.h [deleted file]
stglibs/smux.lib/ber_tlv_length.h [deleted file]
stglibs/smux.lib/ber_tlv_tag.h [deleted file]
stglibs/smux.lib/constr_CHOICE.h [deleted file]
stglibs/smux.lib/constr_SEQUENCE.h [deleted file]
stglibs/smux.lib/constr_SEQUENCE_OF.h [deleted file]
stglibs/smux.lib/constr_SET_OF.h [deleted file]
stglibs/smux.lib/constr_TYPE.h [deleted file]
stglibs/smux.lib/constraints.h [deleted file]
stglibs/smux.lib/der_encoder.h [deleted file]
stglibs/smux.lib/include/stg/ANY.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ApplicationSyntax.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/AtEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/BIT_STRING.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/BOOLEAN.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ClosePDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/Counter.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/DisplayString.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/EgpNeighEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/Gauge.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/GetNextRequest-PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/GetRequest-PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/GetResponse-PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/INTEGER.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/IfEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/IpAddrEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/IpAddress.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/IpNetToMediaEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/IpRouteEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/Message.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/NULL.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/NativeEnumerated.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/NativeInteger.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/NetworkAddress.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/OBJECT_IDENTIFIER.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/OCTET_STRING.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ObjectName.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ObjectSyntax.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/Opaque.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/OpenPDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/PDUs.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/PhysAddress.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/RReqPDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/RRspPDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/SMUX-PDUs.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/SOutPDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/SetRequest-PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/SimpleOpen.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/SimpleSyntax.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/TcpConnEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/TimeTicks.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/Trap-PDU.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/UdpEntry.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/VarBind.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/VarBindList.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_SEQUENCE_OF.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_SET_OF.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_application.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_codecs.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_codecs_prim.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_internal.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/asn_system.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ber_decoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ber_tlv_length.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/ber_tlv_tag.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constr_CHOICE.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constr_SEQUENCE.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constr_SEQUENCE_OF.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constr_SET_OF.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constr_TYPE.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/constraints.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/der_encoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/per_decoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/per_encoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/per_support.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/xer_decoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/xer_encoder.h [new file with mode: 0644]
stglibs/smux.lib/include/stg/xer_support.h [new file with mode: 0644]
stglibs/smux.lib/per_decoder.h [deleted file]
stglibs/smux.lib/per_encoder.h [deleted file]
stglibs/smux.lib/per_support.h [deleted file]
stglibs/smux.lib/xer_decoder.h [deleted file]
stglibs/smux.lib/xer_encoder.h [deleted file]
stglibs/smux.lib/xer_support.h [deleted file]
stglibs/srvconf.lib/include/stg/netunit.h [new file with mode: 0644]
stglibs/srvconf.lib/include/stg/servconf.h [new file with mode: 0644]
stglibs/srvconf.lib/netunit.h [deleted file]
stglibs/srvconf.lib/servconf.h [deleted file]
tests/tut.h [deleted file]
tests/tut/tut.hpp
tests/tut/tut_assert.hpp
tests/tut/tut_config.hpp [new file with mode: 0644]
tests/tut/tut_console_reporter.hpp
tests/tut/tut_cppunit_reporter.hpp
tests/tut/tut_exception.hpp
tests/tut/tut_fpt.hpp [new file with mode: 0644]
tests/tut/tut_macros.hpp [new file with mode: 0644]
tests/tut/tut_main.hpp [new file with mode: 0644]
tests/tut/tut_posix.hpp
tests/tut/tut_restartable.hpp
tests/tut/tut_result.hpp
tests/tut/tut_runner.hpp
tests/tut/tut_xml_reporter.hpp
tests/tut_reporter.h [deleted file]
tests/tut_restartable.h [deleted file]

diff --git a/stglibs/common.lib/common.h b/stglibs/common.lib/common.h
deleted file mode 100644 (file)
index ac09114..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
- /*
- $Revision: 1.32 $
- $Date: 2010/11/08 10:11:19 $
- $Author: faust $
- */
-
-#ifndef common_h
-#define common_h
-
-#ifdef __BORLANDC__
-#include <time.h>
-#else
-#include <ctime>
-#endif
-#include <string>
-
-#include "stg/os_int.h"
-#include "stg/const.h"
-
-#define STAT_TIME_3         (1)
-#define STAT_TIME_2         (2)
-#define STAT_TIME_1         (3)
-#define STAT_TIME_1_2       (4)
-#define STAT_TIME_1_4       (5)
-#define STAT_TIME_1_6       (6)
-
-#define FN_STR_LEN      (NAME_MAX)
-
-#define ST_F    0
-#define ST_B    1
-#define ST_KB   2
-#define ST_MB   3
-
-//-----------------------------------------------------------------------------
-const char    * IntToKMG(long long a, int statType = ST_F);
-const char    * LogDate(time_t t);
-int             ParesTimeStat(const char * str);
-int             IsTimeStat(struct tm * t, int statTime);
-/*bool            IsDigit(char c);
-bool            IsAlpha(char c);*/
-int             strtodouble2(const char * s, double &a);
-int             printfd(const char * __file__, const char * fmt, ...);
-void            Encode12(char * dst, const char * src, size_t srcLen);
-void            Decode21(char * dst, const char * src);
-
-void            Encode12str(std::string & dst, const std::string & src);
-void            Decode21str(std::string & dst, const std::string & src);
-
-int             ParseIPString(const char * str, uint32_t * ips, int maxIP);
-void            KOIToWin(const char * s1, char * s2, int l);
-void            WinToKOI(const char * s1, char * s2, int l);
-void            KOIToWin(const std::string & s1, std::string * s2);
-void            WinToKOI(const std::string & s1, std::string * s2);
-int             DaysInMonth(unsigned year, unsigned mon);
-int             DaysInCurrentMonth();
-int             Min8(int a);
-//char          * inet_ntostr(unsigned long);
-std::string     inet_ntostring(uint32_t);
-uint32_t        inet_strington(const std::string & value);
-int             strprintf(std::string * str, const char * fmt, ...);
-int             ParseTariffTimeStr(const char * str, int &h1, int &m1, int &h2, int &m2);
-uint32_t        CalcMask(uint32_t msk);
-void            TouchFile(const std::string & fileName);
-#ifdef WIN32
-void            EncodeStr(char * str, unsigned long serial, int useHDD);
-void            DecodeStr(char * str, unsigned long serial, int useHDD);
-#endif //WIN32
-void            SwapBytes(uint16_t & value);
-void            SwapBytes(uint32_t & value);
-void            SwapBytes(uint64_t & value);
-void            SwapBytes(int16_t & value);
-void            SwapBytes(int32_t & value);
-void            SwapBytes(int64_t & value);
-
-std::string &   TrimL(std::string & val);
-std::string &   TrimR(std::string & val);
-std::string &   Trim(std::string & val);
-
-std::string     IconvString(const std::string & source, const std::string & from, const std::string & to);
-
-int ParseInt(const std::string & str, int * val);
-int ParseUnsigned(const std::string & str, unsigned * val);
-int ParseIntInRange(const std::string & str, int min, int max, int * val);
-int ParseUnsignedInRange(const std::string & str, unsigned min,
-                         unsigned max, unsigned * val);
-int ParseYesNo(const std::string & str, bool * val);
-
-bool WaitPackets(int sd);
-
-//-----------------------------------------------------------------------------
-template <typename varT>
-int str2x(const std::string & str, varT & x)
-{
-    int pos = 0;
-    int minus = 1;
-
-    if (str.empty())
-        return -1;
-
-    if (str[0] == '+')
-        pos++;
-
-    if (str[0] == '-')
-    {
-        pos++;
-        minus = -1;
-    }
-
-    if ((str[pos] < '0' || str[pos] > '9'))
-        return -1;
-
-    x = str[pos++] - '0';
-
-    for (unsigned i = pos; i < str.size(); i++)
-    {
-        if ((str[i] < '0' || str[i] > '9'))
-            return -1;
-
-        x *= 10;
-        x += str[i] - '0';
-    }
-
-    x*= minus;
-
-    return 0;
-}
-//-----------------------------------------------------------------------------
-template <typename varT>
-const std::string & x2str(varT x, std::string & s)
-{
-    varT xx = x;
-    int pos = 1;
-
-    x /= 10;
-    while (x != 0)
-    {
-        x /= 10;
-        pos++;
-    }
-
-    if (xx < 0)
-    {
-        pos++;
-        s.resize(pos, 0);
-        s[0] = '-';
-    }
-    else if (xx > 0)
-    {
-        s.resize(pos, 0);
-    }
-    else
-    {
-        s.resize(1, 0);
-        s[0] = '0';
-        return s;
-    }
-
-    x = xx;
-
-    while (x != 0)
-    {
-        if (x < 0)
-            s[--pos] = -(x % 10) + '0';
-        else
-            s[--pos] = x % 10 + '0';
-
-        x /= 10;
-    }
-
-    return s;
-}
-//-----------------------------------------------------------------------------
-template <typename varT>
-const std::string & unsigned2str(varT x, std::string & s)
-{
-    varT xx = x;
-    int pos = 1;
-
-    x /= 10;
-    while (x != 0)
-    {
-        x /= 10;
-        pos++;
-    }
-
-    if (xx > 0)
-    {
-        s.resize(pos, 0);
-    }
-    else
-    {
-        s.resize(1, 0);
-        s[0] = '0';
-        return s;
-    }
-
-    x = xx;
-
-    while (x != 0)
-    {
-        s[--pos] = x % 10 + '0';
-
-        x /= 10;
-    }
-
-    return s;
-}
-//-----------------------------------------------------------------------------
-int str2x(const std::string & str, int & x);
-int str2x(const std::string & str, unsigned & x);
-int str2x(const std::string & str, long & x);
-int str2x(const std::string & str, unsigned long & x);
-#ifndef WIN32
-int str2x(const std::string & str, long long & x);
-int str2x(const std::string & str, unsigned long long & x);
-#endif
-//-----------------------------------------------------------------------------
-const std::string & x2str(unsigned x, std::string & s);
-const std::string & x2str(unsigned long x, std::string & s);
-const std::string & x2str(unsigned long long x, std::string & s);
-//-----------------------------------------------------------------------------
-char * stg_strptime(const char *, const char *, struct tm *);
-time_t stg_timegm(struct tm *);
-
-#endif
diff --git a/stglibs/common.lib/include/stg/common.h b/stglibs/common.lib/include/stg/common.h
new file mode 100644 (file)
index 0000000..ac09114
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+ /*
+ $Revision: 1.32 $
+ $Date: 2010/11/08 10:11:19 $
+ $Author: faust $
+ */
+
+#ifndef common_h
+#define common_h
+
+#ifdef __BORLANDC__
+#include <time.h>
+#else
+#include <ctime>
+#endif
+#include <string>
+
+#include "stg/os_int.h"
+#include "stg/const.h"
+
+#define STAT_TIME_3         (1)
+#define STAT_TIME_2         (2)
+#define STAT_TIME_1         (3)
+#define STAT_TIME_1_2       (4)
+#define STAT_TIME_1_4       (5)
+#define STAT_TIME_1_6       (6)
+
+#define FN_STR_LEN      (NAME_MAX)
+
+#define ST_F    0
+#define ST_B    1
+#define ST_KB   2
+#define ST_MB   3
+
+//-----------------------------------------------------------------------------
+const char    * IntToKMG(long long a, int statType = ST_F);
+const char    * LogDate(time_t t);
+int             ParesTimeStat(const char * str);
+int             IsTimeStat(struct tm * t, int statTime);
+/*bool            IsDigit(char c);
+bool            IsAlpha(char c);*/
+int             strtodouble2(const char * s, double &a);
+int             printfd(const char * __file__, const char * fmt, ...);
+void            Encode12(char * dst, const char * src, size_t srcLen);
+void            Decode21(char * dst, const char * src);
+
+void            Encode12str(std::string & dst, const std::string & src);
+void            Decode21str(std::string & dst, const std::string & src);
+
+int             ParseIPString(const char * str, uint32_t * ips, int maxIP);
+void            KOIToWin(const char * s1, char * s2, int l);
+void            WinToKOI(const char * s1, char * s2, int l);
+void            KOIToWin(const std::string & s1, std::string * s2);
+void            WinToKOI(const std::string & s1, std::string * s2);
+int             DaysInMonth(unsigned year, unsigned mon);
+int             DaysInCurrentMonth();
+int             Min8(int a);
+//char          * inet_ntostr(unsigned long);
+std::string     inet_ntostring(uint32_t);
+uint32_t        inet_strington(const std::string & value);
+int             strprintf(std::string * str, const char * fmt, ...);
+int             ParseTariffTimeStr(const char * str, int &h1, int &m1, int &h2, int &m2);
+uint32_t        CalcMask(uint32_t msk);
+void            TouchFile(const std::string & fileName);
+#ifdef WIN32
+void            EncodeStr(char * str, unsigned long serial, int useHDD);
+void            DecodeStr(char * str, unsigned long serial, int useHDD);
+#endif //WIN32
+void            SwapBytes(uint16_t & value);
+void            SwapBytes(uint32_t & value);
+void            SwapBytes(uint64_t & value);
+void            SwapBytes(int16_t & value);
+void            SwapBytes(int32_t & value);
+void            SwapBytes(int64_t & value);
+
+std::string &   TrimL(std::string & val);
+std::string &   TrimR(std::string & val);
+std::string &   Trim(std::string & val);
+
+std::string     IconvString(const std::string & source, const std::string & from, const std::string & to);
+
+int ParseInt(const std::string & str, int * val);
+int ParseUnsigned(const std::string & str, unsigned * val);
+int ParseIntInRange(const std::string & str, int min, int max, int * val);
+int ParseUnsignedInRange(const std::string & str, unsigned min,
+                         unsigned max, unsigned * val);
+int ParseYesNo(const std::string & str, bool * val);
+
+bool WaitPackets(int sd);
+
+//-----------------------------------------------------------------------------
+template <typename varT>
+int str2x(const std::string & str, varT & x)
+{
+    int pos = 0;
+    int minus = 1;
+
+    if (str.empty())
+        return -1;
+
+    if (str[0] == '+')
+        pos++;
+
+    if (str[0] == '-')
+    {
+        pos++;
+        minus = -1;
+    }
+
+    if ((str[pos] < '0' || str[pos] > '9'))
+        return -1;
+
+    x = str[pos++] - '0';
+
+    for (unsigned i = pos; i < str.size(); i++)
+    {
+        if ((str[i] < '0' || str[i] > '9'))
+            return -1;
+
+        x *= 10;
+        x += str[i] - '0';
+    }
+
+    x*= minus;
+
+    return 0;
+}
+//-----------------------------------------------------------------------------
+template <typename varT>
+const std::string & x2str(varT x, std::string & s)
+{
+    varT xx = x;
+    int pos = 1;
+
+    x /= 10;
+    while (x != 0)
+    {
+        x /= 10;
+        pos++;
+    }
+
+    if (xx < 0)
+    {
+        pos++;
+        s.resize(pos, 0);
+        s[0] = '-';
+    }
+    else if (xx > 0)
+    {
+        s.resize(pos, 0);
+    }
+    else
+    {
+        s.resize(1, 0);
+        s[0] = '0';
+        return s;
+    }
+
+    x = xx;
+
+    while (x != 0)
+    {
+        if (x < 0)
+            s[--pos] = -(x % 10) + '0';
+        else
+            s[--pos] = x % 10 + '0';
+
+        x /= 10;
+    }
+
+    return s;
+}
+//-----------------------------------------------------------------------------
+template <typename varT>
+const std::string & unsigned2str(varT x, std::string & s)
+{
+    varT xx = x;
+    int pos = 1;
+
+    x /= 10;
+    while (x != 0)
+    {
+        x /= 10;
+        pos++;
+    }
+
+    if (xx > 0)
+    {
+        s.resize(pos, 0);
+    }
+    else
+    {
+        s.resize(1, 0);
+        s[0] = '0';
+        return s;
+    }
+
+    x = xx;
+
+    while (x != 0)
+    {
+        s[--pos] = x % 10 + '0';
+
+        x /= 10;
+    }
+
+    return s;
+}
+//-----------------------------------------------------------------------------
+int str2x(const std::string & str, int & x);
+int str2x(const std::string & str, unsigned & x);
+int str2x(const std::string & str, long & x);
+int str2x(const std::string & str, unsigned long & x);
+#ifndef WIN32
+int str2x(const std::string & str, long long & x);
+int str2x(const std::string & str, unsigned long long & x);
+#endif
+//-----------------------------------------------------------------------------
+const std::string & x2str(unsigned x, std::string & s);
+const std::string & x2str(unsigned long x, std::string & s);
+const std::string & x2str(unsigned long long x, std::string & s);
+//-----------------------------------------------------------------------------
+char * stg_strptime(const char *, const char *, struct tm *);
+time_t stg_timegm(struct tm *);
+
+#endif
diff --git a/stglibs/conffiles.lib/conffiles.h b/stglibs/conffiles.lib/conffiles.h
deleted file mode 100644 (file)
index 6909c6c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Date: 27.10.2002
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@ua.fm>
- */
-
-/*
- $Revision: 1.5 $
- $Date: 2009/06/22 16:00:38 $
- */
-
-//---------------------------------------------------------------------------
-
-#ifndef ConfFilesH
-#define ConfFilesH
-
-#include <map>
-#include <string>
-
-#include "stg/os_int.h"
-
-using namespace std;
-//---------------------------------------------------------------------------
-
-typedef bool (*StringCaseCmp_t)(const string & str1, const string & str2);
-
-class CONFIGFILE
-{
-public:
-    CONFIGFILE(const string & fn, bool nook = false);
-    ~CONFIGFILE();
-    const string & GetFileName() const;
-
-    // æÕÎËÃÉÉ Read* ×ÏÚ×ÒÁÝÁÀÔ 0 ÐÒÉ ÕÓÐÅÛÎÏÍ ÓÞÉÔÙ×ÁÎÉÉ
-    // É EINVAL ÐÒÉ ÏÔÓÕÔÓ×ÉÉ ÐÁÒÁÍÅÔÒÁ É ×ÙÓÔÁ×ÌÑÀÔ defaulValue
-    //int ReadString(const string & param, char * val, int * maxLen, const char * defaultVal) const;
-    int ReadString(const string & param, string * val, const string & defaultVal) const;
-    int ReadTime(const string & param, time_t *, time_t) const;
-    int ReadShortInt(const string & param, short int *, short int) const;
-    int ReadInt(const string & param, int *, int) const;
-    int ReadLongInt(const string & param, long int *, long int) const;
-    int ReadLongLongInt(const string & param, int64_t *, int64_t) const;
-    int ReadUShortInt(const string & param, unsigned short int *, unsigned short int) const;
-    int ReadUInt(const string & param, unsigned int *, unsigned int) const;
-    int ReadULongInt(const string & param, unsigned long int *, unsigned long int) const;
-    int ReadULongLongInt(const string & param, uint64_t *, uint64_t) const;
-    int ReadDouble(const string & param, double * val, double defaultVal) const;
-
-    void WriteString(const string & param, const char * val) { return WriteString(param, std::string(val)); }
-    void WriteString(const string & param, const string & val);
-    void WriteInt(const string & param, int64_t val);
-    void WriteDouble(const string & param, double val);
-
-    int Error() const;
-    int Flush() const;
-
-private:
-    map<string, string, StringCaseCmp_t> param_val;
-    string fileName;
-    mutable int error;
-    mutable bool changed;
-
-    int Flush(const std::string & path) const;
-};
-//---------------------------------------------------------------------------
-#endif
diff --git a/stglibs/conffiles.lib/include/stg/conffiles.h b/stglibs/conffiles.lib/include/stg/conffiles.h
new file mode 100644 (file)
index 0000000..6909c6c
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Date: 27.10.2002
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@ua.fm>
+ */
+
+/*
+ $Revision: 1.5 $
+ $Date: 2009/06/22 16:00:38 $
+ */
+
+//---------------------------------------------------------------------------
+
+#ifndef ConfFilesH
+#define ConfFilesH
+
+#include <map>
+#include <string>
+
+#include "stg/os_int.h"
+
+using namespace std;
+//---------------------------------------------------------------------------
+
+typedef bool (*StringCaseCmp_t)(const string & str1, const string & str2);
+
+class CONFIGFILE
+{
+public:
+    CONFIGFILE(const string & fn, bool nook = false);
+    ~CONFIGFILE();
+    const string & GetFileName() const;
+
+    // æÕÎËÃÉÉ Read* ×ÏÚ×ÒÁÝÁÀÔ 0 ÐÒÉ ÕÓÐÅÛÎÏÍ ÓÞÉÔÙ×ÁÎÉÉ
+    // É EINVAL ÐÒÉ ÏÔÓÕÔÓ×ÉÉ ÐÁÒÁÍÅÔÒÁ É ×ÙÓÔÁ×ÌÑÀÔ defaulValue
+    //int ReadString(const string & param, char * val, int * maxLen, const char * defaultVal) const;
+    int ReadString(const string & param, string * val, const string & defaultVal) const;
+    int ReadTime(const string & param, time_t *, time_t) const;
+    int ReadShortInt(const string & param, short int *, short int) const;
+    int ReadInt(const string & param, int *, int) const;
+    int ReadLongInt(const string & param, long int *, long int) const;
+    int ReadLongLongInt(const string & param, int64_t *, int64_t) const;
+    int ReadUShortInt(const string & param, unsigned short int *, unsigned short int) const;
+    int ReadUInt(const string & param, unsigned int *, unsigned int) const;
+    int ReadULongInt(const string & param, unsigned long int *, unsigned long int) const;
+    int ReadULongLongInt(const string & param, uint64_t *, uint64_t) const;
+    int ReadDouble(const string & param, double * val, double defaultVal) const;
+
+    void WriteString(const string & param, const char * val) { return WriteString(param, std::string(val)); }
+    void WriteString(const string & param, const string & val);
+    void WriteInt(const string & param, int64_t val);
+    void WriteDouble(const string & param, double val);
+
+    int Error() const;
+    int Flush() const;
+
+private:
+    map<string, string, StringCaseCmp_t> param_val;
+    string fileName;
+    mutable int error;
+    mutable bool changed;
+
+    int Flush(const std::string & path) const;
+};
+//---------------------------------------------------------------------------
+#endif
diff --git a/stglibs/crypto.lib/ag_md5.h b/stglibs/crypto.lib/ag_md5.h
deleted file mode 100644 (file)
index b278f97..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _MD5_H
-#define _MD5_H
-
-#include <time.h>
-
-#include "stg/os_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct MD5Context {
-       uint32_t buf[4];
-       uint32_t bits[2];
-       unsigned char in[64];
-};
-
-typedef struct MD5Context MD5_CTX;
-
-char *crypt_make_salt(void);
-void byteReverse(unsigned char*, unsigned);
-void MD5Init(struct MD5Context *ctx);
-void MD5Update(struct MD5Context*, char const*, unsigned);
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
-void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
-char *libshadow_md5_crypt(const char*, const char*);
-char *pw_encrypt(const char*, const char*);
-
-/* AG functions */
-char *make_ag_hash(time_t salt, const char *clear);
-int check_ag_hash(time_t salt, const char *clear, const char *hash);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/stglibs/crypto.lib/blowfish.h b/stglibs/crypto.lib/blowfish.h
deleted file mode 100644 (file)
index a8800d7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Author     :  Paul Kocher
- * E-mail     :  pck@netcom.com
- * Date       :  1997
- * Description:  C implementation of the Blowfish algorithm.
- */
-
-#ifndef BLOWFISH_H
-#define BLOWFISH_H
-
-#include "stg/os_int.h"
-
-#define MAXKEYBYTES 56          /* 448 bits */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-  uint32_t P[16 + 2];
-  uint32_t S[4][256];
-} BLOWFISH_CTX;
-
-void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen);
-void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr);
-void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr);
-
-void EnDecodeInit(const char * key, size_t length, BLOWFISH_CTX *ctx);
-void DecodeString(char * d, const char * s, BLOWFISH_CTX *ctx);
-void EncodeString(char * d, const char * s, BLOWFISH_CTX *ctx);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/stglibs/crypto.lib/include/stg/ag_md5.h b/stglibs/crypto.lib/include/stg/ag_md5.h
new file mode 100644 (file)
index 0000000..b278f97
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _MD5_H
+#define _MD5_H
+
+#include <time.h>
+
+#include "stg/os_int.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct MD5Context {
+       uint32_t buf[4];
+       uint32_t bits[2];
+       unsigned char in[64];
+};
+
+typedef struct MD5Context MD5_CTX;
+
+char *crypt_make_salt(void);
+void byteReverse(unsigned char*, unsigned);
+void MD5Init(struct MD5Context *ctx);
+void MD5Update(struct MD5Context*, char const*, unsigned);
+void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
+void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
+char *libshadow_md5_crypt(const char*, const char*);
+char *pw_encrypt(const char*, const char*);
+
+/* AG functions */
+char *make_ag_hash(time_t salt, const char *clear);
+int check_ag_hash(time_t salt, const char *clear, const char *hash);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/stglibs/crypto.lib/include/stg/blowfish.h b/stglibs/crypto.lib/include/stg/blowfish.h
new file mode 100644 (file)
index 0000000..a8800d7
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Author     :  Paul Kocher
+ * E-mail     :  pck@netcom.com
+ * Date       :  1997
+ * Description:  C implementation of the Blowfish algorithm.
+ */
+
+#ifndef BLOWFISH_H
+#define BLOWFISH_H
+
+#include "stg/os_int.h"
+
+#define MAXKEYBYTES 56          /* 448 bits */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+  uint32_t P[16 + 2];
+  uint32_t S[4][256];
+} BLOWFISH_CTX;
+
+void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen);
+void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr);
+void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr);
+
+void EnDecodeInit(const char * key, size_t length, BLOWFISH_CTX *ctx);
+void DecodeString(char * d, const char * s, BLOWFISH_CTX *ctx);
+void EncodeString(char * d, const char * s, BLOWFISH_CTX *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/stglibs/dotconfpp.lib/dotconfpp.h b/stglibs/dotconfpp.lib/dotconfpp.h
deleted file mode 100644 (file)
index 8c2a82a..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*  Copyright (C) 2003 Aleksey Krivoshey <voodoo@foss.kharkov.ua>
-*
-*   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
-#ifndef DOTCONFPP_H
-#define DOTCONFPP_H
-
-#include <list>
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include "stg/os_int.h"
-
-typedef void (* DOTCONFCallback) (void * data, const char * buf);
-
-class DOTCONFDocument;
-class AsyncDNSMemPool;
-
-class DOTCONFDocumentNode
-{
-friend class DOTCONFDocument;
-private:
-    DOTCONFDocumentNode * previousNode;
-    DOTCONFDocumentNode * nextNode;
-    DOTCONFDocumentNode * parentNode;
-    DOTCONFDocumentNode * childNode;
-    char ** values;
-    int valuesCount;
-    char * name;
-    const DOTCONFDocument * document;
-    int lineNum;
-    char * fileName;
-    bool closed;
-
-    void pushValue(char * _value);
-
-public:
-    DOTCONFDocumentNode();
-    ~DOTCONFDocumentNode();
-
-    const char * getConfigurationFileName() const { return fileName; }
-    int getConfigurationLineNumber() const { return lineNum; }
-
-    const DOTCONFDocumentNode * getNextNode() const { return nextNode; }
-    const DOTCONFDocumentNode * getPreviuosNode() const { return previousNode; }
-    const DOTCONFDocumentNode * getParentNode() const { return parentNode; }
-    const DOTCONFDocumentNode * getChildNode() const { return childNode; }
-    const char * getValue(int index = 0) const;
-    const char * getName() const { return name; }
-    const DOTCONFDocument * getDocument() const { return document; }
-};
-
-class DOTCONFDocument
-{
-public:
-    enum CaseSensitive { CASESENSITIVE, CASEINSENSITIVE };
-protected:
-    AsyncDNSMemPool * mempool;    
-private:
-    DOTCONFDocumentNode * curParent;
-    DOTCONFDocumentNode * curPrev;
-    DOTCONFCallback errorCallback;
-    void * errorCallbackData;
-    int curLine;
-    bool quoted;
-    std::list<DOTCONFDocumentNode *> nodeTree;
-    std::list<char *> requiredOptions;
-    std::list<char *> processedFiles;
-    FILE * file;
-    char * fileName;
-    std::list<char *> words;
-    int (* cmp_func)(const char *, const char *);
-
-    int checkRequiredOptions();
-    int parseLine();
-    int parseFile(DOTCONFDocumentNode * _parent = NULL);
-    int checkConfig(const std::list<DOTCONFDocumentNode *>::iterator & from);
-    int cleanupLine(char * line);
-    char * getSubstitution(char * macro, int lineNum);
-    int macroSubstitute(DOTCONFDocumentNode * tagNode, int valueIndex);
-
-protected:
-    virtual void error(int lineNum, const char * fileName, const char * fmt, ...);
-
-public:
-    DOTCONFDocument(CaseSensitive caseSensitivity = CASESENSITIVE);
-    virtual ~DOTCONFDocument();
-
-    void setErrorCallback(DOTCONFCallback _callback, void * _data) { errorCallback = _callback; errorCallbackData = _data; };
-
-    int setContent(const char * _fileName);
-
-    void setRequiredOptionNames(const char ** requiredOptionNames); // !TERMINATE ARRAY WITH NULL
-    const DOTCONFDocumentNode * getFirstNode() const;    
-    const DOTCONFDocumentNode * findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode = NULL, const DOTCONFDocumentNode * startNode = NULL) const;
-};
-
-#endif
diff --git a/stglibs/dotconfpp.lib/include/stg/dotconfpp.h b/stglibs/dotconfpp.lib/include/stg/dotconfpp.h
new file mode 100644 (file)
index 0000000..8c2a82a
--- /dev/null
@@ -0,0 +1,122 @@
+/*  Copyright (C) 2003 Aleksey Krivoshey <voodoo@foss.kharkov.ua>
+*
+*   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+#ifndef DOTCONFPP_H
+#define DOTCONFPP_H
+
+#include <list>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include "stg/os_int.h"
+
+typedef void (* DOTCONFCallback) (void * data, const char * buf);
+
+class DOTCONFDocument;
+class AsyncDNSMemPool;
+
+class DOTCONFDocumentNode
+{
+friend class DOTCONFDocument;
+private:
+    DOTCONFDocumentNode * previousNode;
+    DOTCONFDocumentNode * nextNode;
+    DOTCONFDocumentNode * parentNode;
+    DOTCONFDocumentNode * childNode;
+    char ** values;
+    int valuesCount;
+    char * name;
+    const DOTCONFDocument * document;
+    int lineNum;
+    char * fileName;
+    bool closed;
+
+    void pushValue(char * _value);
+
+public:
+    DOTCONFDocumentNode();
+    ~DOTCONFDocumentNode();
+
+    const char * getConfigurationFileName() const { return fileName; }
+    int getConfigurationLineNumber() const { return lineNum; }
+
+    const DOTCONFDocumentNode * getNextNode() const { return nextNode; }
+    const DOTCONFDocumentNode * getPreviuosNode() const { return previousNode; }
+    const DOTCONFDocumentNode * getParentNode() const { return parentNode; }
+    const DOTCONFDocumentNode * getChildNode() const { return childNode; }
+    const char * getValue(int index = 0) const;
+    const char * getName() const { return name; }
+    const DOTCONFDocument * getDocument() const { return document; }
+};
+
+class DOTCONFDocument
+{
+public:
+    enum CaseSensitive { CASESENSITIVE, CASEINSENSITIVE };
+protected:
+    AsyncDNSMemPool * mempool;    
+private:
+    DOTCONFDocumentNode * curParent;
+    DOTCONFDocumentNode * curPrev;
+    DOTCONFCallback errorCallback;
+    void * errorCallbackData;
+    int curLine;
+    bool quoted;
+    std::list<DOTCONFDocumentNode *> nodeTree;
+    std::list<char *> requiredOptions;
+    std::list<char *> processedFiles;
+    FILE * file;
+    char * fileName;
+    std::list<char *> words;
+    int (* cmp_func)(const char *, const char *);
+
+    int checkRequiredOptions();
+    int parseLine();
+    int parseFile(DOTCONFDocumentNode * _parent = NULL);
+    int checkConfig(const std::list<DOTCONFDocumentNode *>::iterator & from);
+    int cleanupLine(char * line);
+    char * getSubstitution(char * macro, int lineNum);
+    int macroSubstitute(DOTCONFDocumentNode * tagNode, int valueIndex);
+
+protected:
+    virtual void error(int lineNum, const char * fileName, const char * fmt, ...);
+
+public:
+    DOTCONFDocument(CaseSensitive caseSensitivity = CASESENSITIVE);
+    virtual ~DOTCONFDocument();
+
+    void setErrorCallback(DOTCONFCallback _callback, void * _data) { errorCallback = _callback; errorCallbackData = _data; };
+
+    int setContent(const char * _fileName);
+
+    void setRequiredOptionNames(const char ** requiredOptionNames); // !TERMINATE ARRAY WITH NULL
+    const DOTCONFDocumentNode * getFirstNode() const;    
+    const DOTCONFDocumentNode * findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode = NULL, const DOTCONFDocumentNode * startNode = NULL) const;
+};
+
+#endif
diff --git a/stglibs/ia.lib/ia.h b/stglibs/ia.lib/ia.h
deleted file mode 100644 (file)
index 9c8ea37..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-** 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*
- $Author: faust $
- $Revision: 1.10 $
- $Date: 2010/03/15 12:57:24 $
-*/
-
-/*
-* Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
-*/
-//---------------------------------------------------------------------------
-#ifndef IA_AUTH_C_H
-#define IA_AUTH_C_H
-
-#ifndef WIN32
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#else
-#include <winsock2.h>
-#endif
-
-#include <string>
-#include <vector>
-#include <map>
-
-#include "stg/blowfish.h"
-#include "stg/ia_packets.h"
-
-#define IA_BIND_ERROR           (1)
-#define IA_SERVER_ERROR         (2)
-#define IA_FCNTL_ERROR          (3)
-#define IA_GETHOSTBYNAME_ERROR  (4)
-
-#define IA_PROTO_VER            (8)
-#define IA_PROTO_PROXY_VER      (101)
-
-using namespace std;
-
-typedef void (*tpStatusChangedCb)(int status, void * data);
-typedef void (*tpStatChangedCb)(const LOADSTAT & stat, void * data);
-typedef void (*tpCallBackInfoFn)(const string & message, int infoType, int showTime, int sendTime, void * data);
-typedef void (*tpCallBackErrorFn)(const string & message, int netError, void * data);
-typedef void (*tpCallBackDirNameFn)(const vector<string> & dirName, void * data);
-
-//---------------------------------------------------------------------------
-class IA_CLIENT_PROT
-{
-#ifdef WIN32
-friend unsigned long WINAPI RunW(void * data);
-#else
-friend void * RunL(void * data);
-#endif
-
-public:
-    IA_CLIENT_PROT(const string & sn, uint16_t p, uint16_t localPort = 0);
-    ~IA_CLIENT_PROT();
-
-    void        Start();
-    void        Stop();
-    void        GetStat(LOADSTAT * ls);
-
-    void        SetServer(const string & sn, unsigned short port);
-    void        SetLogin(const string & login);
-    void        SetPassword(const string & password);
-    void        SetEnabledDirs(const bool * selectedDirs);
-
-    void        SetStatusChangedCb(tpStatusChangedCb p, void * data);
-    void        SetStatChangedCb(tpStatChangedCb p, void * data);
-    void        SetInfoCb(tpCallBackInfoFn p, void * data);
-    void        SetErrorCb(tpCallBackErrorFn p, void * data);
-    void        SetDirNameCb(tpCallBackDirNameFn p, void * data);
-
-    int         Connect();
-    int         Disconnect();
-    int         GetAuthorized() const { return phase == 3 || phase == 4; };
-    int         GetPhase() const { return phase; };
-    int         GetStatus() const;
-    int         GetReconnect() const { return reconnect; };
-    void        SetReconnect(int r) { reconnect = r; };
-    char        GetProtoVer() const { return proxyMode ? IA_PROTO_PROXY_VER : IA_PROTO_VER; };
-    void        GetMessageText(string * text) const { *text = messageText; };
-    void        GetInfoText(string * text) const { *text = infoText; };
-    int         GetStrError(string * error) const;
-
-    void        SetProxyMode(bool on) { proxyMode = on; };
-    bool        GetProxyMode() const { return proxyMode; };
-
-    void        SetIP(uint32_t ip) { IA_CLIENT_PROT::ip = ip; };
-    uint32_t    GetIP() const { return ip; };
-
-private:
-    void            Run();
-    int             NetRecv();
-    int             NetSend(int n);
-    bool            GetNonstop() const { return nonstop; };
-    void            PrepareNet();
-    int             DeterminatePacketType(const char * buffer);
-
-    int             Process_CONN_SYN_ACK_8(const char * buffer);
-    int             Process_ALIVE_SYN_8(const char * buffer);
-    int             Process_DISCONN_SYN_ACK_8(const char * buffer);
-    int             Process_FIN_8(const char * buffer);
-    int             Process_INFO_8(const char * buffer);
-    int             Process_ERROR(const char * buffer);
-
-    int             Prepare_CONN_SYN_8(char * buffer);
-    int             Prepare_CONN_ACK_8(char * buffer);
-    int             Prepare_ALIVE_ACK_8(char * buffer);
-    int             Prepare_DISCONN_SYN_8(char * buffer);
-    int             Prepare_DISCONN_ACK_8(char * buffer);
-
-    void            FillHdr8(char * buffer, unsigned long ip);
-    int             Send(char * buffer, int len);
-    int             Recv(char * buffer, int len);
-
-    LOADSTAT        stat;
-    int             action;
-    int             phase;
-    int             phaseTime;
-    string          messageText;
-    string          infoText;
-    mutable string  strError;
-    mutable int     codeError;
-    bool            nonstop;
-    bool            isNetPrepared;
-    bool            proxyMode;
-
-    BLOWFISH_CTX    ctxPass;
-    BLOWFISH_CTX    ctxHdr;
-
-    bool            selectedDirs[DIR_NUM];
-
-    string          password;
-    string          login;
-
-    #ifdef WIN32
-    WSADATA wsaData;
-    #else
-    pthread_t thread;
-    #endif
-
-    string          serverName;
-    uint16_t        port;
-    uint32_t        ip;
-    uint32_t        localPort;
-
-    struct sockaddr_in  servAddr;
-
-    bool            firstConnect;
-    int             reconnect;
-    int             sockr;
-    int             protNum;
-    int             userTimeout;
-    int             aliveTimeout;
-    unsigned int    rnd;
-
-    tpStatusChangedCb   pStatusChangedCb;
-    tpStatChangedCb     pStatChangedCb;
-    tpCallBackInfoFn    pInfoCb;
-    tpCallBackErrorFn   pErrorCb;
-    tpCallBackDirNameFn pDirNameCb;
-
-    void              * statusChangedCbData;
-    void              * statChangedCbData;
-    void              * infoCbData;
-    void              * errorCbData;
-    void              * dirNameCbData;
-
-    map<string, int>    packetTypes;
-
-    CONN_SYN_8        * connSyn8;
-    CONN_SYN_ACK_8    * connSynAck8;
-    CONN_ACK_8        * connAck8;
-    ALIVE_SYN_8       * aliveSyn8;
-    ALIVE_ACK_8       * aliveAck8;
-    DISCONN_SYN_8     * disconnSyn8;
-    DISCONN_SYN_ACK_8 * disconnSynAck8;
-    DISCONN_ACK_8     * disconnAck8;
-    INFO_8            * info;
-};
-//---------------------------------------------------------------------------
-#ifdef WIN32
-unsigned long WINAPI RunW(void *);
-#else
-void * RunW(void *);
-#endif
-
-//---------------------------------------------------------------------------
-#endif //IA_AUTH_C_H
diff --git a/stglibs/ia.lib/include/stg/ia.h b/stglibs/ia.lib/include/stg/ia.h
new file mode 100644 (file)
index 0000000..9c8ea37
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+** 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ $Author: faust $
+ $Revision: 1.10 $
+ $Date: 2010/03/15 12:57:24 $
+*/
+
+/*
+* Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+*/
+//---------------------------------------------------------------------------
+#ifndef IA_AUTH_C_H
+#define IA_AUTH_C_H
+
+#ifndef WIN32
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <pthread.h>
+#else
+#include <winsock2.h>
+#endif
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "stg/blowfish.h"
+#include "stg/ia_packets.h"
+
+#define IA_BIND_ERROR           (1)
+#define IA_SERVER_ERROR         (2)
+#define IA_FCNTL_ERROR          (3)
+#define IA_GETHOSTBYNAME_ERROR  (4)
+
+#define IA_PROTO_VER            (8)
+#define IA_PROTO_PROXY_VER      (101)
+
+using namespace std;
+
+typedef void (*tpStatusChangedCb)(int status, void * data);
+typedef void (*tpStatChangedCb)(const LOADSTAT & stat, void * data);
+typedef void (*tpCallBackInfoFn)(const string & message, int infoType, int showTime, int sendTime, void * data);
+typedef void (*tpCallBackErrorFn)(const string & message, int netError, void * data);
+typedef void (*tpCallBackDirNameFn)(const vector<string> & dirName, void * data);
+
+//---------------------------------------------------------------------------
+class IA_CLIENT_PROT
+{
+#ifdef WIN32
+friend unsigned long WINAPI RunW(void * data);
+#else
+friend void * RunL(void * data);
+#endif
+
+public:
+    IA_CLIENT_PROT(const string & sn, uint16_t p, uint16_t localPort = 0);
+    ~IA_CLIENT_PROT();
+
+    void        Start();
+    void        Stop();
+    void        GetStat(LOADSTAT * ls);
+
+    void        SetServer(const string & sn, unsigned short port);
+    void        SetLogin(const string & login);
+    void        SetPassword(const string & password);
+    void        SetEnabledDirs(const bool * selectedDirs);
+
+    void        SetStatusChangedCb(tpStatusChangedCb p, void * data);
+    void        SetStatChangedCb(tpStatChangedCb p, void * data);
+    void        SetInfoCb(tpCallBackInfoFn p, void * data);
+    void        SetErrorCb(tpCallBackErrorFn p, void * data);
+    void        SetDirNameCb(tpCallBackDirNameFn p, void * data);
+
+    int         Connect();
+    int         Disconnect();
+    int         GetAuthorized() const { return phase == 3 || phase == 4; };
+    int         GetPhase() const { return phase; };
+    int         GetStatus() const;
+    int         GetReconnect() const { return reconnect; };
+    void        SetReconnect(int r) { reconnect = r; };
+    char        GetProtoVer() const { return proxyMode ? IA_PROTO_PROXY_VER : IA_PROTO_VER; };
+    void        GetMessageText(string * text) const { *text = messageText; };
+    void        GetInfoText(string * text) const { *text = infoText; };
+    int         GetStrError(string * error) const;
+
+    void        SetProxyMode(bool on) { proxyMode = on; };
+    bool        GetProxyMode() const { return proxyMode; };
+
+    void        SetIP(uint32_t ip) { IA_CLIENT_PROT::ip = ip; };
+    uint32_t    GetIP() const { return ip; };
+
+private:
+    void            Run();
+    int             NetRecv();
+    int             NetSend(int n);
+    bool            GetNonstop() const { return nonstop; };
+    void            PrepareNet();
+    int             DeterminatePacketType(const char * buffer);
+
+    int             Process_CONN_SYN_ACK_8(const char * buffer);
+    int             Process_ALIVE_SYN_8(const char * buffer);
+    int             Process_DISCONN_SYN_ACK_8(const char * buffer);
+    int             Process_FIN_8(const char * buffer);
+    int             Process_INFO_8(const char * buffer);
+    int             Process_ERROR(const char * buffer);
+
+    int             Prepare_CONN_SYN_8(char * buffer);
+    int             Prepare_CONN_ACK_8(char * buffer);
+    int             Prepare_ALIVE_ACK_8(char * buffer);
+    int             Prepare_DISCONN_SYN_8(char * buffer);
+    int             Prepare_DISCONN_ACK_8(char * buffer);
+
+    void            FillHdr8(char * buffer, unsigned long ip);
+    int             Send(char * buffer, int len);
+    int             Recv(char * buffer, int len);
+
+    LOADSTAT        stat;
+    int             action;
+    int             phase;
+    int             phaseTime;
+    string          messageText;
+    string          infoText;
+    mutable string  strError;
+    mutable int     codeError;
+    bool            nonstop;
+    bool            isNetPrepared;
+    bool            proxyMode;
+
+    BLOWFISH_CTX    ctxPass;
+    BLOWFISH_CTX    ctxHdr;
+
+    bool            selectedDirs[DIR_NUM];
+
+    string          password;
+    string          login;
+
+    #ifdef WIN32
+    WSADATA wsaData;
+    #else
+    pthread_t thread;
+    #endif
+
+    string          serverName;
+    uint16_t        port;
+    uint32_t        ip;
+    uint32_t        localPort;
+
+    struct sockaddr_in  servAddr;
+
+    bool            firstConnect;
+    int             reconnect;
+    int             sockr;
+    int             protNum;
+    int             userTimeout;
+    int             aliveTimeout;
+    unsigned int    rnd;
+
+    tpStatusChangedCb   pStatusChangedCb;
+    tpStatChangedCb     pStatChangedCb;
+    tpCallBackInfoFn    pInfoCb;
+    tpCallBackErrorFn   pErrorCb;
+    tpCallBackDirNameFn pDirNameCb;
+
+    void              * statusChangedCbData;
+    void              * statChangedCbData;
+    void              * infoCbData;
+    void              * errorCbData;
+    void              * dirNameCbData;
+
+    map<string, int>    packetTypes;
+
+    CONN_SYN_8        * connSyn8;
+    CONN_SYN_ACK_8    * connSynAck8;
+    CONN_ACK_8        * connAck8;
+    ALIVE_SYN_8       * aliveSyn8;
+    ALIVE_ACK_8       * aliveAck8;
+    DISCONN_SYN_8     * disconnSyn8;
+    DISCONN_SYN_ACK_8 * disconnSynAck8;
+    DISCONN_ACK_8     * disconnAck8;
+    INFO_8            * info;
+};
+//---------------------------------------------------------------------------
+#ifdef WIN32
+unsigned long WINAPI RunW(void *);
+#else
+void * RunW(void *);
+#endif
+
+//---------------------------------------------------------------------------
+#endif //IA_AUTH_C_H
diff --git a/stglibs/ibpp.lib/ibpp.h b/stglibs/ibpp.lib/ibpp.h
deleted file mode 100644 (file)
index 37a19ad..0000000
+++ /dev/null
@@ -1,929 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     File    : $Id: ibpp.h,v 1.3 2007/10/28 11:17:44 nobunaga Exp $\r
-//     Subject : IBPP public header file. This is _the_ only file you include in\r
-//                       your application files when developing with IBPP.\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     (C) Copyright 2000-2006 T.I.P. Group S.A. and the IBPP Team (www.ibpp.org)\r
-//\r
-//     The contents of this file are subject to the IBPP License (the "License");\r
-//     you may not use this file except in compliance with the License.  You may\r
-//     obtain a copy of the License at http://www.ibpp.org or in the 'license.txt'\r
-//     file which must have been distributed along with this file.\r
-//\r
-//     This software, distributed under the License, is distributed on an "AS IS"\r
-//     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the\r
-//     License for the specific language governing rights and limitations\r
-//     under the License.\r
-//\r
-//     Contributor(s):\r
-//\r
-//             Olivier Mascia, main coding\r
-//             Matt Hortman, initial linux port\r
-//             Mark Jordan, design contributions\r
-//             Maxim Abrashkin, enhancement patches\r
-//             Torsten Martinsen, enhancement patches\r
-//             Michael Hieke, darwin (OS X) port, enhancement patches\r
-//             Val Samko, enhancement patches and debugging\r
-//             Mike Nordell, invaluable C++ advices\r
-//             Claudio Valderrama, help with not-so-well documented IB/FB features\r
-//             Many others, excellent suggestions, bug finding, and support\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     COMMENTS\r
-//     Tabulations should be set every four characters when editing this file.\r
-//\r
-//     When compiling a project using IBPP, the following defines should be made\r
-//     on the command-line (or in makefiles) according to the OS platform and\r
-//     compiler used.\r
-//\r
-//     Select the platform:    IBPP_WINDOWS | IBPP_LINUX | IBPP_DARWIN\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-\r
-#ifndef __IBPP_H__\r
-#define __IBPP_H__\r
-\r
-#if !defined(IBPP_WINDOWS) && !defined(IBPP_LINUX) && !defined(IBPP_DARWIN)\r
-#error Please define IBPP_WINDOWS/IBPP_LINUX/IBPP_DARWIN before compiling !\r
-#endif\r
-\r
-#if !defined(__BCPLUSPLUS__) && !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__DMC__)
-#error Your compiler is not recognized.\r
-#endif\r
-\r
-#if defined(IBPP_LINUX) || defined(IBPP_DARWIN)\r
-#define IBPP_UNIX      // IBPP_UNIX stands as a common denominator to *NIX flavours\r
-#endif\r
-\r
-// IBPP is written for 32 bits systems or higher.\r
-// The standard type 'int' is assumed to be at least 32 bits.\r
-// And the standard type 'short' is assumed to be exactly 16 bits.\r
-// Everywhere possible, where the exact size of an integer does not matter,\r
-// the standard type 'int' is used. And where an exact integer size is required\r
-// the standard exact precision types definitions of C 99 standard are used.\r
-\r
-#if defined(_MSC_VER) || defined(__DMC__) || defined(__BCPLUSPLUS__)\r
-// C99 §7.18.1.1 Exact-width integer types (only those used by IBPP)\r
-#if defined(_MSC_VER) && (_MSC_VER < 1300)     // MSVC 6 should be < 1300\r
-       typedef short int16_t;\r
-       typedef int int32_t;\r
-       typedef unsigned int uint32_t;\r
-#else\r
-       typedef __int16 int16_t;\r
-       typedef __int32 int32_t;\r
-       typedef unsigned __int32 uint32_t;\r
-#endif\r
-       typedef __int64 int64_t;\r
-#else\r
-       #include <stg/os_int.h>                 // C99 (§7.18) integer types definitions\r
-#endif\r
-\r
-#if !defined(_)\r
-#define _(s)   s\r
-#endif\r
-\r
-#include <exception>\r
-#include <string>\r
-#include <vector>\r
-\r
-namespace IBPP\r
-{\r
-       //      Typically you use this constant in a call IBPP::CheckVersion as in:\r
-       //      if (! IBPP::CheckVersion(IBPP::Version)) { throw .... ; }\r
-       const uint32_t Version = (2<<24) + (5<<16) + (3<<8) + 0; // Version == 2.5.3.0\r
-\r
-       //      Dates range checking\r
-       const int MinDate = -693594;    //  1 JAN 0001\r
-       const int MaxDate = 2958464;    // 31 DEC 9999\r
-       \r
-       //      Transaction Access Modes\r
-       enum TAM {amWrite, amRead};\r
-\r
-       //      Transaction Isolation Levels\r
-       enum TIL {ilConcurrency, ilReadDirty, ilReadCommitted, ilConsistency};\r
-\r
-       //      Transaction Lock Resolution\r
-       enum TLR {lrWait, lrNoWait};\r
-\r
-       // Transaction Table Reservation\r
-       enum TTR {trSharedWrite, trSharedRead, trProtectedWrite, trProtectedRead};\r
-\r
-       //      Prepared Statement Types\r
-       enum STT {stUnknown, stUnsupported,\r
-               stSelect, stInsert, stUpdate, stDelete, stDDL, stExecProcedure,\r
-               stSelectUpdate, stSetGenerator, stSavePoint};\r
-\r
-       //      SQL Data Types\r
-       enum SDT {sdArray, sdBlob, sdDate, sdTime, sdTimestamp, sdString,\r
-               sdSmallint, sdInteger, sdLargeint, sdFloat, sdDouble};\r
-\r
-       //      Array Data Types\r
-       enum ADT {adDate, adTime, adTimestamp, adString,\r
-               adBool, adInt16, adInt32, adInt64, adFloat, adDouble};\r
-\r
-       // Database::Shutdown Modes\r
-       enum DSM {dsForce, dsDenyTrans, dsDenyAttach};\r
-\r
-       // Service::StartBackup && Service::StartRestore Flags\r
-       enum BRF {\r
-               brVerbose = 0x1,\r
-               // Backup flags\r
-               brIgnoreChecksums = 0x100, brIgnoreLimbo = 0x200,\r
-               brMetadataOnly = 0x400, brNoGarbageCollect = 0x800,\r
-               brNonTransportable = 0x1000, brConvertExtTables = 0x2000,\r
-               // Restore flags\r
-               brReplace = 0x10000, brDeactivateIdx = 0x20000,\r
-               brNoShadow = 0x40000, brNoValidity = 0x80000,\r
-               brPerTableCommit = 0x100000, brUseAllSpace = 0x200000\r
-       };\r
-\r
-       // Service::Repair Flags\r
-       enum RPF\r
-       {\r
-               // Mandatory and mutually exclusives\r
-               rpMendRecords = 0x1, rpValidatePages = 0x2, rpValidateFull = 0x4,\r
-               // Options\r
-               rpReadOnly = 0x100, rpIgnoreChecksums = 0x200, rpKillShadows = 0x400\r
-       };\r
-\r
-       // TransactionFactory Flags\r
-       enum TFF {tfIgnoreLimbo = 0x1, tfAutoCommit = 0x2, tfNoAutoUndo = 0x4};\r
-\r
-       /* IBPP never return any error codes. It throws exceptions.\r
-        * On database engine reported errors, an IBPP::SQLException is thrown.\r
-        * In all other cases, IBPP throws IBPP::LogicException.\r
-        * Also note that the runtime and the language might also throw exceptions\r
-        * while executing some IBPP methods. A failing new operator will throw\r
-        * std::bad_alloc, IBPP does nothing to alter the standard behaviour.\r
-        *\r
-        *                    std::exception\r
-        *                           |\r
-        *                   IBPP::Exception\r
-        *                 /                 \\r
-        *    IBPP::LogicException    IBPP::SQLException\r
-        *             |\r
-        *      IBPP::WrongType\r
-        */\r
-\r
-       class Exception : public std::exception\r
-       {\r
-       public:\r
-               virtual const char* Origin() const throw() = 0;\r
-               virtual const char* ErrorMessage() const throw() = 0;   // Deprecated, use what()\r
-               virtual const char* what() const throw() = 0;\r
-               virtual ~Exception() throw();\r
-       };\r
-\r
-       class LogicException : public Exception\r
-       {\r
-       public:\r
-               virtual ~LogicException() throw();\r
-       };\r
-\r
-       class SQLException : public Exception\r
-       {\r
-       public:\r
-               virtual int SqlCode() const throw() = 0;\r
-               virtual int EngineCode() const throw() = 0;\r
-               \r
-               virtual ~SQLException() throw();\r
-       };\r
-\r
-       class WrongType : public LogicException\r
-       {\r
-       public:\r
-               virtual ~WrongType() throw();\r
-       };\r
-       \r
-       /* Classes Date, Time, Timestamp and DBKey are 'helper' classes.  They help\r
-        * in retrieving or setting some special SQL types. Dates, times and dbkeys\r
-        * are often read and written as strings in SQL scripts. When programming\r
-        * with IBPP, we handle those data with these specific classes, which\r
-        * enhance their usefullness and free us of format problems (M/D/Y, D/M/Y,\r
-        * Y-M-D ?, and so on...). */\r
-\r
-       /* Class Date represent purely a Date (no time part specified). It is\r
-        * usefull in interactions with the SQL DATE type of Interbase.  You can add\r
-        * or substract a number from a Date, that will modify it to represent the\r
-        * correct date, X days later or sooner. All the Y2K details taken into\r
-        * account.\r
-        * The full range goes from integer values IBPP::MinDate to IBPP::MaxDate\r
-        * which means from 01 Jan 0001 to 31 Dec 9999. ( Which is inherently\r
-        * incorrect as this assumes Gregorian calendar. ) */\r
-       \r
-       class Timestamp;        // Cross-reference between Timestamp, Date and Time\r
-       \r
-       class Date\r
-       {\r
-       protected:\r
-               int mDate;      // The date : 1 == 1 Jan 1900\r
-\r
-       public:\r
-               void Clear()    { mDate = MinDate - 1; };\r
-               void Today();\r
-               void SetDate(int year, int month, int day);\r
-               void SetDate(int dt);\r
-               void GetDate(int& year, int& month, int& day) const;\r
-               int GetDate() const     { return mDate; }\r
-               int Year() const;\r
-               int Month() const;\r
-               int Day() const;\r
-               void Add(int days);\r
-               void StartOfMonth();\r
-               void EndOfMonth();\r
-       \r
-               Date()                  { Clear(); };\r
-               Date(int dt)    { SetDate(dt); }\r
-               Date(int year, int month, int day);\r
-               Date(const Date&);                                                      // Copy Constructor\r
-               Date& operator=(const Timestamp&);                      // Timestamp Assignment operator\r
-               Date& operator=(const Date&);                           // Date Assignment operator\r
-\r
-               bool operator==(const Date& rv) const { return mDate == rv.GetDate(); }\r
-               bool operator!=(const Date& rv) const { return mDate != rv.GetDate(); }\r
-               bool operator<(const Date& rv) const { return mDate < rv.GetDate(); }\r
-               bool operator>(const Date& rv) const { return mDate > rv.GetDate(); }\r
-\r
-               virtual ~Date() { };\r
-       };\r
-\r
-       /* Class Time represent purely a Time. It is usefull in interactions\r
-        * with the SQL TIME type of Interbase. */\r
-\r
-       class Time\r
-       {\r
-       protected:\r
-               int mTime;      // The time, in ten-thousandths of seconds since midnight\r
-\r
-       public:\r
-               void Clear()    { mTime = 0; }\r
-               void Now();\r
-               void SetTime(int hour, int minute, int second, int tenthousandths = 0);\r
-               void SetTime(int tm);\r
-               void GetTime(int& hour, int& minute, int& second) const;\r
-               void GetTime(int& hour, int& minute, int& second, int& tenthousandths) const;\r
-               int GetTime() const     { return mTime; }\r
-               int Hours() const;\r
-               int Minutes() const;\r
-               int Seconds() const;\r
-               int SubSeconds() const;         // Actually tenthousandths of seconds\r
-               Time()                  { Clear(); }\r
-               Time(int tm)    { SetTime(tm); }\r
-               Time(int hour, int minute, int second, int tenthousandths = 0);\r
-               Time(const Time&);                                                      // Copy Constructor\r
-               Time& operator=(const Timestamp&);                      // Timestamp Assignment operator\r
-               Time& operator=(const Time&);                           // Time Assignment operator\r
-\r
-               bool operator==(const Time& rv) const { return mTime == rv.GetTime(); }\r
-               bool operator!=(const Time& rv) const { return mTime != rv.GetTime(); }\r
-               bool operator<(const Time& rv) const { return mTime < rv.GetTime(); }\r
-               bool operator>(const Time& rv) const { return mTime > rv.GetTime(); }\r
-\r
-               virtual ~Time() { };\r
-       };\r
-\r
-       /* Class Timestamp represent a date AND a time. It is usefull in\r
-        * interactions with the SQL TIMESTAMP type of Interbase. This class\r
-        * inherits from Date and Time and completely inline implements its small\r
-        * specific details. */\r
-\r
-       class Timestamp : public Date, public Time\r
-       {\r
-       public:\r
-               void Clear()    { Date::Clear(); Time::Clear(); }\r
-               void Today()    { Date::Today(); Time::Clear(); }\r
-               void Now()              { Date::Today(); Time::Now(); }\r
-\r
-               Timestamp()             { Clear(); }\r
-\r
-               Timestamp(int y, int m, int d)\r
-                       { Date::SetDate(y, m, d); Time::Clear(); }\r
-\r
-               Timestamp(int y, int mo, int d, int h, int mi, int s, int t = 0)\r
-                       { Date::SetDate(y, mo, d); Time::SetTime(h, mi, s, t); }\r
-\r
-               Timestamp(const Timestamp& rv)\r
-                       : Date(rv.mDate), Time(rv.mTime) {}     // Copy Constructor\r
-\r
-               Timestamp(const Date& rv)\r
-                       { mDate = rv.GetDate(); mTime = 0; }\r
-\r
-               Timestamp(const Time& rv)\r
-                       { mDate = 0; mTime = rv.GetTime(); }\r
-\r
-               Timestamp& operator=(const Timestamp& rv)       // Timestamp Assignment operator\r
-                       { mDate = rv.mDate; mTime = rv.mTime; return *this; }\r
-\r
-               Timestamp& operator=(const Date& rv)            // Date Assignment operator\r
-                       { mDate = rv.GetDate(); return *this; }\r
-\r
-               Timestamp& operator=(const Time& rv)            // Time Assignment operator\r
-                       { mTime = rv.GetTime(); return *this; }\r
-\r
-               bool operator==(const Timestamp& rv) const\r
-                       { return (mDate == rv.GetDate()) && (mTime == rv.GetTime()); }\r
-\r
-               bool operator!=(const Timestamp& rv) const\r
-                       { return (mDate != rv.GetDate()) || (mTime != rv.GetTime()); }\r
-\r
-               bool operator<(const Timestamp& rv) const\r
-                       { return (mDate < rv.GetDate()) ||\r
-                               (mDate == rv.GetDate() && mTime < rv.GetTime()); }\r
-\r
-               bool operator>(const Timestamp& rv) const\r
-                       { return (mDate > rv.GetDate()) ||\r
-                               (mDate == rv.GetDate() && mTime > rv.GetTime()); }\r
-\r
-               ~Timestamp() { }\r
-       };\r
-\r
-       /* Class DBKey can store a DBKEY, that special value which the hidden\r
-        * RDB$DBKEY can give you from a select statement. A DBKey is nothing\r
-        * specific to IBPP. It's a feature of the Firebird database engine. See its\r
-        * documentation for more information. */\r
-\r
-       class DBKey\r
-       {\r
-       private:\r
-               std::string mDBKey;                     // Stores the binary DBKey\r
-               mutable std::string mString;// String (temporary) representation of it\r
-\r
-       public:\r
-               void Clear();\r
-               int Size() const        { return (int)mDBKey.size(); }\r
-               void SetKey(const void*, int size);\r
-               void GetKey(void*, int size) const;\r
-               const char* AsString() const;\r
-\r
-               DBKey& operator=(const DBKey&); // Assignment operator\r
-               DBKey(const DBKey&);                    // Copy Constructor\r
-               DBKey() { }\r
-               ~DBKey() { }\r
-       };\r
-\r
-       /* Class User wraps all the information about a user that the engine can manage. */\r
-\r
-       class User\r
-       {\r
-       public:\r
-               std::string username;\r
-               std::string password;\r
-               std::string firstname;\r
-               std::string middlename;\r
-               std::string lastname;\r
-               uint32_t userid;                // Only relevant on unixes\r
-               uint32_t groupid;               // Only relevant on unixes\r
-\r
-       private:\r
-               void copyfrom(const User& r);\r
-\r
-       public:\r
-               void clear();\r
-               User& operator=(const User& r)  { copyfrom(r); return *this; }\r
-               User(const User& r)                             { copyfrom(r); }\r
-               User() : userid(0), groupid(0)  { }\r
-               ~User() { };\r
-       };\r
-\r
-       //      Interface Wrapper\r
-       template <class T>\r
-       class Ptr\r
-       {\r
-       private:\r
-               T* mObject;\r
-\r
-       public:\r
-               void clear()\r
-               {\r
-                       if (mObject != 0) { mObject->Release(); mObject = 0; }\r
-               }\r
-\r
-               T* intf() const                                         { return mObject; }\r
-               T* operator->() const                           { return mObject; }\r
-\r
-               bool operator==(const T* p) const       { return mObject == p; }\r
-               bool operator==(const Ptr& r) const     { return mObject == r.mObject; }\r
-               bool operator!=(const T* p) const       { return mObject != p; }\r
-               bool operator!=(const Ptr& r) const     { return mObject != r.mObject; }\r
-\r
-               Ptr& operator=(T* p)\r
-               {\r
-                       // AddRef _before_ Release gives correct behaviour on self-assigns\r
-                       T* tmp = (p == 0 ? 0 : p->AddRef());    // Take care of 0\r
-                       if (mObject != 0) mObject->Release();\r
-                       mObject = tmp; return *this;\r
-               }\r
-\r
-               Ptr& operator=(const Ptr& r)\r
-               {\r
-                       // AddRef _before_ Release gives correct behaviour on self-assigns\r
-                       T* tmp = (r.intf() == 0 ? 0 : r->AddRef());// Take care of 0\r
-                       if (mObject != 0) mObject->Release();\r
-                       mObject = tmp; return *this;\r
-               }\r
-\r
-               Ptr(T* p) : mObject(p == 0 ? 0 : p->AddRef()) { }\r
-               Ptr(const Ptr& r) : mObject(r.intf() == 0 ? 0 : r->AddRef()) {  }\r
-\r
-               Ptr() : mObject(0) { }\r
-               ~Ptr() { clear(); }\r
-       };\r
-\r
-       //      --- Interface Classes --- //\r
-\r
-       /* Interfaces IBlob, IArray, IService, IDatabase, ITransaction and\r
-        * IStatement are at the core of IBPP. Though it is possible to program your\r
-        * applications by using theses interfaces directly (as was the case with\r
-        * IBPP 1.x), you should refrain from using them and prefer the new IBPP\r
-        * Objects Blob, Array, ... (without the I in front). Those new objects are\r
-        * typedef'd right after each interface class definition as you can read\r
-        * below. If you program using the Blob (instead of the IBlob interface\r
-        * itself), you'll never have to care about AddRef/Release and you'll never\r
-        * have to care about deleting your objects. */\r
-\r
-       class IBlob;                    typedef Ptr<IBlob> Blob;\r
-       class IArray;                   typedef Ptr<IArray> Array;\r
-       class IService;                 typedef Ptr<IService> Service;\r
-       class IDatabase;                typedef Ptr<IDatabase> Database;\r
-       class ITransaction;             typedef Ptr<ITransaction> Transaction;\r
-       class IStatement;               typedef Ptr<IStatement> Statement;\r
-       class IEvents;                  typedef Ptr<IEvents> Events;\r
-       class IRow;                             typedef Ptr<IRow> Row;\r
-\r
-       /* IBlob is the interface to the blob capabilities of IBPP. Blob is the\r
-        * object class you actually use in your programming. In Firebird, at the\r
-        * row level, a blob is merely a handle to a blob, stored elsewhere in the\r
-        * database. Blob allows you to retrieve such a handle and then read from or\r
-        * write to the blob, much in the same manner than you would do with a file. */\r
-\r
-       class IBlob\r
-       {\r
-       public:\r
-               virtual void Create() = 0;\r
-               virtual void Open() = 0;\r
-               virtual void Close() = 0;\r
-               virtual void Cancel() = 0;\r
-               virtual int Read(void*, int size) = 0;\r
-               virtual void Write(const void*, int size) = 0;\r
-               virtual void Info(int* Size, int* Largest, int* Segments) = 0;\r
-       \r
-               virtual void Save(const std::string& data) = 0;\r
-               virtual void Load(std::string& data) = 0;\r
-\r
-               virtual Database DatabasePtr() const = 0;\r
-               virtual Transaction TransactionPtr() const = 0;\r
-\r
-               virtual IBlob* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-               virtual ~IBlob() { };\r
-       };\r
-\r
-       /*      IArray is the interface to the array capabilities of IBPP. Array is the\r
-       * object class you actually use in your programming. With an Array object, you\r
-       * can create, read and write Interbase Arrays, as a whole or in slices. */\r
-\r
-       class IArray\r
-       {\r
-       public:\r
-               virtual void Describe(const std::string& table, const std::string& column) = 0;\r
-               virtual void ReadTo(ADT, void* buffer, int elemcount) = 0;\r
-               virtual void WriteFrom(ADT, const void* buffer, int elemcount) = 0;\r
-               virtual SDT ElementType() = 0;\r
-               virtual int ElementSize() = 0;\r
-               virtual int ElementScale() = 0;\r
-               virtual int Dimensions() = 0;\r
-               virtual void Bounds(int dim, int* low, int* high) = 0;\r
-               virtual void SetBounds(int dim, int low, int high) = 0;\r
-\r
-               virtual Database DatabasePtr() const = 0;\r
-               virtual Transaction TransactionPtr() const = 0;\r
-\r
-               virtual IArray* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-               virtual ~IArray() { };\r
-       };\r
-\r
-       /* IService is the interface to the service capabilities of IBPP. Service is\r
-        * the object class you actually use in your programming. With a Service\r
-        * object, you can do some maintenance work of databases and servers\r
-        * (backup, restore, create/update users, ...) */\r
-\r
-       class IService\r
-       {\r
-       public:\r
-           virtual void Connect() = 0;\r
-               virtual bool Connected() = 0;\r
-               virtual void Disconnect() = 0;\r
-\r
-               virtual void GetVersion(std::string& version) = 0;\r
-\r
-               virtual void AddUser(const User&) = 0;\r
-               virtual void GetUser(User&) = 0;\r
-               virtual void GetUsers(std::vector<User>&) = 0;\r
-               virtual void ModifyUser(const User&) = 0;\r
-               virtual void RemoveUser(const std::string& username) = 0;\r
-\r
-               virtual void SetPageBuffers(const std::string& dbfile, int buffers) = 0;\r
-               virtual void SetSweepInterval(const std::string& dbfile, int sweep) = 0;\r
-               virtual void SetSyncWrite(const std::string& dbfile, bool) = 0;\r
-               virtual void SetReadOnly(const std::string& dbfile, bool) = 0;\r
-               virtual void SetReserveSpace(const std::string& dbfile, bool) = 0;\r
-\r
-               virtual void Shutdown(const std::string& dbfile, DSM mode, int sectimeout) = 0;\r
-               virtual void Restart(const std::string& dbfile) = 0;\r
-               virtual void Sweep(const std::string& dbfile) = 0;\r
-               virtual void Repair(const std::string& dbfile, RPF flags) = 0;\r
-\r
-               virtual void StartBackup(const std::string& dbfile,\r
-                       const std::string& bkfile, BRF flags = BRF(0)) = 0;\r
-               virtual void StartRestore(const std::string& bkfile, const std::string& dbfile,\r
-                       int pagesize = 0, BRF flags = BRF(0)) = 0;\r
-\r
-               virtual const char* WaitMsg() = 0;      // With reporting (does not block)\r
-               virtual void Wait() = 0;                        // Without reporting (does block)\r
-\r
-               virtual IService* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-               virtual ~IService() { };\r
-       };\r
-\r
-       /*      IDatabase is the interface to the database connections in IBPP. Database\r
-        * is the object class you actually use in your programming. With a Database\r
-        * object, you can create/drop/connect databases. */\r
-\r
-       class EventInterface;   // Cross-reference between EventInterface and IDatabase\r
-       \r
-       class IDatabase\r
-       {\r
-       public:\r
-               virtual const char* ServerName() const = 0;\r
-               virtual const char* DatabaseName() const = 0;\r
-               virtual const char* Username() const = 0;\r
-               virtual const char* UserPassword() const = 0;\r
-               virtual const char* RoleName() const = 0;\r
-               virtual const char* CharSet() const = 0;\r
-               virtual const char* CreateParams() const = 0;\r
-\r
-               virtual void Info(int* ODS, int* ODSMinor, int* PageSize,\r
-                       int* Pages,     int* Buffers, int* Sweep, bool* Sync,\r
-                       bool* Reserve) = 0;\r
-               virtual void Statistics(int* Fetches, int* Marks,\r
-                       int* Reads, int* Writes) = 0;\r
-               virtual void Counts(int* Insert, int* Update, int* Delete, \r
-                       int* ReadIdx, int* ReadSeq) = 0;\r
-               virtual void Users(std::vector<std::string>& users) = 0;\r
-               virtual int Dialect() = 0;\r
-\r
-               virtual void Create(int dialect) = 0;\r
-               virtual void Connect() = 0;\r
-               virtual bool Connected() = 0;\r
-               virtual void Inactivate() = 0;\r
-               virtual void Disconnect() = 0;\r
-               virtual void Drop() = 0;\r
-\r
-               virtual IDatabase* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-           virtual ~IDatabase() { };\r
-       };\r
-\r
-       /* ITransaction is the interface to the transaction connections in IBPP.\r
-        * Transaction is the object class you actually use in your programming. A\r
-        * Transaction object can be associated with more than one Database,\r
-        * allowing for distributed transactions spanning multiple databases,\r
-        * possibly located on different servers. IBPP is one among the few\r
-        * programming interfaces to Firebird that allows you to support distributed\r
-        * transactions. */\r
-\r
-       class ITransaction\r
-       {\r
-       public:\r
-           virtual void AttachDatabase(Database db, TAM am = amWrite,\r
-                       TIL il = ilConcurrency, TLR lr = lrWait, TFF flags = TFF(0)) = 0;\r
-           virtual void DetachDatabase(Database db) = 0;\r
-               virtual void AddReservation(Database db,\r
-                               const std::string& table, TTR tr) = 0;\r
-\r
-               virtual void Start() = 0;\r
-               virtual bool Started() = 0;\r
-           virtual void Commit() = 0;\r
-           virtual void Rollback() = 0;\r
-           virtual void CommitRetain() = 0;\r
-               virtual void RollbackRetain() = 0;\r
-\r
-               virtual ITransaction* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-           virtual ~ITransaction() { };\r
-       };\r
-\r
-       /*\r
-        *      Class Row can hold all the values of a row (from a SELECT for instance).\r
-        */\r
-\r
-       class IRow\r
-       {\r
-       public:\r
-               virtual void SetNull(int) = 0;\r
-               virtual void Set(int, bool) = 0;\r
-               virtual void Set(int, const void*, int) = 0;            // byte buffers\r
-               virtual void Set(int, const char*) = 0;                         // c-string\r
-               virtual void Set(int, const std::string&) = 0;\r
-               virtual void Set(int, int16_t) = 0;\r
-               virtual void Set(int, int32_t) = 0;\r
-               virtual void Set(int, int64_t) = 0;\r
-               virtual void Set(int, float) = 0;\r
-               virtual void Set(int, double) = 0;\r
-               virtual void Set(int, const Timestamp&) = 0;\r
-               virtual void Set(int, const Date&) = 0;\r
-               virtual void Set(int, const Time&) = 0;\r
-               virtual void Set(int, const DBKey&) = 0;\r
-               virtual void Set(int, const Blob&) = 0;\r
-               virtual void Set(int, const Array&) = 0;\r
-\r
-               virtual bool IsNull(int) = 0;\r
-               virtual bool Get(int, bool&) = 0;\r
-               virtual bool Get(int, void*, int&) = 0; // byte buffers\r
-               virtual bool Get(int, std::string&) = 0;\r
-               virtual bool Get(int, int16_t&) = 0;\r
-               virtual bool Get(int, int32_t&) = 0;\r
-               virtual bool Get(int, int64_t&) = 0;\r
-               virtual bool Get(int, float&) = 0;\r
-               virtual bool Get(int, double&) = 0;\r
-               virtual bool Get(int, Timestamp&) = 0;\r
-               virtual bool Get(int, Date&) = 0;\r
-               virtual bool Get(int, Time&) = 0;\r
-               virtual bool Get(int, DBKey&) = 0;\r
-               virtual bool Get(int, Blob&) = 0;\r
-               virtual bool Get(int, Array&) = 0;\r
-\r
-               virtual bool IsNull(const std::string&) = 0;\r
-               virtual bool Get(const std::string&, bool&) = 0;\r
-               virtual bool Get(const std::string&, void*, int&) = 0;  // byte buffers\r
-               virtual bool Get(const std::string&, std::string&) = 0;\r
-               virtual bool Get(const std::string&, int16_t&) = 0;\r
-               virtual bool Get(const std::string&, int32_t&) = 0;\r
-               virtual bool Get(const std::string&, int64_t&) = 0;\r
-               virtual bool Get(const std::string&, float&) = 0;\r
-               virtual bool Get(const std::string&, double&) = 0;\r
-               virtual bool Get(const std::string&, Timestamp&) = 0;\r
-               virtual bool Get(const std::string&, Date&) = 0;\r
-               virtual bool Get(const std::string&, Time&) = 0;\r
-               virtual bool Get(const std::string&, DBKey&) = 0;\r
-               virtual bool Get(const std::string&, Blob&) = 0;\r
-               virtual bool Get(const std::string&, Array&) = 0;\r
-\r
-               virtual int ColumnNum(const std::string&) = 0;\r
-               virtual const char* ColumnName(int) = 0;\r
-               virtual const char* ColumnAlias(int) = 0;\r
-               virtual const char* ColumnTable(int) = 0;\r
-               virtual SDT ColumnType(int) = 0;\r
-               virtual int ColumnSubtype(int) = 0;\r
-               virtual int ColumnSize(int) = 0;\r
-               virtual int ColumnScale(int) = 0;\r
-               virtual int Columns() = 0;\r
-               \r
-               virtual bool ColumnUpdated(int) = 0;\r
-               virtual bool Updated() = 0;\r
-\r
-               virtual Database DatabasePtr() const = 0;\r
-               virtual Transaction TransactionPtr() const = 0;\r
-\r
-               virtual IRow* Clone() = 0;\r
-               virtual IRow* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-           virtual ~IRow() {};\r
-       };\r
-\r
-       /* IStatement is the interface to the statements execution in IBPP.\r
-        * Statement is the object class you actually use in your programming. A\r
-        * Statement object is the work horse of IBPP. All your data manipulation\r
-        * statements will be done through it. It is also used to access the result\r
-        * set of a query (when the statement is such), one row at a time and in\r
-        * strict forward direction. */\r
-\r
-       class IStatement\r
-       {\r
-       public:\r
-               virtual void Prepare(const std::string&) = 0;\r
-               virtual void Execute() = 0;\r
-               virtual void Execute(const std::string&) = 0;\r
-               virtual void ExecuteImmediate(const std::string&) = 0;\r
-               virtual void CursorExecute(const std::string& cursor) = 0;\r
-               virtual void CursorExecute(const std::string& cursor, const std::string&) = 0;\r
-               virtual bool Fetch() = 0;\r
-               virtual bool Fetch(Row&) = 0;\r
-               virtual int AffectedRows() = 0;\r
-               virtual void Close() = 0;\r
-               virtual std::string& Sql() = 0;\r
-               virtual STT Type() = 0;\r
-\r
-               virtual void SetNull(int) = 0;\r
-               virtual void Set(int, bool) = 0;\r
-               virtual void Set(int, const void*, int) = 0;            // byte buffers\r
-               virtual void Set(int, const char*) = 0;                         // c-string\r
-               virtual void Set(int, const std::string&) = 0;\r
-               virtual void Set(int, int16_t value) = 0;\r
-               virtual void Set(int, int32_t value) = 0;\r
-               virtual void Set(int, int64_t value) = 0;\r
-               virtual void Set(int, float value) = 0;\r
-               virtual void Set(int, double value) = 0;\r
-               virtual void Set(int, const Timestamp& value) = 0;\r
-               virtual void Set(int, const Date& value) = 0;\r
-               virtual void Set(int, const Time& value) = 0;\r
-               virtual void Set(int, const DBKey& value) = 0;\r
-               virtual void Set(int, const Blob& value) = 0;\r
-               virtual void Set(int, const Array& value) = 0;\r
-\r
-               virtual bool IsNull(int) = 0;\r
-               virtual bool Get(int, bool&) = 0;\r
-               virtual bool Get(int, void*, int&) = 0; // byte buffers\r
-               virtual bool Get(int, std::string&) = 0;\r
-               virtual bool Get(int, int16_t&) = 0;\r
-               virtual bool Get(int, int32_t&) = 0;\r
-               virtual bool Get(int, int64_t&) = 0;\r
-               virtual bool Get(int, float&) = 0;\r
-               virtual bool Get(int, double&) = 0;\r
-               virtual bool Get(int, Timestamp& value) = 0;\r
-               virtual bool Get(int, Date& value) = 0;\r
-               virtual bool Get(int, Time& value) = 0;\r
-               virtual bool Get(int, DBKey& value) = 0;\r
-               virtual bool Get(int, Blob& value) = 0;\r
-               virtual bool Get(int, Array& value) = 0;\r
-\r
-               virtual bool IsNull(const std::string&) = 0;\r
-               virtual bool Get(const std::string&, bool&) = 0;\r
-               virtual bool Get(const std::string&, void*, int&) = 0;  // byte buffers\r
-               virtual bool Get(const std::string&, std::string&) = 0;\r
-               virtual bool Get(const std::string&, int16_t&) = 0;\r
-               virtual bool Get(const std::string&, int32_t&) = 0;\r
-               virtual bool Get(const std::string&, int64_t&) = 0;\r
-               virtual bool Get(const std::string&, float&) = 0;\r
-               virtual bool Get(const std::string&, double&) = 0;\r
-               virtual bool Get(const std::string&, Timestamp& value) = 0;\r
-               virtual bool Get(const std::string&, Date& value) = 0;\r
-               virtual bool Get(const std::string&, Time& value) = 0;\r
-               virtual bool Get(const std::string&, DBKey& value) = 0;\r
-               virtual bool Get(const std::string&, Blob& value) = 0;\r
-               virtual bool Get(const std::string&, Array& value) = 0;\r
-\r
-               virtual int ColumnNum(const std::string&) = 0;\r
-               virtual const char* ColumnName(int) = 0;\r
-               virtual const char* ColumnAlias(int) = 0;\r
-               virtual const char* ColumnTable(int) = 0;\r
-               virtual SDT ColumnType(int) = 0;\r
-               virtual int ColumnSubtype(int) = 0;\r
-               virtual int ColumnSize(int) = 0;\r
-               virtual int ColumnScale(int) = 0;\r
-               virtual int Columns() = 0;\r
-\r
-               virtual SDT ParameterType(int) = 0;\r
-               virtual int ParameterSubtype(int) = 0;\r
-               virtual int ParameterSize(int) = 0;\r
-               virtual int ParameterScale(int) = 0;\r
-               virtual int Parameters() = 0;\r
-\r
-               virtual void Plan(std::string&) = 0;\r
-\r
-               virtual Database DatabasePtr() const = 0;\r
-               virtual Transaction TransactionPtr() const = 0;\r
-\r
-               virtual IStatement* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-           virtual ~IStatement() { };\r
-\r
-               // DEPRECATED METHODS (WON'T BE AVAILABLE IN VERSIONS 3.x)\r
-               virtual bool Get(int, char*) = 0;                                       // DEPRECATED\r
-               virtual bool Get(const std::string&, char*) = 0;        // DEPRECATED\r
-               virtual bool Get(int, bool*) = 0;                                       // DEPRECATED\r
-               virtual bool Get(const std::string&, bool*) = 0;        // DEPRECATED\r
-               virtual bool Get(int, int16_t*) = 0;                            // DEPRECATED\r
-               virtual bool Get(const std::string&, int16_t*) = 0;     // DEPRECATED\r
-               virtual bool Get(int, int32_t*) = 0;                            // DEPRECATED\r
-               virtual bool Get(const std::string&, int32_t*) = 0;     // DEPRECATED\r
-               virtual bool Get(int, int64_t*) = 0;                            // DEPRECATED\r
-               virtual bool Get(const std::string&, int64_t*) = 0;     // DEPRECATED\r
-               virtual bool Get(int, float*) = 0;                                      // DEPRECATED\r
-               virtual bool Get(const std::string&, float*) = 0;       // DEPRECATED\r
-               virtual bool Get(int, double*) = 0;                                     // DEPRECATED\r
-               virtual bool Get(const std::string&, double*) = 0;      // DEPRECATED\r
-       };\r
-       \r
-       class IEvents\r
-       {\r
-       public:\r
-               virtual void Add(const std::string&, EventInterface*) = 0;\r
-               virtual void Drop(const std::string&) = 0;\r
-               virtual void List(std::vector<std::string>&) = 0;\r
-               virtual void Clear() = 0;                               // Drop all events\r
-               virtual void Dispatch() = 0;                    // Dispatch events (calls handlers)\r
-\r
-               virtual Database DatabasePtr() const = 0;\r
-\r
-               virtual IEvents* AddRef() = 0;\r
-               virtual void Release() = 0;\r
-\r
-           virtual ~IEvents() { };\r
-       };\r
-       \r
-       /* Class EventInterface is merely a pure interface.\r
-        * It is _not_ implemented by IBPP. It is only a base class definition from\r
-        * which your own event interface classes have to derive from.\r
-        * Please read the reference guide at http://www.ibpp.org for more info. */\r
-\r
-       class EventInterface\r
-       {\r
-       public:\r
-               virtual void ibppEventHandler(Events, const std::string&, int) = 0;\r
-               virtual ~EventInterface() { };\r
-       };\r
-\r
-       //      --- Factories ---\r
-       //      These methods are the only way to get one of the above\r
-       //      Interfaces.  They are at the heart of how you program using IBPP.  For\r
-       //      instance, to get access to a database, you'll write code similar to this:\r
-       //      {\r
-       //              Database db = DatabaseFactory("server", "databasename",\r
-       //                                              "user", "password");\r
-       //              db->Connect();\r
-       //              ...\r
-       //              db->Disconnect();\r
-       //      }\r
-\r
-       Service ServiceFactory(const std::string& ServerName,\r
-               const std::string& UserName, const std::string& UserPassword);\r
-\r
-       Database DatabaseFactory(const std::string& ServerName,\r
-               const std::string& DatabaseName, const std::string& UserName,\r
-                       const std::string& UserPassword, const std::string& RoleName,\r
-                               const std::string& CharSet, const std::string& CreateParams);\r
-\r
-       inline Database DatabaseFactory(const std::string& ServerName,\r
-               const std::string& DatabaseName, const std::string& UserName,\r
-                       const std::string& UserPassword)\r
-               { return DatabaseFactory(ServerName, DatabaseName, UserName, UserPassword, "", "", ""); }\r
-\r
-       Transaction TransactionFactory(Database db, TAM am = amWrite,\r
-               TIL il = ilConcurrency, TLR lr = lrWait, TFF flags = TFF(0));\r
-\r
-       Statement StatementFactory(Database db, Transaction tr,\r
-               const std::string& sql);\r
-\r
-       inline Statement StatementFactory(Database db, Transaction tr)\r
-               { return StatementFactory(db, tr, ""); }\r
-\r
-       Blob BlobFactory(Database db, Transaction tr);\r
-       \r
-       Array ArrayFactory(Database db, Transaction tr);\r
-       \r
-       Events EventsFactory(Database db);\r
-\r
-       /* IBPP uses a self initialization system. Each time an object that may\r
-        * require the usage of the Interbase client C-API library is used, the\r
-        * library internal handling details are automatically initialized, if not\r
-        * already done. You can kick this initialization at the start of an\r
-        * application by calling IBPP::CheckVersion(). This is recommended, because\r
-        * IBPP::CheckVersion will assure you that YOUR code has been compiled\r
-        * against a compatible version of the library. */\r
-\r
-       bool CheckVersion(uint32_t);\r
-       int GDSVersion();\r
-       \r
-       /* On Win32 platform, ClientLibSearchPaths() allows to setup\r
-        * one or multiple additional paths (separated with a ';') where IBPP\r
-        * will look for the client library (before the default implicit search\r
-        * locations). This is usefull for applications distributed with a 'private'\r
-        * copy of Firebird, when the registry is useless to identify the location\r
-        * from where to attempt loading the fbclient.dll / gds32.dll.\r
-        * If called, this function must be called *early* by the application,\r
-        * before *any* other function or object methods of IBPP.\r
-        * Currently, this is a NO-OP on platforms other than Win32. */\r
-        \r
-       void ClientLibSearchPaths(const std::string&);\r
-\r
-       /* Finally, here are some date and time conversion routines used by IBPP and\r
-        * that may be helpful at the application level. They do not depend on\r
-        * anything related to Firebird/Interbase. Just a bonus. dtoi and itod\r
-        * return false on invalid parameters or out of range conversions. */\r
-\r
-       bool dtoi(int date, int* py, int* pm, int* pd);\r
-       bool itod(int* pdate, int year, int month, int day);\r
-       void ttoi(int itime, int* phour, int* pminute, int* psecond, int* ptt);\r
-       void itot(int* ptime, int hour, int minute, int second = 0, int tenthousandths = 0);\r
-\r
-}\r
-\r
-#endif\r
-\r
-//\r
-//     EOF\r
-//\r
diff --git a/stglibs/ibpp.lib/include/stg/ibpp.h b/stglibs/ibpp.lib/include/stg/ibpp.h
new file mode 100644 (file)
index 0000000..37a19ad
--- /dev/null
@@ -0,0 +1,929 @@
+///////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     File    : $Id: ibpp.h,v 1.3 2007/10/28 11:17:44 nobunaga Exp $\r
+//     Subject : IBPP public header file. This is _the_ only file you include in\r
+//                       your application files when developing with IBPP.\r
+//\r
+///////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     (C) Copyright 2000-2006 T.I.P. Group S.A. and the IBPP Team (www.ibpp.org)\r
+//\r
+//     The contents of this file are subject to the IBPP License (the "License");\r
+//     you may not use this file except in compliance with the License.  You may\r
+//     obtain a copy of the License at http://www.ibpp.org or in the 'license.txt'\r
+//     file which must have been distributed along with this file.\r
+//\r
+//     This software, distributed under the License, is distributed on an "AS IS"\r
+//     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the\r
+//     License for the specific language governing rights and limitations\r
+//     under the License.\r
+//\r
+//     Contributor(s):\r
+//\r
+//             Olivier Mascia, main coding\r
+//             Matt Hortman, initial linux port\r
+//             Mark Jordan, design contributions\r
+//             Maxim Abrashkin, enhancement patches\r
+//             Torsten Martinsen, enhancement patches\r
+//             Michael Hieke, darwin (OS X) port, enhancement patches\r
+//             Val Samko, enhancement patches and debugging\r
+//             Mike Nordell, invaluable C++ advices\r
+//             Claudio Valderrama, help with not-so-well documented IB/FB features\r
+//             Many others, excellent suggestions, bug finding, and support\r
+//\r
+///////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     COMMENTS\r
+//     Tabulations should be set every four characters when editing this file.\r
+//\r
+//     When compiling a project using IBPP, the following defines should be made\r
+//     on the command-line (or in makefiles) according to the OS platform and\r
+//     compiler used.\r
+//\r
+//     Select the platform:    IBPP_WINDOWS | IBPP_LINUX | IBPP_DARWIN\r
+//\r
+///////////////////////////////////////////////////////////////////////////////\r
+\r
+#ifndef __IBPP_H__\r
+#define __IBPP_H__\r
+\r
+#if !defined(IBPP_WINDOWS) && !defined(IBPP_LINUX) && !defined(IBPP_DARWIN)\r
+#error Please define IBPP_WINDOWS/IBPP_LINUX/IBPP_DARWIN before compiling !\r
+#endif\r
+\r
+#if !defined(__BCPLUSPLUS__) && !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__DMC__)
+#error Your compiler is not recognized.\r
+#endif\r
+\r
+#if defined(IBPP_LINUX) || defined(IBPP_DARWIN)\r
+#define IBPP_UNIX      // IBPP_UNIX stands as a common denominator to *NIX flavours\r
+#endif\r
+\r
+// IBPP is written for 32 bits systems or higher.\r
+// The standard type 'int' is assumed to be at least 32 bits.\r
+// And the standard type 'short' is assumed to be exactly 16 bits.\r
+// Everywhere possible, where the exact size of an integer does not matter,\r
+// the standard type 'int' is used. And where an exact integer size is required\r
+// the standard exact precision types definitions of C 99 standard are used.\r
+\r
+#if defined(_MSC_VER) || defined(__DMC__) || defined(__BCPLUSPLUS__)\r
+// C99 §7.18.1.1 Exact-width integer types (only those used by IBPP)\r
+#if defined(_MSC_VER) && (_MSC_VER < 1300)     // MSVC 6 should be < 1300\r
+       typedef short int16_t;\r
+       typedef int int32_t;\r
+       typedef unsigned int uint32_t;\r
+#else\r
+       typedef __int16 int16_t;\r
+       typedef __int32 int32_t;\r
+       typedef unsigned __int32 uint32_t;\r
+#endif\r
+       typedef __int64 int64_t;\r
+#else\r
+       #include <stg/os_int.h>                 // C99 (§7.18) integer types definitions\r
+#endif\r
+\r
+#if !defined(_)\r
+#define _(s)   s\r
+#endif\r
+\r
+#include <exception>\r
+#include <string>\r
+#include <vector>\r
+\r
+namespace IBPP\r
+{\r
+       //      Typically you use this constant in a call IBPP::CheckVersion as in:\r
+       //      if (! IBPP::CheckVersion(IBPP::Version)) { throw .... ; }\r
+       const uint32_t Version = (2<<24) + (5<<16) + (3<<8) + 0; // Version == 2.5.3.0\r
+\r
+       //      Dates range checking\r
+       const int MinDate = -693594;    //  1 JAN 0001\r
+       const int MaxDate = 2958464;    // 31 DEC 9999\r
+       \r
+       //      Transaction Access Modes\r
+       enum TAM {amWrite, amRead};\r
+\r
+       //      Transaction Isolation Levels\r
+       enum TIL {ilConcurrency, ilReadDirty, ilReadCommitted, ilConsistency};\r
+\r
+       //      Transaction Lock Resolution\r
+       enum TLR {lrWait, lrNoWait};\r
+\r
+       // Transaction Table Reservation\r
+       enum TTR {trSharedWrite, trSharedRead, trProtectedWrite, trProtectedRead};\r
+\r
+       //      Prepared Statement Types\r
+       enum STT {stUnknown, stUnsupported,\r
+               stSelect, stInsert, stUpdate, stDelete, stDDL, stExecProcedure,\r
+               stSelectUpdate, stSetGenerator, stSavePoint};\r
+\r
+       //      SQL Data Types\r
+       enum SDT {sdArray, sdBlob, sdDate, sdTime, sdTimestamp, sdString,\r
+               sdSmallint, sdInteger, sdLargeint, sdFloat, sdDouble};\r
+\r
+       //      Array Data Types\r
+       enum ADT {adDate, adTime, adTimestamp, adString,\r
+               adBool, adInt16, adInt32, adInt64, adFloat, adDouble};\r
+\r
+       // Database::Shutdown Modes\r
+       enum DSM {dsForce, dsDenyTrans, dsDenyAttach};\r
+\r
+       // Service::StartBackup && Service::StartRestore Flags\r
+       enum BRF {\r
+               brVerbose = 0x1,\r
+               // Backup flags\r
+               brIgnoreChecksums = 0x100, brIgnoreLimbo = 0x200,\r
+               brMetadataOnly = 0x400, brNoGarbageCollect = 0x800,\r
+               brNonTransportable = 0x1000, brConvertExtTables = 0x2000,\r
+               // Restore flags\r
+               brReplace = 0x10000, brDeactivateIdx = 0x20000,\r
+               brNoShadow = 0x40000, brNoValidity = 0x80000,\r
+               brPerTableCommit = 0x100000, brUseAllSpace = 0x200000\r
+       };\r
+\r
+       // Service::Repair Flags\r
+       enum RPF\r
+       {\r
+               // Mandatory and mutually exclusives\r
+               rpMendRecords = 0x1, rpValidatePages = 0x2, rpValidateFull = 0x4,\r
+               // Options\r
+               rpReadOnly = 0x100, rpIgnoreChecksums = 0x200, rpKillShadows = 0x400\r
+       };\r
+\r
+       // TransactionFactory Flags\r
+       enum TFF {tfIgnoreLimbo = 0x1, tfAutoCommit = 0x2, tfNoAutoUndo = 0x4};\r
+\r
+       /* IBPP never return any error codes. It throws exceptions.\r
+        * On database engine reported errors, an IBPP::SQLException is thrown.\r
+        * In all other cases, IBPP throws IBPP::LogicException.\r
+        * Also note that the runtime and the language might also throw exceptions\r
+        * while executing some IBPP methods. A failing new operator will throw\r
+        * std::bad_alloc, IBPP does nothing to alter the standard behaviour.\r
+        *\r
+        *                    std::exception\r
+        *                           |\r
+        *                   IBPP::Exception\r
+        *                 /                 \\r
+        *    IBPP::LogicException    IBPP::SQLException\r
+        *             |\r
+        *      IBPP::WrongType\r
+        */\r
+\r
+       class Exception : public std::exception\r
+       {\r
+       public:\r
+               virtual const char* Origin() const throw() = 0;\r
+               virtual const char* ErrorMessage() const throw() = 0;   // Deprecated, use what()\r
+               virtual const char* what() const throw() = 0;\r
+               virtual ~Exception() throw();\r
+       };\r
+\r
+       class LogicException : public Exception\r
+       {\r
+       public:\r
+               virtual ~LogicException() throw();\r
+       };\r
+\r
+       class SQLException : public Exception\r
+       {\r
+       public:\r
+               virtual int SqlCode() const throw() = 0;\r
+               virtual int EngineCode() const throw() = 0;\r
+               \r
+               virtual ~SQLException() throw();\r
+       };\r
+\r
+       class WrongType : public LogicException\r
+       {\r
+       public:\r
+               virtual ~WrongType() throw();\r
+       };\r
+       \r
+       /* Classes Date, Time, Timestamp and DBKey are 'helper' classes.  They help\r
+        * in retrieving or setting some special SQL types. Dates, times and dbkeys\r
+        * are often read and written as strings in SQL scripts. When programming\r
+        * with IBPP, we handle those data with these specific classes, which\r
+        * enhance their usefullness and free us of format problems (M/D/Y, D/M/Y,\r
+        * Y-M-D ?, and so on...). */\r
+\r
+       /* Class Date represent purely a Date (no time part specified). It is\r
+        * usefull in interactions with the SQL DATE type of Interbase.  You can add\r
+        * or substract a number from a Date, that will modify it to represent the\r
+        * correct date, X days later or sooner. All the Y2K details taken into\r
+        * account.\r
+        * The full range goes from integer values IBPP::MinDate to IBPP::MaxDate\r
+        * which means from 01 Jan 0001 to 31 Dec 9999. ( Which is inherently\r
+        * incorrect as this assumes Gregorian calendar. ) */\r
+       \r
+       class Timestamp;        // Cross-reference between Timestamp, Date and Time\r
+       \r
+       class Date\r
+       {\r
+       protected:\r
+               int mDate;      // The date : 1 == 1 Jan 1900\r
+\r
+       public:\r
+               void Clear()    { mDate = MinDate - 1; };\r
+               void Today();\r
+               void SetDate(int year, int month, int day);\r
+               void SetDate(int dt);\r
+               void GetDate(int& year, int& month, int& day) const;\r
+               int GetDate() const     { return mDate; }\r
+               int Year() const;\r
+               int Month() const;\r
+               int Day() const;\r
+               void Add(int days);\r
+               void StartOfMonth();\r
+               void EndOfMonth();\r
+       \r
+               Date()                  { Clear(); };\r
+               Date(int dt)    { SetDate(dt); }\r
+               Date(int year, int month, int day);\r
+               Date(const Date&);                                                      // Copy Constructor\r
+               Date& operator=(const Timestamp&);                      // Timestamp Assignment operator\r
+               Date& operator=(const Date&);                           // Date Assignment operator\r
+\r
+               bool operator==(const Date& rv) const { return mDate == rv.GetDate(); }\r
+               bool operator!=(const Date& rv) const { return mDate != rv.GetDate(); }\r
+               bool operator<(const Date& rv) const { return mDate < rv.GetDate(); }\r
+               bool operator>(const Date& rv) const { return mDate > rv.GetDate(); }\r
+\r
+               virtual ~Date() { };\r
+       };\r
+\r
+       /* Class Time represent purely a Time. It is usefull in interactions\r
+        * with the SQL TIME type of Interbase. */\r
+\r
+       class Time\r
+       {\r
+       protected:\r
+               int mTime;      // The time, in ten-thousandths of seconds since midnight\r
+\r
+       public:\r
+               void Clear()    { mTime = 0; }\r
+               void Now();\r
+               void SetTime(int hour, int minute, int second, int tenthousandths = 0);\r
+               void SetTime(int tm);\r
+               void GetTime(int& hour, int& minute, int& second) const;\r
+               void GetTime(int& hour, int& minute, int& second, int& tenthousandths) const;\r
+               int GetTime() const     { return mTime; }\r
+               int Hours() const;\r
+               int Minutes() const;\r
+               int Seconds() const;\r
+               int SubSeconds() const;         // Actually tenthousandths of seconds\r
+               Time()                  { Clear(); }\r
+               Time(int tm)    { SetTime(tm); }\r
+               Time(int hour, int minute, int second, int tenthousandths = 0);\r
+               Time(const Time&);                                                      // Copy Constructor\r
+               Time& operator=(const Timestamp&);                      // Timestamp Assignment operator\r
+               Time& operator=(const Time&);                           // Time Assignment operator\r
+\r
+               bool operator==(const Time& rv) const { return mTime == rv.GetTime(); }\r
+               bool operator!=(const Time& rv) const { return mTime != rv.GetTime(); }\r
+               bool operator<(const Time& rv) const { return mTime < rv.GetTime(); }\r
+               bool operator>(const Time& rv) const { return mTime > rv.GetTime(); }\r
+\r
+               virtual ~Time() { };\r
+       };\r
+\r
+       /* Class Timestamp represent a date AND a time. It is usefull in\r
+        * interactions with the SQL TIMESTAMP type of Interbase. This class\r
+        * inherits from Date and Time and completely inline implements its small\r
+        * specific details. */\r
+\r
+       class Timestamp : public Date, public Time\r
+       {\r
+       public:\r
+               void Clear()    { Date::Clear(); Time::Clear(); }\r
+               void Today()    { Date::Today(); Time::Clear(); }\r
+               void Now()              { Date::Today(); Time::Now(); }\r
+\r
+               Timestamp()             { Clear(); }\r
+\r
+               Timestamp(int y, int m, int d)\r
+                       { Date::SetDate(y, m, d); Time::Clear(); }\r
+\r
+               Timestamp(int y, int mo, int d, int h, int mi, int s, int t = 0)\r
+                       { Date::SetDate(y, mo, d); Time::SetTime(h, mi, s, t); }\r
+\r
+               Timestamp(const Timestamp& rv)\r
+                       : Date(rv.mDate), Time(rv.mTime) {}     // Copy Constructor\r
+\r
+               Timestamp(const Date& rv)\r
+                       { mDate = rv.GetDate(); mTime = 0; }\r
+\r
+               Timestamp(const Time& rv)\r
+                       { mDate = 0; mTime = rv.GetTime(); }\r
+\r
+               Timestamp& operator=(const Timestamp& rv)       // Timestamp Assignment operator\r
+                       { mDate = rv.mDate; mTime = rv.mTime; return *this; }\r
+\r
+               Timestamp& operator=(const Date& rv)            // Date Assignment operator\r
+                       { mDate = rv.GetDate(); return *this; }\r
+\r
+               Timestamp& operator=(const Time& rv)            // Time Assignment operator\r
+                       { mTime = rv.GetTime(); return *this; }\r
+\r
+               bool operator==(const Timestamp& rv) const\r
+                       { return (mDate == rv.GetDate()) && (mTime == rv.GetTime()); }\r
+\r
+               bool operator!=(const Timestamp& rv) const\r
+                       { return (mDate != rv.GetDate()) || (mTime != rv.GetTime()); }\r
+\r
+               bool operator<(const Timestamp& rv) const\r
+                       { return (mDate < rv.GetDate()) ||\r
+                               (mDate == rv.GetDate() && mTime < rv.GetTime()); }\r
+\r
+               bool operator>(const Timestamp& rv) const\r
+                       { return (mDate > rv.GetDate()) ||\r
+                               (mDate == rv.GetDate() && mTime > rv.GetTime()); }\r
+\r
+               ~Timestamp() { }\r
+       };\r
+\r
+       /* Class DBKey can store a DBKEY, that special value which the hidden\r
+        * RDB$DBKEY can give you from a select statement. A DBKey is nothing\r
+        * specific to IBPP. It's a feature of the Firebird database engine. See its\r
+        * documentation for more information. */\r
+\r
+       class DBKey\r
+       {\r
+       private:\r
+               std::string mDBKey;                     // Stores the binary DBKey\r
+               mutable std::string mString;// String (temporary) representation of it\r
+\r
+       public:\r
+               void Clear();\r
+               int Size() const        { return (int)mDBKey.size(); }\r
+               void SetKey(const void*, int size);\r
+               void GetKey(void*, int size) const;\r
+               const char* AsString() const;\r
+\r
+               DBKey& operator=(const DBKey&); // Assignment operator\r
+               DBKey(const DBKey&);                    // Copy Constructor\r
+               DBKey() { }\r
+               ~DBKey() { }\r
+       };\r
+\r
+       /* Class User wraps all the information about a user that the engine can manage. */\r
+\r
+       class User\r
+       {\r
+       public:\r
+               std::string username;\r
+               std::string password;\r
+               std::string firstname;\r
+               std::string middlename;\r
+               std::string lastname;\r
+               uint32_t userid;                // Only relevant on unixes\r
+               uint32_t groupid;               // Only relevant on unixes\r
+\r
+       private:\r
+               void copyfrom(const User& r);\r
+\r
+       public:\r
+               void clear();\r
+               User& operator=(const User& r)  { copyfrom(r); return *this; }\r
+               User(const User& r)                             { copyfrom(r); }\r
+               User() : userid(0), groupid(0)  { }\r
+               ~User() { };\r
+       };\r
+\r
+       //      Interface Wrapper\r
+       template <class T>\r
+       class Ptr\r
+       {\r
+       private:\r
+               T* mObject;\r
+\r
+       public:\r
+               void clear()\r
+               {\r
+                       if (mObject != 0) { mObject->Release(); mObject = 0; }\r
+               }\r
+\r
+               T* intf() const                                         { return mObject; }\r
+               T* operator->() const                           { return mObject; }\r
+\r
+               bool operator==(const T* p) const       { return mObject == p; }\r
+               bool operator==(const Ptr& r) const     { return mObject == r.mObject; }\r
+               bool operator!=(const T* p) const       { return mObject != p; }\r
+               bool operator!=(const Ptr& r) const     { return mObject != r.mObject; }\r
+\r
+               Ptr& operator=(T* p)\r
+               {\r
+                       // AddRef _before_ Release gives correct behaviour on self-assigns\r
+                       T* tmp = (p == 0 ? 0 : p->AddRef());    // Take care of 0\r
+                       if (mObject != 0) mObject->Release();\r
+                       mObject = tmp; return *this;\r
+               }\r
+\r
+               Ptr& operator=(const Ptr& r)\r
+               {\r
+                       // AddRef _before_ Release gives correct behaviour on self-assigns\r
+                       T* tmp = (r.intf() == 0 ? 0 : r->AddRef());// Take care of 0\r
+                       if (mObject != 0) mObject->Release();\r
+                       mObject = tmp; return *this;\r
+               }\r
+\r
+               Ptr(T* p) : mObject(p == 0 ? 0 : p->AddRef()) { }\r
+               Ptr(const Ptr& r) : mObject(r.intf() == 0 ? 0 : r->AddRef()) {  }\r
+\r
+               Ptr() : mObject(0) { }\r
+               ~Ptr() { clear(); }\r
+       };\r
+\r
+       //      --- Interface Classes --- //\r
+\r
+       /* Interfaces IBlob, IArray, IService, IDatabase, ITransaction and\r
+        * IStatement are at the core of IBPP. Though it is possible to program your\r
+        * applications by using theses interfaces directly (as was the case with\r
+        * IBPP 1.x), you should refrain from using them and prefer the new IBPP\r
+        * Objects Blob, Array, ... (without the I in front). Those new objects are\r
+        * typedef'd right after each interface class definition as you can read\r
+        * below. If you program using the Blob (instead of the IBlob interface\r
+        * itself), you'll never have to care about AddRef/Release and you'll never\r
+        * have to care about deleting your objects. */\r
+\r
+       class IBlob;                    typedef Ptr<IBlob> Blob;\r
+       class IArray;                   typedef Ptr<IArray> Array;\r
+       class IService;                 typedef Ptr<IService> Service;\r
+       class IDatabase;                typedef Ptr<IDatabase> Database;\r
+       class ITransaction;             typedef Ptr<ITransaction> Transaction;\r
+       class IStatement;               typedef Ptr<IStatement> Statement;\r
+       class IEvents;                  typedef Ptr<IEvents> Events;\r
+       class IRow;                             typedef Ptr<IRow> Row;\r
+\r
+       /* IBlob is the interface to the blob capabilities of IBPP. Blob is the\r
+        * object class you actually use in your programming. In Firebird, at the\r
+        * row level, a blob is merely a handle to a blob, stored elsewhere in the\r
+        * database. Blob allows you to retrieve such a handle and then read from or\r
+        * write to the blob, much in the same manner than you would do with a file. */\r
+\r
+       class IBlob\r
+       {\r
+       public:\r
+               virtual void Create() = 0;\r
+               virtual void Open() = 0;\r
+               virtual void Close() = 0;\r
+               virtual void Cancel() = 0;\r
+               virtual int Read(void*, int size) = 0;\r
+               virtual void Write(const void*, int size) = 0;\r
+               virtual void Info(int* Size, int* Largest, int* Segments) = 0;\r
+       \r
+               virtual void Save(const std::string& data) = 0;\r
+               virtual void Load(std::string& data) = 0;\r
+\r
+               virtual Database DatabasePtr() const = 0;\r
+               virtual Transaction TransactionPtr() const = 0;\r
+\r
+               virtual IBlob* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+               virtual ~IBlob() { };\r
+       };\r
+\r
+       /*      IArray is the interface to the array capabilities of IBPP. Array is the\r
+       * object class you actually use in your programming. With an Array object, you\r
+       * can create, read and write Interbase Arrays, as a whole or in slices. */\r
+\r
+       class IArray\r
+       {\r
+       public:\r
+               virtual void Describe(const std::string& table, const std::string& column) = 0;\r
+               virtual void ReadTo(ADT, void* buffer, int elemcount) = 0;\r
+               virtual void WriteFrom(ADT, const void* buffer, int elemcount) = 0;\r
+               virtual SDT ElementType() = 0;\r
+               virtual int ElementSize() = 0;\r
+               virtual int ElementScale() = 0;\r
+               virtual int Dimensions() = 0;\r
+               virtual void Bounds(int dim, int* low, int* high) = 0;\r
+               virtual void SetBounds(int dim, int low, int high) = 0;\r
+\r
+               virtual Database DatabasePtr() const = 0;\r
+               virtual Transaction TransactionPtr() const = 0;\r
+\r
+               virtual IArray* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+               virtual ~IArray() { };\r
+       };\r
+\r
+       /* IService is the interface to the service capabilities of IBPP. Service is\r
+        * the object class you actually use in your programming. With a Service\r
+        * object, you can do some maintenance work of databases and servers\r
+        * (backup, restore, create/update users, ...) */\r
+\r
+       class IService\r
+       {\r
+       public:\r
+           virtual void Connect() = 0;\r
+               virtual bool Connected() = 0;\r
+               virtual void Disconnect() = 0;\r
+\r
+               virtual void GetVersion(std::string& version) = 0;\r
+\r
+               virtual void AddUser(const User&) = 0;\r
+               virtual void GetUser(User&) = 0;\r
+               virtual void GetUsers(std::vector<User>&) = 0;\r
+               virtual void ModifyUser(const User&) = 0;\r
+               virtual void RemoveUser(const std::string& username) = 0;\r
+\r
+               virtual void SetPageBuffers(const std::string& dbfile, int buffers) = 0;\r
+               virtual void SetSweepInterval(const std::string& dbfile, int sweep) = 0;\r
+               virtual void SetSyncWrite(const std::string& dbfile, bool) = 0;\r
+               virtual void SetReadOnly(const std::string& dbfile, bool) = 0;\r
+               virtual void SetReserveSpace(const std::string& dbfile, bool) = 0;\r
+\r
+               virtual void Shutdown(const std::string& dbfile, DSM mode, int sectimeout) = 0;\r
+               virtual void Restart(const std::string& dbfile) = 0;\r
+               virtual void Sweep(const std::string& dbfile) = 0;\r
+               virtual void Repair(const std::string& dbfile, RPF flags) = 0;\r
+\r
+               virtual void StartBackup(const std::string& dbfile,\r
+                       const std::string& bkfile, BRF flags = BRF(0)) = 0;\r
+               virtual void StartRestore(const std::string& bkfile, const std::string& dbfile,\r
+                       int pagesize = 0, BRF flags = BRF(0)) = 0;\r
+\r
+               virtual const char* WaitMsg() = 0;      // With reporting (does not block)\r
+               virtual void Wait() = 0;                        // Without reporting (does block)\r
+\r
+               virtual IService* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+               virtual ~IService() { };\r
+       };\r
+\r
+       /*      IDatabase is the interface to the database connections in IBPP. Database\r
+        * is the object class you actually use in your programming. With a Database\r
+        * object, you can create/drop/connect databases. */\r
+\r
+       class EventInterface;   // Cross-reference between EventInterface and IDatabase\r
+       \r
+       class IDatabase\r
+       {\r
+       public:\r
+               virtual const char* ServerName() const = 0;\r
+               virtual const char* DatabaseName() const = 0;\r
+               virtual const char* Username() const = 0;\r
+               virtual const char* UserPassword() const = 0;\r
+               virtual const char* RoleName() const = 0;\r
+               virtual const char* CharSet() const = 0;\r
+               virtual const char* CreateParams() const = 0;\r
+\r
+               virtual void Info(int* ODS, int* ODSMinor, int* PageSize,\r
+                       int* Pages,     int* Buffers, int* Sweep, bool* Sync,\r
+                       bool* Reserve) = 0;\r
+               virtual void Statistics(int* Fetches, int* Marks,\r
+                       int* Reads, int* Writes) = 0;\r
+               virtual void Counts(int* Insert, int* Update, int* Delete, \r
+                       int* ReadIdx, int* ReadSeq) = 0;\r
+               virtual void Users(std::vector<std::string>& users) = 0;\r
+               virtual int Dialect() = 0;\r
+\r
+               virtual void Create(int dialect) = 0;\r
+               virtual void Connect() = 0;\r
+               virtual bool Connected() = 0;\r
+               virtual void Inactivate() = 0;\r
+               virtual void Disconnect() = 0;\r
+               virtual void Drop() = 0;\r
+\r
+               virtual IDatabase* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+           virtual ~IDatabase() { };\r
+       };\r
+\r
+       /* ITransaction is the interface to the transaction connections in IBPP.\r
+        * Transaction is the object class you actually use in your programming. A\r
+        * Transaction object can be associated with more than one Database,\r
+        * allowing for distributed transactions spanning multiple databases,\r
+        * possibly located on different servers. IBPP is one among the few\r
+        * programming interfaces to Firebird that allows you to support distributed\r
+        * transactions. */\r
+\r
+       class ITransaction\r
+       {\r
+       public:\r
+           virtual void AttachDatabase(Database db, TAM am = amWrite,\r
+                       TIL il = ilConcurrency, TLR lr = lrWait, TFF flags = TFF(0)) = 0;\r
+           virtual void DetachDatabase(Database db) = 0;\r
+               virtual void AddReservation(Database db,\r
+                               const std::string& table, TTR tr) = 0;\r
+\r
+               virtual void Start() = 0;\r
+               virtual bool Started() = 0;\r
+           virtual void Commit() = 0;\r
+           virtual void Rollback() = 0;\r
+           virtual void CommitRetain() = 0;\r
+               virtual void RollbackRetain() = 0;\r
+\r
+               virtual ITransaction* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+           virtual ~ITransaction() { };\r
+       };\r
+\r
+       /*\r
+        *      Class Row can hold all the values of a row (from a SELECT for instance).\r
+        */\r
+\r
+       class IRow\r
+       {\r
+       public:\r
+               virtual void SetNull(int) = 0;\r
+               virtual void Set(int, bool) = 0;\r
+               virtual void Set(int, const void*, int) = 0;            // byte buffers\r
+               virtual void Set(int, const char*) = 0;                         // c-string\r
+               virtual void Set(int, const std::string&) = 0;\r
+               virtual void Set(int, int16_t) = 0;\r
+               virtual void Set(int, int32_t) = 0;\r
+               virtual void Set(int, int64_t) = 0;\r
+               virtual void Set(int, float) = 0;\r
+               virtual void Set(int, double) = 0;\r
+               virtual void Set(int, const Timestamp&) = 0;\r
+               virtual void Set(int, const Date&) = 0;\r
+               virtual void Set(int, const Time&) = 0;\r
+               virtual void Set(int, const DBKey&) = 0;\r
+               virtual void Set(int, const Blob&) = 0;\r
+               virtual void Set(int, const Array&) = 0;\r
+\r
+               virtual bool IsNull(int) = 0;\r
+               virtual bool Get(int, bool&) = 0;\r
+               virtual bool Get(int, void*, int&) = 0; // byte buffers\r
+               virtual bool Get(int, std::string&) = 0;\r
+               virtual bool Get(int, int16_t&) = 0;\r
+               virtual bool Get(int, int32_t&) = 0;\r
+               virtual bool Get(int, int64_t&) = 0;\r
+               virtual bool Get(int, float&) = 0;\r
+               virtual bool Get(int, double&) = 0;\r
+               virtual bool Get(int, Timestamp&) = 0;\r
+               virtual bool Get(int, Date&) = 0;\r
+               virtual bool Get(int, Time&) = 0;\r
+               virtual bool Get(int, DBKey&) = 0;\r
+               virtual bool Get(int, Blob&) = 0;\r
+               virtual bool Get(int, Array&) = 0;\r
+\r
+               virtual bool IsNull(const std::string&) = 0;\r
+               virtual bool Get(const std::string&, bool&) = 0;\r
+               virtual bool Get(const std::string&, void*, int&) = 0;  // byte buffers\r
+               virtual bool Get(const std::string&, std::string&) = 0;\r
+               virtual bool Get(const std::string&, int16_t&) = 0;\r
+               virtual bool Get(const std::string&, int32_t&) = 0;\r
+               virtual bool Get(const std::string&, int64_t&) = 0;\r
+               virtual bool Get(const std::string&, float&) = 0;\r
+               virtual bool Get(const std::string&, double&) = 0;\r
+               virtual bool Get(const std::string&, Timestamp&) = 0;\r
+               virtual bool Get(const std::string&, Date&) = 0;\r
+               virtual bool Get(const std::string&, Time&) = 0;\r
+               virtual bool Get(const std::string&, DBKey&) = 0;\r
+               virtual bool Get(const std::string&, Blob&) = 0;\r
+               virtual bool Get(const std::string&, Array&) = 0;\r
+\r
+               virtual int ColumnNum(const std::string&) = 0;\r
+               virtual const char* ColumnName(int) = 0;\r
+               virtual const char* ColumnAlias(int) = 0;\r
+               virtual const char* ColumnTable(int) = 0;\r
+               virtual SDT ColumnType(int) = 0;\r
+               virtual int ColumnSubtype(int) = 0;\r
+               virtual int ColumnSize(int) = 0;\r
+               virtual int ColumnScale(int) = 0;\r
+               virtual int Columns() = 0;\r
+               \r
+               virtual bool ColumnUpdated(int) = 0;\r
+               virtual bool Updated() = 0;\r
+\r
+               virtual Database DatabasePtr() const = 0;\r
+               virtual Transaction TransactionPtr() const = 0;\r
+\r
+               virtual IRow* Clone() = 0;\r
+               virtual IRow* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+           virtual ~IRow() {};\r
+       };\r
+\r
+       /* IStatement is the interface to the statements execution in IBPP.\r
+        * Statement is the object class you actually use in your programming. A\r
+        * Statement object is the work horse of IBPP. All your data manipulation\r
+        * statements will be done through it. It is also used to access the result\r
+        * set of a query (when the statement is such), one row at a time and in\r
+        * strict forward direction. */\r
+\r
+       class IStatement\r
+       {\r
+       public:\r
+               virtual void Prepare(const std::string&) = 0;\r
+               virtual void Execute() = 0;\r
+               virtual void Execute(const std::string&) = 0;\r
+               virtual void ExecuteImmediate(const std::string&) = 0;\r
+               virtual void CursorExecute(const std::string& cursor) = 0;\r
+               virtual void CursorExecute(const std::string& cursor, const std::string&) = 0;\r
+               virtual bool Fetch() = 0;\r
+               virtual bool Fetch(Row&) = 0;\r
+               virtual int AffectedRows() = 0;\r
+               virtual void Close() = 0;\r
+               virtual std::string& Sql() = 0;\r
+               virtual STT Type() = 0;\r
+\r
+               virtual void SetNull(int) = 0;\r
+               virtual void Set(int, bool) = 0;\r
+               virtual void Set(int, const void*, int) = 0;            // byte buffers\r
+               virtual void Set(int, const char*) = 0;                         // c-string\r
+               virtual void Set(int, const std::string&) = 0;\r
+               virtual void Set(int, int16_t value) = 0;\r
+               virtual void Set(int, int32_t value) = 0;\r
+               virtual void Set(int, int64_t value) = 0;\r
+               virtual void Set(int, float value) = 0;\r
+               virtual void Set(int, double value) = 0;\r
+               virtual void Set(int, const Timestamp& value) = 0;\r
+               virtual void Set(int, const Date& value) = 0;\r
+               virtual void Set(int, const Time& value) = 0;\r
+               virtual void Set(int, const DBKey& value) = 0;\r
+               virtual void Set(int, const Blob& value) = 0;\r
+               virtual void Set(int, const Array& value) = 0;\r
+\r
+               virtual bool IsNull(int) = 0;\r
+               virtual bool Get(int, bool&) = 0;\r
+               virtual bool Get(int, void*, int&) = 0; // byte buffers\r
+               virtual bool Get(int, std::string&) = 0;\r
+               virtual bool Get(int, int16_t&) = 0;\r
+               virtual bool Get(int, int32_t&) = 0;\r
+               virtual bool Get(int, int64_t&) = 0;\r
+               virtual bool Get(int, float&) = 0;\r
+               virtual bool Get(int, double&) = 0;\r
+               virtual bool Get(int, Timestamp& value) = 0;\r
+               virtual bool Get(int, Date& value) = 0;\r
+               virtual bool Get(int, Time& value) = 0;\r
+               virtual bool Get(int, DBKey& value) = 0;\r
+               virtual bool Get(int, Blob& value) = 0;\r
+               virtual bool Get(int, Array& value) = 0;\r
+\r
+               virtual bool IsNull(const std::string&) = 0;\r
+               virtual bool Get(const std::string&, bool&) = 0;\r
+               virtual bool Get(const std::string&, void*, int&) = 0;  // byte buffers\r
+               virtual bool Get(const std::string&, std::string&) = 0;\r
+               virtual bool Get(const std::string&, int16_t&) = 0;\r
+               virtual bool Get(const std::string&, int32_t&) = 0;\r
+               virtual bool Get(const std::string&, int64_t&) = 0;\r
+               virtual bool Get(const std::string&, float&) = 0;\r
+               virtual bool Get(const std::string&, double&) = 0;\r
+               virtual bool Get(const std::string&, Timestamp& value) = 0;\r
+               virtual bool Get(const std::string&, Date& value) = 0;\r
+               virtual bool Get(const std::string&, Time& value) = 0;\r
+               virtual bool Get(const std::string&, DBKey& value) = 0;\r
+               virtual bool Get(const std::string&, Blob& value) = 0;\r
+               virtual bool Get(const std::string&, Array& value) = 0;\r
+\r
+               virtual int ColumnNum(const std::string&) = 0;\r
+               virtual const char* ColumnName(int) = 0;\r
+               virtual const char* ColumnAlias(int) = 0;\r
+               virtual const char* ColumnTable(int) = 0;\r
+               virtual SDT ColumnType(int) = 0;\r
+               virtual int ColumnSubtype(int) = 0;\r
+               virtual int ColumnSize(int) = 0;\r
+               virtual int ColumnScale(int) = 0;\r
+               virtual int Columns() = 0;\r
+\r
+               virtual SDT ParameterType(int) = 0;\r
+               virtual int ParameterSubtype(int) = 0;\r
+               virtual int ParameterSize(int) = 0;\r
+               virtual int ParameterScale(int) = 0;\r
+               virtual int Parameters() = 0;\r
+\r
+               virtual void Plan(std::string&) = 0;\r
+\r
+               virtual Database DatabasePtr() const = 0;\r
+               virtual Transaction TransactionPtr() const = 0;\r
+\r
+               virtual IStatement* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+           virtual ~IStatement() { };\r
+\r
+               // DEPRECATED METHODS (WON'T BE AVAILABLE IN VERSIONS 3.x)\r
+               virtual bool Get(int, char*) = 0;                                       // DEPRECATED\r
+               virtual bool Get(const std::string&, char*) = 0;        // DEPRECATED\r
+               virtual bool Get(int, bool*) = 0;                                       // DEPRECATED\r
+               virtual bool Get(const std::string&, bool*) = 0;        // DEPRECATED\r
+               virtual bool Get(int, int16_t*) = 0;                            // DEPRECATED\r
+               virtual bool Get(const std::string&, int16_t*) = 0;     // DEPRECATED\r
+               virtual bool Get(int, int32_t*) = 0;                            // DEPRECATED\r
+               virtual bool Get(const std::string&, int32_t*) = 0;     // DEPRECATED\r
+               virtual bool Get(int, int64_t*) = 0;                            // DEPRECATED\r
+               virtual bool Get(const std::string&, int64_t*) = 0;     // DEPRECATED\r
+               virtual bool Get(int, float*) = 0;                                      // DEPRECATED\r
+               virtual bool Get(const std::string&, float*) = 0;       // DEPRECATED\r
+               virtual bool Get(int, double*) = 0;                                     // DEPRECATED\r
+               virtual bool Get(const std::string&, double*) = 0;      // DEPRECATED\r
+       };\r
+       \r
+       class IEvents\r
+       {\r
+       public:\r
+               virtual void Add(const std::string&, EventInterface*) = 0;\r
+               virtual void Drop(const std::string&) = 0;\r
+               virtual void List(std::vector<std::string>&) = 0;\r
+               virtual void Clear() = 0;                               // Drop all events\r
+               virtual void Dispatch() = 0;                    // Dispatch events (calls handlers)\r
+\r
+               virtual Database DatabasePtr() const = 0;\r
+\r
+               virtual IEvents* AddRef() = 0;\r
+               virtual void Release() = 0;\r
+\r
+           virtual ~IEvents() { };\r
+       };\r
+       \r
+       /* Class EventInterface is merely a pure interface.\r
+        * It is _not_ implemented by IBPP. It is only a base class definition from\r
+        * which your own event interface classes have to derive from.\r
+        * Please read the reference guide at http://www.ibpp.org for more info. */\r
+\r
+       class EventInterface\r
+       {\r
+       public:\r
+               virtual void ibppEventHandler(Events, const std::string&, int) = 0;\r
+               virtual ~EventInterface() { };\r
+       };\r
+\r
+       //      --- Factories ---\r
+       //      These methods are the only way to get one of the above\r
+       //      Interfaces.  They are at the heart of how you program using IBPP.  For\r
+       //      instance, to get access to a database, you'll write code similar to this:\r
+       //      {\r
+       //              Database db = DatabaseFactory("server", "databasename",\r
+       //                                              "user", "password");\r
+       //              db->Connect();\r
+       //              ...\r
+       //              db->Disconnect();\r
+       //      }\r
+\r
+       Service ServiceFactory(const std::string& ServerName,\r
+               const std::string& UserName, const std::string& UserPassword);\r
+\r
+       Database DatabaseFactory(const std::string& ServerName,\r
+               const std::string& DatabaseName, const std::string& UserName,\r
+                       const std::string& UserPassword, const std::string& RoleName,\r
+                               const std::string& CharSet, const std::string& CreateParams);\r
+\r
+       inline Database DatabaseFactory(const std::string& ServerName,\r
+               const std::string& DatabaseName, const std::string& UserName,\r
+                       const std::string& UserPassword)\r
+               { return DatabaseFactory(ServerName, DatabaseName, UserName, UserPassword, "", "", ""); }\r
+\r
+       Transaction TransactionFactory(Database db, TAM am = amWrite,\r
+               TIL il = ilConcurrency, TLR lr = lrWait, TFF flags = TFF(0));\r
+\r
+       Statement StatementFactory(Database db, Transaction tr,\r
+               const std::string& sql);\r
+\r
+       inline Statement StatementFactory(Database db, Transaction tr)\r
+               { return StatementFactory(db, tr, ""); }\r
+\r
+       Blob BlobFactory(Database db, Transaction tr);\r
+       \r
+       Array ArrayFactory(Database db, Transaction tr);\r
+       \r
+       Events EventsFactory(Database db);\r
+\r
+       /* IBPP uses a self initialization system. Each time an object that may\r
+        * require the usage of the Interbase client C-API library is used, the\r
+        * library internal handling details are automatically initialized, if not\r
+        * already done. You can kick this initialization at the start of an\r
+        * application by calling IBPP::CheckVersion(). This is recommended, because\r
+        * IBPP::CheckVersion will assure you that YOUR code has been compiled\r
+        * against a compatible version of the library. */\r
+\r
+       bool CheckVersion(uint32_t);\r
+       int GDSVersion();\r
+       \r
+       /* On Win32 platform, ClientLibSearchPaths() allows to setup\r
+        * one or multiple additional paths (separated with a ';') where IBPP\r
+        * will look for the client library (before the default implicit search\r
+        * locations). This is usefull for applications distributed with a 'private'\r
+        * copy of Firebird, when the registry is useless to identify the location\r
+        * from where to attempt loading the fbclient.dll / gds32.dll.\r
+        * If called, this function must be called *early* by the application,\r
+        * before *any* other function or object methods of IBPP.\r
+        * Currently, this is a NO-OP on platforms other than Win32. */\r
+        \r
+       void ClientLibSearchPaths(const std::string&);\r
+\r
+       /* Finally, here are some date and time conversion routines used by IBPP and\r
+        * that may be helpful at the application level. They do not depend on\r
+        * anything related to Firebird/Interbase. Just a bonus. dtoi and itod\r
+        * return false on invalid parameters or out of range conversions. */\r
+\r
+       bool dtoi(int date, int* py, int* pm, int* pd);\r
+       bool itod(int* pdate, int year, int month, int day);\r
+       void ttoi(int itime, int* phour, int* pminute, int* psecond, int* ptt);\r
+       void itot(int* ptime, int hour, int minute, int second = 0, int tenthousandths = 0);\r
+\r
+}\r
+\r
+#endif\r
+\r
+//\r
+//     EOF\r
+//\r
diff --git a/stglibs/locker.lib/include/stg/locker.h b/stglibs/locker.lib/include/stg/locker.h
new file mode 100644 (file)
index 0000000..7a8d0b8
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+/*
+ $Revision: 1.5 $
+ $Date: 2010/03/04 11:57:11 $
+ $Author: faust $
+*/
+
+
+#ifndef STG_LOCKER_H
+#define STG_LOCKER_H
+
+#include <pthread.h>
+
+#ifdef DEBUG_LOCKER
+
+#include <iostream>
+#include <string>
+#include <pthread.h>
+
+#endif
+
+//-----------------------------------------------------------------------------
+class STG_LOCKER
+{
+public:
+    #ifdef DEBUG_LOCKER
+    STG_LOCKER(pthread_mutex_t * m, const char * __file__, int __line__)
+        : mutex(m),
+          file(__file__),
+          line(__line__),
+          lockerMutex(),
+          lockID(0)
+    #else
+    STG_LOCKER(pthread_mutex_t * m, const char *, int)
+        : mutex(m)
+    #endif
+        {
+        mutex = m;
+        #ifdef DEBUG_LOCKER
+        pthread_mutex_lock(&lockerMutex);
+        file = __file__;
+        line = __line__;
+        if (id == 0)
+            pthread_mutex_init(&lockerMutex, NULL);
+
+        lockID = ++id;
+        std::cout << "Lock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
+        pthread_mutex_unlock(&lockerMutex);
+        #endif
+        pthread_mutex_lock(mutex);
+        };
+
+    ~STG_LOCKER()
+        {
+        pthread_mutex_unlock(mutex);
+        #ifdef DEBUG_LOCKER
+        pthread_mutex_lock(&lockerMutex);
+        std::cout << "Unlock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
+        pthread_mutex_unlock(&lockerMutex);
+        #endif
+        };
+private:
+    STG_LOCKER(const STG_LOCKER & rvalue);
+    STG_LOCKER & operator=(const STG_LOCKER & rvalue);
+
+    pthread_mutex_t * mutex;
+    #ifdef DEBUG_LOCKER
+    std::string file;
+    int line;
+    static pthread_mutex_t lockerMutex;
+    static long long id;
+    long long lockID;
+    #endif
+};
+//-----------------------------------------------------------------------------
+
+#endif //STG_LOCKER_H
diff --git a/stglibs/locker.lib/locker.h b/stglibs/locker.lib/locker.h
deleted file mode 100644 (file)
index 7a8d0b8..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
-/*
- $Revision: 1.5 $
- $Date: 2010/03/04 11:57:11 $
- $Author: faust $
-*/
-
-
-#ifndef STG_LOCKER_H
-#define STG_LOCKER_H
-
-#include <pthread.h>
-
-#ifdef DEBUG_LOCKER
-
-#include <iostream>
-#include <string>
-#include <pthread.h>
-
-#endif
-
-//-----------------------------------------------------------------------------
-class STG_LOCKER
-{
-public:
-    #ifdef DEBUG_LOCKER
-    STG_LOCKER(pthread_mutex_t * m, const char * __file__, int __line__)
-        : mutex(m),
-          file(__file__),
-          line(__line__),
-          lockerMutex(),
-          lockID(0)
-    #else
-    STG_LOCKER(pthread_mutex_t * m, const char *, int)
-        : mutex(m)
-    #endif
-        {
-        mutex = m;
-        #ifdef DEBUG_LOCKER
-        pthread_mutex_lock(&lockerMutex);
-        file = __file__;
-        line = __line__;
-        if (id == 0)
-            pthread_mutex_init(&lockerMutex, NULL);
-
-        lockID = ++id;
-        std::cout << "Lock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
-        pthread_mutex_unlock(&lockerMutex);
-        #endif
-        pthread_mutex_lock(mutex);
-        };
-
-    ~STG_LOCKER()
-        {
-        pthread_mutex_unlock(mutex);
-        #ifdef DEBUG_LOCKER
-        pthread_mutex_lock(&lockerMutex);
-        std::cout << "Unlock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
-        pthread_mutex_unlock(&lockerMutex);
-        #endif
-        };
-private:
-    STG_LOCKER(const STG_LOCKER & rvalue);
-    STG_LOCKER & operator=(const STG_LOCKER & rvalue);
-
-    pthread_mutex_t * mutex;
-    #ifdef DEBUG_LOCKER
-    std::string file;
-    int line;
-    static pthread_mutex_t lockerMutex;
-    static long long id;
-    long long lockID;
-    #endif
-};
-//-----------------------------------------------------------------------------
-
-#endif //STG_LOCKER_H
diff --git a/stglibs/logger.lib/include/stg/logger.h b/stglibs/logger.lib/include/stg/logger.h
new file mode 100644 (file)
index 0000000..9fe1487
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef STG_LOGGER_H
+#define STG_LOGGER_H
+
+#include <pthread.h>
+
+#include <string>
+
+const char * LogDate(time_t t);
+//-----------------------------------------------------------------------------
+class STG_LOGGER;
+STG_LOGGER & GetStgLogger();
+//-----------------------------------------------------------------------------
+class STG_LOGGER_LOCKER
+{
+public:
+    STG_LOGGER_LOCKER(pthread_mutex_t * m) : mutex(m) { pthread_mutex_lock(mutex); };
+    ~STG_LOGGER_LOCKER() { pthread_mutex_unlock(mutex); };
+
+private:
+    STG_LOGGER_LOCKER(const STG_LOGGER_LOCKER & rvalue);
+    STG_LOGGER_LOCKER & operator=(const STG_LOGGER_LOCKER & rvalue);
+
+    pthread_mutex_t * mutex;
+};
+//-----------------------------------------------------------------------------
+class STG_LOGGER
+{
+friend STG_LOGGER & GetStgLogger();
+
+public:
+    ~STG_LOGGER();
+    void SetLogFileName(const std::string & fn);
+    void operator()(const char * fmt, ...);
+
+private:
+    STG_LOGGER();
+    STG_LOGGER(const STG_LOGGER & rvalue);
+    STG_LOGGER & operator=(const STG_LOGGER & rvalue);
+
+    const char * LogDate(time_t t);
+
+    std::string fileName;
+    pthread_mutex_t mutex;
+};
+//-----------------------------------------------------------------------------
+
+#endif //STG_LOGGER_H
diff --git a/stglibs/logger.lib/logger.h b/stglibs/logger.lib/logger.h
deleted file mode 100644 (file)
index 9fe1487..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef STG_LOGGER_H
-#define STG_LOGGER_H
-
-#include <pthread.h>
-
-#include <string>
-
-const char * LogDate(time_t t);
-//-----------------------------------------------------------------------------
-class STG_LOGGER;
-STG_LOGGER & GetStgLogger();
-//-----------------------------------------------------------------------------
-class STG_LOGGER_LOCKER
-{
-public:
-    STG_LOGGER_LOCKER(pthread_mutex_t * m) : mutex(m) { pthread_mutex_lock(mutex); };
-    ~STG_LOGGER_LOCKER() { pthread_mutex_unlock(mutex); };
-
-private:
-    STG_LOGGER_LOCKER(const STG_LOGGER_LOCKER & rvalue);
-    STG_LOGGER_LOCKER & operator=(const STG_LOGGER_LOCKER & rvalue);
-
-    pthread_mutex_t * mutex;
-};
-//-----------------------------------------------------------------------------
-class STG_LOGGER
-{
-friend STG_LOGGER & GetStgLogger();
-
-public:
-    ~STG_LOGGER();
-    void SetLogFileName(const std::string & fn);
-    void operator()(const char * fmt, ...);
-
-private:
-    STG_LOGGER();
-    STG_LOGGER(const STG_LOGGER & rvalue);
-    STG_LOGGER & operator=(const STG_LOGGER & rvalue);
-
-    const char * LogDate(time_t t);
-
-    std::string fileName;
-    pthread_mutex_t mutex;
-};
-//-----------------------------------------------------------------------------
-
-#endif //STG_LOGGER_H
diff --git a/stglibs/pinger.lib/include/stg/pinger.h b/stglibs/pinger.lib/include/stg/pinger.h
new file mode 100644 (file)
index 0000000..b1b7778
--- /dev/null
@@ -0,0 +1,132 @@
+ /*
+ $Revision: 1.8 $
+ $Date: 2008/05/10 11:59:53 $
+ $Author: nobunaga $
+ */
+
+#ifndef PINGER_H
+#define PINGER_H
+
+#include <ctime>
+#include <string>
+#include <list>
+#include <map>
+
+#ifdef LINUX
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/ip_icmp.h>
+#endif
+
+#if defined (FREE_BSD) || defined (FREE_BSD5)
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/ip_var.h>
+#include <arpa/inet.h>
+#endif
+
+#include "stg/os_int.h"
+
+//-----------------------------------------------------------------------------
+struct ICMP_HDR
+{
+uint8_t       type;
+uint8_t       code;
+uint16_t      checksum;
+union
+    {
+    struct
+        {
+        uint16_t    id;
+        uint16_t    sequence;
+        } echo;
+    uint32_t  gateway;
+    struct
+        {
+        uint16_t    unused;
+        uint16_t    mtu;
+        } frag;
+    } un;
+};
+//-----------------------------------------------------------------------------
+struct IP_HDR
+{
+    uint8_t     ihl:4,
+                version:4;
+    uint8_t     tos;
+    uint16_t    tot_len;
+    uint16_t    id;
+    uint16_t    frag_off;
+    uint8_t     ttl;
+    uint8_t     protocol;
+    uint16_t    check;
+    uint32_t    saddr;
+    uint32_t    daddr;
+};
+//-----------------------------------------------------------------------------
+struct PING_IP_TIME
+{
+uint32_t    ip;
+time_t      pingTime;
+};
+//-----------------------------------------------------------------------------
+
+#define PING_DATA_LEN   (64)
+//-----------------------------------------------------------------------------
+struct PING_MESSAGE
+{
+    ICMP_HDR    hdr;
+    char        msg[PING_DATA_LEN];
+};
+//-----------------------------------------------------------------------------
+class STG_PINGER
+{
+public:
+            STG_PINGER(time_t delay = 15);
+            ~STG_PINGER();
+
+    int     Start();
+    int     Stop();
+    void    AddIP(uint32_t ip);
+    void    DelIP(uint32_t ip);
+    int     GetPingIPNum() const;
+    void    PrintAllIP();
+    int     GetIPTime(uint32_t ip, time_t * t) const;
+    void    SetDelayTime(time_t d) { delay = d; }
+    time_t  GetDelayTime() const { return delay; }
+    const std::string & GetStrError() const { return errorStr; }
+
+private:
+    uint16_t    PingCheckSum(void * data, int len);
+    int         SendPing(uint32_t ip);
+    uint32_t    RecvPing();
+    void        RealAddIP();
+    void        RealDelIP();
+
+    static void * RunSendPing(void * d);
+    static void * RunRecvPing(void * d);
+
+    int         delay;
+    bool        nonstop;
+    bool        isRunningRecver;
+    bool        isRunningSender;
+    int         sendSocket;
+    int         recvSocket;
+    pthread_t   sendThread;
+    pthread_t   recvThread;
+
+    PING_MESSAGE pmSend;
+    uint32_t    pid;
+
+    std::string errorStr;
+
+    std::multimap<uint32_t, time_t> pingIP;
+    std::list<uint32_t>          ipToAdd;
+    std::list<uint32_t>          ipToDel;
+
+    mutable pthread_mutex_t mutex;
+};
+//-----------------------------------------------------------------------------
+#endif
diff --git a/stglibs/pinger.lib/pinger.h b/stglibs/pinger.lib/pinger.h
deleted file mode 100644 (file)
index b1b7778..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
- /*
- $Revision: 1.8 $
- $Date: 2008/05/10 11:59:53 $
- $Author: nobunaga $
- */
-
-#ifndef PINGER_H
-#define PINGER_H
-
-#include <ctime>
-#include <string>
-#include <list>
-#include <map>
-
-#ifdef LINUX
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/ip_icmp.h>
-#endif
-
-#if defined (FREE_BSD) || defined (FREE_BSD5)
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_icmp.h>
-#include <netinet/ip_var.h>
-#include <arpa/inet.h>
-#endif
-
-#include "stg/os_int.h"
-
-//-----------------------------------------------------------------------------
-struct ICMP_HDR
-{
-uint8_t       type;
-uint8_t       code;
-uint16_t      checksum;
-union
-    {
-    struct
-        {
-        uint16_t    id;
-        uint16_t    sequence;
-        } echo;
-    uint32_t  gateway;
-    struct
-        {
-        uint16_t    unused;
-        uint16_t    mtu;
-        } frag;
-    } un;
-};
-//-----------------------------------------------------------------------------
-struct IP_HDR
-{
-    uint8_t     ihl:4,
-                version:4;
-    uint8_t     tos;
-    uint16_t    tot_len;
-    uint16_t    id;
-    uint16_t    frag_off;
-    uint8_t     ttl;
-    uint8_t     protocol;
-    uint16_t    check;
-    uint32_t    saddr;
-    uint32_t    daddr;
-};
-//-----------------------------------------------------------------------------
-struct PING_IP_TIME
-{
-uint32_t    ip;
-time_t      pingTime;
-};
-//-----------------------------------------------------------------------------
-
-#define PING_DATA_LEN   (64)
-//-----------------------------------------------------------------------------
-struct PING_MESSAGE
-{
-    ICMP_HDR    hdr;
-    char        msg[PING_DATA_LEN];
-};
-//-----------------------------------------------------------------------------
-class STG_PINGER
-{
-public:
-            STG_PINGER(time_t delay = 15);
-            ~STG_PINGER();
-
-    int     Start();
-    int     Stop();
-    void    AddIP(uint32_t ip);
-    void    DelIP(uint32_t ip);
-    int     GetPingIPNum() const;
-    void    PrintAllIP();
-    int     GetIPTime(uint32_t ip, time_t * t) const;
-    void    SetDelayTime(time_t d) { delay = d; }
-    time_t  GetDelayTime() const { return delay; }
-    const std::string & GetStrError() const { return errorStr; }
-
-private:
-    uint16_t    PingCheckSum(void * data, int len);
-    int         SendPing(uint32_t ip);
-    uint32_t    RecvPing();
-    void        RealAddIP();
-    void        RealDelIP();
-
-    static void * RunSendPing(void * d);
-    static void * RunRecvPing(void * d);
-
-    int         delay;
-    bool        nonstop;
-    bool        isRunningRecver;
-    bool        isRunningSender;
-    int         sendSocket;
-    int         recvSocket;
-    pthread_t   sendThread;
-    pthread_t   recvThread;
-
-    PING_MESSAGE pmSend;
-    uint32_t    pid;
-
-    std::string errorStr;
-
-    std::multimap<uint32_t, time_t> pingIP;
-    std::list<uint32_t>          ipToAdd;
-    std::list<uint32_t>          ipToDel;
-
-    mutable pthread_mutex_t mutex;
-};
-//-----------------------------------------------------------------------------
-#endif
diff --git a/stglibs/scriptexecuter.lib/include/stg/scriptexecuter.h b/stglibs/scriptexecuter.lib/include/stg/scriptexecuter.h
new file mode 100644 (file)
index 0000000..41b02a2
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef SCRIPT_EXECUTER_H
+#define SCRIPT_EXECUTER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int ScriptExec(const char * str);
+#ifdef LINUX
+void Executer(int msgID, pid_t pid, char * procName);
+#else
+void Executer(int msgID, pid_t pid);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/stglibs/scriptexecuter.lib/scriptexecuter.h b/stglibs/scriptexecuter.lib/scriptexecuter.h
deleted file mode 100644 (file)
index 41b02a2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef SCRIPT_EXECUTER_H
-#define SCRIPT_EXECUTER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int ScriptExec(const char * str);
-#ifdef LINUX
-void Executer(int msgID, pid_t pid, char * procName);
-#else
-void Executer(int msgID, pid_t pid);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/stglibs/smux.lib/ANY.h b/stglibs/smux.lib/ANY.h
deleted file mode 100644 (file)
index b7d92fa..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef ASN_TYPE_ANY_H
-#define ASN_TYPE_ANY_H
-
-#include <OCTET_STRING.h>      /* Implemented via OCTET STRING type */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ANY {
-       uint8_t *buf;   /* BER-encoded ANY contents */
-       int size;       /* Size of the above buffer */
-
-       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
-} ANY_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_ANY;
-
-asn_struct_free_f ANY_free;
-asn_struct_print_f ANY_print;
-ber_type_decoder_f ANY_decode_ber;
-der_type_encoder_f ANY_encode_der;
-xer_type_encoder_f ANY_encode_xer;
-
-/******************************
- * Handy conversion routines. *
- ******************************/
-
-/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
-int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
-ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
-
-/* Convert the contents of the ANY type into the specified type. */
-int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
-
-#define        ANY_fromBuf(s, buf, size)       OCTET_STRING_fromBuf((s), (buf), (size))
-#define        ANY_new_fromBuf(buf, size)      OCTET_STRING_new_fromBuf(       \
-                                               &asn_DEF_ANY, (buf), (size))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ASN_TYPE_ANY_H */
diff --git a/stglibs/smux.lib/ApplicationSyntax.h b/stglibs/smux.lib/ApplicationSyntax.h
deleted file mode 100644 (file)
index 90a8707..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _ApplicationSyntax_H_
-#define        _ApplicationSyntax_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "NetworkAddress.h"
-#include "Counter.h"
-#include "Gauge.h"
-#include "TimeTicks.h"
-#include "Opaque.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum ApplicationSyntax_PR {
-       ApplicationSyntax_PR_NOTHING,   /* No components present */
-       ApplicationSyntax_PR_address,
-       ApplicationSyntax_PR_counter,
-       ApplicationSyntax_PR_gauge,
-       ApplicationSyntax_PR_ticks,
-       ApplicationSyntax_PR_arbitrary
-} ApplicationSyntax_PR;
-
-/* ApplicationSyntax */
-typedef struct ApplicationSyntax {
-       ApplicationSyntax_PR present;
-       union ApplicationSyntax_u {
-               NetworkAddress_t         address;
-               Counter_t        counter;
-               Gauge_t  gauge;
-               TimeTicks_t      ticks;
-               Opaque_t         arbitrary;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} ApplicationSyntax_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_ApplicationSyntax;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ApplicationSyntax_H_ */
diff --git a/stglibs/smux.lib/AtEntry.h b/stglibs/smux.lib/AtEntry.h
deleted file mode 100644 (file)
index a0aba10..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _AtEntry_H_
-#define        _AtEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "PhysAddress.h"
-#include "NetworkAddress.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* AtEntry */
-typedef struct AtEntry {
-       INTEGER_t        atIfIndex;
-       PhysAddress_t    atPhysAddress;
-       NetworkAddress_t         atNetAddress;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} AtEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_AtEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _AtEntry_H_ */
diff --git a/stglibs/smux.lib/BIT_STRING.h b/stglibs/smux.lib/BIT_STRING.h
deleted file mode 100644 (file)
index 732e878..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _BIT_STRING_H_
-#define        _BIT_STRING_H_
-
-#include <OCTET_STRING.h>      /* Some help from OCTET STRING */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct BIT_STRING_s {
-       uint8_t *buf;   /* BIT STRING body */
-       int size;       /* Size of the above buffer */
-
-       int bits_unused;/* Unused trailing bits in the last octet (0..7) */
-
-       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
-} BIT_STRING_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING;
-
-asn_struct_print_f BIT_STRING_print;   /* Human-readable output */
-asn_constr_check_f BIT_STRING_constraint;
-xer_type_encoder_f BIT_STRING_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BIT_STRING_H_ */
diff --git a/stglibs/smux.lib/BOOLEAN.h b/stglibs/smux.lib/BOOLEAN.h
deleted file mode 100644 (file)
index 217d0f1..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _BOOLEAN_H_
-#define        _BOOLEAN_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The underlying integer may contain various values, but everything
- * non-zero is capped to 0xff by the DER encoder. The BER decoder may
- * yield non-zero values different from 1, beware.
- */
-typedef int BOOLEAN_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN;
-
-asn_struct_free_f BOOLEAN_free;
-asn_struct_print_f BOOLEAN_print;
-ber_type_decoder_f BOOLEAN_decode_ber;
-der_type_encoder_f BOOLEAN_encode_der;
-xer_type_decoder_f BOOLEAN_decode_xer;
-xer_type_encoder_f BOOLEAN_encode_xer;
-per_type_decoder_f BOOLEAN_decode_uper;
-per_type_encoder_f BOOLEAN_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BOOLEAN_H_ */
diff --git a/stglibs/smux.lib/ClosePDU.h b/stglibs/smux.lib/ClosePDU.h
deleted file mode 100644 (file)
index a3d1e7a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _ClosePDU_H_
-#define        _ClosePDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum ClosePDU {
-       ClosePDU_goingDown      = 0,
-       ClosePDU_unsupportedVersion     = 1,
-       ClosePDU_packetFormat   = 2,
-       ClosePDU_protocolError  = 3,
-       ClosePDU_internalError  = 4,
-       ClosePDU_authenticationFailure  = 5
-} e_ClosePDU;
-
-/* ClosePDU */
-typedef INTEGER_t       ClosePDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_ClosePDU;
-asn_struct_free_f ClosePDU_free;
-asn_struct_print_f ClosePDU_print;
-asn_constr_check_f ClosePDU_constraint;
-ber_type_decoder_f ClosePDU_decode_ber;
-der_type_encoder_f ClosePDU_encode_der;
-xer_type_decoder_f ClosePDU_decode_xer;
-xer_type_encoder_f ClosePDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ClosePDU_H_ */
diff --git a/stglibs/smux.lib/Counter.h b/stglibs/smux.lib/Counter.h
deleted file mode 100644 (file)
index 3c770ad..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _Counter_H_
-#define        _Counter_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Counter */
-typedef INTEGER_t       Counter_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_Counter;
-asn_struct_free_f Counter_free;
-asn_struct_print_f Counter_print;
-asn_constr_check_f Counter_constraint;
-ber_type_decoder_f Counter_decode_ber;
-der_type_encoder_f Counter_encode_der;
-xer_type_decoder_f Counter_decode_xer;
-xer_type_encoder_f Counter_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _Counter_H_ */
diff --git a/stglibs/smux.lib/DisplayString.h b/stglibs/smux.lib/DisplayString.h
deleted file mode 100644 (file)
index ac6862c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _DisplayString_H_
-#define        _DisplayString_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OCTET_STRING.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* DisplayString */
-typedef OCTET_STRING_t  DisplayString_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_DisplayString;
-asn_struct_free_f DisplayString_free;
-asn_struct_print_f DisplayString_print;
-asn_constr_check_f DisplayString_constraint;
-ber_type_decoder_f DisplayString_decode_ber;
-der_type_encoder_f DisplayString_encode_der;
-xer_type_decoder_f DisplayString_decode_xer;
-xer_type_encoder_f DisplayString_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _DisplayString_H_ */
diff --git a/stglibs/smux.lib/EgpNeighEntry.h b/stglibs/smux.lib/EgpNeighEntry.h
deleted file mode 100644 (file)
index 79d3eed..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _EgpNeighEntry_H_
-#define        _EgpNeighEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "IpAddress.h"
-#include "Counter.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* EgpNeighEntry */
-typedef struct EgpNeighEntry {
-       INTEGER_t        egpNeighState;
-       IpAddress_t      egpNeighAddr;
-       INTEGER_t        egpNeighAs;
-       Counter_t        egpNeighInMsgs;
-       Counter_t        egpNeighInErrs;
-       Counter_t        egpNeighOutMsgs;
-       Counter_t        egpNeighOutErrs;
-       Counter_t        egpNeighInErrMsgs;
-       Counter_t        egpNeighOutErrMsgs;
-       Counter_t        egpNeighStateUps;
-       Counter_t        egpNeighStateDowns;
-       INTEGER_t        egpNeighIntervalHello;
-       INTEGER_t        egpNeighIntervalPoll;
-       INTEGER_t        egpNeighMode;
-       INTEGER_t        egpNeighEventTrigger;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} EgpNeighEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_EgpNeighEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _EgpNeighEntry_H_ */
diff --git a/stglibs/smux.lib/Gauge.h b/stglibs/smux.lib/Gauge.h
deleted file mode 100644 (file)
index f3e17c5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _Gauge_H_
-#define        _Gauge_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Gauge */
-typedef INTEGER_t       Gauge_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_Gauge;
-asn_struct_free_f Gauge_free;
-asn_struct_print_f Gauge_print;
-asn_constr_check_f Gauge_constraint;
-ber_type_decoder_f Gauge_decode_ber;
-der_type_encoder_f Gauge_encode_der;
-xer_type_decoder_f Gauge_decode_xer;
-xer_type_encoder_f Gauge_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _Gauge_H_ */
diff --git a/stglibs/smux.lib/GetNextRequest-PDU.h b/stglibs/smux.lib/GetNextRequest-PDU.h
deleted file mode 100644 (file)
index f9298ec..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _GetNextRequest_PDU_H_
-#define        _GetNextRequest_PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "PDU.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* GetNextRequest-PDU */
-typedef PDU_t   GetNextRequest_PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_GetNextRequest_PDU;
-asn_struct_free_f GetNextRequest_PDU_free;
-asn_struct_print_f GetNextRequest_PDU_print;
-asn_constr_check_f GetNextRequest_PDU_constraint;
-ber_type_decoder_f GetNextRequest_PDU_decode_ber;
-der_type_encoder_f GetNextRequest_PDU_encode_der;
-xer_type_decoder_f GetNextRequest_PDU_decode_xer;
-xer_type_encoder_f GetNextRequest_PDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GetNextRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/GetRequest-PDU.h b/stglibs/smux.lib/GetRequest-PDU.h
deleted file mode 100644 (file)
index 9449451..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _GetRequest_PDU_H_
-#define        _GetRequest_PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "PDU.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* GetRequest-PDU */
-typedef PDU_t   GetRequest_PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_GetRequest_PDU;
-asn_struct_free_f GetRequest_PDU_free;
-asn_struct_print_f GetRequest_PDU_print;
-asn_constr_check_f GetRequest_PDU_constraint;
-ber_type_decoder_f GetRequest_PDU_decode_ber;
-der_type_encoder_f GetRequest_PDU_encode_der;
-xer_type_decoder_f GetRequest_PDU_decode_xer;
-xer_type_encoder_f GetRequest_PDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GetRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/GetResponse-PDU.h b/stglibs/smux.lib/GetResponse-PDU.h
deleted file mode 100644 (file)
index 12e3fba..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _GetResponse_PDU_H_
-#define        _GetResponse_PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "PDU.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* GetResponse-PDU */
-typedef PDU_t   GetResponse_PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_GetResponse_PDU;
-asn_struct_free_f GetResponse_PDU_free;
-asn_struct_print_f GetResponse_PDU_print;
-asn_constr_check_f GetResponse_PDU_constraint;
-ber_type_decoder_f GetResponse_PDU_decode_ber;
-der_type_encoder_f GetResponse_PDU_encode_der;
-xer_type_decoder_f GetResponse_PDU_decode_xer;
-xer_type_encoder_f GetResponse_PDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GetResponse_PDU_H_ */
diff --git a/stglibs/smux.lib/INTEGER.h b/stglibs/smux.lib/INTEGER.h
deleted file mode 100644 (file)
index 62832b1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _INTEGER_H_
-#define        _INTEGER_H_
-
-#include <asn_application.h>
-#include <asn_codecs_prim.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_INTEGER;
-
-/* Map with <tag> to integer value association */
-typedef struct asn_INTEGER_enum_map_s {
-       long             nat_value;     /* associated native integer value */
-       size_t           enum_len;      /* strlen("tag") */
-       const char      *enum_name;     /* "tag" */
-} asn_INTEGER_enum_map_t;
-
-/* This type describes an enumeration for INTEGER and ENUMERATED types */
-typedef struct asn_INTEGER_specifics_s {
-       asn_INTEGER_enum_map_t *value2enum;     /* N -> "tag"; sorted by N */
-       unsigned int *enum2value;               /* "tag" => N; sorted by tag */
-       int map_count;                          /* Elements in either map */
-       int extension;                          /* This map is extensible */
-       int strict_enumeration;                 /* Enumeration set is fixed */
-} asn_INTEGER_specifics_t;
-
-asn_struct_print_f INTEGER_print;
-ber_type_decoder_f INTEGER_decode_ber;
-der_type_encoder_f INTEGER_encode_der;
-xer_type_decoder_f INTEGER_decode_xer;
-xer_type_encoder_f INTEGER_encode_xer;
-per_type_decoder_f INTEGER_decode_uper;
-per_type_encoder_f INTEGER_encode_uper;
-
-/***********************************
- * Some handy conversion routines. *
- ***********************************/
-
-/*
- * Returns 0 if it was possible to convert, -1 otherwise.
- * -1/EINVAL: Mandatory argument missing
- * -1/ERANGE: Value encoded is out of range for long representation
- * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
- */
-int asn_INTEGER2long(const INTEGER_t *i, long *l);
-int asn_long2INTEGER(INTEGER_t *i, long l);
-
-/*
- * Convert the integer value into the corresponding enumeration map entry.
- */
-const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _INTEGER_H_ */
diff --git a/stglibs/smux.lib/IfEntry.h b/stglibs/smux.lib/IfEntry.h
deleted file mode 100644 (file)
index eb30717..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _IfEntry_H_
-#define        _IfEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "DisplayString.h"
-#include "Gauge.h"
-#include "PhysAddress.h"
-#include "TimeTicks.h"
-#include "Counter.h"
-#include <OBJECT_IDENTIFIER.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IfEntry */
-typedef struct IfEntry {
-       INTEGER_t        ifIndex;
-       DisplayString_t  ifDescr;
-       INTEGER_t        ifType;
-       INTEGER_t        ifMtu;
-       Gauge_t  ifSpeed;
-       PhysAddress_t    ifPhysAddress;
-       INTEGER_t        ifAdminStatus;
-       INTEGER_t        ifOperStatus;
-       TimeTicks_t      ifLastChange;
-       Counter_t        ifInOctets;
-       Counter_t        ifInUcastPkts;
-       Counter_t        ifInNUcastPkts;
-       Counter_t        ifInDiscards;
-       Counter_t        ifInErrors;
-       Counter_t        ifInUnknownProtos;
-       Counter_t        ifOutOctets;
-       Counter_t        ifOutUcastPkts;
-       Counter_t        ifOutNUcastPkts;
-       Counter_t        ifOutDiscards;
-       Counter_t        ifOutErrors;
-       Gauge_t  ifOutQLen;
-       OBJECT_IDENTIFIER_t      ifSpecific;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} IfEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_IfEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IfEntry_H_ */
diff --git a/stglibs/smux.lib/IpAddrEntry.h b/stglibs/smux.lib/IpAddrEntry.h
deleted file mode 100644 (file)
index 9e36f32..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _IpAddrEntry_H_
-#define        _IpAddrEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "IpAddress.h"
-#include <INTEGER.h>
-#include <NativeInteger.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IpAddrEntry */
-typedef struct IpAddrEntry {
-       IpAddress_t      ipAdEntAddr;
-       INTEGER_t        ipAdEntIfIndex;
-       IpAddress_t      ipAdEntNetMask;
-       INTEGER_t        ipAdEntBcastAddr;
-       long     ipAdEntReasmMaxSize;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} IpAddrEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_IpAddrEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IpAddrEntry_H_ */
diff --git a/stglibs/smux.lib/IpAddress.h b/stglibs/smux.lib/IpAddress.h
deleted file mode 100644 (file)
index 06c1d4a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _IpAddress_H_
-#define        _IpAddress_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OCTET_STRING.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IpAddress */
-typedef OCTET_STRING_t  IpAddress_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_IpAddress;
-asn_struct_free_f IpAddress_free;
-asn_struct_print_f IpAddress_print;
-asn_constr_check_f IpAddress_constraint;
-ber_type_decoder_f IpAddress_decode_ber;
-der_type_encoder_f IpAddress_encode_der;
-xer_type_decoder_f IpAddress_decode_xer;
-xer_type_encoder_f IpAddress_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IpAddress_H_ */
diff --git a/stglibs/smux.lib/IpNetToMediaEntry.h b/stglibs/smux.lib/IpNetToMediaEntry.h
deleted file mode 100644 (file)
index 1eb8124..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _IpNetToMediaEntry_H_
-#define        _IpNetToMediaEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "PhysAddress.h"
-#include "IpAddress.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IpNetToMediaEntry */
-typedef struct IpNetToMediaEntry {
-       INTEGER_t        ipNetToMediaIfIndex;
-       PhysAddress_t    ipNetToMediaPhysAddress;
-       IpAddress_t      ipNetToMediaNetAddress;
-       INTEGER_t        ipNetToMediaType;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} IpNetToMediaEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_IpNetToMediaEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IpNetToMediaEntry_H_ */
diff --git a/stglibs/smux.lib/IpRouteEntry.h b/stglibs/smux.lib/IpRouteEntry.h
deleted file mode 100644 (file)
index 5651a8f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _IpRouteEntry_H_
-#define        _IpRouteEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "IpAddress.h"
-#include <INTEGER.h>
-#include <OBJECT_IDENTIFIER.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IpRouteEntry */
-typedef struct IpRouteEntry {
-       IpAddress_t      ipRouteDest;
-       INTEGER_t        ipRouteIfIndex;
-       INTEGER_t        ipRouteMetric1;
-       INTEGER_t        ipRouteMetric2;
-       INTEGER_t        ipRouteMetric3;
-       INTEGER_t        ipRouteMetric4;
-       IpAddress_t      ipRouteNextHop;
-       INTEGER_t        ipRouteType;
-       INTEGER_t        ipRouteProto;
-       INTEGER_t        ipRouteAge;
-       IpAddress_t      ipRouteMask;
-       INTEGER_t        ipRouteMetric5;
-       OBJECT_IDENTIFIER_t      ipRouteInfo;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} IpRouteEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_IpRouteEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IpRouteEntry_H_ */
diff --git a/stglibs/smux.lib/Message.h b/stglibs/smux.lib/Message.h
deleted file mode 100644 (file)
index 2621d73..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _Message_H_
-#define        _Message_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include <OCTET_STRING.h>
-#include <ANY.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum Message__version {
-       Message__version_version_1      = 0
-} e_Message__version;
-
-/* Message */
-typedef struct Message {
-       INTEGER_t        version;
-       OCTET_STRING_t   community;
-       ANY_t    data;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} Message_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_Message;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _Message_H_ */
diff --git a/stglibs/smux.lib/NULL.h b/stglibs/smux.lib/NULL.h
deleted file mode 100644 (file)
index 131e775..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        ASN_TYPE_NULL_H
-#define        ASN_TYPE_NULL_H
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The value of the NULL type is meaningless: see BOOLEAN if you want to
- * carry true/false semantics.
- */
-typedef int NULL_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_NULL;
-
-asn_struct_print_f NULL_print;
-der_type_encoder_f NULL_encode_der;
-xer_type_decoder_f NULL_decode_xer;
-xer_type_encoder_f NULL_encode_xer;
-per_type_decoder_f NULL_decode_uper;
-per_type_encoder_f NULL_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NULL_H */
diff --git a/stglibs/smux.lib/NativeEnumerated.h b/stglibs/smux.lib/NativeEnumerated.h
deleted file mode 100644 (file)
index c59bb1b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * Copyright (c) 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * This type differs from the standard ENUMERATED in that it is modelled using
- * the fixed machine type (long, int, short), so it can hold only values of
- * limited length. There is no type (i.e., NativeEnumerated_t, any integer type
- * will do).
- * This type may be used when integer range is limited by subtype constraints.
- */
-#ifndef        _NativeEnumerated_H_
-#define        _NativeEnumerated_H_
-
-#include <NativeInteger.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated;
-
-xer_type_encoder_f NativeEnumerated_encode_xer;
-per_type_decoder_f NativeEnumerated_decode_uper;
-per_type_encoder_f NativeEnumerated_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NativeEnumerated_H_ */
diff --git a/stglibs/smux.lib/NativeInteger.h b/stglibs/smux.lib/NativeInteger.h
deleted file mode 100644 (file)
index 4e63a83..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * This type differs from the standard INTEGER in that it is modelled using
- * the fixed machine type (long, int, short), so it can hold only values of
- * limited length. There is no type (i.e., NativeInteger_t, any integer type
- * will do).
- * This type may be used when integer range is limited by subtype constraints.
- */
-#ifndef        _NativeInteger_H_
-#define        _NativeInteger_H_
-
-#include <asn_application.h>
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern asn_TYPE_descriptor_t asn_DEF_NativeInteger;
-
-asn_struct_free_f  NativeInteger_free;
-asn_struct_print_f NativeInteger_print;
-ber_type_decoder_f NativeInteger_decode_ber;
-der_type_encoder_f NativeInteger_encode_der;
-xer_type_decoder_f NativeInteger_decode_xer;
-xer_type_encoder_f NativeInteger_encode_xer;
-per_type_decoder_f NativeInteger_decode_uper;
-per_type_encoder_f NativeInteger_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NativeInteger_H_ */
diff --git a/stglibs/smux.lib/NetworkAddress.h b/stglibs/smux.lib/NetworkAddress.h
deleted file mode 100644 (file)
index 8c73220..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _NetworkAddress_H_
-#define        _NetworkAddress_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "IpAddress.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum NetworkAddress_PR {
-       NetworkAddress_PR_NOTHING,      /* No components present */
-       NetworkAddress_PR_internet
-} NetworkAddress_PR;
-
-/* NetworkAddress */
-typedef struct NetworkAddress {
-       NetworkAddress_PR present;
-       union NetworkAddress_u {
-               IpAddress_t      internet;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} NetworkAddress_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_NetworkAddress;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NetworkAddress_H_ */
diff --git a/stglibs/smux.lib/OBJECT_IDENTIFIER.h b/stglibs/smux.lib/OBJECT_IDENTIFIER.h
deleted file mode 100644 (file)
index 2bb5d03..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- *     All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _OBJECT_IDENTIFIER_H_
-#define        _OBJECT_IDENTIFIER_H_
-
-#include <asn_application.h>
-#include <asn_codecs_prim.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef ASN__PRIMITIVE_TYPE_t OBJECT_IDENTIFIER_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER;
-
-asn_struct_print_f OBJECT_IDENTIFIER_print;
-asn_constr_check_f OBJECT_IDENTIFIER_constraint;
-der_type_encoder_f OBJECT_IDENTIFIER_encode_der;
-xer_type_decoder_f OBJECT_IDENTIFIER_decode_xer;
-xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer;
-
-/**********************************
- * Some handy conversion routines *
- **********************************/
-
-/*
- * This function fills an (_arcs) array with OBJECT IDENTIFIER arcs
- * up to specified (_arc_slots) elements.
- * 
- * EXAMPLE:
- *     void print_arcs(OBJECT_IDENTIFIER_t *oid) {
- *             unsigned long fixed_arcs[10];   // Try with fixed space first
- *             unsigned long *arcs = fixed_arcs;
- *             int arc_type_size = sizeof(fixed_arcs[0]);      // sizeof(long)
- *             int arc_slots = sizeof(fixed_arcs)/sizeof(fixed_arcs[0]); // 10
- *             int count;      // Real number of arcs.
- *             int i;
- * 
- *             count = OBJECT_IDENTIFIER_get_arcs(oid, arcs,
- *                     arc_type_size, arc_slots);
- *             // If necessary, reallocate arcs array and try again.
- *             if(count > arc_slots) {
- *                     arc_slots = count;
- *                     arcs = malloc(arc_type_size * arc_slots);
- *                     if(!arcs) return;
- *                     count = OBJECT_IDENTIFIER_get_arcs(oid, arcs,
- *                             arc_type_size, arc_slots);
- *                     assert(count == arc_slots);
- *             }
- * 
- *             // Print the contents of the arcs array.
- *             for(i = 0; i < count; i++)
- *                     printf("%d\n", arcs[i]);
- * 
- *             // Avoid memory leak.
- *             if(arcs != fixed_arcs) free(arcs);
- *     }
- * 
- * RETURN VALUES:
- * -1/EINVAL:  Invalid arguments (oid is missing)
- * -1/ERANGE:  One or more arcs have value out of array cell type range.
- * >=0:                Number of arcs contained in the OBJECT IDENTIFIER
- * 
- * WARNING: The function always returns the real number of arcs,
- * even if there is no sufficient (_arc_slots) provided.
- */
-int OBJECT_IDENTIFIER_get_arcs(OBJECT_IDENTIFIER_t *_oid,
-       void *_arcs,                    /* e.g., unsigned int arcs[N] */
-       unsigned int _arc_type_size,    /* e.g., sizeof(arcs[0]) */
-       unsigned int _arc_slots         /* e.g., N */);
-
-/*
- * This functions initializes the OBJECT IDENTIFIER object with
- * the given set of arcs.
- * The minimum of two arcs must be present; some restrictions apply.
- * RETURN VALUES:
- * -1/EINVAL:  Invalid arguments
- * -1/ERANGE:  The first two arcs do not conform to ASN.1 restrictions.
- * -1/ENOMEM:  Memory allocation failed
- * 0:          The object was initialized with new arcs.
- */
-int OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *_oid,
-       const void *_arcs,              /* e.g., unsigned int arcs[N] */
-       unsigned int _arc_type_size,    /* e.g., sizeof(arcs[0]) */
-       unsigned int _arc_slots         /* e.g., N */);
-
-/*
- * Print the specified OBJECT IDENTIFIER arc.
- */
-int OBJECT_IDENTIFIER_print_arc(uint8_t *arcbuf, int arclen,
-       int add, /* Arbitrary offset, required to process the first two arcs */
-       asn_app_consume_bytes_f *cb, void *app_key);
-
-/* Same as above, but returns the number of written digits, instead of 0 */
-ssize_t OBJECT_IDENTIFIER__dump_arc(uint8_t *arcbuf, int arclen, int add,
-       asn_app_consume_bytes_f *cb, void *app_key);
-
-/*
- * Parse the OBJECT IDENTIFIER textual representation ("1.3.6.1.4.1.9363").
- * No arc can exceed the (0..signed_long_max) range (typically, 0..2G if L32).
- * This function is not specific to OBJECT IDENTIFIER, it may be used to parse
- * the RELATIVE-OID data, or any other data consisting of dot-separated
- * series of numeric values.
- *
- * If (oid_txt_length == -1), the strlen() will be invoked to determine the
- * size of the (oid_text) string.
- * 
- * After return, the optional (opt_oid_text_end) is set to the character after
- * the last parsed one. (opt_oid_text_end) is never less than (oid_text).
- * 
- * RETURN VALUES:
- *   -1:       Parse error.
- * >= 0:       Number of arcs contained in the OBJECT IDENTIFIER.
- * 
- * WARNING: The function always returns the real number of arcs,
- * even if there is no sufficient (_arc_slots) provided.
- * This is useful for (_arc_slots) value estimation.
- */
-int OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length,
-       long arcs[], unsigned int arcs_slots, const char **opt_oid_text_end);
-
-/*
- * Internal functions.
- * Used by RELATIVE-OID implementation in particular.
- */
-int OBJECT_IDENTIFIER_get_single_arc(uint8_t *arcbuf, unsigned int arclen,
-       signed int add, void *value, unsigned int value_size);
-int OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf,
-       const void *arcval, unsigned int arcval_size, int _prepared_order);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _OBJECT_IDENTIFIER_H_ */
diff --git a/stglibs/smux.lib/OCTET_STRING.h b/stglibs/smux.lib/OCTET_STRING.h
deleted file mode 100644 (file)
index 5150161..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _OCTET_STRING_H_
-#define        _OCTET_STRING_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct OCTET_STRING {
-       uint8_t *buf;   /* Buffer with consecutive OCTET_STRING bits */
-       int size;       /* Size of the buffer */
-
-       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
-} OCTET_STRING_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
-
-asn_struct_free_f OCTET_STRING_free;
-asn_struct_print_f OCTET_STRING_print;
-asn_struct_print_f OCTET_STRING_print_utf8;
-ber_type_decoder_f OCTET_STRING_decode_ber;
-der_type_encoder_f OCTET_STRING_encode_der;
-xer_type_decoder_f OCTET_STRING_decode_xer_hex;                /* Hexadecimal */
-xer_type_decoder_f OCTET_STRING_decode_xer_binary;     /* 01010111010 */
-xer_type_decoder_f OCTET_STRING_decode_xer_utf8;       /* ASCII/UTF-8 */
-xer_type_encoder_f OCTET_STRING_encode_xer;
-xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
-per_type_decoder_f OCTET_STRING_decode_uper;
-per_type_encoder_f OCTET_STRING_encode_uper;
-
-/******************************
- * Handy conversion routines. *
- ******************************/
-
-/*
- * This function clears the previous value of the OCTET STRING (if any)
- * and then allocates a new memory with the specified content (str/size).
- * If size = -1, the size of the original string will be determined
- * using strlen(str).
- * If str equals to NULL, the function will silently clear the
- * current contents of the OCTET STRING.
- * Returns 0 if it was possible to perform operation, -1 otherwise.
- */
-int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);
-
-/* Handy conversion from the C string into the OCTET STRING. */
-#define        OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)
-
-/*
- * Allocate and fill the new OCTET STRING and return a pointer to the newly
- * allocated object. NULL is permitted in str: the function will just allocate
- * empty OCTET STRING.
- */
-OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td,
-       const char *str, int size);
-
-/****************************
- * Internally useful stuff. *
- ****************************/
-
-typedef struct asn_OCTET_STRING_specifics_s {
-       /*
-        * Target structure description.
-        */
-       int struct_size;        /* Size of the structure */
-       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
-
-       int subvariant;         /* {0,1,2} for O-S, BIT STRING or ANY */
-} asn_OCTET_STRING_specifics_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _OCTET_STRING_H_ */
diff --git a/stglibs/smux.lib/ObjectName.h b/stglibs/smux.lib/ObjectName.h
deleted file mode 100644 (file)
index 256577b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _ObjectName_H_
-#define        _ObjectName_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OBJECT_IDENTIFIER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ObjectName */
-typedef OBJECT_IDENTIFIER_t     ObjectName_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_ObjectName;
-asn_struct_free_f ObjectName_free;
-asn_struct_print_f ObjectName_print;
-asn_constr_check_f ObjectName_constraint;
-ber_type_decoder_f ObjectName_decode_ber;
-der_type_encoder_f ObjectName_encode_der;
-xer_type_decoder_f ObjectName_decode_xer;
-xer_type_encoder_f ObjectName_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ObjectName_H_ */
diff --git a/stglibs/smux.lib/ObjectSyntax.h b/stglibs/smux.lib/ObjectSyntax.h
deleted file mode 100644 (file)
index 9030acc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _ObjectSyntax_H_
-#define        _ObjectSyntax_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "SimpleSyntax.h"
-#include "ApplicationSyntax.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum ObjectSyntax_PR {
-       ObjectSyntax_PR_NOTHING,        /* No components present */
-       ObjectSyntax_PR_simple,
-       ObjectSyntax_PR_application_wide
-} ObjectSyntax_PR;
-
-/* ObjectSyntax */
-typedef struct ObjectSyntax {
-       ObjectSyntax_PR present;
-       union ObjectSyntax_u {
-               SimpleSyntax_t   simple;
-               ApplicationSyntax_t      application_wide;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} ObjectSyntax_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_ObjectSyntax;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ObjectSyntax_H_ */
diff --git a/stglibs/smux.lib/Opaque.h b/stglibs/smux.lib/Opaque.h
deleted file mode 100644 (file)
index aa8e2d5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _Opaque_H_
-#define        _Opaque_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OCTET_STRING.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Opaque */
-typedef OCTET_STRING_t  Opaque_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_Opaque;
-asn_struct_free_f Opaque_free;
-asn_struct_print_f Opaque_print;
-asn_constr_check_f Opaque_constraint;
-ber_type_decoder_f Opaque_decode_ber;
-der_type_encoder_f Opaque_encode_der;
-xer_type_decoder_f Opaque_decode_xer;
-xer_type_encoder_f Opaque_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _Opaque_H_ */
diff --git a/stglibs/smux.lib/OpenPDU.h b/stglibs/smux.lib/OpenPDU.h
deleted file mode 100644 (file)
index 5d7e1da..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _OpenPDU_H_
-#define        _OpenPDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "SimpleOpen.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum OpenPDU_PR {
-       OpenPDU_PR_NOTHING,     /* No components present */
-       OpenPDU_PR_simple
-} OpenPDU_PR;
-
-/* OpenPDU */
-typedef struct OpenPDU {
-       OpenPDU_PR present;
-       union OpenPDU_u {
-               SimpleOpen_t     simple;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} OpenPDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_OpenPDU;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _OpenPDU_H_ */
diff --git a/stglibs/smux.lib/PDU.h b/stglibs/smux.lib/PDU.h
deleted file mode 100644 (file)
index cbc7e71..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _PDU_H_
-#define        _PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "VarBindList.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum PDU__error_status {
-       PDU__error_status_noError       = 0,
-       PDU__error_status_tooBig        = 1,
-       PDU__error_status_noSuchName    = 2,
-       PDU__error_status_badValue      = 3,
-       PDU__error_status_readOnly      = 4,
-       PDU__error_status_genErr        = 5
-} e_PDU__error_status;
-
-/* PDU */
-typedef struct PDU {
-       INTEGER_t        request_id;
-       INTEGER_t        error_status;
-       INTEGER_t        error_index;
-       VarBindList_t    variable_bindings;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_PDU;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PDU_H_ */
diff --git a/stglibs/smux.lib/PDUs.h b/stglibs/smux.lib/PDUs.h
deleted file mode 100644 (file)
index 90bb089..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _PDUs_H_
-#define        _PDUs_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "GetRequest-PDU.h"
-#include "GetNextRequest-PDU.h"
-#include "GetResponse-PDU.h"
-#include "SetRequest-PDU.h"
-#include "Trap-PDU.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum PDUs_PR {
-       PDUs_PR_NOTHING,        /* No components present */
-       PDUs_PR_get_request,
-       PDUs_PR_get_next_request,
-       PDUs_PR_get_response,
-       PDUs_PR_set_request,
-       PDUs_PR_trap
-} PDUs_PR;
-
-/* PDUs */
-typedef struct PDUs {
-       PDUs_PR present;
-       union PDUs_u {
-               GetRequest_PDU_t         get_request;
-               GetNextRequest_PDU_t     get_next_request;
-               GetResponse_PDU_t        get_response;
-               SetRequest_PDU_t         set_request;
-               Trap_PDU_t       trap;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} PDUs_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_PDUs;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PDUs_H_ */
diff --git a/stglibs/smux.lib/PhysAddress.h b/stglibs/smux.lib/PhysAddress.h
deleted file mode 100644 (file)
index d6c5fa1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _PhysAddress_H_
-#define        _PhysAddress_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OCTET_STRING.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* PhysAddress */
-typedef OCTET_STRING_t  PhysAddress_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_PhysAddress;
-asn_struct_free_f PhysAddress_free;
-asn_struct_print_f PhysAddress_print;
-asn_constr_check_f PhysAddress_constraint;
-ber_type_decoder_f PhysAddress_decode_ber;
-der_type_encoder_f PhysAddress_encode_der;
-xer_type_decoder_f PhysAddress_decode_xer;
-xer_type_encoder_f PhysAddress_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PhysAddress_H_ */
diff --git a/stglibs/smux.lib/RReqPDU.h b/stglibs/smux.lib/RReqPDU.h
deleted file mode 100644 (file)
index 17f5309..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _RReqPDU_H_
-#define        _RReqPDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "ObjectName.h"
-#include <NativeInteger.h>
-#include <INTEGER.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum RReqPDU__operation {
-       RReqPDU__operation_delete       = 0,
-       RReqPDU__operation_readOnly     = 1,
-       RReqPDU__operation_readWrite    = 2
-} e_RReqPDU__operation;
-
-/* RReqPDU */
-typedef struct RReqPDU {
-       ObjectName_t     subtree;
-       long     priority;
-       INTEGER_t        operation;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} RReqPDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_RReqPDU;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RReqPDU_H_ */
diff --git a/stglibs/smux.lib/RRspPDU.h b/stglibs/smux.lib/RRspPDU.h
deleted file mode 100644 (file)
index 0d9681a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _RRspPDU_H_
-#define        _RRspPDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum RRspPDU {
-       RRspPDU_failure = -1
-} e_RRspPDU;
-
-/* RRspPDU */
-typedef INTEGER_t       RRspPDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_RRspPDU;
-asn_struct_free_f RRspPDU_free;
-asn_struct_print_f RRspPDU_print;
-asn_constr_check_f RRspPDU_constraint;
-ber_type_decoder_f RRspPDU_decode_ber;
-der_type_encoder_f RRspPDU_encode_der;
-xer_type_decoder_f RRspPDU_decode_xer;
-xer_type_encoder_f RRspPDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RRspPDU_H_ */
diff --git a/stglibs/smux.lib/SMUX-PDUs.h b/stglibs/smux.lib/SMUX-PDUs.h
deleted file mode 100644 (file)
index 8489324..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _SMUX_PDUs_H_
-#define        _SMUX_PDUs_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "OpenPDU.h"
-#include "ClosePDU.h"
-#include "RReqPDU.h"
-#include "RRspPDU.h"
-#include "PDUs.h"
-#include "SOutPDU.h"
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum SMUX_PDUs_PR {
-       SMUX_PDUs_PR_NOTHING,   /* No components present */
-       SMUX_PDUs_PR_open,
-       SMUX_PDUs_PR_close,
-       SMUX_PDUs_PR_registerRequest,
-       SMUX_PDUs_PR_registerResponse,
-       SMUX_PDUs_PR_pdus,
-       SMUX_PDUs_PR_commitOrRollback
-} SMUX_PDUs_PR;
-
-/* SMUX-PDUs */
-typedef struct SMUX_PDUs {
-       SMUX_PDUs_PR present;
-       union SMUX_PDUs_u {
-               OpenPDU_t        open;
-               ClosePDU_t       close;
-               RReqPDU_t        registerRequest;
-               RRspPDU_t        registerResponse;
-               PDUs_t   pdus;
-               SOutPDU_t        commitOrRollback;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} SMUX_PDUs_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_SMUX_PDUs;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SMUX_PDUs_H_ */
diff --git a/stglibs/smux.lib/SOutPDU.h b/stglibs/smux.lib/SOutPDU.h
deleted file mode 100644 (file)
index 55e7618..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _SOutPDU_H_
-#define        _SOutPDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum SOutPDU {
-       SOutPDU_commit  = 0,
-       SOutPDU_rollback        = 1
-} e_SOutPDU;
-
-/* SOutPDU */
-typedef INTEGER_t       SOutPDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_SOutPDU;
-asn_struct_free_f SOutPDU_free;
-asn_struct_print_f SOutPDU_print;
-asn_constr_check_f SOutPDU_constraint;
-ber_type_decoder_f SOutPDU_decode_ber;
-der_type_encoder_f SOutPDU_encode_der;
-xer_type_decoder_f SOutPDU_decode_xer;
-xer_type_encoder_f SOutPDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SOutPDU_H_ */
diff --git a/stglibs/smux.lib/SetRequest-PDU.h b/stglibs/smux.lib/SetRequest-PDU.h
deleted file mode 100644 (file)
index 8854574..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _SetRequest_PDU_H_
-#define        _SetRequest_PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "PDU.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* SetRequest-PDU */
-typedef PDU_t   SetRequest_PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_SetRequest_PDU;
-asn_struct_free_f SetRequest_PDU_free;
-asn_struct_print_f SetRequest_PDU_print;
-asn_constr_check_f SetRequest_PDU_constraint;
-ber_type_decoder_f SetRequest_PDU_decode_ber;
-der_type_encoder_f SetRequest_PDU_encode_der;
-xer_type_decoder_f SetRequest_PDU_decode_xer;
-xer_type_encoder_f SetRequest_PDU_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SetRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/SimpleOpen.h b/stglibs/smux.lib/SimpleOpen.h
deleted file mode 100644 (file)
index 5950a6c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "SMUX"
- *     found in "SMUX.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _SimpleOpen_H_
-#define        _SimpleOpen_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include <OBJECT_IDENTIFIER.h>
-#include "DisplayString.h"
-#include <OCTET_STRING.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum SimpleOpen__version {
-       SimpleOpen__version_version_1   = 0
-} e_SimpleOpen__version;
-
-/* SimpleOpen */
-typedef struct SimpleOpen {
-       INTEGER_t        version;
-       OBJECT_IDENTIFIER_t      identity;
-       DisplayString_t  description;
-       OCTET_STRING_t   password;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} SimpleOpen_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_SimpleOpen;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SimpleOpen_H_ */
diff --git a/stglibs/smux.lib/SimpleSyntax.h b/stglibs/smux.lib/SimpleSyntax.h
deleted file mode 100644 (file)
index c04f3ab..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _SimpleSyntax_H_
-#define        _SimpleSyntax_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include <OCTET_STRING.h>
-#include <OBJECT_IDENTIFIER.h>
-#include <NULL.h>
-#include <constr_CHOICE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum SimpleSyntax_PR {
-       SimpleSyntax_PR_NOTHING,        /* No components present */
-       SimpleSyntax_PR_number,
-       SimpleSyntax_PR_string,
-       SimpleSyntax_PR_object,
-       SimpleSyntax_PR_empty
-} SimpleSyntax_PR;
-
-/* SimpleSyntax */
-typedef struct SimpleSyntax {
-       SimpleSyntax_PR present;
-       union SimpleSyntax_u {
-               INTEGER_t        number;
-               OCTET_STRING_t   string;
-               OBJECT_IDENTIFIER_t      object;
-               NULL_t   empty;
-       } choice;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} SimpleSyntax_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_SimpleSyntax;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SimpleSyntax_H_ */
diff --git a/stglibs/smux.lib/TcpConnEntry.h b/stglibs/smux.lib/TcpConnEntry.h
deleted file mode 100644 (file)
index 3160e31..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _TcpConnEntry_H_
-#define        _TcpConnEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-#include "IpAddress.h"
-#include <NativeInteger.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* TcpConnEntry */
-typedef struct TcpConnEntry {
-       INTEGER_t        tcpConnState;
-       IpAddress_t      tcpConnLocalAddress;
-       long     tcpConnLocalPort;
-       IpAddress_t      tcpConnRemAddress;
-       long     tcpConnRemPort;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} TcpConnEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_TcpConnEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TcpConnEntry_H_ */
diff --git a/stglibs/smux.lib/TimeTicks.h b/stglibs/smux.lib/TimeTicks.h
deleted file mode 100644 (file)
index ea92820..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1155-SMI"
- *     found in "RFC1155-SMI.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _TimeTicks_H_
-#define        _TimeTicks_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <INTEGER.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* TimeTicks */
-typedef INTEGER_t       TimeTicks_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_TimeTicks;
-asn_struct_free_f TimeTicks_free;
-asn_struct_print_f TimeTicks_print;
-asn_constr_check_f TimeTicks_constraint;
-ber_type_decoder_f TimeTicks_decode_ber;
-der_type_encoder_f TimeTicks_encode_der;
-xer_type_decoder_f TimeTicks_decode_xer;
-xer_type_encoder_f TimeTicks_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TimeTicks_H_ */
diff --git a/stglibs/smux.lib/Trap-PDU.h b/stglibs/smux.lib/Trap-PDU.h
deleted file mode 100644 (file)
index d8a89e1..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _Trap_PDU_H_
-#define        _Trap_PDU_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <OBJECT_IDENTIFIER.h>
-#include "NetworkAddress.h"
-#include <INTEGER.h>
-#include "TimeTicks.h"
-#include "VarBindList.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Dependencies */
-typedef enum Trap_PDU__generic_trap {
-       Trap_PDU__generic_trap_coldStart        = 0,
-       Trap_PDU__generic_trap_warmStart        = 1,
-       Trap_PDU__generic_trap_linkDown = 2,
-       Trap_PDU__generic_trap_linkUp   = 3,
-       Trap_PDU__generic_trap_authenticationFailure    = 4,
-       Trap_PDU__generic_trap_egpNeighborLoss  = 5,
-       Trap_PDU__generic_trap_enterpriseSpecific       = 6
-} e_Trap_PDU__generic_trap;
-
-/* Trap-PDU */
-typedef struct Trap_PDU {
-       OBJECT_IDENTIFIER_t      enterprise;
-       NetworkAddress_t         agent_addr;
-       INTEGER_t        generic_trap;
-       INTEGER_t        specific_trap;
-       TimeTicks_t      time_stamp;
-       VarBindList_t    variable_bindings;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} Trap_PDU_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_Trap_PDU;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _Trap_PDU_H_ */
diff --git a/stglibs/smux.lib/UdpEntry.h b/stglibs/smux.lib/UdpEntry.h
deleted file mode 100644 (file)
index e4a1026..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1213-MIB"
- *     found in "RFC1213-MIB.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _UdpEntry_H_
-#define        _UdpEntry_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "IpAddress.h"
-#include <NativeInteger.h>
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* UdpEntry */
-typedef struct UdpEntry {
-       IpAddress_t      udpLocalAddress;
-       long     udpLocalPort;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} UdpEntry_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_UdpEntry;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _UdpEntry_H_ */
diff --git a/stglibs/smux.lib/VarBind.h b/stglibs/smux.lib/VarBind.h
deleted file mode 100644 (file)
index 63ecad5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _VarBind_H_
-#define        _VarBind_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include "ObjectName.h"
-#include "ObjectSyntax.h"
-#include <constr_SEQUENCE.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* VarBind */
-typedef struct VarBind {
-       ObjectName_t     name;
-       ObjectSyntax_t   value;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} VarBind_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_VarBind;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VarBind_H_ */
diff --git a/stglibs/smux.lib/VarBindList.h b/stglibs/smux.lib/VarBindList.h
deleted file mode 100644 (file)
index 36ef161..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
- * From ASN.1 module "RFC1157-SNMP"
- *     found in "RFC1157-SNMP.asn1"
- *     `asn1c -fskeletons-copy`
- */
-
-#ifndef        _VarBindList_H_
-#define        _VarBindList_H_
-
-
-#include <asn_application.h>
-
-/* Including external dependencies */
-#include <asn_SEQUENCE_OF.h>
-#include <constr_SEQUENCE_OF.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Forward declarations */
-struct VarBind;
-
-/* VarBindList */
-typedef struct VarBindList {
-       A_SEQUENCE_OF(struct VarBind) list;
-       
-       /* Context for parsing across buffer boundaries */
-       asn_struct_ctx_t _asn_ctx;
-} VarBindList_t;
-
-/* Implementation */
-extern asn_TYPE_descriptor_t asn_DEF_VarBindList;
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Referred external types */
-#include "VarBind.h"
-
-#endif /* _VarBindList_H_ */
diff --git a/stglibs/smux.lib/asn_SEQUENCE_OF.h b/stglibs/smux.lib/asn_SEQUENCE_OF.h
deleted file mode 100644 (file)
index e678f03..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        ASN_SEQUENCE_OF_H
-#define        ASN_SEQUENCE_OF_H
-
-#include <asn_SET_OF.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * SEQUENCE OF is the same as SET OF with a tiny difference:
- * the delete operation preserves the initial order of elements
- * and thus MAY operate in non-constant time.
- */
-#define        A_SEQUENCE_OF(type)     A_SET_OF(type)
-
-#define        ASN_SEQUENCE_ADD(headptr, ptr)          \
-       asn_sequence_add((headptr), (ptr))
-
-/***********************************************
- * Implementation of the SEQUENCE OF structure.
- */
-
-#define        asn_sequence_add        asn_set_add
-#define        asn_sequence_empty      asn_set_empty
-
-/*
- * Delete the element from the set by its number (base 0).
- * This is NOT a constant-time operation.
- * The order of elements is preserved.
- * If _do_free is given AND the (*free) is initialized, the element
- * will be freed using the custom (*free) function as well.
- */
-void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free);
-
-/*
- * Cope with different conversions requirements to/from void in C and C++.
- * This is mostly useful for support library.
- */
-typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_;
-#define _A_SEQUENCE_FROM_VOID(ptr)     ((asn_anonymous_sequence_ *)(ptr))
-#define _A_CSEQUENCE_FROM_VOID(ptr)    ((const asn_anonymous_sequence_ *)(ptr))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ASN_SEQUENCE_OF_H */
diff --git a/stglibs/smux.lib/asn_SET_OF.h b/stglibs/smux.lib/asn_SET_OF.h
deleted file mode 100644 (file)
index 7edf14b..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        ASN_SET_OF_H
-#define        ASN_SET_OF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define        A_SET_OF(type)                                  \
-       struct {                                        \
-               type **array;                           \
-               int count;      /* Meaningful size */   \
-               int size;       /* Allocated size */    \
-               void (*free)(type *);                   \
-       }
-
-#define        ASN_SET_ADD(headptr, ptr)               \
-       asn_set_add((headptr), (ptr))
-
-/*******************************************
- * Implementation of the SET OF structure.
- */
-
-/*
- * Add another structure into the set by its pointer.
- * RETURN VALUES:
- * 0 for success and -1/errno for failure.
- */
-int  asn_set_add(void *asn_set_of_x, void *ptr);
-
-/*
- * Delete the element from the set by its number (base 0).
- * This is a constant-time operation. The order of elements before the
- * deleted ones is guaranteed, the order of elements after the deleted
- * one is NOT guaranteed.
- * If _do_free is given AND the (*free) is initialized, the element
- * will be freed using the custom (*free) function as well.
- */
-void asn_set_del(void *asn_set_of_x, int number, int _do_free);
-
-/*
- * Empty the contents of the set. Will free the elements, if (*free) is given.
- * Will NOT free the set itself.
- */
-void asn_set_empty(void *asn_set_of_x);
-
-/*
- * Cope with different conversions requirements to/from void in C and C++.
- * This is mostly useful for support library.
- */
-typedef A_SET_OF(void) asn_anonymous_set_;
-#define _A_SET_FROM_VOID(ptr)          ((asn_anonymous_set_ *)(ptr))
-#define _A_CSET_FROM_VOID(ptr)         ((const asn_anonymous_set_ *)(ptr))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ASN_SET_OF_H */
diff --git a/stglibs/smux.lib/asn_application.h b/stglibs/smux.lib/asn_application.h
deleted file mode 100644 (file)
index f40cd86..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * Application-level ASN.1 callbacks.
- */
-#ifndef        _ASN_APPLICATION_H_
-#define        _ASN_APPLICATION_H_
-
-#include "asn_system.h"                /* for platform-dependent types */
-#include "asn_codecs.h"                /* for ASN.1 codecs specifics */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Generic type of an application-defined callback to return various
- * types of data to the application.
- * EXPECTED RETURN VALUES:
- *  -1: Failed to consume bytes. Abort the mission.
- * Non-negative return values indicate success, and ignored.
- */
-typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size,
-       void *application_specific_key);
-
-/*
- * A callback of this type is called whenever constraint validation fails
- * on some ASN.1 type. See "constraints.h" for more details on constraint
- * validation.
- * This callback specifies a descriptor of the ASN.1 type which failed
- * the constraint check, as well as human readable message on what
- * particular constraint has failed.
- */
-typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
-       struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
-       const void *structure_which_failed_ptr,
-       const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5);
-
-#ifdef __cplusplus
-}
-#endif
-
-#include "constr_TYPE.h"       /* for asn_TYPE_descriptor_t */
-
-#endif /* _ASN_APPLICATION_H_ */
diff --git a/stglibs/smux.lib/asn_codecs.h b/stglibs/smux.lib/asn_codecs.h
deleted file mode 100644 (file)
index 4a251d9..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _ASN_CODECS_H_
-#define        _ASN_CODECS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/*
- * This structure defines a set of parameters that may be passed
- * to every ASN.1 encoder or decoder function.
- * WARNING: if max_stack_size member is set, and you are calling the
- *   function pointers of the asn_TYPE_descriptor_t directly,
- *   this structure must be ALLOCATED ON THE STACK!
- *   If you can't always satisfy this requirement, use ber_decode(),
- *   xer_decode() and uper_decode() functions instead.
- */
-typedef struct asn_codec_ctx_s {
-       /*
-        * Limit the decoder routines to use no (much) more stack than a given
-        * number of bytes. Most of decoders are stack-based, and this
-        * would protect against stack overflows if the number of nested
-        * encodings is high.
-        * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based,
-        * and are safe from this kind of overflow.
-        * A value from getrlimit(RLIMIT_STACK) may be used to initialize
-        * this variable. Be careful in multithreaded environments, as the
-        * stack size is rather limited.
-        */
-       size_t  max_stack_size; /* 0 disables stack bounds checking */
-} asn_codec_ctx_t;
-
-/*
- * Type of the return value of the encoding functions (der_encode, xer_encode).
- */
-typedef struct asn_enc_rval_s {
-       /*
-        * Number of bytes encoded.
-        * -1 indicates failure to encode the structure.
-        * In this case, the members below this one are meaningful.
-        */
-       ssize_t encoded;
-
-       /*
-        * Members meaningful when (encoded == -1), for post mortem analysis.
-        */
-
-       /* Type which cannot be encoded */
-       struct asn_TYPE_descriptor_s *failed_type;
-
-       /* Pointer to the structure of that type */
-       void *structure_ptr;
-} asn_enc_rval_t;
-#define        _ASN_ENCODE_FAILED do {                                 \
-       asn_enc_rval_t tmp_error;                               \
-       tmp_error.encoded = -1;                                 \
-       tmp_error.failed_type = td;                             \
-       tmp_error.structure_ptr = sptr;                         \
-       ASN_DEBUG("Failed to encode element %s", td->name);     \
-       return tmp_error;                                       \
-} while(0)
-#define        _ASN_ENCODED_OK(rval) do {                              \
-       rval.structure_ptr = 0;                                 \
-       rval.failed_type = 0;                                   \
-       return rval;                                            \
-} while(0)
-
-/*
- * Type of the return value of the decoding functions (ber_decode, xer_decode)
- * 
- * Please note that the number of consumed bytes is ALWAYS meaningful,
- * even if code==RC_FAIL. This is to indicate the number of successfully
- * decoded bytes, hence providing a possibility to fail with more diagnostics
- * (i.e., print the offending remainder of the buffer).
- */
-enum asn_dec_rval_code_e {
-       RC_OK,          /* Decoded successfully */
-       RC_WMORE,       /* More data expected, call again */
-       RC_FAIL         /* Failure to decode data */
-};
-typedef struct asn_dec_rval_s {
-       enum asn_dec_rval_code_e code;  /* Result code */
-       size_t consumed;                /* Number of bytes consumed */
-} asn_dec_rval_t;
-#define        _ASN_DECODE_FAILED do {                                 \
-       asn_dec_rval_t tmp_error;                               \
-       tmp_error.code = RC_FAIL;                               \
-       tmp_error.consumed = 0;                                 \
-       ASN_DEBUG("Failed to decode element %s", td->name);     \
-       return tmp_error;                                       \
-} while(0)
-#define        _ASN_DECODE_STARVED do {                                \
-       asn_dec_rval_t tmp_error;                               \
-       tmp_error.code = RC_WMORE;                              \
-       tmp_error.consumed = 0;                                 \
-       return tmp_error;                                       \
-} while(0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ASN_CODECS_H_ */
diff --git a/stglibs/smux.lib/asn_codecs_prim.h b/stglibs/smux.lib/asn_codecs_prim.h
deleted file mode 100644 (file)
index 0f683fd..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        ASN_CODECS_PRIM_H
-#define        ASN_CODECS_PRIM_H
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ASN__PRIMITIVE_TYPE_s {
-       uint8_t *buf;   /* Buffer with consecutive primitive encoding bytes */
-       int size;       /* Size of the buffer */
-} ASN__PRIMITIVE_TYPE_t;       /* Do not use this type directly! */
-
-asn_struct_free_f ASN__PRIMITIVE_TYPE_free;
-ber_type_decoder_f ber_decode_primitive;
-der_type_encoder_f der_encode_primitive;
-
-/*
- * A callback specification for the xer_decode_primitive() function below.
- */
-enum xer_pbd_rval {
-       XPBD_SYSTEM_FAILURE,    /* System failure (memory shortage, etc) */
-       XPBD_DECODER_LIMIT,     /* Hit some decoder limitation or deficiency */
-       XPBD_BROKEN_ENCODING,   /* Encoding of a primitive body is broken */
-       XPBD_NOT_BODY_IGNORE,   /* Not a body format, but safe to ignore */
-       XPBD_BODY_CONSUMED      /* Body is recognized and consumed */
-};
-typedef enum xer_pbd_rval (xer_primitive_body_decoder_f)
-       (asn_TYPE_descriptor_t *td, void *struct_ptr,
-               const void *chunk_buf, size_t chunk_size);
-
-/*
- * Specific function to decode simple primitive types.
- * Also see xer_decode_general() in xer_decoder.h
- */
-asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
-       asn_TYPE_descriptor_t *type_descriptor,
-       void **struct_ptr, size_t struct_size,
-       const char *opt_mname,
-       const void *buf_ptr, size_t size,
-       xer_primitive_body_decoder_f *prim_body_decoder
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ASN_CODECS_PRIM_H */
diff --git a/stglibs/smux.lib/asn_internal.h b/stglibs/smux.lib/asn_internal.h
deleted file mode 100644 (file)
index 67f055a..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * Declarations internally useful for the ASN.1 support code.
- */
-#ifndef        _ASN_INTERNAL_H_
-#define        _ASN_INTERNAL_H_
-
-#include "asn_application.h"   /* Application-visible API */
-
-#ifndef        __NO_ASSERT_H__         /* Include assert.h only for internal use. */
-#include <assert.h>            /* for assert() macro */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Environment version might be used to avoid running with the old library */
-#define        ASN1C_ENVIRONMENT_VERSION       920     /* Compile-time version */
-int get_asn1c_environment_version(void);       /* Run-time version */
-
-#define        CALLOC(nmemb, size)     calloc(nmemb, size)
-#define        MALLOC(size)            malloc(size)
-#define        REALLOC(oldptr, size)   realloc(oldptr, size)
-#define        FREEMEM(ptr)            free(ptr)
-
-/*
- * A macro for debugging the ASN.1 internals.
- * You may enable or override it.
- */
-#ifndef        ASN_DEBUG       /* If debugging code is not defined elsewhere... */
-#if    EMIT_ASN_DEBUG == 1     /* And it was asked to emit this code... */
-#ifdef __GNUC__
-#define        ASN_DEBUG(fmt, args...) do {            \
-               fprintf(stderr, fmt, ##args);   \
-               fprintf(stderr, " (%s:%d)\n",   \
-                       __FILE__, __LINE__);    \
-       } while(0)
-#else  /* !__GNUC__ */
-void ASN_DEBUG_f(const char *fmt, ...);
-#define        ASN_DEBUG       ASN_DEBUG_f
-#endif /* __GNUC__ */
-#else  /* EMIT_ASN_DEBUG != 1 */
-static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
-#endif /* EMIT_ASN_DEBUG */
-#endif /* ASN_DEBUG */
-
-/*
- * Invoke the application-supplied callback and fail, if something is wrong.
- */
-#define        __ASN_E_cbc(buf, size)  (cb((buf), (size), app_key) < 0)
-#define        _ASN_E_CALLBACK(foo)    do {                                    \
-               if(foo) goto cb_failed;                                 \
-       } while(0)
-#define        _ASN_CALLBACK(buf, size)                                        \
-       _ASN_E_CALLBACK(__ASN_E_cbc(buf, size))
-#define        _ASN_CALLBACK2(buf1, size1, buf2, size2)                        \
-       _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2))
-#define        _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3)           \
-       _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1)                        \
-               || __ASN_E_cbc(buf2, size2)                             \
-               || __ASN_E_cbc(buf3, size3))
-
-#define        _i_ASN_TEXT_INDENT(nl, level) do {                              \
-       int __level = (level);                                          \
-       int __nl = ((nl) != 0);                                         \
-       int __i;                                                        \
-       if(__nl) _ASN_CALLBACK("\n", 1);                                \
-       for(__i = 0; __i < __level; __i++)                              \
-               _ASN_CALLBACK("    ", 4);                               \
-       er.encoded += __nl + 4 * __level;                               \
-} while(0)
-
-#define        _i_INDENT(nl)   do {                                            \
-       int __i;                                                        \
-       if((nl) && cb("\n", 1, app_key) < 0) return -1;                 \
-       for(__i = 0; __i < ilevel; __i++)                               \
-               if(cb("    ", 4, app_key) < 0) return -1;               \
-} while(0)
-
-/*
- * Check stack against overflow, if limit is set.
- */
-#define        _ASN_DEFAULT_STACK_MAX  (30000)
-static inline int
-_ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) {
-       if(ctx && ctx->max_stack_size) {
-
-               /* ctx MUST be allocated on the stack */
-               ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx);
-               if(usedstack > 0) usedstack = -usedstack; /* grows up! */
-
-               /* double negative required to avoid int wrap-around */
-               if(usedstack < -(ptrdiff_t)ctx->max_stack_size) {
-                       ASN_DEBUG("Stack limit %ld reached",
-                               (long)ctx->max_stack_size);
-                       return -1;
-               }
-       }
-       return 0;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ASN_INTERNAL_H_ */
diff --git a/stglibs/smux.lib/asn_system.h b/stglibs/smux.lib/asn_system.h
deleted file mode 100644 (file)
index d7ebdaa..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * Miscellaneous system-dependent types.
- */
-#ifndef        _ASN_SYSTEM_H_
-#define        _ASN_SYSTEM_H_
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>     /* For snprintf(3) */
-#include <stdlib.h>    /* For *alloc(3) */
-#include <string.h>    /* For memcpy(3) */
-#include <sys/types.h> /* For size_t */
-#include <stdarg.h>    /* For va_start */
-#include <stddef.h>    /* for offsetof and ptrdiff_t */
-
-#ifdef WIN32
-
-#include <malloc.h>
-#include <stdint.h>
-#define         snprintf       _snprintf
-#define         vsnprintf      _vsnprintf
-
-#ifdef _MSC_VER                        /* MSVS.Net */
-#ifndef __cplusplus
-#define inline __inline
-#endif
-#define        ssize_t         SSIZE_T
-typedef        char            int8_t;
-typedef        short           int16_t;
-typedef        int             int32_t;
-typedef        unsigned char   uint8_t;
-typedef        unsigned short  uint16_t;
-typedef        unsigned int    uint32_t;
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <float.h>
-#define isnan _isnan
-#define finite _finite
-#define copysign _copysign
-#define        ilogb   _logb
-#endif /* _MSC_VER */
-
-#else  /* !WIN32 */
-
-#if defined(__vxworks)
-#include <types/vxTypes.h>
-#else  /* !defined(__vxworks) */
-
-#include <inttypes.h>  /* C99 specifies this file */
-/*
- * 1. Earlier FreeBSD version didn't have <stdint.h>,
- * but <inttypes.h> was present.
- * 2. Sun Solaris requires <alloca.h> for alloca(3),
- * but does not have <stdint.h>.
- */
-#if    (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_))
-#if    defined(sun)
-#include <alloca.h>    /* For alloca(3) */
-#include <ieeefp.h>    /* for finite(3) */
-#elif  defined(__hpux)
-#ifdef __GNUC__
-#include <alloca.h>    /* For alloca(3) */
-#else  /* !__GNUC__ */
-#define inline
-#endif /* __GNUC__ */
-#else
-#include <stdint.h>    /* SUSv2+ and C99 specify this file, for uintXX_t */
-#endif /* defined(sun) */
-#endif
-
-#endif /* defined(__vxworks) */
-
-#endif /* WIN32 */
-
-#if    __GNUC__ >= 3
-#ifndef        GCC_PRINTFLIKE
-#define        GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#endif
-#else
-#ifndef        GCC_PRINTFLIKE
-#define        GCC_PRINTFLIKE(fmt,var) /* nothing */
-#endif
-#endif
-
-#ifndef        offsetof        /* If not defined by <stddef.h> */
-#define        offsetof(s, m)  ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0))
-#endif /* offsetof */
-
-#ifndef        MIN             /* Suitable for comparing primitive types (integers) */
-#if defined(__GNUC__)
-#define        MIN(a,b)        ({ __typeof a _a = a; __typeof b _b = b;        \
-       ((_a)<(_b)?(_a):(_b)); })
-#else  /* !__GNUC__ */
-#define        MIN(a,b)        ((a)<(b)?(a):(b))       /* Unsafe variant */
-#endif /* __GNUC__ */
-#endif /* MIN */
-
-#endif /* _ASN_SYSTEM_H_ */
diff --git a/stglibs/smux.lib/ber_decoder.h b/stglibs/smux.lib/ber_decoder.h
deleted file mode 100644 (file)
index 768133b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _BER_DECODER_H_
-#define        _BER_DECODER_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-struct asn_codec_ctx_s;                /* Forward declaration */
-
-/*
- * The BER decoder of any type.
- * This function may be invoked directly from the application.
- */
-asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
-       struct asn_TYPE_descriptor_s *type_descriptor,
-       void **struct_ptr,      /* Pointer to a target structure's pointer */
-       const void *buffer,     /* Data to be decoded */
-       size_t size             /* Size of that buffer */
-       );
-
-/*
- * Type of generic function which decodes the byte stream into the structure.
- */
-typedef asn_dec_rval_t (ber_type_decoder_f)(
-               struct asn_codec_ctx_s *opt_codec_ctx,
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void **struct_ptr, const void *buf_ptr, size_t size,
-               int tag_mode);
-
-/*******************************
- * INTERNALLY USEFUL FUNCTIONS *
- *******************************/
-
-/*
- * Check that all tags correspond to the type definition (as given in head).
- * On return, last_length would contain either a non-negative length of the
- * value part of the last TLV, or the negative number of expected
- * "end of content" sequences. The number may only be negative if the
- * head->last_tag_form is non-zero.
- */
-asn_dec_rval_t ber_check_tags(
-               struct asn_codec_ctx_s *opt_codec_ctx,  /* codec options */
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               asn_struct_ctx_t *opt_ctx,      /* saved decoding context */
-               const void *ptr, size_t size,
-               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-               int last_tag_form,      /* {-1,0:1}: any, primitive, constr */
-               ber_tlv_len_t *last_length,
-               int *opt_tlv_form       /* optional tag form */
-       );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BER_DECODER_H_ */
diff --git a/stglibs/smux.lib/ber_tlv_length.h b/stglibs/smux.lib/ber_tlv_length.h
deleted file mode 100644 (file)
index 3496802..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _BER_TLV_LENGTH_H_
-#define        _BER_TLV_LENGTH_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef ssize_t ber_tlv_len_t;
-
-/*
- * This function tries to fetch the length of the BER TLV value and place it
- * in *len_r.
- * RETURN VALUES:
- *      0:     More data expected than bufptr contains.
- *     -1:     Fatal error deciphering length.
- *     >0:     Number of bytes used from bufptr.
- * On return with >0, len_r is constrained as -1..MAX, where -1 mean
- * that the value is of indefinite length.
- */
-ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size,
-       ber_tlv_len_t *len_r);
-
-/*
- * This function expects bufptr to be positioned over L in TLV.
- * It returns number of bytes occupied by L and V together, suitable
- * for skipping. The function properly handles indefinite length.
- * RETURN VALUES:
- *     Standard {-1,0,>0} convention.
- */
-ssize_t ber_skip_length(
-       struct asn_codec_ctx_s *opt_codec_ctx,  /* optional context */
-       int _is_constructed, const void *bufptr, size_t size);
-
-/*
- * This function serializes the length (L from TLV) in DER format.
- * It always returns number of bytes necessary to represent the length,
- * it is a caller's responsibility to check the return value
- * against the supplied buffer's size.
- */
-size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BER_TLV_LENGTH_H_ */
diff --git a/stglibs/smux.lib/ber_tlv_tag.h b/stglibs/smux.lib/ber_tlv_tag.h
deleted file mode 100644 (file)
index 60e8668..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _BER_TLV_TAG_H_
-#define        _BER_TLV_TAG_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum asn_tag_class {
-       ASN_TAG_CLASS_UNIVERSAL         = 0,    /* 0b00 */
-       ASN_TAG_CLASS_APPLICATION       = 1,    /* 0b01 */
-       ASN_TAG_CLASS_CONTEXT           = 2,    /* 0b10 */
-       ASN_TAG_CLASS_PRIVATE           = 3     /* 0b11 */
-};
-typedef unsigned ber_tlv_tag_t;        /* BER TAG from Tag-Length-Value */
-
-/*
- * Tag class is encoded together with tag value for optimization purposes.
- */
-#define        BER_TAG_CLASS(tag)      ((tag) & 0x3)
-#define        BER_TAG_VALUE(tag)      ((tag) >> 2)
-#define        BER_TLV_CONSTRUCTED(tagptr)     (((*(const uint8_t *)tagptr)&0x20)?1:0)
-
-#define        BER_TAGS_EQUAL(tag1, tag2)      ((tag1) == (tag2))
-
-/*
- * Several functions for printing the TAG in the canonical form
- * (i.e. "[PRIVATE 0]").
- * Return values correspond to their libc counterparts (if any).
- */
-ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen);
-ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *);
-char *ber_tlv_tag_string(ber_tlv_tag_t tag);
-
-
-/*
- * This function tries to fetch the tag from the input stream.
- * RETURN VALUES:
- *      0:     More data expected than bufptr contains.
- *     -1:     Fatal error deciphering tag.
- *     >0:     Number of bytes used from bufptr. tag_r will contain the tag.
- */
-ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r);
-
-/*
- * This function serializes the tag (T from TLV) in BER format.
- * It always returns number of bytes necessary to represent the tag,
- * it is a caller's responsibility to check the return value
- * against the supplied buffer's size.
- */
-size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BER_TLV_TAG_H_ */
diff --git a/stglibs/smux.lib/constr_CHOICE.h b/stglibs/smux.lib/constr_CHOICE.h
deleted file mode 100644 (file)
index 83404e6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _CONSTR_CHOICE_H_
-#define        _CONSTR_CHOICE_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct asn_CHOICE_specifics_s {
-       /*
-        * Target structure description.
-        */
-       int struct_size;        /* Size of the target structure. */
-       int ctx_offset;         /* Offset of the asn_codec_ctx_t member */
-       int pres_offset;        /* Identifier of the present member */
-       int pres_size;          /* Size of the identifier (enum) */
-
-       /*
-        * Tags to members mapping table.
-        */
-       asn_TYPE_tag2member_t *tag2el;
-       int tag2el_count;
-
-       /* Canonical ordering of CHOICE elements, for PER */
-       int *canonical_order;
-
-       /*
-        * Extensions-related stuff.
-        */
-       int ext_start;          /* First member of extensions, or -1 */
-} asn_CHOICE_specifics_t;
-
-/*
- * A set specialized functions dealing with the CHOICE type.
- */
-asn_struct_free_f CHOICE_free;
-asn_struct_print_f CHOICE_print;
-asn_constr_check_f CHOICE_constraint;
-ber_type_decoder_f CHOICE_decode_ber;
-der_type_encoder_f CHOICE_encode_der;
-xer_type_decoder_f CHOICE_decode_xer;
-xer_type_encoder_f CHOICE_encode_xer;
-per_type_decoder_f CHOICE_decode_uper;
-per_type_encoder_f CHOICE_encode_uper;
-asn_outmost_tag_f CHOICE_outmost_tag;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONSTR_CHOICE_H_ */
diff --git a/stglibs/smux.lib/constr_SEQUENCE.h b/stglibs/smux.lib/constr_SEQUENCE.h
deleted file mode 100644 (file)
index 5f589d5..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _CONSTR_SEQUENCE_H_
-#define        _CONSTR_SEQUENCE_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct asn_SEQUENCE_specifics_s {
-       /*
-        * Target structure description.
-        */
-       int struct_size;        /* Size of the target structure. */
-       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
-
-       /*
-        * Tags to members mapping table (sorted).
-        */
-       asn_TYPE_tag2member_t *tag2el;
-       int tag2el_count;
-
-       /*
-        * Optional members of the extensions root (roms) or additions (aoms).
-        * Meaningful for PER.
-        */
-       int *oms;               /* Optional MemberS */
-       int  roms_count;        /* Root optional members count */
-       int  aoms_count;        /* Additions optional members count */
-
-       /*
-        * Description of an extensions group.
-        */
-       int ext_after;          /* Extensions start after this member */
-       int ext_before;         /* Extensions stop before this member */
-} asn_SEQUENCE_specifics_t;
-
-
-/*
- * A set specialized functions dealing with the SEQUENCE type.
- */
-asn_struct_free_f SEQUENCE_free;
-asn_struct_print_f SEQUENCE_print;
-asn_constr_check_f SEQUENCE_constraint;
-ber_type_decoder_f SEQUENCE_decode_ber;
-der_type_encoder_f SEQUENCE_encode_der;
-xer_type_decoder_f SEQUENCE_decode_xer;
-xer_type_encoder_f SEQUENCE_encode_xer;
-per_type_decoder_f SEQUENCE_decode_uper;
-per_type_encoder_f SEQUENCE_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONSTR_SEQUENCE_H_ */
diff --git a/stglibs/smux.lib/constr_SEQUENCE_OF.h b/stglibs/smux.lib/constr_SEQUENCE_OF.h
deleted file mode 100644 (file)
index e2272f3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _CONSTR_SEQUENCE_OF_H_
-#define        _CONSTR_SEQUENCE_OF_H_
-
-#include <asn_application.h>
-#include <constr_SET_OF.h>             /* Implemented using SET OF */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * A set specialized functions dealing with the SEQUENCE OF type.
- * Generally implemented using SET OF.
- */
-#define        SEQUENCE_OF_free        SET_OF_free
-#define        SEQUENCE_OF_print       SET_OF_print
-#define        SEQUENCE_OF_constraint  SET_OF_constraint
-#define        SEQUENCE_OF_decode_ber  SET_OF_decode_ber
-#define        SEQUENCE_OF_decode_xer  SET_OF_decode_xer
-#define        SEQUENCE_OF_decode_uper SET_OF_decode_uper
-der_type_encoder_f SEQUENCE_OF_encode_der;
-xer_type_encoder_f SEQUENCE_OF_encode_xer;
-per_type_encoder_f SEQUENCE_OF_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONSTR_SET_OF_H_ */
diff --git a/stglibs/smux.lib/constr_SET_OF.h b/stglibs/smux.lib/constr_SET_OF.h
deleted file mode 100644 (file)
index bcd0966..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _CONSTR_SET_OF_H_
-#define        _CONSTR_SET_OF_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct asn_SET_OF_specifics_s {
-       /*
-        * Target structure description.
-        */
-       int struct_size;        /* Size of the target structure. */
-       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
-
-       /* XER-specific stuff */
-       int as_XMLValueList;    /* The member type must be encoded like this */
-} asn_SET_OF_specifics_t;
-
-/*
- * A set specialized functions dealing with the SET OF type.
- */
-asn_struct_free_f SET_OF_free;
-asn_struct_print_f SET_OF_print;
-asn_constr_check_f SET_OF_constraint;
-ber_type_decoder_f SET_OF_decode_ber;
-der_type_encoder_f SET_OF_encode_der;
-xer_type_decoder_f SET_OF_decode_xer;
-xer_type_encoder_f SET_OF_encode_xer;
-per_type_decoder_f SET_OF_decode_uper;
-per_type_encoder_f SET_OF_encode_uper;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONSTR_SET_OF_H_ */
diff --git a/stglibs/smux.lib/constr_TYPE.h b/stglibs/smux.lib/constr_TYPE.h
deleted file mode 100644 (file)
index 95507c8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * This file contains the declaration structure called "ASN.1 Type Definition",
- * which holds all information necessary for encoding and decoding routines.
- * This structure even contains pointer to these encoding and decoding routines
- * for each defined ASN.1 type.
- */
-#ifndef        _CONSTR_TYPE_H_
-#define        _CONSTR_TYPE_H_
-
-#include <ber_tlv_length.h>
-#include <ber_tlv_tag.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-struct asn_TYPE_member_s;      /* Forward declaration */
-
-/*
- * This type provides the context information for various ASN.1 routines,
- * primarily ones doing decoding. A member _asn_ctx of this type must be
- * included into certain target language's structures, such as compound types.
- */
-typedef struct asn_struct_ctx_s {
-       short phase;            /* Decoding phase */
-       short step;             /* Elementary step of a phase */
-       int context;            /* Other context information */
-       void *ptr;              /* Decoder-specific stuff (stack elements) */
-       ber_tlv_len_t left;     /* Number of bytes left, -1 for indefinite */
-} asn_struct_ctx_t;
-
-#include <ber_decoder.h>       /* Basic Encoding Rules decoder */
-#include <der_encoder.h>       /* Distinguished Encoding Rules encoder */
-#include <xer_decoder.h>       /* Decoder of XER (XML, text) */
-#include <xer_encoder.h>       /* Encoder into XER (XML, text) */
-#include <per_decoder.h>       /* Packet Encoding Rules decoder */
-#include <per_encoder.h>       /* Packet Encoding Rules encoder */
-#include <constraints.h>       /* Subtype constraints support */
-
-/*
- * Free the structure according to its specification.
- * If (free_contents_only) is set, the wrapper structure itself (struct_ptr)
- * will not be freed. (It may be useful in case the structure is allocated
- * statically or arranged on the stack, yet its elements are allocated
- * dynamically.)
- */
-typedef void (asn_struct_free_f)(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr, int free_contents_only);
-#define        ASN_STRUCT_FREE(asn_DEF, ptr)   (asn_DEF).free_struct(&(asn_DEF),ptr,0)
-#define        ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr)     \
-                                       (asn_DEF).free_struct(&(asn_DEF),ptr,1)
-
-/*
- * Print the structure according to its specification.
- */
-typedef int (asn_struct_print_f)(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               const void *struct_ptr,
-               int level,      /* Indentation level */
-               asn_app_consume_bytes_f *callback, void *app_key);
-
-/*
- * Return the outmost tag of the type.
- * If the type is untagged CHOICE, the dynamic operation is performed.
- * NOTE: This function pointer type is only useful internally.
- * Do not use it in your application.
- */
-typedef ber_tlv_tag_t (asn_outmost_tag_f)(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag);
-/* The instance of the above function type; used internally. */
-asn_outmost_tag_f asn_TYPE_outmost_tag;
-
-\f
-/*
- * The definitive description of the destination language's structure.
- */
-typedef struct asn_TYPE_descriptor_s {
-       char *name;     /* A name of the ASN.1 type. "" in some cases. */
-       char *xml_tag;  /* Name used in XML tag */
-
-       /*
-        * Generalized functions for dealing with the specific type.
-        * May be directly invoked by applications.
-        */
-       asn_struct_free_f  *free_struct;        /* Free the structure */
-       asn_struct_print_f *print_struct;       /* Human readable output */
-       asn_constr_check_f *check_constraints;  /* Constraints validator */
-       ber_type_decoder_f *ber_decoder;        /* Generic BER decoder */
-       der_type_encoder_f *der_encoder;        /* Canonical DER encoder */
-       xer_type_decoder_f *xer_decoder;        /* Generic XER decoder */
-       xer_type_encoder_f *xer_encoder;        /* [Canonical] XER encoder */
-       per_type_decoder_f *uper_decoder;       /* Unaligned PER decoder */
-       per_type_encoder_f *uper_encoder;       /* Unaligned PER encoder */
-
-       /***********************************************************************
-        * Internally useful members. Not to be used by applications directly. *
-        **********************************************************************/
-
-       /*
-        * Tags that are expected to occur.
-        */
-       asn_outmost_tag_f  *outmost_tag;        /* <optional, internal> */
-       ber_tlv_tag_t *tags;    /* Effective tags sequence for this type */
-       int tags_count;         /* Number of tags which are expected */
-       ber_tlv_tag_t *all_tags;/* Every tag for BER/containment */
-       int all_tags_count;     /* Number of tags */
-
-       asn_per_constraints_t *per_constraints; /* PER compiled constraints */
-
-       /*
-        * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE).
-        */
-       struct asn_TYPE_member_s *elements;
-       int elements_count;
-
-       /*
-        * Additional information describing the type, used by appropriate
-        * functions above.
-        */
-       void *specifics;
-} asn_TYPE_descriptor_t;
-
-/*
- * This type describes an element of the constructed type,
- * i.e. SEQUENCE, SET, CHOICE, etc.
- */
-  enum asn_TYPE_flags_e {
-       ATF_NOFLAGS,
-       ATF_POINTER     = 0x01, /* Represented by the pointer */
-       ATF_OPEN_TYPE   = 0x02  /* ANY type, without meaningful tag */
-  };
-typedef struct asn_TYPE_member_s {
-       enum asn_TYPE_flags_e flags;    /* Element's presentation flags */
-       int optional;   /* Following optional members, including current */
-       int memb_offset;                /* Offset of the element */
-       ber_tlv_tag_t tag;              /* Outmost (most immediate) tag */
-       int tag_mode;           /* IMPLICIT/no/EXPLICIT tag at current level */
-       asn_TYPE_descriptor_t *type;    /* Member type descriptor */
-       asn_constr_check_f *memb_constraints;   /* Constraints validator */
-       asn_per_constraints_t *per_constraints; /* PER compiled constraints */
-       int (*default_value)(int setval, void **sptr);  /* DEFAULT <value> */
-       char *name;                     /* ASN.1 identifier of the element */
-} asn_TYPE_member_t;
-
-/*
- * BER tag to element number mapping.
- */
-typedef struct asn_TYPE_tag2member_s {
-       ber_tlv_tag_t el_tag;   /* Outmost tag of the member */
-       int el_no;              /* Index of the associated member, base 0 */
-       int toff_first;         /* First occurence of the el_tag, relative */
-       int toff_last;          /* Last occurence of the el_tag, relatvie */
-} asn_TYPE_tag2member_t;
-
-/*
- * This function is a wrapper around (td)->print_struct, which prints out
- * the contents of the target language's structure (struct_ptr) into the
- * file pointer (stream) in human readable form.
- * RETURN VALUES:
- *      0: The structure is printed.
- *     -1: Problem dumping the structure.
- * (See also xer_fprint() in xer_encoder.h)
- */
-int asn_fprint(FILE *stream,           /* Destination stream descriptor */
-       asn_TYPE_descriptor_t *td,      /* ASN.1 type descriptor */
-       const void *struct_ptr);        /* Structure to be printed */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONSTR_TYPE_H_ */
diff --git a/stglibs/smux.lib/constraints.h b/stglibs/smux.lib/constraints.h
deleted file mode 100644 (file)
index 5032345..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _ASN1_CONSTRAINTS_VALIDATOR_H_
-#define        _ASN1_CONSTRAINTS_VALIDATOR_H_
-
-#include <asn_system.h>                /* Platform-dependent types */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;          /* Forward declaration */
-
-/*
- * Validate the structure according to the ASN.1 constraints.
- * If errbuf and errlen are given, they shall be pointing to the appropriate
- * buffer space and its length before calling this function. Alternatively,
- * they could be passed as NULL's. If constraints validation fails,
- * errlen will contain the actual number of bytes taken from the errbuf
- * to encode an error message (properly 0-terminated).
- * 
- * RETURN VALUES:
- * This function returns 0 in case all ASN.1 constraints are met
- * and -1 if one or more constraints were failed.
- */
-int
-asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor,
-       const void *struct_ptr, /* Target language's structure */
-       char *errbuf,           /* Returned error description */
-       size_t *errlen          /* Length of the error description */
-       );
-
-
-/*
- * Generic type for constraint checking callback,
- * associated with every type descriptor.
- */
-typedef int (asn_constr_check_f)(
-       struct asn_TYPE_descriptor_s *type_descriptor,
-       const void *struct_ptr,
-       asn_app_constraint_failed_f *optional_callback, /* Log the error */
-       void *optional_app_key          /* Opaque key passed to a callback */
-       );
-
-/*******************************
- * INTERNALLY USEFUL FUNCTIONS *
- *******************************/
-
-asn_constr_check_f asn_generic_no_constraint;  /* No constraint whatsoever */
-asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */
-
-/*
- * Invoke the callback with a complete error message.
- */
-#define        _ASN_CTFAIL     if(ctfailcb) ctfailcb
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ASN1_CONSTRAINTS_VALIDATOR_H_ */
diff --git a/stglibs/smux.lib/der_encoder.h b/stglibs/smux.lib/der_encoder.h
deleted file mode 100644 (file)
index 4e2fb06..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _DER_ENCODER_H_
-#define        _DER_ENCODER_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/*
- * The DER encoder of any type. May be invoked by the application.
- */
-asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr,       /* Structure to be encoded */
-               asn_app_consume_bytes_f *consume_bytes_cb,
-               void *app_key           /* Arbitrary callback argument */
-       );
-
-/* A variant of der_encode() which encodes data into the pre-allocated buffer */
-asn_enc_rval_t der_encode_to_buffer(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr,       /* Structure to be encoded */
-               void *buffer,           /* Pre-allocated buffer */
-               size_t buffer_size      /* Initial buffer size (maximum) */
-       );
-
-/*
- * Type of the generic DER encoder.
- */
-typedef asn_enc_rval_t (der_type_encoder_f)(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr,       /* Structure to be encoded */
-               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-               ber_tlv_tag_t tag,
-               asn_app_consume_bytes_f *consume_bytes_cb,      /* Callback */
-               void *app_key           /* Arbitrary callback argument */
-       );
-
-
-/*******************************
- * INTERNALLY USEFUL FUNCTIONS *
- *******************************/
-
-/*
- * Write out leading TL[v] sequence according to the type definition.
- */
-ssize_t der_write_tags(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               size_t struct_length,
-               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-               int last_tag_form,      /* {0,!0}: prim, constructed */
-               ber_tlv_tag_t tag,
-               asn_app_consume_bytes_f *consume_bytes_cb,
-               void *app_key
-       );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _DER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/ANY.h b/stglibs/smux.lib/include/stg/ANY.h
new file mode 100644 (file)
index 0000000..b7d92fa
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef ASN_TYPE_ANY_H
+#define ASN_TYPE_ANY_H
+
+#include <OCTET_STRING.h>      /* Implemented via OCTET STRING type */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ANY {
+       uint8_t *buf;   /* BER-encoded ANY contents */
+       int size;       /* Size of the above buffer */
+
+       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
+} ANY_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_ANY;
+
+asn_struct_free_f ANY_free;
+asn_struct_print_f ANY_print;
+ber_type_decoder_f ANY_decode_ber;
+der_type_encoder_f ANY_encode_der;
+xer_type_encoder_f ANY_encode_xer;
+
+/******************************
+ * Handy conversion routines. *
+ ******************************/
+
+/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
+int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
+ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
+
+/* Convert the contents of the ANY type into the specified type. */
+int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
+
+#define        ANY_fromBuf(s, buf, size)       OCTET_STRING_fromBuf((s), (buf), (size))
+#define        ANY_new_fromBuf(buf, size)      OCTET_STRING_new_fromBuf(       \
+                                               &asn_DEF_ANY, (buf), (size))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ASN_TYPE_ANY_H */
diff --git a/stglibs/smux.lib/include/stg/ApplicationSyntax.h b/stglibs/smux.lib/include/stg/ApplicationSyntax.h
new file mode 100644 (file)
index 0000000..90a8707
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _ApplicationSyntax_H_
+#define        _ApplicationSyntax_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "NetworkAddress.h"
+#include "Counter.h"
+#include "Gauge.h"
+#include "TimeTicks.h"
+#include "Opaque.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum ApplicationSyntax_PR {
+       ApplicationSyntax_PR_NOTHING,   /* No components present */
+       ApplicationSyntax_PR_address,
+       ApplicationSyntax_PR_counter,
+       ApplicationSyntax_PR_gauge,
+       ApplicationSyntax_PR_ticks,
+       ApplicationSyntax_PR_arbitrary
+} ApplicationSyntax_PR;
+
+/* ApplicationSyntax */
+typedef struct ApplicationSyntax {
+       ApplicationSyntax_PR present;
+       union ApplicationSyntax_u {
+               NetworkAddress_t         address;
+               Counter_t        counter;
+               Gauge_t  gauge;
+               TimeTicks_t      ticks;
+               Opaque_t         arbitrary;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} ApplicationSyntax_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ApplicationSyntax;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ApplicationSyntax_H_ */
diff --git a/stglibs/smux.lib/include/stg/AtEntry.h b/stglibs/smux.lib/include/stg/AtEntry.h
new file mode 100644 (file)
index 0000000..a0aba10
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _AtEntry_H_
+#define        _AtEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "PhysAddress.h"
+#include "NetworkAddress.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* AtEntry */
+typedef struct AtEntry {
+       INTEGER_t        atIfIndex;
+       PhysAddress_t    atPhysAddress;
+       NetworkAddress_t         atNetAddress;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} AtEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_AtEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AtEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/BIT_STRING.h b/stglibs/smux.lib/include/stg/BIT_STRING.h
new file mode 100644 (file)
index 0000000..732e878
--- /dev/null
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _BIT_STRING_H_
+#define        _BIT_STRING_H_
+
+#include <OCTET_STRING.h>      /* Some help from OCTET STRING */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct BIT_STRING_s {
+       uint8_t *buf;   /* BIT STRING body */
+       int size;       /* Size of the above buffer */
+
+       int bits_unused;/* Unused trailing bits in the last octet (0..7) */
+
+       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
+} BIT_STRING_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING;
+
+asn_struct_print_f BIT_STRING_print;   /* Human-readable output */
+asn_constr_check_f BIT_STRING_constraint;
+xer_type_encoder_f BIT_STRING_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BIT_STRING_H_ */
diff --git a/stglibs/smux.lib/include/stg/BOOLEAN.h b/stglibs/smux.lib/include/stg/BOOLEAN.h
new file mode 100644 (file)
index 0000000..217d0f1
--- /dev/null
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _BOOLEAN_H_
+#define        _BOOLEAN_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The underlying integer may contain various values, but everything
+ * non-zero is capped to 0xff by the DER encoder. The BER decoder may
+ * yield non-zero values different from 1, beware.
+ */
+typedef int BOOLEAN_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN;
+
+asn_struct_free_f BOOLEAN_free;
+asn_struct_print_f BOOLEAN_print;
+ber_type_decoder_f BOOLEAN_decode_ber;
+der_type_encoder_f BOOLEAN_encode_der;
+xer_type_decoder_f BOOLEAN_decode_xer;
+xer_type_encoder_f BOOLEAN_encode_xer;
+per_type_decoder_f BOOLEAN_decode_uper;
+per_type_encoder_f BOOLEAN_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BOOLEAN_H_ */
diff --git a/stglibs/smux.lib/include/stg/ClosePDU.h b/stglibs/smux.lib/include/stg/ClosePDU.h
new file mode 100644 (file)
index 0000000..a3d1e7a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _ClosePDU_H_
+#define        _ClosePDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum ClosePDU {
+       ClosePDU_goingDown      = 0,
+       ClosePDU_unsupportedVersion     = 1,
+       ClosePDU_packetFormat   = 2,
+       ClosePDU_protocolError  = 3,
+       ClosePDU_internalError  = 4,
+       ClosePDU_authenticationFailure  = 5
+} e_ClosePDU;
+
+/* ClosePDU */
+typedef INTEGER_t       ClosePDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ClosePDU;
+asn_struct_free_f ClosePDU_free;
+asn_struct_print_f ClosePDU_print;
+asn_constr_check_f ClosePDU_constraint;
+ber_type_decoder_f ClosePDU_decode_ber;
+der_type_encoder_f ClosePDU_encode_der;
+xer_type_decoder_f ClosePDU_decode_xer;
+xer_type_encoder_f ClosePDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ClosePDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/Counter.h b/stglibs/smux.lib/include/stg/Counter.h
new file mode 100644 (file)
index 0000000..3c770ad
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _Counter_H_
+#define        _Counter_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Counter */
+typedef INTEGER_t       Counter_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_Counter;
+asn_struct_free_f Counter_free;
+asn_struct_print_f Counter_print;
+asn_constr_check_f Counter_constraint;
+ber_type_decoder_f Counter_decode_ber;
+der_type_encoder_f Counter_encode_der;
+xer_type_decoder_f Counter_decode_xer;
+xer_type_encoder_f Counter_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Counter_H_ */
diff --git a/stglibs/smux.lib/include/stg/DisplayString.h b/stglibs/smux.lib/include/stg/DisplayString.h
new file mode 100644 (file)
index 0000000..ac6862c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _DisplayString_H_
+#define        _DisplayString_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OCTET_STRING.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* DisplayString */
+typedef OCTET_STRING_t  DisplayString_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_DisplayString;
+asn_struct_free_f DisplayString_free;
+asn_struct_print_f DisplayString_print;
+asn_constr_check_f DisplayString_constraint;
+ber_type_decoder_f DisplayString_decode_ber;
+der_type_encoder_f DisplayString_encode_der;
+xer_type_decoder_f DisplayString_decode_xer;
+xer_type_encoder_f DisplayString_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DisplayString_H_ */
diff --git a/stglibs/smux.lib/include/stg/EgpNeighEntry.h b/stglibs/smux.lib/include/stg/EgpNeighEntry.h
new file mode 100644 (file)
index 0000000..79d3eed
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _EgpNeighEntry_H_
+#define        _EgpNeighEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "IpAddress.h"
+#include "Counter.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* EgpNeighEntry */
+typedef struct EgpNeighEntry {
+       INTEGER_t        egpNeighState;
+       IpAddress_t      egpNeighAddr;
+       INTEGER_t        egpNeighAs;
+       Counter_t        egpNeighInMsgs;
+       Counter_t        egpNeighInErrs;
+       Counter_t        egpNeighOutMsgs;
+       Counter_t        egpNeighOutErrs;
+       Counter_t        egpNeighInErrMsgs;
+       Counter_t        egpNeighOutErrMsgs;
+       Counter_t        egpNeighStateUps;
+       Counter_t        egpNeighStateDowns;
+       INTEGER_t        egpNeighIntervalHello;
+       INTEGER_t        egpNeighIntervalPoll;
+       INTEGER_t        egpNeighMode;
+       INTEGER_t        egpNeighEventTrigger;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} EgpNeighEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_EgpNeighEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EgpNeighEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/Gauge.h b/stglibs/smux.lib/include/stg/Gauge.h
new file mode 100644 (file)
index 0000000..f3e17c5
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _Gauge_H_
+#define        _Gauge_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Gauge */
+typedef INTEGER_t       Gauge_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_Gauge;
+asn_struct_free_f Gauge_free;
+asn_struct_print_f Gauge_print;
+asn_constr_check_f Gauge_constraint;
+ber_type_decoder_f Gauge_decode_ber;
+der_type_encoder_f Gauge_encode_der;
+xer_type_decoder_f Gauge_decode_xer;
+xer_type_encoder_f Gauge_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Gauge_H_ */
diff --git a/stglibs/smux.lib/include/stg/GetNextRequest-PDU.h b/stglibs/smux.lib/include/stg/GetNextRequest-PDU.h
new file mode 100644 (file)
index 0000000..f9298ec
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _GetNextRequest_PDU_H_
+#define        _GetNextRequest_PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "PDU.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GetNextRequest-PDU */
+typedef PDU_t   GetNextRequest_PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_GetNextRequest_PDU;
+asn_struct_free_f GetNextRequest_PDU_free;
+asn_struct_print_f GetNextRequest_PDU_print;
+asn_constr_check_f GetNextRequest_PDU_constraint;
+ber_type_decoder_f GetNextRequest_PDU_decode_ber;
+der_type_encoder_f GetNextRequest_PDU_encode_der;
+xer_type_decoder_f GetNextRequest_PDU_decode_xer;
+xer_type_encoder_f GetNextRequest_PDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GetNextRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/GetRequest-PDU.h b/stglibs/smux.lib/include/stg/GetRequest-PDU.h
new file mode 100644 (file)
index 0000000..9449451
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _GetRequest_PDU_H_
+#define        _GetRequest_PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "PDU.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GetRequest-PDU */
+typedef PDU_t   GetRequest_PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_GetRequest_PDU;
+asn_struct_free_f GetRequest_PDU_free;
+asn_struct_print_f GetRequest_PDU_print;
+asn_constr_check_f GetRequest_PDU_constraint;
+ber_type_decoder_f GetRequest_PDU_decode_ber;
+der_type_encoder_f GetRequest_PDU_encode_der;
+xer_type_decoder_f GetRequest_PDU_decode_xer;
+xer_type_encoder_f GetRequest_PDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GetRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/GetResponse-PDU.h b/stglibs/smux.lib/include/stg/GetResponse-PDU.h
new file mode 100644 (file)
index 0000000..12e3fba
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _GetResponse_PDU_H_
+#define        _GetResponse_PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "PDU.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GetResponse-PDU */
+typedef PDU_t   GetResponse_PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_GetResponse_PDU;
+asn_struct_free_f GetResponse_PDU_free;
+asn_struct_print_f GetResponse_PDU_print;
+asn_constr_check_f GetResponse_PDU_constraint;
+ber_type_decoder_f GetResponse_PDU_decode_ber;
+der_type_encoder_f GetResponse_PDU_encode_der;
+xer_type_decoder_f GetResponse_PDU_decode_xer;
+xer_type_encoder_f GetResponse_PDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GetResponse_PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/INTEGER.h b/stglibs/smux.lib/include/stg/INTEGER.h
new file mode 100644 (file)
index 0000000..62832b1
--- /dev/null
@@ -0,0 +1,65 @@
+/*-
+ * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _INTEGER_H_
+#define        _INTEGER_H_
+
+#include <asn_application.h>
+#include <asn_codecs_prim.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_INTEGER;
+
+/* Map with <tag> to integer value association */
+typedef struct asn_INTEGER_enum_map_s {
+       long             nat_value;     /* associated native integer value */
+       size_t           enum_len;      /* strlen("tag") */
+       const char      *enum_name;     /* "tag" */
+} asn_INTEGER_enum_map_t;
+
+/* This type describes an enumeration for INTEGER and ENUMERATED types */
+typedef struct asn_INTEGER_specifics_s {
+       asn_INTEGER_enum_map_t *value2enum;     /* N -> "tag"; sorted by N */
+       unsigned int *enum2value;               /* "tag" => N; sorted by tag */
+       int map_count;                          /* Elements in either map */
+       int extension;                          /* This map is extensible */
+       int strict_enumeration;                 /* Enumeration set is fixed */
+} asn_INTEGER_specifics_t;
+
+asn_struct_print_f INTEGER_print;
+ber_type_decoder_f INTEGER_decode_ber;
+der_type_encoder_f INTEGER_encode_der;
+xer_type_decoder_f INTEGER_decode_xer;
+xer_type_encoder_f INTEGER_encode_xer;
+per_type_decoder_f INTEGER_decode_uper;
+per_type_encoder_f INTEGER_encode_uper;
+
+/***********************************
+ * Some handy conversion routines. *
+ ***********************************/
+
+/*
+ * Returns 0 if it was possible to convert, -1 otherwise.
+ * -1/EINVAL: Mandatory argument missing
+ * -1/ERANGE: Value encoded is out of range for long representation
+ * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
+ */
+int asn_INTEGER2long(const INTEGER_t *i, long *l);
+int asn_long2INTEGER(INTEGER_t *i, long l);
+
+/*
+ * Convert the integer value into the corresponding enumeration map entry.
+ */
+const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INTEGER_H_ */
diff --git a/stglibs/smux.lib/include/stg/IfEntry.h b/stglibs/smux.lib/include/stg/IfEntry.h
new file mode 100644 (file)
index 0000000..eb30717
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _IfEntry_H_
+#define        _IfEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "DisplayString.h"
+#include "Gauge.h"
+#include "PhysAddress.h"
+#include "TimeTicks.h"
+#include "Counter.h"
+#include <OBJECT_IDENTIFIER.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IfEntry */
+typedef struct IfEntry {
+       INTEGER_t        ifIndex;
+       DisplayString_t  ifDescr;
+       INTEGER_t        ifType;
+       INTEGER_t        ifMtu;
+       Gauge_t  ifSpeed;
+       PhysAddress_t    ifPhysAddress;
+       INTEGER_t        ifAdminStatus;
+       INTEGER_t        ifOperStatus;
+       TimeTicks_t      ifLastChange;
+       Counter_t        ifInOctets;
+       Counter_t        ifInUcastPkts;
+       Counter_t        ifInNUcastPkts;
+       Counter_t        ifInDiscards;
+       Counter_t        ifInErrors;
+       Counter_t        ifInUnknownProtos;
+       Counter_t        ifOutOctets;
+       Counter_t        ifOutUcastPkts;
+       Counter_t        ifOutNUcastPkts;
+       Counter_t        ifOutDiscards;
+       Counter_t        ifOutErrors;
+       Gauge_t  ifOutQLen;
+       OBJECT_IDENTIFIER_t      ifSpecific;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} IfEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_IfEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IfEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/IpAddrEntry.h b/stglibs/smux.lib/include/stg/IpAddrEntry.h
new file mode 100644 (file)
index 0000000..9e36f32
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _IpAddrEntry_H_
+#define        _IpAddrEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "IpAddress.h"
+#include <INTEGER.h>
+#include <NativeInteger.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IpAddrEntry */
+typedef struct IpAddrEntry {
+       IpAddress_t      ipAdEntAddr;
+       INTEGER_t        ipAdEntIfIndex;
+       IpAddress_t      ipAdEntNetMask;
+       INTEGER_t        ipAdEntBcastAddr;
+       long     ipAdEntReasmMaxSize;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} IpAddrEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_IpAddrEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IpAddrEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/IpAddress.h b/stglibs/smux.lib/include/stg/IpAddress.h
new file mode 100644 (file)
index 0000000..06c1d4a
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _IpAddress_H_
+#define        _IpAddress_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OCTET_STRING.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IpAddress */
+typedef OCTET_STRING_t  IpAddress_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_IpAddress;
+asn_struct_free_f IpAddress_free;
+asn_struct_print_f IpAddress_print;
+asn_constr_check_f IpAddress_constraint;
+ber_type_decoder_f IpAddress_decode_ber;
+der_type_encoder_f IpAddress_encode_der;
+xer_type_decoder_f IpAddress_decode_xer;
+xer_type_encoder_f IpAddress_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IpAddress_H_ */
diff --git a/stglibs/smux.lib/include/stg/IpNetToMediaEntry.h b/stglibs/smux.lib/include/stg/IpNetToMediaEntry.h
new file mode 100644 (file)
index 0000000..1eb8124
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _IpNetToMediaEntry_H_
+#define        _IpNetToMediaEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "PhysAddress.h"
+#include "IpAddress.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IpNetToMediaEntry */
+typedef struct IpNetToMediaEntry {
+       INTEGER_t        ipNetToMediaIfIndex;
+       PhysAddress_t    ipNetToMediaPhysAddress;
+       IpAddress_t      ipNetToMediaNetAddress;
+       INTEGER_t        ipNetToMediaType;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} IpNetToMediaEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_IpNetToMediaEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IpNetToMediaEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/IpRouteEntry.h b/stglibs/smux.lib/include/stg/IpRouteEntry.h
new file mode 100644 (file)
index 0000000..5651a8f
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _IpRouteEntry_H_
+#define        _IpRouteEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "IpAddress.h"
+#include <INTEGER.h>
+#include <OBJECT_IDENTIFIER.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IpRouteEntry */
+typedef struct IpRouteEntry {
+       IpAddress_t      ipRouteDest;
+       INTEGER_t        ipRouteIfIndex;
+       INTEGER_t        ipRouteMetric1;
+       INTEGER_t        ipRouteMetric2;
+       INTEGER_t        ipRouteMetric3;
+       INTEGER_t        ipRouteMetric4;
+       IpAddress_t      ipRouteNextHop;
+       INTEGER_t        ipRouteType;
+       INTEGER_t        ipRouteProto;
+       INTEGER_t        ipRouteAge;
+       IpAddress_t      ipRouteMask;
+       INTEGER_t        ipRouteMetric5;
+       OBJECT_IDENTIFIER_t      ipRouteInfo;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} IpRouteEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_IpRouteEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IpRouteEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/Message.h b/stglibs/smux.lib/include/stg/Message.h
new file mode 100644 (file)
index 0000000..2621d73
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _Message_H_
+#define        _Message_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include <OCTET_STRING.h>
+#include <ANY.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum Message__version {
+       Message__version_version_1      = 0
+} e_Message__version;
+
+/* Message */
+typedef struct Message {
+       INTEGER_t        version;
+       OCTET_STRING_t   community;
+       ANY_t    data;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} Message_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_Message;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Message_H_ */
diff --git a/stglibs/smux.lib/include/stg/NULL.h b/stglibs/smux.lib/include/stg/NULL.h
new file mode 100644 (file)
index 0000000..131e775
--- /dev/null
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        ASN_TYPE_NULL_H
+#define        ASN_TYPE_NULL_H
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The value of the NULL type is meaningless: see BOOLEAN if you want to
+ * carry true/false semantics.
+ */
+typedef int NULL_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_NULL;
+
+asn_struct_print_f NULL_print;
+der_type_encoder_f NULL_encode_der;
+xer_type_decoder_f NULL_decode_xer;
+xer_type_encoder_f NULL_encode_xer;
+per_type_decoder_f NULL_decode_uper;
+per_type_encoder_f NULL_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NULL_H */
diff --git a/stglibs/smux.lib/include/stg/NativeEnumerated.h b/stglibs/smux.lib/include/stg/NativeEnumerated.h
new file mode 100644 (file)
index 0000000..c59bb1b
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
+ * All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * This type differs from the standard ENUMERATED in that it is modelled using
+ * the fixed machine type (long, int, short), so it can hold only values of
+ * limited length. There is no type (i.e., NativeEnumerated_t, any integer type
+ * will do).
+ * This type may be used when integer range is limited by subtype constraints.
+ */
+#ifndef        _NativeEnumerated_H_
+#define        _NativeEnumerated_H_
+
+#include <NativeInteger.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated;
+
+xer_type_encoder_f NativeEnumerated_encode_xer;
+per_type_decoder_f NativeEnumerated_decode_uper;
+per_type_encoder_f NativeEnumerated_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NativeEnumerated_H_ */
diff --git a/stglibs/smux.lib/include/stg/NativeInteger.h b/stglibs/smux.lib/include/stg/NativeInteger.h
new file mode 100644 (file)
index 0000000..4e63a83
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * This type differs from the standard INTEGER in that it is modelled using
+ * the fixed machine type (long, int, short), so it can hold only values of
+ * limited length. There is no type (i.e., NativeInteger_t, any integer type
+ * will do).
+ * This type may be used when integer range is limited by subtype constraints.
+ */
+#ifndef        _NativeInteger_H_
+#define        _NativeInteger_H_
+
+#include <asn_application.h>
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern asn_TYPE_descriptor_t asn_DEF_NativeInteger;
+
+asn_struct_free_f  NativeInteger_free;
+asn_struct_print_f NativeInteger_print;
+ber_type_decoder_f NativeInteger_decode_ber;
+der_type_encoder_f NativeInteger_encode_der;
+xer_type_decoder_f NativeInteger_decode_xer;
+xer_type_encoder_f NativeInteger_encode_xer;
+per_type_decoder_f NativeInteger_decode_uper;
+per_type_encoder_f NativeInteger_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NativeInteger_H_ */
diff --git a/stglibs/smux.lib/include/stg/NetworkAddress.h b/stglibs/smux.lib/include/stg/NetworkAddress.h
new file mode 100644 (file)
index 0000000..8c73220
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _NetworkAddress_H_
+#define        _NetworkAddress_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "IpAddress.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum NetworkAddress_PR {
+       NetworkAddress_PR_NOTHING,      /* No components present */
+       NetworkAddress_PR_internet
+} NetworkAddress_PR;
+
+/* NetworkAddress */
+typedef struct NetworkAddress {
+       NetworkAddress_PR present;
+       union NetworkAddress_u {
+               IpAddress_t      internet;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} NetworkAddress_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_NetworkAddress;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NetworkAddress_H_ */
diff --git a/stglibs/smux.lib/include/stg/OBJECT_IDENTIFIER.h b/stglibs/smux.lib/include/stg/OBJECT_IDENTIFIER.h
new file mode 100644 (file)
index 0000000..2bb5d03
--- /dev/null
@@ -0,0 +1,139 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
+ *     All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _OBJECT_IDENTIFIER_H_
+#define        _OBJECT_IDENTIFIER_H_
+
+#include <asn_application.h>
+#include <asn_codecs_prim.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef ASN__PRIMITIVE_TYPE_t OBJECT_IDENTIFIER_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER;
+
+asn_struct_print_f OBJECT_IDENTIFIER_print;
+asn_constr_check_f OBJECT_IDENTIFIER_constraint;
+der_type_encoder_f OBJECT_IDENTIFIER_encode_der;
+xer_type_decoder_f OBJECT_IDENTIFIER_decode_xer;
+xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer;
+
+/**********************************
+ * Some handy conversion routines *
+ **********************************/
+
+/*
+ * This function fills an (_arcs) array with OBJECT IDENTIFIER arcs
+ * up to specified (_arc_slots) elements.
+ * 
+ * EXAMPLE:
+ *     void print_arcs(OBJECT_IDENTIFIER_t *oid) {
+ *             unsigned long fixed_arcs[10];   // Try with fixed space first
+ *             unsigned long *arcs = fixed_arcs;
+ *             int arc_type_size = sizeof(fixed_arcs[0]);      // sizeof(long)
+ *             int arc_slots = sizeof(fixed_arcs)/sizeof(fixed_arcs[0]); // 10
+ *             int count;      // Real number of arcs.
+ *             int i;
+ * 
+ *             count = OBJECT_IDENTIFIER_get_arcs(oid, arcs,
+ *                     arc_type_size, arc_slots);
+ *             // If necessary, reallocate arcs array and try again.
+ *             if(count > arc_slots) {
+ *                     arc_slots = count;
+ *                     arcs = malloc(arc_type_size * arc_slots);
+ *                     if(!arcs) return;
+ *                     count = OBJECT_IDENTIFIER_get_arcs(oid, arcs,
+ *                             arc_type_size, arc_slots);
+ *                     assert(count == arc_slots);
+ *             }
+ * 
+ *             // Print the contents of the arcs array.
+ *             for(i = 0; i < count; i++)
+ *                     printf("%d\n", arcs[i]);
+ * 
+ *             // Avoid memory leak.
+ *             if(arcs != fixed_arcs) free(arcs);
+ *     }
+ * 
+ * RETURN VALUES:
+ * -1/EINVAL:  Invalid arguments (oid is missing)
+ * -1/ERANGE:  One or more arcs have value out of array cell type range.
+ * >=0:                Number of arcs contained in the OBJECT IDENTIFIER
+ * 
+ * WARNING: The function always returns the real number of arcs,
+ * even if there is no sufficient (_arc_slots) provided.
+ */
+int OBJECT_IDENTIFIER_get_arcs(OBJECT_IDENTIFIER_t *_oid,
+       void *_arcs,                    /* e.g., unsigned int arcs[N] */
+       unsigned int _arc_type_size,    /* e.g., sizeof(arcs[0]) */
+       unsigned int _arc_slots         /* e.g., N */);
+
+/*
+ * This functions initializes the OBJECT IDENTIFIER object with
+ * the given set of arcs.
+ * The minimum of two arcs must be present; some restrictions apply.
+ * RETURN VALUES:
+ * -1/EINVAL:  Invalid arguments
+ * -1/ERANGE:  The first two arcs do not conform to ASN.1 restrictions.
+ * -1/ENOMEM:  Memory allocation failed
+ * 0:          The object was initialized with new arcs.
+ */
+int OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *_oid,
+       const void *_arcs,              /* e.g., unsigned int arcs[N] */
+       unsigned int _arc_type_size,    /* e.g., sizeof(arcs[0]) */
+       unsigned int _arc_slots         /* e.g., N */);
+
+/*
+ * Print the specified OBJECT IDENTIFIER arc.
+ */
+int OBJECT_IDENTIFIER_print_arc(uint8_t *arcbuf, int arclen,
+       int add, /* Arbitrary offset, required to process the first two arcs */
+       asn_app_consume_bytes_f *cb, void *app_key);
+
+/* Same as above, but returns the number of written digits, instead of 0 */
+ssize_t OBJECT_IDENTIFIER__dump_arc(uint8_t *arcbuf, int arclen, int add,
+       asn_app_consume_bytes_f *cb, void *app_key);
+
+/*
+ * Parse the OBJECT IDENTIFIER textual representation ("1.3.6.1.4.1.9363").
+ * No arc can exceed the (0..signed_long_max) range (typically, 0..2G if L32).
+ * This function is not specific to OBJECT IDENTIFIER, it may be used to parse
+ * the RELATIVE-OID data, or any other data consisting of dot-separated
+ * series of numeric values.
+ *
+ * If (oid_txt_length == -1), the strlen() will be invoked to determine the
+ * size of the (oid_text) string.
+ * 
+ * After return, the optional (opt_oid_text_end) is set to the character after
+ * the last parsed one. (opt_oid_text_end) is never less than (oid_text).
+ * 
+ * RETURN VALUES:
+ *   -1:       Parse error.
+ * >= 0:       Number of arcs contained in the OBJECT IDENTIFIER.
+ * 
+ * WARNING: The function always returns the real number of arcs,
+ * even if there is no sufficient (_arc_slots) provided.
+ * This is useful for (_arc_slots) value estimation.
+ */
+int OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length,
+       long arcs[], unsigned int arcs_slots, const char **opt_oid_text_end);
+
+/*
+ * Internal functions.
+ * Used by RELATIVE-OID implementation in particular.
+ */
+int OBJECT_IDENTIFIER_get_single_arc(uint8_t *arcbuf, unsigned int arclen,
+       signed int add, void *value, unsigned int value_size);
+int OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf,
+       const void *arcval, unsigned int arcval_size, int _prepared_order);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OBJECT_IDENTIFIER_H_ */
diff --git a/stglibs/smux.lib/include/stg/OCTET_STRING.h b/stglibs/smux.lib/include/stg/OCTET_STRING.h
new file mode 100644 (file)
index 0000000..5150161
--- /dev/null
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _OCTET_STRING_H_
+#define        _OCTET_STRING_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct OCTET_STRING {
+       uint8_t *buf;   /* Buffer with consecutive OCTET_STRING bits */
+       int size;       /* Size of the buffer */
+
+       asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
+} OCTET_STRING_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
+
+asn_struct_free_f OCTET_STRING_free;
+asn_struct_print_f OCTET_STRING_print;
+asn_struct_print_f OCTET_STRING_print_utf8;
+ber_type_decoder_f OCTET_STRING_decode_ber;
+der_type_encoder_f OCTET_STRING_encode_der;
+xer_type_decoder_f OCTET_STRING_decode_xer_hex;                /* Hexadecimal */
+xer_type_decoder_f OCTET_STRING_decode_xer_binary;     /* 01010111010 */
+xer_type_decoder_f OCTET_STRING_decode_xer_utf8;       /* ASCII/UTF-8 */
+xer_type_encoder_f OCTET_STRING_encode_xer;
+xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
+per_type_decoder_f OCTET_STRING_decode_uper;
+per_type_encoder_f OCTET_STRING_encode_uper;
+
+/******************************
+ * Handy conversion routines. *
+ ******************************/
+
+/*
+ * This function clears the previous value of the OCTET STRING (if any)
+ * and then allocates a new memory with the specified content (str/size).
+ * If size = -1, the size of the original string will be determined
+ * using strlen(str).
+ * If str equals to NULL, the function will silently clear the
+ * current contents of the OCTET STRING.
+ * Returns 0 if it was possible to perform operation, -1 otherwise.
+ */
+int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);
+
+/* Handy conversion from the C string into the OCTET STRING. */
+#define        OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)
+
+/*
+ * Allocate and fill the new OCTET STRING and return a pointer to the newly
+ * allocated object. NULL is permitted in str: the function will just allocate
+ * empty OCTET STRING.
+ */
+OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td,
+       const char *str, int size);
+
+/****************************
+ * Internally useful stuff. *
+ ****************************/
+
+typedef struct asn_OCTET_STRING_specifics_s {
+       /*
+        * Target structure description.
+        */
+       int struct_size;        /* Size of the structure */
+       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
+
+       int subvariant;         /* {0,1,2} for O-S, BIT STRING or ANY */
+} asn_OCTET_STRING_specifics_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OCTET_STRING_H_ */
diff --git a/stglibs/smux.lib/include/stg/ObjectName.h b/stglibs/smux.lib/include/stg/ObjectName.h
new file mode 100644 (file)
index 0000000..256577b
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _ObjectName_H_
+#define        _ObjectName_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OBJECT_IDENTIFIER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ObjectName */
+typedef OBJECT_IDENTIFIER_t     ObjectName_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ObjectName;
+asn_struct_free_f ObjectName_free;
+asn_struct_print_f ObjectName_print;
+asn_constr_check_f ObjectName_constraint;
+ber_type_decoder_f ObjectName_decode_ber;
+der_type_encoder_f ObjectName_encode_der;
+xer_type_decoder_f ObjectName_decode_xer;
+xer_type_encoder_f ObjectName_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ObjectName_H_ */
diff --git a/stglibs/smux.lib/include/stg/ObjectSyntax.h b/stglibs/smux.lib/include/stg/ObjectSyntax.h
new file mode 100644 (file)
index 0000000..9030acc
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _ObjectSyntax_H_
+#define        _ObjectSyntax_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "SimpleSyntax.h"
+#include "ApplicationSyntax.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum ObjectSyntax_PR {
+       ObjectSyntax_PR_NOTHING,        /* No components present */
+       ObjectSyntax_PR_simple,
+       ObjectSyntax_PR_application_wide
+} ObjectSyntax_PR;
+
+/* ObjectSyntax */
+typedef struct ObjectSyntax {
+       ObjectSyntax_PR present;
+       union ObjectSyntax_u {
+               SimpleSyntax_t   simple;
+               ApplicationSyntax_t      application_wide;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} ObjectSyntax_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ObjectSyntax;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ObjectSyntax_H_ */
diff --git a/stglibs/smux.lib/include/stg/Opaque.h b/stglibs/smux.lib/include/stg/Opaque.h
new file mode 100644 (file)
index 0000000..aa8e2d5
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _Opaque_H_
+#define        _Opaque_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OCTET_STRING.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Opaque */
+typedef OCTET_STRING_t  Opaque_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_Opaque;
+asn_struct_free_f Opaque_free;
+asn_struct_print_f Opaque_print;
+asn_constr_check_f Opaque_constraint;
+ber_type_decoder_f Opaque_decode_ber;
+der_type_encoder_f Opaque_encode_der;
+xer_type_decoder_f Opaque_decode_xer;
+xer_type_encoder_f Opaque_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Opaque_H_ */
diff --git a/stglibs/smux.lib/include/stg/OpenPDU.h b/stglibs/smux.lib/include/stg/OpenPDU.h
new file mode 100644 (file)
index 0000000..5d7e1da
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _OpenPDU_H_
+#define        _OpenPDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "SimpleOpen.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum OpenPDU_PR {
+       OpenPDU_PR_NOTHING,     /* No components present */
+       OpenPDU_PR_simple
+} OpenPDU_PR;
+
+/* OpenPDU */
+typedef struct OpenPDU {
+       OpenPDU_PR present;
+       union OpenPDU_u {
+               SimpleOpen_t     simple;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} OpenPDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_OpenPDU;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OpenPDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/PDU.h b/stglibs/smux.lib/include/stg/PDU.h
new file mode 100644 (file)
index 0000000..cbc7e71
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _PDU_H_
+#define        _PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "VarBindList.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum PDU__error_status {
+       PDU__error_status_noError       = 0,
+       PDU__error_status_tooBig        = 1,
+       PDU__error_status_noSuchName    = 2,
+       PDU__error_status_badValue      = 3,
+       PDU__error_status_readOnly      = 4,
+       PDU__error_status_genErr        = 5
+} e_PDU__error_status;
+
+/* PDU */
+typedef struct PDU {
+       INTEGER_t        request_id;
+       INTEGER_t        error_status;
+       INTEGER_t        error_index;
+       VarBindList_t    variable_bindings;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_PDU;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/PDUs.h b/stglibs/smux.lib/include/stg/PDUs.h
new file mode 100644 (file)
index 0000000..90bb089
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _PDUs_H_
+#define        _PDUs_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "GetRequest-PDU.h"
+#include "GetNextRequest-PDU.h"
+#include "GetResponse-PDU.h"
+#include "SetRequest-PDU.h"
+#include "Trap-PDU.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum PDUs_PR {
+       PDUs_PR_NOTHING,        /* No components present */
+       PDUs_PR_get_request,
+       PDUs_PR_get_next_request,
+       PDUs_PR_get_response,
+       PDUs_PR_set_request,
+       PDUs_PR_trap
+} PDUs_PR;
+
+/* PDUs */
+typedef struct PDUs {
+       PDUs_PR present;
+       union PDUs_u {
+               GetRequest_PDU_t         get_request;
+               GetNextRequest_PDU_t     get_next_request;
+               GetResponse_PDU_t        get_response;
+               SetRequest_PDU_t         set_request;
+               Trap_PDU_t       trap;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} PDUs_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_PDUs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PDUs_H_ */
diff --git a/stglibs/smux.lib/include/stg/PhysAddress.h b/stglibs/smux.lib/include/stg/PhysAddress.h
new file mode 100644 (file)
index 0000000..d6c5fa1
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _PhysAddress_H_
+#define        _PhysAddress_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OCTET_STRING.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* PhysAddress */
+typedef OCTET_STRING_t  PhysAddress_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_PhysAddress;
+asn_struct_free_f PhysAddress_free;
+asn_struct_print_f PhysAddress_print;
+asn_constr_check_f PhysAddress_constraint;
+ber_type_decoder_f PhysAddress_decode_ber;
+der_type_encoder_f PhysAddress_encode_der;
+xer_type_decoder_f PhysAddress_decode_xer;
+xer_type_encoder_f PhysAddress_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PhysAddress_H_ */
diff --git a/stglibs/smux.lib/include/stg/RReqPDU.h b/stglibs/smux.lib/include/stg/RReqPDU.h
new file mode 100644 (file)
index 0000000..17f5309
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _RReqPDU_H_
+#define        _RReqPDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "ObjectName.h"
+#include <NativeInteger.h>
+#include <INTEGER.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum RReqPDU__operation {
+       RReqPDU__operation_delete       = 0,
+       RReqPDU__operation_readOnly     = 1,
+       RReqPDU__operation_readWrite    = 2
+} e_RReqPDU__operation;
+
+/* RReqPDU */
+typedef struct RReqPDU {
+       ObjectName_t     subtree;
+       long     priority;
+       INTEGER_t        operation;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} RReqPDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_RReqPDU;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RReqPDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/RRspPDU.h b/stglibs/smux.lib/include/stg/RRspPDU.h
new file mode 100644 (file)
index 0000000..0d9681a
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _RRspPDU_H_
+#define        _RRspPDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum RRspPDU {
+       RRspPDU_failure = -1
+} e_RRspPDU;
+
+/* RRspPDU */
+typedef INTEGER_t       RRspPDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_RRspPDU;
+asn_struct_free_f RRspPDU_free;
+asn_struct_print_f RRspPDU_print;
+asn_constr_check_f RRspPDU_constraint;
+ber_type_decoder_f RRspPDU_decode_ber;
+der_type_encoder_f RRspPDU_encode_der;
+xer_type_decoder_f RRspPDU_decode_xer;
+xer_type_encoder_f RRspPDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RRspPDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/SMUX-PDUs.h b/stglibs/smux.lib/include/stg/SMUX-PDUs.h
new file mode 100644 (file)
index 0000000..8489324
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _SMUX_PDUs_H_
+#define        _SMUX_PDUs_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "OpenPDU.h"
+#include "ClosePDU.h"
+#include "RReqPDU.h"
+#include "RRspPDU.h"
+#include "PDUs.h"
+#include "SOutPDU.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum SMUX_PDUs_PR {
+       SMUX_PDUs_PR_NOTHING,   /* No components present */
+       SMUX_PDUs_PR_open,
+       SMUX_PDUs_PR_close,
+       SMUX_PDUs_PR_registerRequest,
+       SMUX_PDUs_PR_registerResponse,
+       SMUX_PDUs_PR_pdus,
+       SMUX_PDUs_PR_commitOrRollback
+} SMUX_PDUs_PR;
+
+/* SMUX-PDUs */
+typedef struct SMUX_PDUs {
+       SMUX_PDUs_PR present;
+       union SMUX_PDUs_u {
+               OpenPDU_t        open;
+               ClosePDU_t       close;
+               RReqPDU_t        registerRequest;
+               RRspPDU_t        registerResponse;
+               PDUs_t   pdus;
+               SOutPDU_t        commitOrRollback;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} SMUX_PDUs_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_SMUX_PDUs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SMUX_PDUs_H_ */
diff --git a/stglibs/smux.lib/include/stg/SOutPDU.h b/stglibs/smux.lib/include/stg/SOutPDU.h
new file mode 100644 (file)
index 0000000..55e7618
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _SOutPDU_H_
+#define        _SOutPDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum SOutPDU {
+       SOutPDU_commit  = 0,
+       SOutPDU_rollback        = 1
+} e_SOutPDU;
+
+/* SOutPDU */
+typedef INTEGER_t       SOutPDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_SOutPDU;
+asn_struct_free_f SOutPDU_free;
+asn_struct_print_f SOutPDU_print;
+asn_constr_check_f SOutPDU_constraint;
+ber_type_decoder_f SOutPDU_decode_ber;
+der_type_encoder_f SOutPDU_encode_der;
+xer_type_decoder_f SOutPDU_decode_xer;
+xer_type_encoder_f SOutPDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SOutPDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/SetRequest-PDU.h b/stglibs/smux.lib/include/stg/SetRequest-PDU.h
new file mode 100644 (file)
index 0000000..8854574
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _SetRequest_PDU_H_
+#define        _SetRequest_PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "PDU.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* SetRequest-PDU */
+typedef PDU_t   SetRequest_PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_SetRequest_PDU;
+asn_struct_free_f SetRequest_PDU_free;
+asn_struct_print_f SetRequest_PDU_print;
+asn_constr_check_f SetRequest_PDU_constraint;
+ber_type_decoder_f SetRequest_PDU_decode_ber;
+der_type_encoder_f SetRequest_PDU_encode_der;
+xer_type_decoder_f SetRequest_PDU_decode_xer;
+xer_type_encoder_f SetRequest_PDU_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SetRequest_PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/SimpleOpen.h b/stglibs/smux.lib/include/stg/SimpleOpen.h
new file mode 100644 (file)
index 0000000..5950a6c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "SMUX"
+ *     found in "SMUX.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _SimpleOpen_H_
+#define        _SimpleOpen_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include <OBJECT_IDENTIFIER.h>
+#include "DisplayString.h"
+#include <OCTET_STRING.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum SimpleOpen__version {
+       SimpleOpen__version_version_1   = 0
+} e_SimpleOpen__version;
+
+/* SimpleOpen */
+typedef struct SimpleOpen {
+       INTEGER_t        version;
+       OBJECT_IDENTIFIER_t      identity;
+       DisplayString_t  description;
+       OCTET_STRING_t   password;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} SimpleOpen_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_SimpleOpen;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SimpleOpen_H_ */
diff --git a/stglibs/smux.lib/include/stg/SimpleSyntax.h b/stglibs/smux.lib/include/stg/SimpleSyntax.h
new file mode 100644 (file)
index 0000000..c04f3ab
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _SimpleSyntax_H_
+#define        _SimpleSyntax_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include <OCTET_STRING.h>
+#include <OBJECT_IDENTIFIER.h>
+#include <NULL.h>
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum SimpleSyntax_PR {
+       SimpleSyntax_PR_NOTHING,        /* No components present */
+       SimpleSyntax_PR_number,
+       SimpleSyntax_PR_string,
+       SimpleSyntax_PR_object,
+       SimpleSyntax_PR_empty
+} SimpleSyntax_PR;
+
+/* SimpleSyntax */
+typedef struct SimpleSyntax {
+       SimpleSyntax_PR present;
+       union SimpleSyntax_u {
+               INTEGER_t        number;
+               OCTET_STRING_t   string;
+               OBJECT_IDENTIFIER_t      object;
+               NULL_t   empty;
+       } choice;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} SimpleSyntax_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_SimpleSyntax;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SimpleSyntax_H_ */
diff --git a/stglibs/smux.lib/include/stg/TcpConnEntry.h b/stglibs/smux.lib/include/stg/TcpConnEntry.h
new file mode 100644 (file)
index 0000000..3160e31
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _TcpConnEntry_H_
+#define        _TcpConnEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+#include "IpAddress.h"
+#include <NativeInteger.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* TcpConnEntry */
+typedef struct TcpConnEntry {
+       INTEGER_t        tcpConnState;
+       IpAddress_t      tcpConnLocalAddress;
+       long     tcpConnLocalPort;
+       IpAddress_t      tcpConnRemAddress;
+       long     tcpConnRemPort;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} TcpConnEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_TcpConnEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TcpConnEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/TimeTicks.h b/stglibs/smux.lib/include/stg/TimeTicks.h
new file mode 100644 (file)
index 0000000..ea92820
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1155-SMI"
+ *     found in "RFC1155-SMI.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _TimeTicks_H_
+#define        _TimeTicks_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <INTEGER.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* TimeTicks */
+typedef INTEGER_t       TimeTicks_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_TimeTicks;
+asn_struct_free_f TimeTicks_free;
+asn_struct_print_f TimeTicks_print;
+asn_constr_check_f TimeTicks_constraint;
+ber_type_decoder_f TimeTicks_decode_ber;
+der_type_encoder_f TimeTicks_encode_der;
+xer_type_decoder_f TimeTicks_decode_xer;
+xer_type_encoder_f TimeTicks_encode_xer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TimeTicks_H_ */
diff --git a/stglibs/smux.lib/include/stg/Trap-PDU.h b/stglibs/smux.lib/include/stg/Trap-PDU.h
new file mode 100644 (file)
index 0000000..d8a89e1
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _Trap_PDU_H_
+#define        _Trap_PDU_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OBJECT_IDENTIFIER.h>
+#include "NetworkAddress.h"
+#include <INTEGER.h>
+#include "TimeTicks.h"
+#include "VarBindList.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum Trap_PDU__generic_trap {
+       Trap_PDU__generic_trap_coldStart        = 0,
+       Trap_PDU__generic_trap_warmStart        = 1,
+       Trap_PDU__generic_trap_linkDown = 2,
+       Trap_PDU__generic_trap_linkUp   = 3,
+       Trap_PDU__generic_trap_authenticationFailure    = 4,
+       Trap_PDU__generic_trap_egpNeighborLoss  = 5,
+       Trap_PDU__generic_trap_enterpriseSpecific       = 6
+} e_Trap_PDU__generic_trap;
+
+/* Trap-PDU */
+typedef struct Trap_PDU {
+       OBJECT_IDENTIFIER_t      enterprise;
+       NetworkAddress_t         agent_addr;
+       INTEGER_t        generic_trap;
+       INTEGER_t        specific_trap;
+       TimeTicks_t      time_stamp;
+       VarBindList_t    variable_bindings;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} Trap_PDU_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_Trap_PDU;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Trap_PDU_H_ */
diff --git a/stglibs/smux.lib/include/stg/UdpEntry.h b/stglibs/smux.lib/include/stg/UdpEntry.h
new file mode 100644 (file)
index 0000000..e4a1026
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1213-MIB"
+ *     found in "RFC1213-MIB.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _UdpEntry_H_
+#define        _UdpEntry_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "IpAddress.h"
+#include <NativeInteger.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* UdpEntry */
+typedef struct UdpEntry {
+       IpAddress_t      udpLocalAddress;
+       long     udpLocalPort;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} UdpEntry_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_UdpEntry;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UdpEntry_H_ */
diff --git a/stglibs/smux.lib/include/stg/VarBind.h b/stglibs/smux.lib/include/stg/VarBind.h
new file mode 100644 (file)
index 0000000..63ecad5
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _VarBind_H_
+#define        _VarBind_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "ObjectName.h"
+#include "ObjectSyntax.h"
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* VarBind */
+typedef struct VarBind {
+       ObjectName_t     name;
+       ObjectSyntax_t   value;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} VarBind_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_VarBind;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VarBind_H_ */
diff --git a/stglibs/smux.lib/include/stg/VarBindList.h b/stglibs/smux.lib/include/stg/VarBindList.h
new file mode 100644 (file)
index 0000000..36ef161
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Generated by asn1c-0.9.21 (http://lionet.info/asn1c)
+ * From ASN.1 module "RFC1157-SNMP"
+ *     found in "RFC1157-SNMP.asn1"
+ *     `asn1c -fskeletons-copy`
+ */
+
+#ifndef        _VarBindList_H_
+#define        _VarBindList_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <asn_SEQUENCE_OF.h>
+#include <constr_SEQUENCE_OF.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Forward declarations */
+struct VarBind;
+
+/* VarBindList */
+typedef struct VarBindList {
+       A_SEQUENCE_OF(struct VarBind) list;
+       
+       /* Context for parsing across buffer boundaries */
+       asn_struct_ctx_t _asn_ctx;
+} VarBindList_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_VarBindList;
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Referred external types */
+#include "VarBind.h"
+
+#endif /* _VarBindList_H_ */
diff --git a/stglibs/smux.lib/include/stg/asn_SEQUENCE_OF.h b/stglibs/smux.lib/include/stg/asn_SEQUENCE_OF.h
new file mode 100644 (file)
index 0000000..e678f03
--- /dev/null
@@ -0,0 +1,52 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        ASN_SEQUENCE_OF_H
+#define        ASN_SEQUENCE_OF_H
+
+#include <asn_SET_OF.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * SEQUENCE OF is the same as SET OF with a tiny difference:
+ * the delete operation preserves the initial order of elements
+ * and thus MAY operate in non-constant time.
+ */
+#define        A_SEQUENCE_OF(type)     A_SET_OF(type)
+
+#define        ASN_SEQUENCE_ADD(headptr, ptr)          \
+       asn_sequence_add((headptr), (ptr))
+
+/***********************************************
+ * Implementation of the SEQUENCE OF structure.
+ */
+
+#define        asn_sequence_add        asn_set_add
+#define        asn_sequence_empty      asn_set_empty
+
+/*
+ * Delete the element from the set by its number (base 0).
+ * This is NOT a constant-time operation.
+ * The order of elements is preserved.
+ * If _do_free is given AND the (*free) is initialized, the element
+ * will be freed using the custom (*free) function as well.
+ */
+void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free);
+
+/*
+ * Cope with different conversions requirements to/from void in C and C++.
+ * This is mostly useful for support library.
+ */
+typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_;
+#define _A_SEQUENCE_FROM_VOID(ptr)     ((asn_anonymous_sequence_ *)(ptr))
+#define _A_CSEQUENCE_FROM_VOID(ptr)    ((const asn_anonymous_sequence_ *)(ptr))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ASN_SEQUENCE_OF_H */
diff --git a/stglibs/smux.lib/include/stg/asn_SET_OF.h b/stglibs/smux.lib/include/stg/asn_SET_OF.h
new file mode 100644 (file)
index 0000000..7edf14b
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        ASN_SET_OF_H
+#define        ASN_SET_OF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define        A_SET_OF(type)                                  \
+       struct {                                        \
+               type **array;                           \
+               int count;      /* Meaningful size */   \
+               int size;       /* Allocated size */    \
+               void (*free)(type *);                   \
+       }
+
+#define        ASN_SET_ADD(headptr, ptr)               \
+       asn_set_add((headptr), (ptr))
+
+/*******************************************
+ * Implementation of the SET OF structure.
+ */
+
+/*
+ * Add another structure into the set by its pointer.
+ * RETURN VALUES:
+ * 0 for success and -1/errno for failure.
+ */
+int  asn_set_add(void *asn_set_of_x, void *ptr);
+
+/*
+ * Delete the element from the set by its number (base 0).
+ * This is a constant-time operation. The order of elements before the
+ * deleted ones is guaranteed, the order of elements after the deleted
+ * one is NOT guaranteed.
+ * If _do_free is given AND the (*free) is initialized, the element
+ * will be freed using the custom (*free) function as well.
+ */
+void asn_set_del(void *asn_set_of_x, int number, int _do_free);
+
+/*
+ * Empty the contents of the set. Will free the elements, if (*free) is given.
+ * Will NOT free the set itself.
+ */
+void asn_set_empty(void *asn_set_of_x);
+
+/*
+ * Cope with different conversions requirements to/from void in C and C++.
+ * This is mostly useful for support library.
+ */
+typedef A_SET_OF(void) asn_anonymous_set_;
+#define _A_SET_FROM_VOID(ptr)          ((asn_anonymous_set_ *)(ptr))
+#define _A_CSET_FROM_VOID(ptr)         ((const asn_anonymous_set_ *)(ptr))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ASN_SET_OF_H */
diff --git a/stglibs/smux.lib/include/stg/asn_application.h b/stglibs/smux.lib/include/stg/asn_application.h
new file mode 100644 (file)
index 0000000..f40cd86
--- /dev/null
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * Application-level ASN.1 callbacks.
+ */
+#ifndef        _ASN_APPLICATION_H_
+#define        _ASN_APPLICATION_H_
+
+#include "asn_system.h"                /* for platform-dependent types */
+#include "asn_codecs.h"                /* for ASN.1 codecs specifics */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Generic type of an application-defined callback to return various
+ * types of data to the application.
+ * EXPECTED RETURN VALUES:
+ *  -1: Failed to consume bytes. Abort the mission.
+ * Non-negative return values indicate success, and ignored.
+ */
+typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size,
+       void *application_specific_key);
+
+/*
+ * A callback of this type is called whenever constraint validation fails
+ * on some ASN.1 type. See "constraints.h" for more details on constraint
+ * validation.
+ * This callback specifies a descriptor of the ASN.1 type which failed
+ * the constraint check, as well as human readable message on what
+ * particular constraint has failed.
+ */
+typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
+       struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
+       const void *structure_which_failed_ptr,
+       const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include "constr_TYPE.h"       /* for asn_TYPE_descriptor_t */
+
+#endif /* _ASN_APPLICATION_H_ */
diff --git a/stglibs/smux.lib/include/stg/asn_codecs.h b/stglibs/smux.lib/include/stg/asn_codecs.h
new file mode 100644 (file)
index 0000000..4a251d9
--- /dev/null
@@ -0,0 +1,109 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
+ * All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _ASN_CODECS_H_
+#define        _ASN_CODECS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/*
+ * This structure defines a set of parameters that may be passed
+ * to every ASN.1 encoder or decoder function.
+ * WARNING: if max_stack_size member is set, and you are calling the
+ *   function pointers of the asn_TYPE_descriptor_t directly,
+ *   this structure must be ALLOCATED ON THE STACK!
+ *   If you can't always satisfy this requirement, use ber_decode(),
+ *   xer_decode() and uper_decode() functions instead.
+ */
+typedef struct asn_codec_ctx_s {
+       /*
+        * Limit the decoder routines to use no (much) more stack than a given
+        * number of bytes. Most of decoders are stack-based, and this
+        * would protect against stack overflows if the number of nested
+        * encodings is high.
+        * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based,
+        * and are safe from this kind of overflow.
+        * A value from getrlimit(RLIMIT_STACK) may be used to initialize
+        * this variable. Be careful in multithreaded environments, as the
+        * stack size is rather limited.
+        */
+       size_t  max_stack_size; /* 0 disables stack bounds checking */
+} asn_codec_ctx_t;
+
+/*
+ * Type of the return value of the encoding functions (der_encode, xer_encode).
+ */
+typedef struct asn_enc_rval_s {
+       /*
+        * Number of bytes encoded.
+        * -1 indicates failure to encode the structure.
+        * In this case, the members below this one are meaningful.
+        */
+       ssize_t encoded;
+
+       /*
+        * Members meaningful when (encoded == -1), for post mortem analysis.
+        */
+
+       /* Type which cannot be encoded */
+       struct asn_TYPE_descriptor_s *failed_type;
+
+       /* Pointer to the structure of that type */
+       void *structure_ptr;
+} asn_enc_rval_t;
+#define        _ASN_ENCODE_FAILED do {                                 \
+       asn_enc_rval_t tmp_error;                               \
+       tmp_error.encoded = -1;                                 \
+       tmp_error.failed_type = td;                             \
+       tmp_error.structure_ptr = sptr;                         \
+       ASN_DEBUG("Failed to encode element %s", td->name);     \
+       return tmp_error;                                       \
+} while(0)
+#define        _ASN_ENCODED_OK(rval) do {                              \
+       rval.structure_ptr = 0;                                 \
+       rval.failed_type = 0;                                   \
+       return rval;                                            \
+} while(0)
+
+/*
+ * Type of the return value of the decoding functions (ber_decode, xer_decode)
+ * 
+ * Please note that the number of consumed bytes is ALWAYS meaningful,
+ * even if code==RC_FAIL. This is to indicate the number of successfully
+ * decoded bytes, hence providing a possibility to fail with more diagnostics
+ * (i.e., print the offending remainder of the buffer).
+ */
+enum asn_dec_rval_code_e {
+       RC_OK,          /* Decoded successfully */
+       RC_WMORE,       /* More data expected, call again */
+       RC_FAIL         /* Failure to decode data */
+};
+typedef struct asn_dec_rval_s {
+       enum asn_dec_rval_code_e code;  /* Result code */
+       size_t consumed;                /* Number of bytes consumed */
+} asn_dec_rval_t;
+#define        _ASN_DECODE_FAILED do {                                 \
+       asn_dec_rval_t tmp_error;                               \
+       tmp_error.code = RC_FAIL;                               \
+       tmp_error.consumed = 0;                                 \
+       ASN_DEBUG("Failed to decode element %s", td->name);     \
+       return tmp_error;                                       \
+} while(0)
+#define        _ASN_DECODE_STARVED do {                                \
+       asn_dec_rval_t tmp_error;                               \
+       tmp_error.code = RC_WMORE;                              \
+       tmp_error.consumed = 0;                                 \
+       return tmp_error;                                       \
+} while(0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ASN_CODECS_H_ */
diff --git a/stglibs/smux.lib/include/stg/asn_codecs_prim.h b/stglibs/smux.lib/include/stg/asn_codecs_prim.h
new file mode 100644 (file)
index 0000000..0f683fd
--- /dev/null
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        ASN_CODECS_PRIM_H
+#define        ASN_CODECS_PRIM_H
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ASN__PRIMITIVE_TYPE_s {
+       uint8_t *buf;   /* Buffer with consecutive primitive encoding bytes */
+       int size;       /* Size of the buffer */
+} ASN__PRIMITIVE_TYPE_t;       /* Do not use this type directly! */
+
+asn_struct_free_f ASN__PRIMITIVE_TYPE_free;
+ber_type_decoder_f ber_decode_primitive;
+der_type_encoder_f der_encode_primitive;
+
+/*
+ * A callback specification for the xer_decode_primitive() function below.
+ */
+enum xer_pbd_rval {
+       XPBD_SYSTEM_FAILURE,    /* System failure (memory shortage, etc) */
+       XPBD_DECODER_LIMIT,     /* Hit some decoder limitation or deficiency */
+       XPBD_BROKEN_ENCODING,   /* Encoding of a primitive body is broken */
+       XPBD_NOT_BODY_IGNORE,   /* Not a body format, but safe to ignore */
+       XPBD_BODY_CONSUMED      /* Body is recognized and consumed */
+};
+typedef enum xer_pbd_rval (xer_primitive_body_decoder_f)
+       (asn_TYPE_descriptor_t *td, void *struct_ptr,
+               const void *chunk_buf, size_t chunk_size);
+
+/*
+ * Specific function to decode simple primitive types.
+ * Also see xer_decode_general() in xer_decoder.h
+ */
+asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
+       asn_TYPE_descriptor_t *type_descriptor,
+       void **struct_ptr, size_t struct_size,
+       const char *opt_mname,
+       const void *buf_ptr, size_t size,
+       xer_primitive_body_decoder_f *prim_body_decoder
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ASN_CODECS_PRIM_H */
diff --git a/stglibs/smux.lib/include/stg/asn_internal.h b/stglibs/smux.lib/include/stg/asn_internal.h
new file mode 100644 (file)
index 0000000..67f055a
--- /dev/null
@@ -0,0 +1,111 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
+ * All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * Declarations internally useful for the ASN.1 support code.
+ */
+#ifndef        _ASN_INTERNAL_H_
+#define        _ASN_INTERNAL_H_
+
+#include "asn_application.h"   /* Application-visible API */
+
+#ifndef        __NO_ASSERT_H__         /* Include assert.h only for internal use. */
+#include <assert.h>            /* for assert() macro */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Environment version might be used to avoid running with the old library */
+#define        ASN1C_ENVIRONMENT_VERSION       920     /* Compile-time version */
+int get_asn1c_environment_version(void);       /* Run-time version */
+
+#define        CALLOC(nmemb, size)     calloc(nmemb, size)
+#define        MALLOC(size)            malloc(size)
+#define        REALLOC(oldptr, size)   realloc(oldptr, size)
+#define        FREEMEM(ptr)            free(ptr)
+
+/*
+ * A macro for debugging the ASN.1 internals.
+ * You may enable or override it.
+ */
+#ifndef        ASN_DEBUG       /* If debugging code is not defined elsewhere... */
+#if    EMIT_ASN_DEBUG == 1     /* And it was asked to emit this code... */
+#ifdef __GNUC__
+#define        ASN_DEBUG(fmt, args...) do {            \
+               fprintf(stderr, fmt, ##args);   \
+               fprintf(stderr, " (%s:%d)\n",   \
+                       __FILE__, __LINE__);    \
+       } while(0)
+#else  /* !__GNUC__ */
+void ASN_DEBUG_f(const char *fmt, ...);
+#define        ASN_DEBUG       ASN_DEBUG_f
+#endif /* __GNUC__ */
+#else  /* EMIT_ASN_DEBUG != 1 */
+static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
+#endif /* EMIT_ASN_DEBUG */
+#endif /* ASN_DEBUG */
+
+/*
+ * Invoke the application-supplied callback and fail, if something is wrong.
+ */
+#define        __ASN_E_cbc(buf, size)  (cb((buf), (size), app_key) < 0)
+#define        _ASN_E_CALLBACK(foo)    do {                                    \
+               if(foo) goto cb_failed;                                 \
+       } while(0)
+#define        _ASN_CALLBACK(buf, size)                                        \
+       _ASN_E_CALLBACK(__ASN_E_cbc(buf, size))
+#define        _ASN_CALLBACK2(buf1, size1, buf2, size2)                        \
+       _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2))
+#define        _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3)           \
+       _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1)                        \
+               || __ASN_E_cbc(buf2, size2)                             \
+               || __ASN_E_cbc(buf3, size3))
+
+#define        _i_ASN_TEXT_INDENT(nl, level) do {                              \
+       int __level = (level);                                          \
+       int __nl = ((nl) != 0);                                         \
+       int __i;                                                        \
+       if(__nl) _ASN_CALLBACK("\n", 1);                                \
+       for(__i = 0; __i < __level; __i++)                              \
+               _ASN_CALLBACK("    ", 4);                               \
+       er.encoded += __nl + 4 * __level;                               \
+} while(0)
+
+#define        _i_INDENT(nl)   do {                                            \
+       int __i;                                                        \
+       if((nl) && cb("\n", 1, app_key) < 0) return -1;                 \
+       for(__i = 0; __i < ilevel; __i++)                               \
+               if(cb("    ", 4, app_key) < 0) return -1;               \
+} while(0)
+
+/*
+ * Check stack against overflow, if limit is set.
+ */
+#define        _ASN_DEFAULT_STACK_MAX  (30000)
+static inline int
+_ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) {
+       if(ctx && ctx->max_stack_size) {
+
+               /* ctx MUST be allocated on the stack */
+               ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx);
+               if(usedstack > 0) usedstack = -usedstack; /* grows up! */
+
+               /* double negative required to avoid int wrap-around */
+               if(usedstack < -(ptrdiff_t)ctx->max_stack_size) {
+                       ASN_DEBUG("Stack limit %ld reached",
+                               (long)ctx->max_stack_size);
+                       return -1;
+               }
+       }
+       return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ASN_INTERNAL_H_ */
diff --git a/stglibs/smux.lib/include/stg/asn_system.h b/stglibs/smux.lib/include/stg/asn_system.h
new file mode 100644 (file)
index 0000000..d7ebdaa
--- /dev/null
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * Miscellaneous system-dependent types.
+ */
+#ifndef        _ASN_SYSTEM_H_
+#define        _ASN_SYSTEM_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>     /* For snprintf(3) */
+#include <stdlib.h>    /* For *alloc(3) */
+#include <string.h>    /* For memcpy(3) */
+#include <sys/types.h> /* For size_t */
+#include <stdarg.h>    /* For va_start */
+#include <stddef.h>    /* for offsetof and ptrdiff_t */
+
+#ifdef WIN32
+
+#include <malloc.h>
+#include <stdint.h>
+#define         snprintf       _snprintf
+#define         vsnprintf      _vsnprintf
+
+#ifdef _MSC_VER                        /* MSVS.Net */
+#ifndef __cplusplus
+#define inline __inline
+#endif
+#define        ssize_t         SSIZE_T
+typedef        char            int8_t;
+typedef        short           int16_t;
+typedef        int             int32_t;
+typedef        unsigned char   uint8_t;
+typedef        unsigned short  uint16_t;
+typedef        unsigned int    uint32_t;
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <float.h>
+#define isnan _isnan
+#define finite _finite
+#define copysign _copysign
+#define        ilogb   _logb
+#endif /* _MSC_VER */
+
+#else  /* !WIN32 */
+
+#if defined(__vxworks)
+#include <types/vxTypes.h>
+#else  /* !defined(__vxworks) */
+
+#include <inttypes.h>  /* C99 specifies this file */
+/*
+ * 1. Earlier FreeBSD version didn't have <stdint.h>,
+ * but <inttypes.h> was present.
+ * 2. Sun Solaris requires <alloca.h> for alloca(3),
+ * but does not have <stdint.h>.
+ */
+#if    (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_))
+#if    defined(sun)
+#include <alloca.h>    /* For alloca(3) */
+#include <ieeefp.h>    /* for finite(3) */
+#elif  defined(__hpux)
+#ifdef __GNUC__
+#include <alloca.h>    /* For alloca(3) */
+#else  /* !__GNUC__ */
+#define inline
+#endif /* __GNUC__ */
+#else
+#include <stdint.h>    /* SUSv2+ and C99 specify this file, for uintXX_t */
+#endif /* defined(sun) */
+#endif
+
+#endif /* defined(__vxworks) */
+
+#endif /* WIN32 */
+
+#if    __GNUC__ >= 3
+#ifndef        GCC_PRINTFLIKE
+#define        GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+#endif
+#else
+#ifndef        GCC_PRINTFLIKE
+#define        GCC_PRINTFLIKE(fmt,var) /* nothing */
+#endif
+#endif
+
+#ifndef        offsetof        /* If not defined by <stddef.h> */
+#define        offsetof(s, m)  ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0))
+#endif /* offsetof */
+
+#ifndef        MIN             /* Suitable for comparing primitive types (integers) */
+#if defined(__GNUC__)
+#define        MIN(a,b)        ({ __typeof a _a = a; __typeof b _b = b;        \
+       ((_a)<(_b)?(_a):(_b)); })
+#else  /* !__GNUC__ */
+#define        MIN(a,b)        ((a)<(b)?(a):(b))       /* Unsafe variant */
+#endif /* __GNUC__ */
+#endif /* MIN */
+
+#endif /* _ASN_SYSTEM_H_ */
diff --git a/stglibs/smux.lib/include/stg/ber_decoder.h b/stglibs/smux.lib/include/stg/ber_decoder.h
new file mode 100644 (file)
index 0000000..768133b
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _BER_DECODER_H_
+#define        _BER_DECODER_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+struct asn_codec_ctx_s;                /* Forward declaration */
+
+/*
+ * The BER decoder of any type.
+ * This function may be invoked directly from the application.
+ */
+asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
+       struct asn_TYPE_descriptor_s *type_descriptor,
+       void **struct_ptr,      /* Pointer to a target structure's pointer */
+       const void *buffer,     /* Data to be decoded */
+       size_t size             /* Size of that buffer */
+       );
+
+/*
+ * Type of generic function which decodes the byte stream into the structure.
+ */
+typedef asn_dec_rval_t (ber_type_decoder_f)(
+               struct asn_codec_ctx_s *opt_codec_ctx,
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void **struct_ptr, const void *buf_ptr, size_t size,
+               int tag_mode);
+
+/*******************************
+ * INTERNALLY USEFUL FUNCTIONS *
+ *******************************/
+
+/*
+ * Check that all tags correspond to the type definition (as given in head).
+ * On return, last_length would contain either a non-negative length of the
+ * value part of the last TLV, or the negative number of expected
+ * "end of content" sequences. The number may only be negative if the
+ * head->last_tag_form is non-zero.
+ */
+asn_dec_rval_t ber_check_tags(
+               struct asn_codec_ctx_s *opt_codec_ctx,  /* codec options */
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               asn_struct_ctx_t *opt_ctx,      /* saved decoding context */
+               const void *ptr, size_t size,
+               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+               int last_tag_form,      /* {-1,0:1}: any, primitive, constr */
+               ber_tlv_len_t *last_length,
+               int *opt_tlv_form       /* optional tag form */
+       );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BER_DECODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/ber_tlv_length.h b/stglibs/smux.lib/include/stg/ber_tlv_length.h
new file mode 100644 (file)
index 0000000..3496802
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _BER_TLV_LENGTH_H_
+#define        _BER_TLV_LENGTH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef ssize_t ber_tlv_len_t;
+
+/*
+ * This function tries to fetch the length of the BER TLV value and place it
+ * in *len_r.
+ * RETURN VALUES:
+ *      0:     More data expected than bufptr contains.
+ *     -1:     Fatal error deciphering length.
+ *     >0:     Number of bytes used from bufptr.
+ * On return with >0, len_r is constrained as -1..MAX, where -1 mean
+ * that the value is of indefinite length.
+ */
+ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size,
+       ber_tlv_len_t *len_r);
+
+/*
+ * This function expects bufptr to be positioned over L in TLV.
+ * It returns number of bytes occupied by L and V together, suitable
+ * for skipping. The function properly handles indefinite length.
+ * RETURN VALUES:
+ *     Standard {-1,0,>0} convention.
+ */
+ssize_t ber_skip_length(
+       struct asn_codec_ctx_s *opt_codec_ctx,  /* optional context */
+       int _is_constructed, const void *bufptr, size_t size);
+
+/*
+ * This function serializes the length (L from TLV) in DER format.
+ * It always returns number of bytes necessary to represent the length,
+ * it is a caller's responsibility to check the return value
+ * against the supplied buffer's size.
+ */
+size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BER_TLV_LENGTH_H_ */
diff --git a/stglibs/smux.lib/include/stg/ber_tlv_tag.h b/stglibs/smux.lib/include/stg/ber_tlv_tag.h
new file mode 100644 (file)
index 0000000..60e8668
--- /dev/null
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _BER_TLV_TAG_H_
+#define        _BER_TLV_TAG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum asn_tag_class {
+       ASN_TAG_CLASS_UNIVERSAL         = 0,    /* 0b00 */
+       ASN_TAG_CLASS_APPLICATION       = 1,    /* 0b01 */
+       ASN_TAG_CLASS_CONTEXT           = 2,    /* 0b10 */
+       ASN_TAG_CLASS_PRIVATE           = 3     /* 0b11 */
+};
+typedef unsigned ber_tlv_tag_t;        /* BER TAG from Tag-Length-Value */
+
+/*
+ * Tag class is encoded together with tag value for optimization purposes.
+ */
+#define        BER_TAG_CLASS(tag)      ((tag) & 0x3)
+#define        BER_TAG_VALUE(tag)      ((tag) >> 2)
+#define        BER_TLV_CONSTRUCTED(tagptr)     (((*(const uint8_t *)tagptr)&0x20)?1:0)
+
+#define        BER_TAGS_EQUAL(tag1, tag2)      ((tag1) == (tag2))
+
+/*
+ * Several functions for printing the TAG in the canonical form
+ * (i.e. "[PRIVATE 0]").
+ * Return values correspond to their libc counterparts (if any).
+ */
+ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen);
+ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *);
+char *ber_tlv_tag_string(ber_tlv_tag_t tag);
+
+
+/*
+ * This function tries to fetch the tag from the input stream.
+ * RETURN VALUES:
+ *      0:     More data expected than bufptr contains.
+ *     -1:     Fatal error deciphering tag.
+ *     >0:     Number of bytes used from bufptr. tag_r will contain the tag.
+ */
+ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r);
+
+/*
+ * This function serializes the tag (T from TLV) in BER format.
+ * It always returns number of bytes necessary to represent the tag,
+ * it is a caller's responsibility to check the return value
+ * against the supplied buffer's size.
+ */
+size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BER_TLV_TAG_H_ */
diff --git a/stglibs/smux.lib/include/stg/constr_CHOICE.h b/stglibs/smux.lib/include/stg/constr_CHOICE.h
new file mode 100644 (file)
index 0000000..83404e6
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
+ * All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _CONSTR_CHOICE_H_
+#define        _CONSTR_CHOICE_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct asn_CHOICE_specifics_s {
+       /*
+        * Target structure description.
+        */
+       int struct_size;        /* Size of the target structure. */
+       int ctx_offset;         /* Offset of the asn_codec_ctx_t member */
+       int pres_offset;        /* Identifier of the present member */
+       int pres_size;          /* Size of the identifier (enum) */
+
+       /*
+        * Tags to members mapping table.
+        */
+       asn_TYPE_tag2member_t *tag2el;
+       int tag2el_count;
+
+       /* Canonical ordering of CHOICE elements, for PER */
+       int *canonical_order;
+
+       /*
+        * Extensions-related stuff.
+        */
+       int ext_start;          /* First member of extensions, or -1 */
+} asn_CHOICE_specifics_t;
+
+/*
+ * A set specialized functions dealing with the CHOICE type.
+ */
+asn_struct_free_f CHOICE_free;
+asn_struct_print_f CHOICE_print;
+asn_constr_check_f CHOICE_constraint;
+ber_type_decoder_f CHOICE_decode_ber;
+der_type_encoder_f CHOICE_encode_der;
+xer_type_decoder_f CHOICE_decode_xer;
+xer_type_encoder_f CHOICE_encode_xer;
+per_type_decoder_f CHOICE_decode_uper;
+per_type_encoder_f CHOICE_encode_uper;
+asn_outmost_tag_f CHOICE_outmost_tag;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CONSTR_CHOICE_H_ */
diff --git a/stglibs/smux.lib/include/stg/constr_SEQUENCE.h b/stglibs/smux.lib/include/stg/constr_SEQUENCE.h
new file mode 100644 (file)
index 0000000..5f589d5
--- /dev/null
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _CONSTR_SEQUENCE_H_
+#define        _CONSTR_SEQUENCE_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct asn_SEQUENCE_specifics_s {
+       /*
+        * Target structure description.
+        */
+       int struct_size;        /* Size of the target structure. */
+       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
+
+       /*
+        * Tags to members mapping table (sorted).
+        */
+       asn_TYPE_tag2member_t *tag2el;
+       int tag2el_count;
+
+       /*
+        * Optional members of the extensions root (roms) or additions (aoms).
+        * Meaningful for PER.
+        */
+       int *oms;               /* Optional MemberS */
+       int  roms_count;        /* Root optional members count */
+       int  aoms_count;        /* Additions optional members count */
+
+       /*
+        * Description of an extensions group.
+        */
+       int ext_after;          /* Extensions start after this member */
+       int ext_before;         /* Extensions stop before this member */
+} asn_SEQUENCE_specifics_t;
+
+
+/*
+ * A set specialized functions dealing with the SEQUENCE type.
+ */
+asn_struct_free_f SEQUENCE_free;
+asn_struct_print_f SEQUENCE_print;
+asn_constr_check_f SEQUENCE_constraint;
+ber_type_decoder_f SEQUENCE_decode_ber;
+der_type_encoder_f SEQUENCE_encode_der;
+xer_type_decoder_f SEQUENCE_decode_xer;
+xer_type_encoder_f SEQUENCE_encode_xer;
+per_type_decoder_f SEQUENCE_decode_uper;
+per_type_encoder_f SEQUENCE_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CONSTR_SEQUENCE_H_ */
diff --git a/stglibs/smux.lib/include/stg/constr_SEQUENCE_OF.h b/stglibs/smux.lib/include/stg/constr_SEQUENCE_OF.h
new file mode 100644 (file)
index 0000000..e2272f3
--- /dev/null
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _CONSTR_SEQUENCE_OF_H_
+#define        _CONSTR_SEQUENCE_OF_H_
+
+#include <asn_application.h>
+#include <constr_SET_OF.h>             /* Implemented using SET OF */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A set specialized functions dealing with the SEQUENCE OF type.
+ * Generally implemented using SET OF.
+ */
+#define        SEQUENCE_OF_free        SET_OF_free
+#define        SEQUENCE_OF_print       SET_OF_print
+#define        SEQUENCE_OF_constraint  SET_OF_constraint
+#define        SEQUENCE_OF_decode_ber  SET_OF_decode_ber
+#define        SEQUENCE_OF_decode_xer  SET_OF_decode_xer
+#define        SEQUENCE_OF_decode_uper SET_OF_decode_uper
+der_type_encoder_f SEQUENCE_OF_encode_der;
+xer_type_encoder_f SEQUENCE_OF_encode_xer;
+per_type_encoder_f SEQUENCE_OF_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CONSTR_SET_OF_H_ */
diff --git a/stglibs/smux.lib/include/stg/constr_SET_OF.h b/stglibs/smux.lib/include/stg/constr_SET_OF.h
new file mode 100644 (file)
index 0000000..bcd0966
--- /dev/null
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _CONSTR_SET_OF_H_
+#define        _CONSTR_SET_OF_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct asn_SET_OF_specifics_s {
+       /*
+        * Target structure description.
+        */
+       int struct_size;        /* Size of the target structure. */
+       int ctx_offset;         /* Offset of the asn_struct_ctx_t member */
+
+       /* XER-specific stuff */
+       int as_XMLValueList;    /* The member type must be encoded like this */
+} asn_SET_OF_specifics_t;
+
+/*
+ * A set specialized functions dealing with the SET OF type.
+ */
+asn_struct_free_f SET_OF_free;
+asn_struct_print_f SET_OF_print;
+asn_constr_check_f SET_OF_constraint;
+ber_type_decoder_f SET_OF_decode_ber;
+der_type_encoder_f SET_OF_encode_der;
+xer_type_decoder_f SET_OF_decode_xer;
+xer_type_encoder_f SET_OF_encode_xer;
+per_type_decoder_f SET_OF_decode_uper;
+per_type_encoder_f SET_OF_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CONSTR_SET_OF_H_ */
diff --git a/stglibs/smux.lib/include/stg/constr_TYPE.h b/stglibs/smux.lib/include/stg/constr_TYPE.h
new file mode 100644 (file)
index 0000000..95507c8
--- /dev/null
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
+ * All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * This file contains the declaration structure called "ASN.1 Type Definition",
+ * which holds all information necessary for encoding and decoding routines.
+ * This structure even contains pointer to these encoding and decoding routines
+ * for each defined ASN.1 type.
+ */
+#ifndef        _CONSTR_TYPE_H_
+#define        _CONSTR_TYPE_H_
+
+#include <ber_tlv_length.h>
+#include <ber_tlv_tag.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+struct asn_TYPE_member_s;      /* Forward declaration */
+
+/*
+ * This type provides the context information for various ASN.1 routines,
+ * primarily ones doing decoding. A member _asn_ctx of this type must be
+ * included into certain target language's structures, such as compound types.
+ */
+typedef struct asn_struct_ctx_s {
+       short phase;            /* Decoding phase */
+       short step;             /* Elementary step of a phase */
+       int context;            /* Other context information */
+       void *ptr;              /* Decoder-specific stuff (stack elements) */
+       ber_tlv_len_t left;     /* Number of bytes left, -1 for indefinite */
+} asn_struct_ctx_t;
+
+#include <ber_decoder.h>       /* Basic Encoding Rules decoder */
+#include <der_encoder.h>       /* Distinguished Encoding Rules encoder */
+#include <xer_decoder.h>       /* Decoder of XER (XML, text) */
+#include <xer_encoder.h>       /* Encoder into XER (XML, text) */
+#include <per_decoder.h>       /* Packet Encoding Rules decoder */
+#include <per_encoder.h>       /* Packet Encoding Rules encoder */
+#include <constraints.h>       /* Subtype constraints support */
+
+/*
+ * Free the structure according to its specification.
+ * If (free_contents_only) is set, the wrapper structure itself (struct_ptr)
+ * will not be freed. (It may be useful in case the structure is allocated
+ * statically or arranged on the stack, yet its elements are allocated
+ * dynamically.)
+ */
+typedef void (asn_struct_free_f)(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr, int free_contents_only);
+#define        ASN_STRUCT_FREE(asn_DEF, ptr)   (asn_DEF).free_struct(&(asn_DEF),ptr,0)
+#define        ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr)     \
+                                       (asn_DEF).free_struct(&(asn_DEF),ptr,1)
+
+/*
+ * Print the structure according to its specification.
+ */
+typedef int (asn_struct_print_f)(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               const void *struct_ptr,
+               int level,      /* Indentation level */
+               asn_app_consume_bytes_f *callback, void *app_key);
+
+/*
+ * Return the outmost tag of the type.
+ * If the type is untagged CHOICE, the dynamic operation is performed.
+ * NOTE: This function pointer type is only useful internally.
+ * Do not use it in your application.
+ */
+typedef ber_tlv_tag_t (asn_outmost_tag_f)(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag);
+/* The instance of the above function type; used internally. */
+asn_outmost_tag_f asn_TYPE_outmost_tag;
+
+\f
+/*
+ * The definitive description of the destination language's structure.
+ */
+typedef struct asn_TYPE_descriptor_s {
+       char *name;     /* A name of the ASN.1 type. "" in some cases. */
+       char *xml_tag;  /* Name used in XML tag */
+
+       /*
+        * Generalized functions for dealing with the specific type.
+        * May be directly invoked by applications.
+        */
+       asn_struct_free_f  *free_struct;        /* Free the structure */
+       asn_struct_print_f *print_struct;       /* Human readable output */
+       asn_constr_check_f *check_constraints;  /* Constraints validator */
+       ber_type_decoder_f *ber_decoder;        /* Generic BER decoder */
+       der_type_encoder_f *der_encoder;        /* Canonical DER encoder */
+       xer_type_decoder_f *xer_decoder;        /* Generic XER decoder */
+       xer_type_encoder_f *xer_encoder;        /* [Canonical] XER encoder */
+       per_type_decoder_f *uper_decoder;       /* Unaligned PER decoder */
+       per_type_encoder_f *uper_encoder;       /* Unaligned PER encoder */
+
+       /***********************************************************************
+        * Internally useful members. Not to be used by applications directly. *
+        **********************************************************************/
+
+       /*
+        * Tags that are expected to occur.
+        */
+       asn_outmost_tag_f  *outmost_tag;        /* <optional, internal> */
+       ber_tlv_tag_t *tags;    /* Effective tags sequence for this type */
+       int tags_count;         /* Number of tags which are expected */
+       ber_tlv_tag_t *all_tags;/* Every tag for BER/containment */
+       int all_tags_count;     /* Number of tags */
+
+       asn_per_constraints_t *per_constraints; /* PER compiled constraints */
+
+       /*
+        * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE).
+        */
+       struct asn_TYPE_member_s *elements;
+       int elements_count;
+
+       /*
+        * Additional information describing the type, used by appropriate
+        * functions above.
+        */
+       void *specifics;
+} asn_TYPE_descriptor_t;
+
+/*
+ * This type describes an element of the constructed type,
+ * i.e. SEQUENCE, SET, CHOICE, etc.
+ */
+  enum asn_TYPE_flags_e {
+       ATF_NOFLAGS,
+       ATF_POINTER     = 0x01, /* Represented by the pointer */
+       ATF_OPEN_TYPE   = 0x02  /* ANY type, without meaningful tag */
+  };
+typedef struct asn_TYPE_member_s {
+       enum asn_TYPE_flags_e flags;    /* Element's presentation flags */
+       int optional;   /* Following optional members, including current */
+       int memb_offset;                /* Offset of the element */
+       ber_tlv_tag_t tag;              /* Outmost (most immediate) tag */
+       int tag_mode;           /* IMPLICIT/no/EXPLICIT tag at current level */
+       asn_TYPE_descriptor_t *type;    /* Member type descriptor */
+       asn_constr_check_f *memb_constraints;   /* Constraints validator */
+       asn_per_constraints_t *per_constraints; /* PER compiled constraints */
+       int (*default_value)(int setval, void **sptr);  /* DEFAULT <value> */
+       char *name;                     /* ASN.1 identifier of the element */
+} asn_TYPE_member_t;
+
+/*
+ * BER tag to element number mapping.
+ */
+typedef struct asn_TYPE_tag2member_s {
+       ber_tlv_tag_t el_tag;   /* Outmost tag of the member */
+       int el_no;              /* Index of the associated member, base 0 */
+       int toff_first;         /* First occurence of the el_tag, relative */
+       int toff_last;          /* Last occurence of the el_tag, relatvie */
+} asn_TYPE_tag2member_t;
+
+/*
+ * This function is a wrapper around (td)->print_struct, which prints out
+ * the contents of the target language's structure (struct_ptr) into the
+ * file pointer (stream) in human readable form.
+ * RETURN VALUES:
+ *      0: The structure is printed.
+ *     -1: Problem dumping the structure.
+ * (See also xer_fprint() in xer_encoder.h)
+ */
+int asn_fprint(FILE *stream,           /* Destination stream descriptor */
+       asn_TYPE_descriptor_t *td,      /* ASN.1 type descriptor */
+       const void *struct_ptr);        /* Structure to be printed */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CONSTR_TYPE_H_ */
diff --git a/stglibs/smux.lib/include/stg/constraints.h b/stglibs/smux.lib/include/stg/constraints.h
new file mode 100644 (file)
index 0000000..5032345
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _ASN1_CONSTRAINTS_VALIDATOR_H_
+#define        _ASN1_CONSTRAINTS_VALIDATOR_H_
+
+#include <asn_system.h>                /* Platform-dependent types */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;          /* Forward declaration */
+
+/*
+ * Validate the structure according to the ASN.1 constraints.
+ * If errbuf and errlen are given, they shall be pointing to the appropriate
+ * buffer space and its length before calling this function. Alternatively,
+ * they could be passed as NULL's. If constraints validation fails,
+ * errlen will contain the actual number of bytes taken from the errbuf
+ * to encode an error message (properly 0-terminated).
+ * 
+ * RETURN VALUES:
+ * This function returns 0 in case all ASN.1 constraints are met
+ * and -1 if one or more constraints were failed.
+ */
+int
+asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor,
+       const void *struct_ptr, /* Target language's structure */
+       char *errbuf,           /* Returned error description */
+       size_t *errlen          /* Length of the error description */
+       );
+
+
+/*
+ * Generic type for constraint checking callback,
+ * associated with every type descriptor.
+ */
+typedef int (asn_constr_check_f)(
+       struct asn_TYPE_descriptor_s *type_descriptor,
+       const void *struct_ptr,
+       asn_app_constraint_failed_f *optional_callback, /* Log the error */
+       void *optional_app_key          /* Opaque key passed to a callback */
+       );
+
+/*******************************
+ * INTERNALLY USEFUL FUNCTIONS *
+ *******************************/
+
+asn_constr_check_f asn_generic_no_constraint;  /* No constraint whatsoever */
+asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */
+
+/*
+ * Invoke the callback with a complete error message.
+ */
+#define        _ASN_CTFAIL     if(ctfailcb) ctfailcb
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ASN1_CONSTRAINTS_VALIDATOR_H_ */
diff --git a/stglibs/smux.lib/include/stg/der_encoder.h b/stglibs/smux.lib/include/stg/der_encoder.h
new file mode 100644 (file)
index 0000000..4e2fb06
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _DER_ENCODER_H_
+#define        _DER_ENCODER_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/*
+ * The DER encoder of any type. May be invoked by the application.
+ */
+asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr,       /* Structure to be encoded */
+               asn_app_consume_bytes_f *consume_bytes_cb,
+               void *app_key           /* Arbitrary callback argument */
+       );
+
+/* A variant of der_encode() which encodes data into the pre-allocated buffer */
+asn_enc_rval_t der_encode_to_buffer(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr,       /* Structure to be encoded */
+               void *buffer,           /* Pre-allocated buffer */
+               size_t buffer_size      /* Initial buffer size (maximum) */
+       );
+
+/*
+ * Type of the generic DER encoder.
+ */
+typedef asn_enc_rval_t (der_type_encoder_f)(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr,       /* Structure to be encoded */
+               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+               ber_tlv_tag_t tag,
+               asn_app_consume_bytes_f *consume_bytes_cb,      /* Callback */
+               void *app_key           /* Arbitrary callback argument */
+       );
+
+
+/*******************************
+ * INTERNALLY USEFUL FUNCTIONS *
+ *******************************/
+
+/*
+ * Write out leading TL[v] sequence according to the type definition.
+ */
+ssize_t der_write_tags(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               size_t struct_length,
+               int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+               int last_tag_form,      /* {0,!0}: prim, constructed */
+               ber_tlv_tag_t tag,
+               asn_app_consume_bytes_f *consume_bytes_cb,
+               void *app_key
+       );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/per_decoder.h b/stglibs/smux.lib/include/stg/per_decoder.h
new file mode 100644 (file)
index 0000000..26aaf59
--- /dev/null
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _PER_DECODER_H_
+#define        _PER_DECODER_H_
+
+#include <asn_application.h>
+#include <per_support.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/*
+ * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
+ */
+asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
+       struct asn_TYPE_descriptor_s *type_descriptor,  /* Type to decode */
+       void **struct_ptr,      /* Pointer to a target structure's pointer */
+       const void *buffer,     /* Data to be decoded */
+       size_t size,            /* Size of data buffer */
+       int skip_bits,          /* Number of unused leading bits, 0..7 */
+       int unused_bits         /* Number of unused tailing bits, 0..7 */
+       );
+
+
+/*
+ * Type of the type-specific PER decoder function.
+ */
+typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               asn_per_constraints_t *constraints,
+               void **struct_ptr,
+               asn_per_data_t *per_data
+       );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PER_DECODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/per_encoder.h b/stglibs/smux.lib/include/stg/per_encoder.h
new file mode 100644 (file)
index 0000000..9ac130b
--- /dev/null
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _PER_ENCODER_H_
+#define        _PER_ENCODER_H_
+
+#include <asn_application.h>
+#include <per_support.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/*
+ * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.
+ */
+asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor,
+       void *struct_ptr,       /* Structure to be encoded */
+       asn_app_consume_bytes_f *consume_bytes_cb,      /* Data collector */
+       void *app_key           /* Arbitrary callback argument */
+);
+
+/* A variant of uper_encode() which encodes data into the existing buffer */
+asn_enc_rval_t uper_encode_to_buffer(
+       struct asn_TYPE_descriptor_s *type_descriptor,
+       void *struct_ptr,       /* Structure to be encoded */
+       void *buffer,           /* Pre-allocated buffer */
+       size_t buffer_size      /* Initial buffer size (max) */
+);
+
+
+/*
+ * Type of the generic PER encoder function.
+ */
+typedef asn_enc_rval_t (per_type_encoder_f)(
+       struct asn_TYPE_descriptor_s *type_descriptor,
+       asn_per_constraints_t *constraints,
+       void *struct_ptr,
+       asn_per_outp_t *per_output
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/per_support.h b/stglibs/smux.lib/include/stg/per_support.h
new file mode 100644 (file)
index 0000000..420bb83
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2005, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _PER_SUPPORT_H_
+#define        _PER_SUPPORT_H_
+
+#include <asn_system.h>                /* Platform-specific types */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Pre-computed PER constraints.
+ */
+typedef struct asn_per_constraint_s {
+       enum asn_per_constraint_flags {
+               APC_UNCONSTRAINED       = 0x0,  /* No PER visible constraints */
+               APC_SEMI_CONSTRAINED    = 0x1,  /* Constrained at "lb" */
+               APC_CONSTRAINED         = 0x2,  /* Fully constrained */
+               APC_EXTENSIBLE          = 0x4   /* May have extension */
+       } flags;
+       int  range_bits;                /* Full number of bits in the range */
+       int  effective_bits;            /* Effective bits */
+       long lower_bound;               /* "lb" value */
+       long upper_bound;               /* "ub" value */
+} asn_per_constraint_t;
+typedef struct asn_per_constraints_s {
+       asn_per_constraint_t value;
+       asn_per_constraint_t size;
+} asn_per_constraints_t;
+
+/*
+ * This structure describes a position inside an incoming PER bit stream.
+ */
+typedef struct asn_per_data_s {
+ const uint8_t *buffer;        /* Pointer to the octet stream */
+        size_t  nboff; /* Bit offset to the meaningful bit */
+        size_t  nbits; /* Number of bits in the stream */
+} asn_per_data_t;
+
+/*
+ * Extract a small number of bits (<= 31) from the specified PER data pointer.
+ * This function returns -1 if the specified number of bits could not be
+ * extracted due to EOD or other conditions.
+ */
+int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits);
+
+/*
+ * Extract a large number of bits from the specified PER data pointer.
+ * This function returns -1 if the specified number of bits could not be
+ * extracted due to EOD or other conditions.
+ */
+int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align,
+                       int get_nbits);
+
+/*
+ * Get the length "n" from the Unaligned PER stream.
+ */
+ssize_t uper_get_length(asn_per_data_t *pd,
+                       int effective_bound_bits,
+                       int *repeat);
+
+/*
+ * Get the normally small non-negative whole number.
+ */
+ssize_t uper_get_nsnnwn(asn_per_data_t *pd);
+
+/*
+ * This structure supports forming PER output.
+ */
+typedef struct asn_per_outp_s {
+       uint8_t *buffer;        /* Pointer into the (tmpspace) */
+       size_t nboff;           /* Bit offset to the meaningful bit */
+       size_t nbits;           /* Number of bits left in (tmpspace) */
+       uint8_t tmpspace[32];   /* Preliminary storage to hold data */
+       int (*outper)(const void *data, size_t size, void *op_key);
+       void *op_key;           /* Key for (outper) data callback */
+       size_t flushed_bytes;   /* Bytes already flushed through (outper) */
+} asn_per_outp_t;
+
+/* Output a small number of bits (<= 31) */
+int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits);
+
+/* Output a large number of bits */
+int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits);
+
+/*
+ * Put the length "n" to the Unaligned PER stream.
+ * This function returns the number of units which may be flushed
+ * in the next units saving iteration.
+ */
+ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length);
+
+/*
+ * Put the normally small non-negative whole number.
+ */
+int uper_put_nsnnwn(asn_per_outp_t *po, int n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PER_SUPPORT_H_ */
diff --git a/stglibs/smux.lib/include/stg/xer_decoder.h b/stglibs/smux.lib/include/stg/xer_decoder.h
new file mode 100644 (file)
index 0000000..cf0d846
--- /dev/null
@@ -0,0 +1,106 @@
+/*-
+ * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _XER_DECODER_H_
+#define        _XER_DECODER_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/*
+ * The XER decoder of any ASN.1 type. May be invoked by the application.
+ */
+asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
+       struct asn_TYPE_descriptor_s *type_descriptor,
+       void **struct_ptr,      /* Pointer to a target structure's pointer */
+       const void *buffer,     /* Data to be decoded */
+       size_t size             /* Size of data buffer */
+       );
+
+/*
+ * Type of the type-specific XER decoder function.
+ */
+typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void **struct_ptr,
+               const char *opt_mname,  /* Member name */
+               const void *buf_ptr, size_t size
+       );
+
+/*******************************
+ * INTERNALLY USEFUL FUNCTIONS *
+ *******************************/
+
+/*
+ * Generalized function for decoding the primitive values.
+ * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8
+ * and others. This function should not be used by applications, as its API
+ * is subject to changes.
+ */
+asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
+       asn_struct_ctx_t *ctx,  /* Type decoder context */
+       void *struct_key,       /* Treated as opaque pointer */
+       const char *xml_tag,    /* Expected XML tag name */
+       const void *buf_ptr, size_t size,
+       int (*opt_unexpected_tag_decoder)
+               (void *struct_key, const void *chunk_buf, size_t chunk_size),
+       ssize_t (*body_receiver)
+               (void *struct_key, const void *chunk_buf, size_t chunk_size,
+                       int have_more)
+       );
+
+
+/*
+ * Fetch the next XER (XML) token from the stream.
+ * The function returns the number of bytes occupied by the chunk type,
+ * returned in the _ch_type. The _ch_type is only set (and valid) when
+ * the return value is greater than 0.
+ */
+  typedef enum pxer_chunk_type {
+       PXER_TAG,       /* Complete XER tag */
+       PXER_TEXT,      /* Plain text between XER tags */
+       PXER_COMMENT    /* A comment, may be part of */
+  } pxer_chunk_type_e;
+ssize_t xer_next_token(int *stateContext,
+       const void *buffer, size_t size, pxer_chunk_type_e *_ch_type);
+
+/*
+ * This function checks the buffer against the tag name is expected to occur.
+ */
+  typedef enum xer_check_tag {
+       XCT_BROKEN      = 0,    /* The tag is broken */
+       XCT_OPENING     = 1,    /* This is the <opening> tag */
+       XCT_CLOSING     = 2,    /* This is the </closing> tag */
+       XCT_BOTH        = 3,    /* This is the <modified/> tag */
+       XCT__UNK__MASK  = 4,    /* Mask of everything unexpected */
+       XCT_UNKNOWN_OP  = 5,    /* Unexpected <opening> tag */
+       XCT_UNKNOWN_CL  = 6,    /* Unexpected </closing> tag */
+       XCT_UNKNOWN_BO  = 7     /* Unexpected <modified/> tag */
+  } xer_check_tag_e;
+xer_check_tag_e xer_check_tag(const void *buf_ptr, int size,
+               const char *need_tag);
+
+/*
+ * Check whether this buffer consists of entirely XER whitespace characters.
+ * RETURN VALUES:
+ * 1:  Whitespace or empty string
+ * 0:  Non-whitespace
+ */
+int xer_is_whitespace(const void *chunk_buf, size_t chunk_size);
+
+/*
+ * Skip the series of anticipated extensions.
+ */
+int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XER_DECODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/xer_encoder.h b/stglibs/smux.lib/include/stg/xer_encoder.h
new file mode 100644 (file)
index 0000000..055e73c
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _XER_ENCODER_H_
+#define        _XER_ENCODER_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s;  /* Forward declaration */
+
+/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
+enum xer_encoder_flags_e {
+       /* Mode of encoding */
+       XER_F_BASIC     = 0x01, /* BASIC-XER (pretty-printing) */
+       XER_F_CANONICAL = 0x02  /* Canonical XER (strict rules) */
+};
+
+/*
+ * The XER encoder of any type. May be invoked by the application.
+ */
+asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr,       /* Structure to be encoded */
+               enum xer_encoder_flags_e xer_flags,
+               asn_app_consume_bytes_f *consume_bytes_cb,
+               void *app_key           /* Arbitrary callback argument */
+       );
+
+/*
+ * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
+ * output into the chosen file pointer.
+ * RETURN VALUES:
+ *      0: The structure is printed.
+ *     -1: Problem printing the structure.
+ * WARNING: No sensible errno value is returned.
+ */
+int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr);
+
+/*
+ * Type of the generic XER encoder.
+ */
+typedef asn_enc_rval_t (xer_type_encoder_f)(
+               struct asn_TYPE_descriptor_s *type_descriptor,
+               void *struct_ptr,       /* Structure to be encoded */
+               int ilevel,             /* Level of indentation */
+               enum xer_encoder_flags_e xer_flags,
+               asn_app_consume_bytes_f *consume_bytes_cb,      /* Callback */
+               void *app_key           /* Arbitrary callback argument */
+       );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/include/stg/xer_support.h b/stglibs/smux.lib/include/stg/xer_support.h
new file mode 100644 (file)
index 0000000..8b01944
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef        _XER_SUPPORT_H_
+#define        _XER_SUPPORT_H_
+
+#include <asn_system.h>                /* Platform-specific types */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Types of data transferred to the application.
+ */
+typedef enum {
+       PXML_TEXT,      /* Plain text between XML tags. */
+       PXML_TAG,       /* A tag, starting with '<'. */
+       PXML_COMMENT,   /* An XML comment, including "<!--" and "-->". */
+       /* 
+        * The following chunk types are reported if the chunk
+        * terminates the specified XML element.
+        */
+       PXML_TAG_END,           /* Tag ended */
+       PXML_COMMENT_END        /* Comment ended */
+} pxml_chunk_type_e;
+
+/*
+ * Callback function that is called by the parser when parsed data is
+ * available. The _opaque is the pointer to a field containing opaque user 
+ * data specified in pxml_create() call. The chunk type is _type and the text 
+ * data is the piece of buffer identified by _bufid (as supplied to
+ * pxml_feed() call) starting at offset _offset and of _size bytes size. 
+ * The chunk is NOT '\0'-terminated.
+ */
+typedef int (pxml_callback_f)(pxml_chunk_type_e _type,
+       const void *_chunk_data, size_t _chunk_size, void *_key);
+
+/*
+ * Parse the given buffer as it were a chunk of XML data.
+ * Invoke the specified callback each time the meaninful data is found.
+ * This function returns number of bytes consumed from the bufer.
+ * It will always be lesser than or equal to the specified _size.
+ * The next invocation of this function must account the difference.
+ */
+ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size,
+       pxml_callback_f *cb, void *_key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XER_SUPPORT_H_ */
diff --git a/stglibs/smux.lib/per_decoder.h b/stglibs/smux.lib/per_decoder.h
deleted file mode 100644 (file)
index 26aaf59..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c) 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _PER_DECODER_H_
-#define        _PER_DECODER_H_
-
-#include <asn_application.h>
-#include <per_support.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/*
- * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
- */
-asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
-       struct asn_TYPE_descriptor_s *type_descriptor,  /* Type to decode */
-       void **struct_ptr,      /* Pointer to a target structure's pointer */
-       const void *buffer,     /* Data to be decoded */
-       size_t size,            /* Size of data buffer */
-       int skip_bits,          /* Number of unused leading bits, 0..7 */
-       int unused_bits         /* Number of unused tailing bits, 0..7 */
-       );
-
-
-/*
- * Type of the type-specific PER decoder function.
- */
-typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               asn_per_constraints_t *constraints,
-               void **struct_ptr,
-               asn_per_data_t *per_data
-       );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PER_DECODER_H_ */
diff --git a/stglibs/smux.lib/per_encoder.h b/stglibs/smux.lib/per_encoder.h
deleted file mode 100644 (file)
index 9ac130b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _PER_ENCODER_H_
-#define        _PER_ENCODER_H_
-
-#include <asn_application.h>
-#include <per_support.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/*
- * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.
- */
-asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-       void *struct_ptr,       /* Structure to be encoded */
-       asn_app_consume_bytes_f *consume_bytes_cb,      /* Data collector */
-       void *app_key           /* Arbitrary callback argument */
-);
-
-/* A variant of uper_encode() which encodes data into the existing buffer */
-asn_enc_rval_t uper_encode_to_buffer(
-       struct asn_TYPE_descriptor_s *type_descriptor,
-       void *struct_ptr,       /* Structure to be encoded */
-       void *buffer,           /* Pre-allocated buffer */
-       size_t buffer_size      /* Initial buffer size (max) */
-);
-
-
-/*
- * Type of the generic PER encoder function.
- */
-typedef asn_enc_rval_t (per_type_encoder_f)(
-       struct asn_TYPE_descriptor_s *type_descriptor,
-       asn_per_constraints_t *constraints,
-       void *struct_ptr,
-       asn_per_outp_t *per_output
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/per_support.h b/stglibs/smux.lib/per_support.h
deleted file mode 100644 (file)
index 420bb83..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2005, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _PER_SUPPORT_H_
-#define        _PER_SUPPORT_H_
-
-#include <asn_system.h>                /* Platform-specific types */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Pre-computed PER constraints.
- */
-typedef struct asn_per_constraint_s {
-       enum asn_per_constraint_flags {
-               APC_UNCONSTRAINED       = 0x0,  /* No PER visible constraints */
-               APC_SEMI_CONSTRAINED    = 0x1,  /* Constrained at "lb" */
-               APC_CONSTRAINED         = 0x2,  /* Fully constrained */
-               APC_EXTENSIBLE          = 0x4   /* May have extension */
-       } flags;
-       int  range_bits;                /* Full number of bits in the range */
-       int  effective_bits;            /* Effective bits */
-       long lower_bound;               /* "lb" value */
-       long upper_bound;               /* "ub" value */
-} asn_per_constraint_t;
-typedef struct asn_per_constraints_s {
-       asn_per_constraint_t value;
-       asn_per_constraint_t size;
-} asn_per_constraints_t;
-
-/*
- * This structure describes a position inside an incoming PER bit stream.
- */
-typedef struct asn_per_data_s {
- const uint8_t *buffer;        /* Pointer to the octet stream */
-        size_t  nboff; /* Bit offset to the meaningful bit */
-        size_t  nbits; /* Number of bits in the stream */
-} asn_per_data_t;
-
-/*
- * Extract a small number of bits (<= 31) from the specified PER data pointer.
- * This function returns -1 if the specified number of bits could not be
- * extracted due to EOD or other conditions.
- */
-int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits);
-
-/*
- * Extract a large number of bits from the specified PER data pointer.
- * This function returns -1 if the specified number of bits could not be
- * extracted due to EOD or other conditions.
- */
-int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align,
-                       int get_nbits);
-
-/*
- * Get the length "n" from the Unaligned PER stream.
- */
-ssize_t uper_get_length(asn_per_data_t *pd,
-                       int effective_bound_bits,
-                       int *repeat);
-
-/*
- * Get the normally small non-negative whole number.
- */
-ssize_t uper_get_nsnnwn(asn_per_data_t *pd);
-
-/*
- * This structure supports forming PER output.
- */
-typedef struct asn_per_outp_s {
-       uint8_t *buffer;        /* Pointer into the (tmpspace) */
-       size_t nboff;           /* Bit offset to the meaningful bit */
-       size_t nbits;           /* Number of bits left in (tmpspace) */
-       uint8_t tmpspace[32];   /* Preliminary storage to hold data */
-       int (*outper)(const void *data, size_t size, void *op_key);
-       void *op_key;           /* Key for (outper) data callback */
-       size_t flushed_bytes;   /* Bytes already flushed through (outper) */
-} asn_per_outp_t;
-
-/* Output a small number of bits (<= 31) */
-int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits);
-
-/* Output a large number of bits */
-int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits);
-
-/*
- * Put the length "n" to the Unaligned PER stream.
- * This function returns the number of units which may be flushed
- * in the next units saving iteration.
- */
-ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length);
-
-/*
- * Put the normally small non-negative whole number.
- */
-int uper_put_nsnnwn(asn_per_outp_t *po, int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PER_SUPPORT_H_ */
diff --git a/stglibs/smux.lib/xer_decoder.h b/stglibs/smux.lib/xer_decoder.h
deleted file mode 100644 (file)
index cf0d846..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _XER_DECODER_H_
-#define        _XER_DECODER_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/*
- * The XER decoder of any ASN.1 type. May be invoked by the application.
- */
-asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
-       struct asn_TYPE_descriptor_s *type_descriptor,
-       void **struct_ptr,      /* Pointer to a target structure's pointer */
-       const void *buffer,     /* Data to be decoded */
-       size_t size             /* Size of data buffer */
-       );
-
-/*
- * Type of the type-specific XER decoder function.
- */
-typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void **struct_ptr,
-               const char *opt_mname,  /* Member name */
-               const void *buf_ptr, size_t size
-       );
-
-/*******************************
- * INTERNALLY USEFUL FUNCTIONS *
- *******************************/
-
-/*
- * Generalized function for decoding the primitive values.
- * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8
- * and others. This function should not be used by applications, as its API
- * is subject to changes.
- */
-asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
-       asn_struct_ctx_t *ctx,  /* Type decoder context */
-       void *struct_key,       /* Treated as opaque pointer */
-       const char *xml_tag,    /* Expected XML tag name */
-       const void *buf_ptr, size_t size,
-       int (*opt_unexpected_tag_decoder)
-               (void *struct_key, const void *chunk_buf, size_t chunk_size),
-       ssize_t (*body_receiver)
-               (void *struct_key, const void *chunk_buf, size_t chunk_size,
-                       int have_more)
-       );
-
-
-/*
- * Fetch the next XER (XML) token from the stream.
- * The function returns the number of bytes occupied by the chunk type,
- * returned in the _ch_type. The _ch_type is only set (and valid) when
- * the return value is greater than 0.
- */
-  typedef enum pxer_chunk_type {
-       PXER_TAG,       /* Complete XER tag */
-       PXER_TEXT,      /* Plain text between XER tags */
-       PXER_COMMENT    /* A comment, may be part of */
-  } pxer_chunk_type_e;
-ssize_t xer_next_token(int *stateContext,
-       const void *buffer, size_t size, pxer_chunk_type_e *_ch_type);
-
-/*
- * This function checks the buffer against the tag name is expected to occur.
- */
-  typedef enum xer_check_tag {
-       XCT_BROKEN      = 0,    /* The tag is broken */
-       XCT_OPENING     = 1,    /* This is the <opening> tag */
-       XCT_CLOSING     = 2,    /* This is the </closing> tag */
-       XCT_BOTH        = 3,    /* This is the <modified/> tag */
-       XCT__UNK__MASK  = 4,    /* Mask of everything unexpected */
-       XCT_UNKNOWN_OP  = 5,    /* Unexpected <opening> tag */
-       XCT_UNKNOWN_CL  = 6,    /* Unexpected </closing> tag */
-       XCT_UNKNOWN_BO  = 7     /* Unexpected <modified/> tag */
-  } xer_check_tag_e;
-xer_check_tag_e xer_check_tag(const void *buf_ptr, int size,
-               const char *need_tag);
-
-/*
- * Check whether this buffer consists of entirely XER whitespace characters.
- * RETURN VALUES:
- * 1:  Whitespace or empty string
- * 0:  Non-whitespace
- */
-int xer_is_whitespace(const void *chunk_buf, size_t chunk_size);
-
-/*
- * Skip the series of anticipated extensions.
- */
-int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XER_DECODER_H_ */
diff --git a/stglibs/smux.lib/xer_encoder.h b/stglibs/smux.lib/xer_encoder.h
deleted file mode 100644 (file)
index 055e73c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _XER_ENCODER_H_
-#define        _XER_ENCODER_H_
-
-#include <asn_application.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct asn_TYPE_descriptor_s;  /* Forward declaration */
-
-/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
-enum xer_encoder_flags_e {
-       /* Mode of encoding */
-       XER_F_BASIC     = 0x01, /* BASIC-XER (pretty-printing) */
-       XER_F_CANONICAL = 0x02  /* Canonical XER (strict rules) */
-};
-
-/*
- * The XER encoder of any type. May be invoked by the application.
- */
-asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr,       /* Structure to be encoded */
-               enum xer_encoder_flags_e xer_flags,
-               asn_app_consume_bytes_f *consume_bytes_cb,
-               void *app_key           /* Arbitrary callback argument */
-       );
-
-/*
- * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
- * output into the chosen file pointer.
- * RETURN VALUES:
- *      0: The structure is printed.
- *     -1: Problem printing the structure.
- * WARNING: No sensible errno value is returned.
- */
-int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr);
-
-/*
- * Type of the generic XER encoder.
- */
-typedef asn_enc_rval_t (xer_type_encoder_f)(
-               struct asn_TYPE_descriptor_s *type_descriptor,
-               void *struct_ptr,       /* Structure to be encoded */
-               int ilevel,             /* Level of indentation */
-               enum xer_encoder_flags_e xer_flags,
-               asn_app_consume_bytes_f *consume_bytes_cb,      /* Callback */
-               void *app_key           /* Arbitrary callback argument */
-       );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XER_ENCODER_H_ */
diff --git a/stglibs/smux.lib/xer_support.h b/stglibs/smux.lib/xer_support.h
deleted file mode 100644 (file)
index 8b01944..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        _XER_SUPPORT_H_
-#define        _XER_SUPPORT_H_
-
-#include <asn_system.h>                /* Platform-specific types */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Types of data transferred to the application.
- */
-typedef enum {
-       PXML_TEXT,      /* Plain text between XML tags. */
-       PXML_TAG,       /* A tag, starting with '<'. */
-       PXML_COMMENT,   /* An XML comment, including "<!--" and "-->". */
-       /* 
-        * The following chunk types are reported if the chunk
-        * terminates the specified XML element.
-        */
-       PXML_TAG_END,           /* Tag ended */
-       PXML_COMMENT_END        /* Comment ended */
-} pxml_chunk_type_e;
-
-/*
- * Callback function that is called by the parser when parsed data is
- * available. The _opaque is the pointer to a field containing opaque user 
- * data specified in pxml_create() call. The chunk type is _type and the text 
- * data is the piece of buffer identified by _bufid (as supplied to
- * pxml_feed() call) starting at offset _offset and of _size bytes size. 
- * The chunk is NOT '\0'-terminated.
- */
-typedef int (pxml_callback_f)(pxml_chunk_type_e _type,
-       const void *_chunk_data, size_t _chunk_size, void *_key);
-
-/*
- * Parse the given buffer as it were a chunk of XML data.
- * Invoke the specified callback each time the meaninful data is found.
- * This function returns number of bytes consumed from the bufer.
- * It will always be lesser than or equal to the specified _size.
- * The next invocation of this function must account the difference.
- */
-ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size,
-       pxml_callback_f *cb, void *_key);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XER_SUPPORT_H_ */
diff --git a/stglibs/srvconf.lib/include/stg/netunit.h b/stglibs/srvconf.lib/include/stg/netunit.h
new file mode 100644 (file)
index 0000000..e288df8
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+ /*
+ $Revision: 1.6 $
+ $Date: 2010/02/11 12:32:53 $
+ $Author: faust $
+ */
+
+#ifndef NetUnitH
+#define NetUnitH
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <list>
+#include <string>
+
+#include "stg/blowfish.h"
+
+#define  STG_HEADER     "SG04"
+#define  OK_HEADER      "OKHD"
+#define  ERR_HEADER     "ERHD"
+#define  OK_LOGIN       "OKLG"
+#define  ERR_LOGIN      "ERLG"
+#define  OK_LOGINS      "OKLS"
+#define  ERR_LOGINS     "ERLS"
+
+// äÌÉÎÎÁ ÛÉÆÒÕÅÍÏÇÏ É ÐÅÒÅÄÁ×ÁÅÍÏÇ ÚÁ ÏÄÉΠÒÁÚ ÂÌÏËÁ ÉÎÆÏÒÍÁÃÉÉ
+#define  ENC_MSG_LEN    (8)
+
+#define MAX_ERR_STR_LEN (64)
+
+typedef int(*RxCallback_t)(void *, std::list<std::string> *);
+
+enum status
+{
+st_ok = 0,
+st_conn_fail,
+st_send_fail,
+st_recv_fail,
+st_header_err,
+st_login_err,
+st_logins_err,
+st_data_err,
+st_unknown_err,
+st_dns_err,
+st_xml_parse_error,
+st_data_error
+};
+
+enum CONF_STATE
+{
+confHdr = 0,
+confLogin,
+confLoginCipher,
+confData
+};
+//---------------------------------------------------------------------------
+class NETTRANSACT
+{
+public:
+    NETTRANSACT();
+    int     Transact(const char * data);
+    const std::string & GetError() const;
+
+    void    SetRxCallback(void * data, RxCallback_t);
+
+    void    SetServer(const char * serverName);
+    void    SetServerPort(short unsigned p);
+
+    void    SetLogin(const char * l);
+    void    SetPassword(const char * p);
+    ////////////////////////////////////////////
+    int     Connect();
+    int     Disconnect();
+    void    Reset();
+private:
+    int     TxHeader();
+    int     RxHeaderAnswer();
+
+    int     TxLogin();
+    int     RxLoginAnswer();
+
+    int     TxLoginS();
+    int     RxLoginSAnswer();
+
+    int     TxData(const char * text);
+    int     TxData(char * data);
+    int     RxDataAnswer();
+
+    void Encrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
+    void EnDecryptInit(const char * passwd, int passwdLen, BLOWFISH_CTX *ctx);
+    void Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
+
+    std::string server;
+    short unsigned  port;
+    std::string login;
+    std::string password;
+    int     outerSocket;
+    std::list<std::string>   answerList;
+    RxCallback_t RxCallBack;
+    void *  dataRxCallBack;
+    std::string errorMsg;
+};
+//---------------------------------------------------------------------------
+#endif
diff --git a/stglibs/srvconf.lib/include/stg/servconf.h b/stglibs/srvconf.lib/include/stg/servconf.h
new file mode 100644 (file)
index 0000000..67c2f24
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+ /*
+ $Revision: 1.10 $
+ $Date: 2009/03/17 09:52:35 $
+ $Author: faust $
+ */
+
+#ifndef SERVCONF_H
+#define SERVCONF_H
+
+#include <expat.h>
+
+#include <list>
+#include <string>
+
+#include "stg/os_int.h"
+#include "stg/const.h"
+#include "netunit.h"
+
+void Start(void *data, const char *el, const char **attr);
+void End(void *data, const char *el);
+
+#define MAX_ERR_STR_LEN (64)
+#define IP_STRING_LEN   (255)
+#define UNAME_LEN       (256)
+#define SERV_VER_LEN    (64)
+#define DIRNAME_LEN     (16)
+
+//-----------------------------------------------------------------------------
+struct STAT
+{
+    long long   su[DIR_NUM];
+    long long   sd[DIR_NUM];
+    long long   mu[DIR_NUM];
+    long long   md[DIR_NUM];
+    double      freeMb;
+};
+//-----------------------------------------------------------------------------
+struct SERVERINFO
+{
+    std::string version;
+    int         tariffNum;
+    int         tariffType;
+    int         usersNum;
+    std::string uname;
+    int         dirNum;
+    std::string dirName[DIR_NUM];
+};
+//-----------------------------------------------------------------------------
+struct USERDATA
+{
+    std::string     login;
+    std::string     password;
+    double          cash;
+    double          credit;
+    time_t          creditExpire;
+    double          lastCash;
+    double          prepaidTraff;
+    int             down;
+    int             passive;
+    int             disableDetailStat;
+    int             connected;
+    int             alwaysOnline;
+    uint32_t        ip;
+    std::string     ips;
+    std::string     tariff;
+    std::string     iface;
+    std::string     group;
+    std::string     note;
+    std::string     email;
+    std::string     name;
+    std::string     address;
+    std::string     phone;
+    STAT            stat;
+    std::string     userData[USERDATA_NUM];
+
+    struct USERDATA * next;
+};
+//-----------------------------------------------------------------------------
+typedef void(*RecvUserDataCb_t)(USERDATA * ud, void * data);
+typedef void(*RecvServerInfoDataCb_t)(SERVERINFO * si, void * data);
+typedef int(*RecvChgUserCb_t)(const char * asnwer, void * data);
+typedef int(*RecvCheckUserCb_t)(const char * answer, void * data);
+typedef int(*RecvSendMessageCb_t)(const char * answer, void * data);
+//-----------------------------------------------------------------------------
+struct ADMINDATA
+{
+    char login[ADM_LOGIN_LEN];
+};
+//-----------------------------------------------------------------------------
+class PARSER
+{
+public:
+    PARSER() {}
+    virtual ~PARSER() {}
+    virtual int ParseStart(const char *el, const char **attr) = 0;
+    virtual void ParseEnd(const char *el) = 0;
+};
+//-----------------------------------------------------------------------------
+class PARSER_CHG_USER: public PARSER
+{
+public:
+    PARSER_CHG_USER();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseAnswer(const char *el, const char **attr);
+    void SetChgUserRecvCb(RecvChgUserCb_t, void * data);
+private:
+    RecvChgUserCb_t RecvChgUserCb;
+    void * chgUserCbData;
+    int depth;
+    bool error;
+};
+//-----------------------------------------------------------------------------
+class PARSER_CHECK_USER: public PARSER
+{
+public:
+    PARSER_CHECK_USER();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseAnswer(const char *el, const char **attr);
+    void SetCheckUserRecvCb(RecvCheckUserCb_t, void * data);
+private:
+    RecvCheckUserCb_t RecvCheckUserCb;
+    void * checkUserCbData;
+    int depth;
+    bool error;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_USERS: public PARSER
+{
+public:
+    PARSER_GET_USERS();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseUsers(const char *el, const char **attr);
+    void ParseUser(const char *el, const char **attr);
+    void ParseUserParams(const char *el, const char **attr);
+    void ParseUserLoadStat(const char * el, const char ** attr);
+    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
+private:
+    RecvUserDataCb_t RecvUserDataCb;
+    void * userDataCb;
+    USERDATA user;
+    int depth;
+    bool error;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_USER: public PARSER
+{
+public:
+    PARSER_GET_USER();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseUsers(const char *el, const char **attr);
+    void ParseUser(const char *el, const char **attr);
+    void ParseUserParams(const char *el, const char **attr);
+    void ParseUserLoadStat(const char * el, const char ** attr);
+    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
+private:
+    RecvUserDataCb_t RecvUserDataCb;
+    void * userDataCb;
+    USERDATA user;
+    int depth;
+    bool error;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_SERVER_INFO: public PARSER
+{
+public:
+    PARSER_GET_SERVER_INFO();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseServerInfo(const char *el, const char **attr);
+    bool GetError();
+    void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
+private:
+    void ParseUname(const char ** attr);
+    void ParseServerVersion(const char ** attr);
+    void ParseUsersNum(const char ** attr);
+    void ParseTariffsNum(const char ** attr);
+    void ParseTariffType(const char ** attr);
+    void ParseDirNum(const char **attr);
+    void ParseDirName(const char **attr, int d);
+
+    RecvServerInfoDataCb_t RecvServerInfoDataCb;
+    void * serverInfoDataCb;
+    int depth;
+    bool error;
+    SERVERINFO serverInfo;
+};
+//-----------------------------------------------------------------------------
+class PARSER_SEND_MESSAGE: public PARSER
+{
+public:
+    PARSER_SEND_MESSAGE();
+    int  ParseStart(const char *el, const char **attr);
+    void ParseEnd(const char *el);
+    void ParseAnswer(const char *el, const char **attr);
+    void SetSendMessageRecvCb(RecvSendMessageCb_t, void * data);
+private:
+    RecvSendMessageCb_t RecvSendMessageCb;
+    void * sendMessageCbData;
+    int depth;
+    bool error;
+};
+//-----------------------------------------------------------------------------
+class SERVCONF
+{
+public:
+    SERVCONF();
+    void SetServer(const char * server);
+    void SetPort(uint16_t port);
+
+    void SetAdmLogin(const char * login);
+    void SetAdmPassword(const char * password);
+
+    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
+    void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
+    void SetChgUserCb(RecvChgUserCb_t, void * data);
+    void SetCheckUserCb(RecvCheckUserCb_t, void * data);
+    void SetGetUserDataRecvCb(RecvUserDataCb_t, void * data);
+    void SetSendMessageCb(RecvSendMessageCb_t, void * data);
+
+    int GetUsers();
+    int GetUser(const char * login);
+    int ChgUser(const char * request);
+    // TODO: Remove this shit!
+    int MsgUser(const char * request);
+    int SendMessage(const char * login, const char * message, int prio);
+    int GetServerInfo();
+    int CheckUser(const char * login, const char * password);
+
+    const std::string & GetStrError() const;
+    int GetError();
+    int Start(const char *el, const char **attr);
+    void End(const char *el);
+
+private:
+    PARSER * currParser;
+
+    PARSER_GET_USERS parserGetUsers;
+    PARSER_GET_USER parserGetUser;
+    PARSER_GET_SERVER_INFO  parserServerInfo;
+    PARSER_CHG_USER parserChgUser;
+    PARSER_CHECK_USER parserCheckUser;
+    PARSER_SEND_MESSAGE parserSendMessage;
+
+    NETTRANSACT nt;
+    int parseDepth;
+
+    std::string errorMsg;
+    int error;
+    XML_Parser parser;
+
+    RecvUserDataCb_t RecvUserDataCb;
+    RecvUserDataCb_t RecvGetUserDataCb;
+    RecvServerInfoDataCb_t RecvServerInfoDataCb;
+    RecvChgUserCb_t RecvChgUserCb;
+    RecvCheckUserCb_t RecvCheckUserCb;
+    RecvSendMessageCb_t RecvSendMessageCb;
+
+    void * getUserDataDataCb;
+    void * getUsersDataDataCb;
+    void * getServerInfoDataCb;
+    void * chgUserDataCb;
+    void * checkUserDataCb;
+    void * sendMessageDataCb;
+
+    friend int AnsRecv(void * data, std::list<std::string> * list);
+};
+//-----------------------------------------------------------------------------
+
+#endif  /* _SERVCONF_H_ */
diff --git a/stglibs/srvconf.lib/netunit.h b/stglibs/srvconf.lib/netunit.h
deleted file mode 100644 (file)
index e288df8..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
- /*
- $Revision: 1.6 $
- $Date: 2010/02/11 12:32:53 $
- $Author: faust $
- */
-
-#ifndef NetUnitH
-#define NetUnitH
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <list>
-#include <string>
-
-#include "stg/blowfish.h"
-
-#define  STG_HEADER     "SG04"
-#define  OK_HEADER      "OKHD"
-#define  ERR_HEADER     "ERHD"
-#define  OK_LOGIN       "OKLG"
-#define  ERR_LOGIN      "ERLG"
-#define  OK_LOGINS      "OKLS"
-#define  ERR_LOGINS     "ERLS"
-
-// äÌÉÎÎÁ ÛÉÆÒÕÅÍÏÇÏ É ÐÅÒÅÄÁ×ÁÅÍÏÇ ÚÁ ÏÄÉΠÒÁÚ ÂÌÏËÁ ÉÎÆÏÒÍÁÃÉÉ
-#define  ENC_MSG_LEN    (8)
-
-#define MAX_ERR_STR_LEN (64)
-
-typedef int(*RxCallback_t)(void *, std::list<std::string> *);
-
-enum status
-{
-st_ok = 0,
-st_conn_fail,
-st_send_fail,
-st_recv_fail,
-st_header_err,
-st_login_err,
-st_logins_err,
-st_data_err,
-st_unknown_err,
-st_dns_err,
-st_xml_parse_error,
-st_data_error
-};
-
-enum CONF_STATE
-{
-confHdr = 0,
-confLogin,
-confLoginCipher,
-confData
-};
-//---------------------------------------------------------------------------
-class NETTRANSACT
-{
-public:
-    NETTRANSACT();
-    int     Transact(const char * data);
-    const std::string & GetError() const;
-
-    void    SetRxCallback(void * data, RxCallback_t);
-
-    void    SetServer(const char * serverName);
-    void    SetServerPort(short unsigned p);
-
-    void    SetLogin(const char * l);
-    void    SetPassword(const char * p);
-    ////////////////////////////////////////////
-    int     Connect();
-    int     Disconnect();
-    void    Reset();
-private:
-    int     TxHeader();
-    int     RxHeaderAnswer();
-
-    int     TxLogin();
-    int     RxLoginAnswer();
-
-    int     TxLoginS();
-    int     RxLoginSAnswer();
-
-    int     TxData(const char * text);
-    int     TxData(char * data);
-    int     RxDataAnswer();
-
-    void Encrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
-    void EnDecryptInit(const char * passwd, int passwdLen, BLOWFISH_CTX *ctx);
-    void Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
-
-    std::string server;
-    short unsigned  port;
-    std::string login;
-    std::string password;
-    int     outerSocket;
-    std::list<std::string>   answerList;
-    RxCallback_t RxCallBack;
-    void *  dataRxCallBack;
-    std::string errorMsg;
-};
-//---------------------------------------------------------------------------
-#endif
diff --git a/stglibs/srvconf.lib/servconf.h b/stglibs/srvconf.lib/servconf.h
deleted file mode 100644 (file)
index 67c2f24..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- *    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
- /*
- $Revision: 1.10 $
- $Date: 2009/03/17 09:52:35 $
- $Author: faust $
- */
-
-#ifndef SERVCONF_H
-#define SERVCONF_H
-
-#include <expat.h>
-
-#include <list>
-#include <string>
-
-#include "stg/os_int.h"
-#include "stg/const.h"
-#include "netunit.h"
-
-void Start(void *data, const char *el, const char **attr);
-void End(void *data, const char *el);
-
-#define MAX_ERR_STR_LEN (64)
-#define IP_STRING_LEN   (255)
-#define UNAME_LEN       (256)
-#define SERV_VER_LEN    (64)
-#define DIRNAME_LEN     (16)
-
-//-----------------------------------------------------------------------------
-struct STAT
-{
-    long long   su[DIR_NUM];
-    long long   sd[DIR_NUM];
-    long long   mu[DIR_NUM];
-    long long   md[DIR_NUM];
-    double      freeMb;
-};
-//-----------------------------------------------------------------------------
-struct SERVERINFO
-{
-    std::string version;
-    int         tariffNum;
-    int         tariffType;
-    int         usersNum;
-    std::string uname;
-    int         dirNum;
-    std::string dirName[DIR_NUM];
-};
-//-----------------------------------------------------------------------------
-struct USERDATA
-{
-    std::string     login;
-    std::string     password;
-    double          cash;
-    double          credit;
-    time_t          creditExpire;
-    double          lastCash;
-    double          prepaidTraff;
-    int             down;
-    int             passive;
-    int             disableDetailStat;
-    int             connected;
-    int             alwaysOnline;
-    uint32_t        ip;
-    std::string     ips;
-    std::string     tariff;
-    std::string     iface;
-    std::string     group;
-    std::string     note;
-    std::string     email;
-    std::string     name;
-    std::string     address;
-    std::string     phone;
-    STAT            stat;
-    std::string     userData[USERDATA_NUM];
-
-    struct USERDATA * next;
-};
-//-----------------------------------------------------------------------------
-typedef void(*RecvUserDataCb_t)(USERDATA * ud, void * data);
-typedef void(*RecvServerInfoDataCb_t)(SERVERINFO * si, void * data);
-typedef int(*RecvChgUserCb_t)(const char * asnwer, void * data);
-typedef int(*RecvCheckUserCb_t)(const char * answer, void * data);
-typedef int(*RecvSendMessageCb_t)(const char * answer, void * data);
-//-----------------------------------------------------------------------------
-struct ADMINDATA
-{
-    char login[ADM_LOGIN_LEN];
-};
-//-----------------------------------------------------------------------------
-class PARSER
-{
-public:
-    PARSER() {}
-    virtual ~PARSER() {}
-    virtual int ParseStart(const char *el, const char **attr) = 0;
-    virtual void ParseEnd(const char *el) = 0;
-};
-//-----------------------------------------------------------------------------
-class PARSER_CHG_USER: public PARSER
-{
-public:
-    PARSER_CHG_USER();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseAnswer(const char *el, const char **attr);
-    void SetChgUserRecvCb(RecvChgUserCb_t, void * data);
-private:
-    RecvChgUserCb_t RecvChgUserCb;
-    void * chgUserCbData;
-    int depth;
-    bool error;
-};
-//-----------------------------------------------------------------------------
-class PARSER_CHECK_USER: public PARSER
-{
-public:
-    PARSER_CHECK_USER();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseAnswer(const char *el, const char **attr);
-    void SetCheckUserRecvCb(RecvCheckUserCb_t, void * data);
-private:
-    RecvCheckUserCb_t RecvCheckUserCb;
-    void * checkUserCbData;
-    int depth;
-    bool error;
-};
-//-----------------------------------------------------------------------------
-class PARSER_GET_USERS: public PARSER
-{
-public:
-    PARSER_GET_USERS();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseUsers(const char *el, const char **attr);
-    void ParseUser(const char *el, const char **attr);
-    void ParseUserParams(const char *el, const char **attr);
-    void ParseUserLoadStat(const char * el, const char ** attr);
-    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
-private:
-    RecvUserDataCb_t RecvUserDataCb;
-    void * userDataCb;
-    USERDATA user;
-    int depth;
-    bool error;
-};
-//-----------------------------------------------------------------------------
-class PARSER_GET_USER: public PARSER
-{
-public:
-    PARSER_GET_USER();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseUsers(const char *el, const char **attr);
-    void ParseUser(const char *el, const char **attr);
-    void ParseUserParams(const char *el, const char **attr);
-    void ParseUserLoadStat(const char * el, const char ** attr);
-    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
-private:
-    RecvUserDataCb_t RecvUserDataCb;
-    void * userDataCb;
-    USERDATA user;
-    int depth;
-    bool error;
-};
-//-----------------------------------------------------------------------------
-class PARSER_GET_SERVER_INFO: public PARSER
-{
-public:
-    PARSER_GET_SERVER_INFO();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseServerInfo(const char *el, const char **attr);
-    bool GetError();
-    void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
-private:
-    void ParseUname(const char ** attr);
-    void ParseServerVersion(const char ** attr);
-    void ParseUsersNum(const char ** attr);
-    void ParseTariffsNum(const char ** attr);
-    void ParseTariffType(const char ** attr);
-    void ParseDirNum(const char **attr);
-    void ParseDirName(const char **attr, int d);
-
-    RecvServerInfoDataCb_t RecvServerInfoDataCb;
-    void * serverInfoDataCb;
-    int depth;
-    bool error;
-    SERVERINFO serverInfo;
-};
-//-----------------------------------------------------------------------------
-class PARSER_SEND_MESSAGE: public PARSER
-{
-public:
-    PARSER_SEND_MESSAGE();
-    int  ParseStart(const char *el, const char **attr);
-    void ParseEnd(const char *el);
-    void ParseAnswer(const char *el, const char **attr);
-    void SetSendMessageRecvCb(RecvSendMessageCb_t, void * data);
-private:
-    RecvSendMessageCb_t RecvSendMessageCb;
-    void * sendMessageCbData;
-    int depth;
-    bool error;
-};
-//-----------------------------------------------------------------------------
-class SERVCONF
-{
-public:
-    SERVCONF();
-    void SetServer(const char * server);
-    void SetPort(uint16_t port);
-
-    void SetAdmLogin(const char * login);
-    void SetAdmPassword(const char * password);
-
-    void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
-    void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
-    void SetChgUserCb(RecvChgUserCb_t, void * data);
-    void SetCheckUserCb(RecvCheckUserCb_t, void * data);
-    void SetGetUserDataRecvCb(RecvUserDataCb_t, void * data);
-    void SetSendMessageCb(RecvSendMessageCb_t, void * data);
-
-    int GetUsers();
-    int GetUser(const char * login);
-    int ChgUser(const char * request);
-    // TODO: Remove this shit!
-    int MsgUser(const char * request);
-    int SendMessage(const char * login, const char * message, int prio);
-    int GetServerInfo();
-    int CheckUser(const char * login, const char * password);
-
-    const std::string & GetStrError() const;
-    int GetError();
-    int Start(const char *el, const char **attr);
-    void End(const char *el);
-
-private:
-    PARSER * currParser;
-
-    PARSER_GET_USERS parserGetUsers;
-    PARSER_GET_USER parserGetUser;
-    PARSER_GET_SERVER_INFO  parserServerInfo;
-    PARSER_CHG_USER parserChgUser;
-    PARSER_CHECK_USER parserCheckUser;
-    PARSER_SEND_MESSAGE parserSendMessage;
-
-    NETTRANSACT nt;
-    int parseDepth;
-
-    std::string errorMsg;
-    int error;
-    XML_Parser parser;
-
-    RecvUserDataCb_t RecvUserDataCb;
-    RecvUserDataCb_t RecvGetUserDataCb;
-    RecvServerInfoDataCb_t RecvServerInfoDataCb;
-    RecvChgUserCb_t RecvChgUserCb;
-    RecvCheckUserCb_t RecvCheckUserCb;
-    RecvSendMessageCb_t RecvSendMessageCb;
-
-    void * getUserDataDataCb;
-    void * getUsersDataDataCb;
-    void * getServerInfoDataCb;
-    void * chgUserDataCb;
-    void * checkUserDataCb;
-    void * sendMessageDataCb;
-
-    friend int AnsRecv(void * data, std::list<std::string> * list);
-};
-//-----------------------------------------------------------------------------
-
-#endif  /* _SERVCONF_H_ */
diff --git a/tests/tut.h b/tests/tut.h
deleted file mode 100644 (file)
index 22859cd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#include <tut/tut.hpp>
index 93233a6ae0f112f8cd840ec5db14fa9dd9bf42d9..52f9643c5171a049b6941cd835c74fdc4541726e 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef TUT_H_GUARD
 #define TUT_H_GUARD
+#include <tut/tut_config.hpp>
 
 #include <iostream>
 #include <map>
@@ -9,11 +10,6 @@
 #include <sstream>
 #include <iterator>
 #include <algorithm>
-#include <typeinfo>
-
-#if defined(linux)
-#define TUT_USE_POSIX
-#endif
 
 #include "tut_exception.hpp"
 #include "tut_result.hpp"
@@ -35,6 +31,9 @@
 namespace tut
 {
 
+template <class, int>
+class test_group;
+
 /**
  * Test object. Contains data test run upon and default test method
  * implementation. Inherited from Data to allow tests to
@@ -43,12 +42,29 @@ namespace tut
 template <class Data>
 class test_object : public Data, public test_object_posix
 {
+    template<class D, int M>
+    friend class test_group;
+
+    void set_test_group(const char *group)
+    {
+        current_test_group_ = group;
+    }
+
+    void set_test_id(int current_test_id)
+    {
+        current_test_id_ = current_test_id;
+    }
+
 public:
 
     /**
      * Default constructor
      */
     test_object()
+        : called_method_was_a_dummy_test_(false),
+          current_test_id_(0),
+          current_test_name_(),
+          current_test_group_()
     {
     }
 
@@ -62,9 +78,9 @@ public:
         return current_test_name_;
     }
 
-    void set_test_id(int current_test_id)
+    const std::string& get_test_group() const
     {
-        current_test_id_ = current_test_id;
+        return current_test_group_;
     }
 
     int get_test_id() const
@@ -86,13 +102,17 @@ public:
      * Used to detect usused test numbers and avoid unnecessary
      * test object creation which may be time-consuming depending
      * on operations described in Data::Data() and Data::~Data().
-     * TODO: replace with throwing special exception from default test.
      */
     bool called_method_was_a_dummy_test_;
 
+    virtual ~test_object()
+    {
+    }
+
 private:
     int             current_test_id_;
     std::string     current_test_name_;
+    std::string     current_test_group_;
 };
 
 
@@ -126,6 +146,9 @@ struct tests_registerer<Test, Group, 0>
 template <class Data, int MaxTestsInGroup = 50>
 class test_group : public group_base, public test_group_posix
 {
+    test_group(const test_group&);
+    void operator=(const test_group&);
+
     const char* name_;
 
     typedef void (test_object<Data>::*testmethod)();
@@ -139,13 +162,15 @@ class test_group : public group_base, public test_group_posix
     tests tests_;
     tests_iterator current_test_;
 
-       enum seh_result
-       {
-               SEH_OK,
-               SEH_CTOR,
-               SEH_TEST,
-               SEH_DUMMY
-       };
+    enum seh_result
+    {
+        SEH_OK,
+#if defined(TUT_USE_SEH)
+        SEH_CTOR,
+        SEH_TEST,
+#endif
+        SEH_DUMMY
+    };
 
     /**
      * Exception-in-destructor-safe smart-pointer class.
@@ -201,11 +226,16 @@ class test_group : public group_base, public test_group_posix
         {
             try
             {
+#if defined(TUT_USE_SEH)
                 if (delete_obj() == false)
                 {
                     throw warning("destructor of test object raised"
                         " an SEH exception");
                 }
+#else
+                bool d = delete_obj();
+                assert(d && "delete failed with SEH disabled: runtime bug?");
+#endif
             }
             catch (const std::exception& ex)
             {
@@ -268,7 +298,9 @@ public:
      * Creates and registers test group with specified name.
      */
     test_group(const char* name)
-        : name_(name)
+        : name_(name),
+          tests_(),
+          current_test_()
     {
         // register itself
         runner.get().register_group(name_,this);
@@ -281,7 +313,9 @@ public:
      * This constructor is used in self-test run only.
      */
     test_group(const char* name, test_runner& another_runner)
-        : name_(name)
+        : name_(name),
+          tests_(),
+          current_test_()
     {
         // register itself
         another_runner.register_group(name_, this);
@@ -367,22 +401,23 @@ public:
         try
         {
             switch (run_test_seh_(ti->second, obj, current_test_name, ti->first))
-                       {
-                               case SEH_CTOR:
-                                       throw bad_ctor("seh");
-                                       break;
-
-                               case SEH_TEST:
-                                       throw seh("seh");
-                                       break;
-
-                               case SEH_DUMMY:
-                                       tr.result = test_result::dummy;
-                                       break;
-
-                               case SEH_OK:
-                                       // ok
-                                       break;
+            {
+#if defined(TUT_USE_SEH)
+                case SEH_CTOR:
+                    throw bad_ctor("seh");
+                    break;
+
+                case SEH_TEST:
+                    throw seh("seh");
+                    break;
+#endif
+                case SEH_DUMMY:
+                    tr.result = test_result::dummy;
+                    break;
+
+                case SEH_OK:
+                    // ok
+                    break;
             }
         }
         catch (const rethrown& ex)
@@ -393,13 +428,13 @@ public:
         catch (const tut_error& ex)
         {
             tr.result = ex.result();
-            tr.exception_typeid = typeid(ex).name();
+            tr.exception_typeid = ex.type();
             tr.message = ex.what();
         }
         catch (const std::exception& ex)
         {
             tr.result = test_result::ex;
-            tr.exception_typeid = typeid(ex).name();
+            tr.exception_typeid = type_name(ex);
             tr.message = ex.what();
         }
         catch (...)
@@ -433,12 +468,12 @@ public:
         __try
         {
 #endif
-        if (obj.get() == 0)
-        {
-            reset_holder_(obj);
-        }
+            if (obj.get() == 0)
+            {
+                reset_holder_(obj);
+            }
 
-        obj->called_method_was_a_dummy_test_ = false;
+            obj->called_method_was_a_dummy_test_ = false;
 
 #if defined(TUT_USE_SEH)
 
@@ -446,6 +481,7 @@ public:
             {
 #endif
                 obj.get()->set_test_id(current_test_id);
+                obj.get()->set_test_group(name_);
                 (obj.get()->*tm)();
 #if defined(TUT_USE_SEH)
             }
@@ -456,20 +492,20 @@ public:
             }
 #endif
 
-        if (obj->called_method_was_a_dummy_test_)
-        {
-            // do not call obj.release(); reuse object
-            return SEH_DUMMY;
-        }
+            if (obj->called_method_was_a_dummy_test_)
+            {
+                // do not call obj.release(); reuse object
+                return SEH_DUMMY;
+            }
 
-        current_test_name = obj->get_test_name();
-        obj.permit_throw();
-        obj.release();
+            current_test_name = obj->get_test_name();
+            obj.permit_throw();
+            obj.release();
 #if defined(TUT_USE_SEH)
         }
         __except(handle_seh_(::GetExceptionCode()))
         {
-                       return SEH_CTOR;
+            return SEH_CTOR;
         }
 #endif
         return SEH_OK;
@@ -531,5 +567,5 @@ inline int handle_seh_(DWORD excode)
 #endif
 }
 
-#endif
+#endif // TUT_H_GUARD
 
index 7ee44bc234bee062fecd01cb89e511ef454668ad..c1959012ade5a6f78756f78b618ef56015f93ab5 100644 (file)
@@ -1,29 +1,34 @@
 #ifndef TUT_ASSERT_H_GUARD
 #define TUT_ASSERT_H_GUARD
+#include <tut/tut_config.hpp>
 
-#include "tut_exception.hpp"
 #include <limits>
 #include <iomanip>
+#include <iterator>
+#include <cassert>
+#include <cmath>
 
 #if defined(TUT_USE_POSIX)
 #include <errno.h>
 #include <cstring>
 #endif
 
+#include "tut_exception.hpp"
+
 namespace tut
 {
 
     namespace detail
     {
         template<typename M>
-        std::ostream &msg_prefix(std::ostream &str, const M &msg)
+        std::ostringstream &msg_prefix(std::ostringstream &str, const M &msg)
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << msg;
 
             if(!ss.str().empty())
             {
-                str << ss.rdbuf() << ": ";
+                str << msg << ": ";
             }
 
             return str;
@@ -83,7 +88,7 @@ void ensure_not(const M& msg, bool cond)
  * Tests two objects for being equal.
  * Throws if false.
  *
- * NB: both T and Q must have operator << defined somewhere, or
+ * NB: both LHS and RHS must have operator << defined somewhere, or
  * client code will not compile at all!
  */
 template <typename M, typename LHS, typename RHS>
@@ -91,42 +96,128 @@ void ensure_equals(const M& msg, const LHS& actual, const RHS& expected)
 {
     if (expected != actual)
     {
-        std::stringstream ss;
+        std::ostringstream ss;
         detail::msg_prefix(ss,msg)
-           << "expected '"
+           << "expected `"
            << expected
-           << "' actual '"
+           << "` actual `"
            << actual
-           << '\'';
+           << "`";
         throw failure(ss.str());
     }
 }
 
-template <typename LHS, typename RHS>
-void ensure_equals(const LHS& actual, const RHS& expected)
+/**
+ * Tests two pointers for being equal.
+ * Throws if false.
+ *
+ * NB: both T and Q must have operator << defined somewhere, or
+ * client code will not compile at all!
+ */
+template <typename M, typename LHS, typename RHS>
+void ensure_equals(const M& msg, const LHS * const actual, const RHS * const expected)
 {
-    ensure_equals("Values are not equal", actual, expected);
+    if (expected != actual)
+    {
+        std::ostringstream ss;
+        detail::msg_prefix(ss,msg)
+           << "expected `"
+           << (void*)expected
+           << "` actual `"
+           << (void*)actual
+           << "`";
+        throw failure(ss.str());
+    }
 }
 
 template<typename M>
-void ensure_equals(const M& msg, const double& actual, const double& expected,
-                   const double& epsilon = std::numeric_limits<double>::epsilon())
+void ensure_equals(const M& msg, const double& actual, const double& expected, const double& epsilon)
 {
     const double diff = actual - expected;
 
-    if ( !((diff <= epsilon) && (diff >= -epsilon )) )
+    if ( (actual != expected) && !((diff <= epsilon) && (diff >= -epsilon )) )
     {
-        std::stringstream ss;
+        std::ostringstream ss;
         detail::msg_prefix(ss,msg)
            << std::scientific
            << std::showpoint
            << std::setprecision(16)
-           << "expected " << expected
-           << " actual " << actual
-           << " with precision " << epsilon;
+           << "expected `" << expected
+           << "` actual `" << actual
+           << "` with precision `" << epsilon << "`";
         throw failure(ss.str());
     }
 }
+
+template<typename M>
+void ensure_equals(const M& msg, const double& actual, const double& expected)
+{
+    ensure_equals(msg, actual, expected, std::numeric_limits<double>::epsilon());
+}
+
+template <typename LHS, typename RHS>
+void ensure_equals(const LHS& actual, const RHS& expected)
+{
+    ensure_equals("Values are not equal", actual, expected);
+}
+
+
+template<typename LhsIterator, typename RhsIterator>
+void ensure_equals(const std::string &msg,
+                   const LhsIterator &lhs_begin, const LhsIterator &lhs_end,
+                   const RhsIterator &rhs_begin, const RhsIterator &rhs_end)
+{
+    typename std::iterator_traits<LhsIterator>::difference_type lhs_size = std::distance(lhs_begin, lhs_end);
+    typename std::iterator_traits<RhsIterator>::difference_type rhs_size = std::distance(rhs_begin, rhs_end);
+
+    if(lhs_size < rhs_size)
+    {
+        ensure_equals(msg + ": range is too short", lhs_size, rhs_size);
+    }
+
+    if(lhs_size > rhs_size)
+    {
+        ensure_equals(msg + ": range is too long", lhs_size, rhs_size);
+    }
+
+    assert(lhs_size == rhs_size);
+
+    LhsIterator lhs_i = lhs_begin;
+    RhsIterator rhs_i = rhs_begin;
+    while( (lhs_i != lhs_end) && (rhs_i != rhs_end) )
+    {
+        if(*lhs_i != *rhs_i)
+        {
+            std::ostringstream ss;
+            detail::msg_prefix(ss,msg)
+                << "expected `" << *rhs_i
+                << "` actual `" << *lhs_i
+                << "` at offset " << std::distance(lhs_begin, lhs_i);
+            throw failure(ss.str());
+        }
+
+        lhs_i++;
+        rhs_i++;
+    }
+
+    assert(lhs_i == lhs_end);
+    assert(rhs_i == rhs_end);
+}
+
+template<typename LhsIterator, typename RhsIterator>
+void ensure_equals(const LhsIterator &lhs_begin, const LhsIterator &lhs_end,
+                   const RhsIterator &rhs_begin, const RhsIterator &rhs_end)
+{
+    ensure_equals("Ranges are not equal", lhs_begin, lhs_end, rhs_begin, rhs_end);
+}
+
+template<typename LhsType, typename RhsType>
+void ensure_equals(const LhsType *lhs_begin, const LhsType *lhs_end,
+                   const RhsType *rhs_begin, const RhsType *rhs_end)
+{
+    ensure_equals("Ranges are not equal", lhs_begin, lhs_end, rhs_begin, rhs_end);
+}
+
 /**
  * Tests two objects for being at most in given distance one from another.
  * Borders are excluded.
@@ -143,15 +234,15 @@ void ensure_distance(const M& msg, const T& actual, const T& expected, const T&
 {
     if (expected-distance >= actual || expected+distance <= actual)
     {
-        std::stringstream ss;
+        std::ostringstream ss;
         detail::msg_prefix(ss,msg)
-            << " expected ("
+            << " expected `"
             << expected-distance
-            << " - "
+            << "` - `"
             << expected+distance
-            << ") actual '"
+            << "` actual `"
             << actual
-            << '\'';
+            << "`";
         throw failure(ss.str());
     }
 }
@@ -169,7 +260,7 @@ void ensure_errno(const M& msg, bool cond)
     {
 #if defined(TUT_USE_POSIX)
         char e[512];
-        std::stringstream ss;
+        std::ostringstream ss;
         detail::msg_prefix(ss,msg)
            << strerror_r(errno, e, sizeof(e));
         throw failure(ss.str());
@@ -193,6 +284,20 @@ void fail(const M& msg)
     throw failure(msg);
 }
 
+/**
+ * Mark test case as known failure and skip execution.
+ */
+void skip(const char* msg = "")
+{
+    throw skipped(msg);
+}
+
+template<typename M>
+void skip(const M& msg)
+{
+    throw skipped(msg);
+}
+
 } // end of namespace
 
 }
diff --git a/tests/tut/tut_config.hpp b/tests/tut/tut_config.hpp
new file mode 100644 (file)
index 0000000..d698c1c
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef TUT_CONFIG_H_GUARD
+#define TUT_CONFIG_H_GUARD
+
+#define TUT_USE_RTTI 1
+
+#endif
index 3c3739be49bdc48e15d62096a1a5007e4d4d08cb..33856db864bec88b3d1c5fdf4b9428d34c505f7d 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef TUT_CONSOLE_REPORTER
 #define TUT_CONSOLE_REPORTER
-
 #include <tut/tut.hpp>
 #include <cassert>
 
@@ -17,29 +16,32 @@ std::ostream& operator<<(std::ostream& os, const tut::test_result& tr)
 {
     switch(tr.result)
     {
-    case tut::test_result::ok:
-        os << '.';
-        break;
-    case tut::test_result::fail:
-        os << '[' << tr.test << "=F]";
-        break;
-    case tut::test_result::ex_ctor:
-        os << '[' << tr.test << "=C]";
-        break;
-    case tut::test_result::ex:
-        os << '[' << tr.test << "=X]";
-        break;
-    case tut::test_result::warn:
-        os << '[' << tr.test << "=W]";
-        break;
-    case tut::test_result::term:
-        os << '[' << tr.test << "=T]";
-        break;
-    case tut::test_result::rethrown:
-        os << '[' << tr.test << "=P]";
-        break;
-    case tut::test_result::dummy:
-        assert(!"Should never be called");
+        case tut::test_result::ok:
+            os << '.';
+            break;
+        case tut::test_result::fail:
+            os << '[' << tr.test << "=F]";
+            break;
+        case tut::test_result::ex_ctor:
+            os << '[' << tr.test << "=C]";
+            break;
+        case tut::test_result::ex:
+            os << '[' << tr.test << "=X]";
+            break;
+        case tut::test_result::warn:
+            os << '[' << tr.test << "=W]";
+            break;
+        case tut::test_result::term:
+            os << '[' << tr.test << "=T]";
+            break;
+        case tut::test_result::rethrown:
+            os << '[' << tr.test << "=P]";
+            break;
+        case tut::test_result::skipped:
+            os << '[' << tr.test << "=S]";
+            break;
+        case tut::test_result::dummy:
+            throw tut::tut_error("console reporter called for dummy test result");
     }
 
     return os;
@@ -60,6 +62,8 @@ class console_reporter : public tut::callback
     not_passed_list not_passed;
     std::ostream& os;
 
+    console_reporter(const console_reporter &);
+    console_reporter &operator=(const console_reporter &);
 public:
 
     int ok_count;
@@ -67,15 +71,33 @@ public:
     int failures_count;
     int terminations_count;
     int warnings_count;
+    int skipped_count;
 
     console_reporter()
-        : os(std::cout)
+        : current_group(),
+          not_passed(),
+          os(std::cout),
+          ok_count(0),
+          exceptions_count(0),
+          failures_count(0),
+          terminations_count(0),
+          warnings_count(0),
+          skipped_count(0)
     {
         init();
     }
 
     console_reporter(std::ostream& out)
-        : os(out)
+        : current_group(),
+          not_passed(),
+          os(out),
+          ok_count(0),
+          exceptions_count(0),
+          failures_count(0),
+          terminations_count(0),
+          warnings_count(0),
+          skipped_count(0)
+
     {
         init();
     }
@@ -114,11 +136,15 @@ public:
             case test_result::term:
                 terminations_count++;
                 break;
+            case test_result::skipped:
+                skipped_count++;
+                break;
             case tut::test_result::dummy:
-                assert(!"Should never be called");
+                assert( (tr.result != tut::test_result::dummy) && "Should never be called");
         } // switch
 
-        if (tr.result != tut::test_result::ok)
+        if ( (tr.result != tut::test_result::ok) &&
+             (tr.result != tut::test_result::skipped) )
         {
             not_passed.push_back(tr);
         }
@@ -181,12 +207,12 @@ public:
                 {
                     if (tr.result == test_result::fail)
                     {
-                        os << "     failed assertion: \"" << tr.message << "\""
+                        os << "     failed assertion: `" << tr.message << "`"
                             << std::endl;
                     }
                     else
                     {
-                        os << "     message: \"" << tr.message << "\""
+                        os << "     message: `" << tr.message << "`"
                             << std::endl;
                     }
                 }
@@ -214,11 +240,17 @@ public:
         {
             os << " warnings:" << warnings_count;
         }
+
         os << " ok:" << ok_count;
+
+        if(skipped_count > 0)
+        {
+            os << " skipped:" << skipped_count;
+        }
         os << std::endl;
     }
 
-    bool all_ok() const
+    virtual bool all_ok() const
     {
         return not_passed.empty();
     }
@@ -232,6 +264,7 @@ private:
         failures_count = 0;
         terminations_count = 0;
         warnings_count = 0;
+        skipped_count = 0;
         not_passed.clear();
     }
 };
index 3b9f38c19c96976db6baf6bd8c0700feb1dbd665..62646b09bd03ea17fbfc9a0639624cbfa49d04b0 100644 (file)
@@ -7,6 +7,7 @@
 #include <fstream>\r
 #include <vector>\r
 #include <stdexcept>\r
+#include <memory>\r
 \r
 namespace tut\r
 {\r
@@ -16,72 +17,60 @@ namespace tut
  */\r
 class cppunit_reporter : public tut::callback\r
 {\r
-    private:\r
-        std::vector<tut::test_result> failed_tests;\r
-        std::vector<tut::test_result> passed_tests;\r
-        std::string filename;\r
+    std::vector<tut::test_result> failed_tests_;\r
+    std::vector<tut::test_result> passed_tests_;\r
+    const std::string filename_;\r
+    std::auto_ptr<std::ostream> stream_;\r
 \r
-        std::string encode(const std::string & text)\r
-        {\r
-            std::string out;\r
 \r
-            for (unsigned int i=0; i<text.length(); ++i) {\r
-                char c = text[i];\r
-                switch (c) {\r
-                    case '<':\r
-                        out += "&lt;";\r
-                        break;\r
-                    case '>':\r
-                        out += "&gt;";\r
-                        break;\r
-                    case '&':\r
-                        out += "&amp;";\r
-                        break;\r
-                    case '\'':\r
-                        out += "&apos;";\r
-                        break;\r
-                    case '"':\r
-                        out += "&quot;";\r
-                        break;\r
-                    default:\r
-                        out += c;\r
-                }\r
-            }\r
-\r
-            return out;\r
-        }\r
+    cppunit_reporter(const cppunit_reporter &);\r
+    cppunit_reporter &operator=(const cppunit_reporter &);\r
 \r
 public:\r
+    explicit cppunit_reporter(const std::string &filename = "testResult.xml")\r
+        : failed_tests_(),\r
+          passed_tests_(),\r
+          filename_(filename),\r
+          stream_(new std::ofstream(filename_.c_str()))\r
+    {\r
+        if (!stream_->good()) {\r
+            throw tut_error("Cannot open output file `" + filename_ + "`");\r
+        }\r
+    }\r
 \r
-    cppunit_reporter(const std::string & _filename = "")\r
+    explicit cppunit_reporter(std::ostream &stream)\r
+        : failed_tests_(),\r
+          passed_tests_(),\r
+          filename_(),\r
+          stream_(&stream)\r
     {\r
-        setFilename(_filename);\r
     }\r
 \r
-    void setFilename(const std::string & _filename)\r
+    ~cppunit_reporter()\r
     {\r
-        if (_filename == "")\r
-        {\r
-            filename = "testResult.xml";\r
-        }\r
-        else\r
+        if(filename_.empty())\r
         {\r
-            filename = _filename;\r
+            stream_.release();\r
         }\r
     }\r
 \r
     void run_started()\r
     {\r
-        failed_tests.clear();\r
-        passed_tests.clear();\r
+        failed_tests_.clear();\r
+        passed_tests_.clear();\r
     }\r
 \r
     void test_completed(const tut::test_result& tr)\r
     {\r
-        if (tr.result == test_result::ok) {\r
-            passed_tests.push_back(tr);\r
-        } else {\r
-            failed_tests.push_back(tr);\r
+        assert(tr.result != test_result::dummy );\r
+        if ( (tr.result == test_result::ok) ||\r
+             (tr.result == test_result::skipped) )\r
+        {\r
+            passed_tests_.push_back(tr);\r
+        }\r
+        else\r
+        {\r
+            failed_tests_.push_back(tr);\r
         }\r
     }\r
 \r
@@ -91,23 +80,18 @@ public:
         int failures = 0;\r
         std::string failure_type;\r
         std::string failure_msg;\r
-        std::ofstream xmlfile;\r
-\r
-        xmlfile.open(filename.c_str(), std::ios::in | std::ios::trunc);\r
-        if (!xmlfile.is_open()) {\r
-            throw (std::runtime_error("Cannot open file for output"));\r
-        }\r
 \r
-        /* *********************** header ***************************** */\r
-        xmlfile << "<?xml version=\"1.0\" encoding='ISO-8859-1' standalone='yes' ?>" << std::endl\r
-                << "<TestRun>" << std::endl;\r
+        *stream_ << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" << std::endl\r
+                 << "<TestRun>" << std::endl;\r
 \r
-        /* *********************** failed tests ***************************** */\r
-        if (failed_tests.size() > 0) {\r
-            xmlfile << "  <FailedTests>" << std::endl;\r
+        if (failed_tests_.size() > 0)\r
+        {\r
+            *stream_ << "  <FailedTests>" << std::endl;\r
 \r
-            for (unsigned int i=0; i<failed_tests.size(); i++) {\r
-                switch (failed_tests[i].result) {\r
+            for (unsigned int i=0; i<failed_tests_.size(); i++)\r
+            {\r
+                switch (failed_tests_[i].result)\r
+                {\r
                     case test_result::fail:\r
                         failure_type = "Assertion";\r
                         failure_msg  = "";\r
@@ -115,84 +99,117 @@ public:
                         break;\r
                     case test_result::ex:\r
                         failure_type = "Assertion";\r
-                        failure_msg  = "Thrown exception: " + failed_tests[i].exception_typeid + '\n';\r
+                        failure_msg  = "Thrown exception: " + failed_tests_[i].exception_typeid + '\n';\r
                         failures++;\r
                         break;\r
                     case test_result::warn:\r
                         failure_type = "Assertion";\r
-                        failure_msg  = "Destructor failed.\n";\r
+                        failure_msg  = "Destructor failed\n";\r
                         failures++;\r
                         break;\r
                     case test_result::term:\r
                         failure_type = "Error";\r
-                        failure_msg  = "Test application terminated abnormally.\n";\r
+                        failure_msg  = "Test application terminated abnormally\n";\r
                         errors++;\r
                         break;\r
                     case test_result::ex_ctor:\r
                         failure_type = "Error";\r
-                        failure_msg  = "Constructor has thrown an exception: " + failed_tests[i].exception_typeid + '\n';\r
+                        failure_msg  = "Constructor has thrown an exception: " + failed_tests_[i].exception_typeid + '\n';\r
                         errors++;\r
                         break;\r
                     case test_result::rethrown:\r
                         failure_type = "Assertion";\r
-                        failure_msg  = "Child failed";\r
+                        failure_msg  = "Child failed\n";\r
                         failures++;\r
                         break;\r
-                    default:\r
+                    default: // ok, skipped, dummy\r
                         failure_type = "Error";\r
                         failure_msg  = "Unknown test status, this should have never happened. "\r
-                                       "You may just have found a BUG in TUT CppUnit reporter, please report it immediately.\n";\r
+                                       "You may just have found a bug in TUT, please report it immediately.\n";\r
                         errors++;\r
                         break;\r
                 }\r
 \r
-                xmlfile << "    <FailedTest id=\"" << failed_tests[i].test << "\">" << std::endl\r
-                        << "      <Name>" << encode(failed_tests[i].group) + "::" + encode(failed_tests[i].name) << "</Name>" << std::endl\r
-                        << "      <FailureType>" << failure_type << "</FailureType>" << std::endl\r
-                        << "      <Location>" << std::endl\r
-                        << "        <File>Unknown</File>" << std::endl\r
-                        << "        <Line>Unknown</Line>" << std::endl\r
-                        << "      </Location>" << std::endl\r
-                        << "      <Message>" << encode(failure_msg + failed_tests[i].message) << "</Message>" << std::endl\r
-                        << "    </FailedTest>" << std::endl;\r
+                *stream_ << "    <FailedTest id=\"" << failed_tests_[i].test << "\">" << std::endl\r
+                            << "      <Name>" << encode(failed_tests_[i].group) + "::" + encode(failed_tests_[i].name) << "</Name>" << std::endl\r
+                            << "      <FailureType>" << failure_type << "</FailureType>" << std::endl\r
+                            << "      <Location>" << std::endl\r
+                            << "        <File>Unknown</File>" << std::endl\r
+                            << "        <Line>Unknown</Line>" << std::endl\r
+                            << "      </Location>" << std::endl\r
+                            << "      <Message>" << encode(failure_msg + failed_tests_[i].message) << "</Message>" << std::endl\r
+                            << "    </FailedTest>" << std::endl;\r
             }\r
 \r
-            xmlfile << "  </FailedTests>" << std::endl;\r
+            *stream_ << "  </FailedTests>" << std::endl;\r
         }\r
 \r
         /* *********************** passed tests ***************************** */\r
-        if (passed_tests.size() > 0) {\r
-            xmlfile << "  <SuccessfulTests>" << std::endl;\r
-\r
-            for (unsigned int i=0; i<passed_tests.size(); i++) {\r
-                xmlfile << "    <Test id=\"" << passed_tests[i].test << "\">" << std::endl\r
-                        << "      <Name>" << encode(passed_tests[i].group) + "::" + encode(passed_tests[i].name) << "</Name>" << std::endl\r
-                        << "    </Test>" << std::endl;\r
+        if (passed_tests_.size() > 0) {\r
+            *stream_ << "  <SuccessfulTests>" << std::endl;\r
+\r
+            for (unsigned int i=0; i<passed_tests_.size(); i++)\r
+            {\r
+                *stream_ << "    <Test id=\"" << passed_tests_[i].test << "\">" << std::endl\r
+                            << "      <Name>" << encode(passed_tests_[i].group) + "::" + encode(passed_tests_[i].name) << "</Name>" << std::endl\r
+                            << "    </Test>" << std::endl;\r
             }\r
 \r
-            xmlfile << "  </SuccessfulTests>" << std::endl;\r
+            *stream_ << "  </SuccessfulTests>" << std::endl;\r
         }\r
 \r
         /* *********************** statistics ***************************** */\r
-        xmlfile << "  <Statistics>" << std::endl\r
-                << "    <Tests>" << (failed_tests.size() + passed_tests.size()) << "</Tests>" << std::endl\r
-                << "    <FailuresTotal>" << failed_tests.size() << "</FailuresTotal>" << std::endl\r
-                << "    <Errors>" << errors << "</Errors>" << std::endl\r
-                << "    <Failures>" << failures << "</Failures>" << std::endl\r
-                << "  </Statistics>" << std::endl;\r
+        *stream_ << "  <Statistics>" << std::endl\r
+                    << "    <Tests>" << (failed_tests_.size() + passed_tests_.size()) << "</Tests>" << std::endl\r
+                    << "    <FailuresTotal>" << failed_tests_.size() << "</FailuresTotal>" << std::endl\r
+                    << "    <Errors>" << errors << "</Errors>" << std::endl\r
+                    << "    <Failures>" << failures << "</Failures>" << std::endl\r
+                    << "  </Statistics>" << std::endl;\r
 \r
         /* *********************** footer ***************************** */\r
-        xmlfile << "</TestRun>" << std::endl;\r
-\r
-        xmlfile.close();\r
+        *stream_ << "</TestRun>" << std::endl;\r
     }\r
 \r
-    bool all_ok() const\r
+    virtual bool all_ok() const\r
     {\r
-        return failed_tests.empty();\r
-    };\r
+        return failed_tests_.empty();\r
+    }\r
 \r
+    /**\r
+     * \brief Encodes text to XML\r
+     * XML-reserved characters (e.g. "<") are encoded according to specification\r
+     * @param text text to be encoded\r
+     * @return encoded string\r
+     */\r
+    static std::string encode(const std::string & text)\r
+    {\r
+        std::string out;\r
+\r
+        for (unsigned int i=0; i<text.length(); ++i) {\r
+            char c = text[i];\r
+            switch (c) {\r
+                case '<':\r
+                    out += "&lt;";\r
+                    break;\r
+                case '>':\r
+                    out += "&gt;";\r
+                    break;\r
+                case '&':\r
+                    out += "&amp;";\r
+                    break;\r
+                case '\'':\r
+                    out += "&apos;";\r
+                    break;\r
+                case '"':\r
+                    out += "&quot;";\r
+                    break;\r
+                default:\r
+                    out += c;\r
+            }\r
+        }\r
 \r
+        return out;\r
+    }\r
 };\r
 \r
 }\r
index c5c88cb231ba6010cc5008d58ecc17ffa971fa05..1ebea341d3db0af0f1c23f6ef1585726d25e3c3f 100644 (file)
@@ -12,7 +12,7 @@ namespace tut
  */
 struct tut_error : public std::exception
 {
-    tut_error(const std::string& msg)
+    explicit tut_error(const std::string& msg)
         : err_msg(msg)
     {
     }
@@ -22,6 +22,11 @@ struct tut_error : public std::exception
         return test_result::ex;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::tut_error";
+    }
+
     const char* what() const throw()
     {
         return err_msg.c_str();
@@ -32,8 +37,9 @@ struct tut_error : public std::exception
     }
 
 private:
+    void operator=(const tut_error &);
 
-    std::string err_msg;
+    const std::string err_msg;
 };
 
 /**
@@ -41,23 +47,48 @@ private:
  */
 struct no_such_group : public tut_error
 {
-    no_such_group(const std::string& grp)
+    explicit no_such_group(const std::string& grp)
         : tut_error(grp)
     {
     }
 
+    virtual std::string type() const
+    {
+        return "tut::no_such_group";
+    }
+
     ~no_such_group() throw()
     {
     }
 };
 
+/**
+ * Test not found exception.
+ */
+struct no_such_test : public tut_error
+{
+    explicit no_such_test(const std::string& grp)
+        : tut_error(grp)
+    {
+    }
+
+    virtual std::string type() const
+    {
+        return "tut::no_such_test";
+    }
+
+    ~no_such_test() throw()
+    {
+    }
+};
+
 /**
  * Internal exception to be throwed when
  * test constructor has failed.
  */
 struct bad_ctor : public tut_error
 {
-    bad_ctor(const std::string& msg)
+    explicit bad_ctor(const std::string& msg)
         : tut_error(msg)
     {
     }
@@ -67,6 +98,11 @@ struct bad_ctor : public tut_error
         return test_result::ex_ctor;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::bad_ctor";
+    }
+
     ~bad_ctor() throw()
     {
     }
@@ -77,7 +113,7 @@ struct bad_ctor : public tut_error
  */
 struct failure : public tut_error
 {
-    failure(const std::string& msg)
+    explicit failure(const std::string& msg)
         : tut_error(msg)
     {
     }
@@ -87,6 +123,11 @@ struct failure : public tut_error
         return test_result::fail;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::failure";
+    }
+
     ~failure() throw()
     {
     }
@@ -97,7 +138,7 @@ struct failure : public tut_error
  */
 struct warning : public tut_error
 {
-    warning(const std::string& msg)
+    explicit warning(const std::string& msg)
         : tut_error(msg)
     {
     }
@@ -107,6 +148,11 @@ struct warning : public tut_error
         return test_result::warn;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::warning";
+    }
+
     ~warning() throw()
     {
     }
@@ -117,7 +163,7 @@ struct warning : public tut_error
  */
 struct seh : public tut_error
 {
-    seh(const std::string& msg)
+    explicit seh(const std::string& msg)
         : tut_error(msg)
     {
     }
@@ -127,6 +173,11 @@ struct seh : public tut_error
         return test_result::term;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::seh";
+    }
+
     ~seh() throw()
     {
     }
@@ -147,6 +198,11 @@ struct rethrown : public failure
         return test_result::rethrown;
     }
 
+    virtual std::string type() const
+    {
+        return "tut::rethrown";
+    }
+
     ~rethrown() throw()
     {
     }
@@ -154,6 +210,28 @@ struct rethrown : public failure
     const test_result tr;
 };
 
+struct skipped : public tut_error
+{
+    explicit skipped(const std::string& msg)
+        : tut_error(msg)
+    {
+    }
+
+    virtual test_result::result_type result() const
+    {
+        return test_result::skipped;
+    }
+
+    virtual std::string type() const
+    {
+        return "tut::skipped";
+    }
+
+    ~skipped() throw()
+    {
+    }
+};
+
 }
 
 #endif
diff --git a/tests/tut/tut_fpt.hpp b/tests/tut/tut_fpt.hpp
new file mode 100644 (file)
index 0000000..e8df8b0
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * @brief  Additional ensures for scientific/engineering applications.
+ * @author Joerg <yogi2005@users.sourceforge.net>
+ * @date   07/04/2008
+ */
+#ifndef TUT_Float_H_GUARD
+#define TUT_Float_H_GUARD
+
+#include <limits>
+#include <iostream>
+
+namespace tut
+{
+    namespace detail
+    {
+        template<bool Predicate, typename Then, typename Else>
+        struct If
+        {
+            typedef Else type;
+        };
+
+        template<typename Then, typename Else>
+        struct If<true,Then,Else>
+        {
+            typedef Then type;
+        };
+
+        template<typename T>
+        struct fpt_traits
+        {
+            struct StdNumericLimitsNotAvailable {};
+            static const StdNumericLimitsNotAvailable static_check[ std::numeric_limits<T>::is_specialized ];
+
+            static const T zero;
+
+            typedef typename If<std::numeric_limits<T>::is_integer,
+                                double,
+                                T>::type Result;
+
+            static T abs(const T &arg)
+            {
+                if(arg < zero)
+                    return zero - arg;
+                else
+                    return arg;
+            }
+
+            static T sig(const T &arg)
+            {
+                if(arg < zero)
+                    return -1;
+                else
+                    return 1;
+            }
+
+            static inline Result div(const Result &number, const T &divisor)
+            {
+                static_cast<void>(static_check);
+
+                if(number == zero && divisor == zero)
+                    return std::numeric_limits<Result>::quiet_NaN();
+
+                if(number == zero)
+                    return zero;
+
+                if(divisor == zero)
+                    return sig(number) * std::numeric_limits<Result>::infinity();
+
+                assert(zero < number);
+                assert(zero < divisor);
+
+                // Avoid underflow
+                if(static_cast<T>(1) < abs(divisor))
+                {
+                    // number / divisor < min <=> number < min * divisor
+                    if( abs(number) < abs(divisor) * std::numeric_limits<T>::min())
+                    {
+                        return sig(divisor) * sig(number) * std::numeric_limits<T>::min();
+                    }
+                }
+
+                // Avoid overflow
+                if( abs(divisor) < static_cast<T>(1))
+                {
+                    // number / divisor > max <=> number > max * divisor
+                    if( abs(divisor) * std::numeric_limits<T>::max() < abs(number))
+                    {
+                        return sig(divisor) * sig(number) * std::numeric_limits<T>::max();
+                    }
+                }
+
+                return number / divisor;
+            }
+        };
+
+        template<typename T>
+        const typename fpt_traits<T>::StdNumericLimitsNotAvailable
+            fpt_traits<T>::static_check[ std::numeric_limits<T>::is_specialized ] = { {} };
+
+        template<typename T>
+        const T fpt_traits<T>::zero = static_cast<T>(0);
+
+        template<typename T, typename U>
+        bool check_tolerance(T actual, T expected, U fraction)
+        {
+            typename fpt_traits<T>::Result diff = fpt_traits<T>::div( fpt_traits<T>::abs( expected - actual ),
+                                                                      fpt_traits<T>::abs( expected ) );
+
+            return (diff == fraction) || (diff < fraction);
+        }
+
+    } // namespace detail
+
+    template<typename T, typename U>
+    void ensure_close(const char* msg, const T& actual, const T& expected, const U& tolerance )
+    {
+        typedef detail::fpt_traits<U> Traits;
+
+        typename Traits::Result fraction = Traits::div( Traits::abs(static_cast<typename Traits::Result>(tolerance)),
+                                                        static_cast<typename Traits::Result>(100) );
+        if( !detail::check_tolerance(actual, expected, fraction) )
+        {
+            std::ostringstream ss;
+            ss << ( msg ? msg : "" )
+            << ( msg ? ": " : "" )
+            << "expected `"
+            << expected
+            << "` and actual `"
+            << actual
+            << "` differ more than "
+            << tolerance
+            << "%";
+             throw failure( ss.str().c_str() );
+        }
+    }
+
+    template<typename T, typename Tolerance>
+    void ensure_close(const T& actual, const T& expected, const Tolerance& tolerance )
+    {
+        ensure_close( 0, actual, expected, tolerance );
+    }
+
+    template<typename T, typename U>
+    void ensure_close_fraction(const char* msg, const T& actual, const T& expected, const U& fraction)
+    {
+        typedef char StdNumericLimitsNotAvailable;
+        const StdNumericLimitsNotAvailable static_check[ std::numeric_limits<U>::is_specialized ] = { 0 };
+        static_cast<void>(static_check);
+
+        typedef typename detail::If<std::numeric_limits<U>::is_integer,
+                                    double,
+                                    U>::type Tolerance;
+
+        if( !detail::check_tolerance(actual, expected, fraction) )
+        {
+            std::ostringstream ss;
+            ss << ( msg ? msg : "" )
+            << ( msg ? ": " : "" )
+            << "expected `"
+            << expected
+            << "` and actual `"
+            << actual
+            << "` differ more than fraction `"
+            << fraction
+            << "`";
+            throw failure( ss.str().c_str() );
+        }
+    }
+
+    template<typename T>
+    void ensure_close_fraction( const char* msg, const T& actual, const T& expected, const int& tolerance )
+    {
+        ensure_close(msg, actual, expected, double(tolerance));
+    }
+
+    template< typename T, typename Tolerance>
+    void ensure_close_fraction(const T& actual, const T& expected, const Tolerance& fraction)
+    {
+        ensure_close_fraction( 0, actual, expected, fraction );
+    }
+
+} // namespace tut
+
+#endif
+
diff --git a/tests/tut/tut_macros.hpp b/tests/tut/tut_macros.hpp
new file mode 100644 (file)
index 0000000..ed517d6
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef TUT_MACROS_HPP
+#define TUT_MACROS_HPP
+
+#include <tut/tut.hpp>
+
+#ifdef ensure_THROW
+#error ensure_THROW macro is already defined
+#endif
+
+/** Helper macros to ensure that a call throws exception.
+ * \code
+ *  #include <tut_macros.h>
+ *  ensure_THROW( this_function_should_throw_bad_alloc(), std::bad_alloc );
+ * \endcode
+ */
+#define ensure_THROW( x, e ) \
+try         \
+{           \
+    x;      \
+    fail(#x " has not thrown expected exception " #e); \
+}                \
+catch(const e &) \
+{                \
+}                \
+catch(const std::exception &ex)  \
+{           \
+    fail( std::string(#x " has thrown unexpected exception ")+tut::type_name(ex)+": "+ex.what()); \
+} \
+catch(...)       \
+{                \
+    fail(#x " has thrown unexpected unknown exception"); \
+}
+
+#ifdef ensure_NO_THROW
+#error ensure_NO_THROW macro is already defined
+#endif
+
+/** Helper macro to ensure a call does not throw any exceptions.
+ * \code
+ *  #include <tut_macros.h>
+ *  ensure_NO_THROW( this_function_should_never_throw() );
+ * \endcode
+ */
+#define ensure_NO_THROW( x ) \
+try         \
+{           \
+    x;      \
+}           \
+catch(const std::exception &ex)  \
+{           \
+    fail( std::string(#x " has thrown unexpected exception ")+tut::type_name(ex)+": "+ex.what()); \
+} \
+catch(...)  \
+{           \
+    fail(#x " has thrown unexpected unknown exception"); \
+}
+
+#ifdef __COUNTER__
+#define TUT_TESTCASE(object) template<> template<> void object::test<__COUNTER__>()
+#endif
+
+#endif
+
diff --git a/tests/tut/tut_main.hpp b/tests/tut/tut_main.hpp
new file mode 100644 (file)
index 0000000..c6955bb
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef TUT_MAIN_H
+#define TUT_MAIN_H
+
+#include <tut/tut.hpp>
+#include <tut/tut_console_reporter.hpp>
+#include <tut/tut_cppunit_reporter.hpp>
+#include <iostream>
+#include <cstring>
+
+namespace tut
+{
+
+/** Helper function to make test binaries simpler.
+ *
+ * Example of basic usage follows.
+ *
+ * @code
+ *  namespace tut { test_runner_singleton runner; }
+ *
+ *  int main(int argc, char **argv)
+ *  {
+ *      if( tut_main(argc, argv) )
+ *          return 0;
+ *      else
+ *          return -1;
+ *  }
+ * @endcode
+ *
+ * It is also possible to do some generic initialization before
+ * running any tests and cleanup before exiting application.
+ * Note that tut_main can throw tut::no_such_group or tut::no_such_test.
+ *
+ * @code
+ *  namespace tut { test_runner_singleton runner; }
+ *
+ *  int main(int argc, char **argv)
+ *  {
+ *      tut::xml_reporter reporter;
+ *      tut::runner.get().insert_callback(&reporter);
+ *
+ *      MyInit();
+ *      try
+ *      {
+ *          tut_main(argc, argv);
+ *      }
+ *      catch(const tut::tut_error &ex)
+ *      {
+ *          std::cerr << "TUT error: " << ex.what() << std::endl;
+ *      }
+ *      MyCleanup();
+ *  }
+ * @endcode
+ */
+inline bool tut_main(int argc, const char * const * const argv, std::ostream &os = std::cerr)
+{
+    std::stringstream usage;
+    usage << "Usage: " << argv[0] << " [group] [testcase]" << std::endl;
+    groupnames gr = runner.get().list_groups();
+    usage << "Available test groups:" << std::endl;
+    for(groupnames::const_iterator i = gr.begin(); i != gr.end(); ++i)
+    {
+        usage << "    " << *i << std::endl;
+    }
+
+    if(argc>1)
+    {
+        if(std::string(argv[1]) == "-h" ||
+           std::string(argv[1]) == "--help" ||
+           std::string(argv[1]) == "/?" ||
+           argc > 3)
+        {
+            os << usage.rdbuf();
+            return false;
+        }
+    }
+
+    // Check command line options.
+    switch(argc)
+    {
+        case 1:
+            runner.get().run_tests();
+        break;
+
+        case 2:
+            runner.get().run_tests(argv[1]);
+        break;
+
+        case 3:
+        {
+            char *end;
+            int t = strtol(argv[2], &end, 10);
+            if(end != argv[2] + strlen(argv[2]))
+            {
+                throw no_such_test("`" + std::string(argv[2]) + "` should be a number");
+            }
+
+            test_result tr;
+            if(!runner.get().run_test(argv[1], t, tr) || tr.result == test_result::dummy)
+            {
+                throw no_such_test("No testcase `" + std::string(argv[2]) + "` in group `" + argv[1] + "`");
+            }
+        }
+        break;
+    }
+
+    return true;
+} // tut_main()
+
+}
+
+#endif
index 89a713053c08946aef2dd8173719d4145590d5b2..c7cfe57a42628ed080dda70bac26e101e2f3c2fc 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef TUT_FORK_H_GUARD
 #define TUT_FORK_H_GUARD
+#include <tut/tut_config.hpp>
 
 #if defined(TUT_USE_POSIX)
 #include <errno.h>
@@ -44,7 +45,7 @@ private:
 
         if(tr.result != test_result::ok)
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << int(tr.result) << "\n"
                 << tr.group << "\n"
                 << tr.test << "\n"
@@ -57,6 +58,10 @@ private:
             ensure_errno("write() failed", w == size);
         }
     }
+
+    virtual ~test_group_posix()
+    {
+    }
 };
 
 template<typename T>
@@ -126,7 +131,8 @@ public:
      * Default constructor
      */
     test_object_posix()
-        : pipe_(-1)
+        : pids_(),
+          pipe_(-1)
     {
     }
 
@@ -142,7 +148,7 @@ public:
 
         if(!pids_.empty())
         {
-            std::stringstream ss;
+            std::ostringstream ss;
 
             // in parent, reap children
             for(std::map<pid_t, int>::iterator i = pids_.begin(); i != pids_.end(); ++i)
@@ -226,7 +232,7 @@ private:
             else
             {
                 // cannot kill, we are in trouble
-                std::stringstream ss;
+                std::ostringstream ss;
                 char e[1024];
                 ss << "child " << pid << " could not be killed with SIGTERM, " << strerror_r(errno, e, sizeof(e)) << std::endl;
                 fail(ss.str());
@@ -257,7 +263,7 @@ private:
                 }
                 else
                 {
-                    std::stringstream ss;
+                    std::ostringstream ss;
                     char e[1024];
                     ss << "child " << pid << " could not be killed with SIGKILL, " << strerror_r(errno, e, sizeof(e)) << std::endl;
                     fail(ss.str());
@@ -269,7 +275,7 @@ private:
 
             ensure_equals("child process exists after SIGKILL", ::kill(pid, 0), -1);
 
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child " << pid << " had to be killed with SIGKILL";
             fail(ss.str());
         }
@@ -361,7 +367,7 @@ private:
     {
         if(WIFSIGNALED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child killed by signal " << WTERMSIG(status)
                 << ": expected exit with code " << exit_status;
 
@@ -372,7 +378,7 @@ private:
         {
             if(WEXITSTATUS(status) != exit_status)
             {
-                std::stringstream ss;
+                std::ostringstream ss;
                 ss << "child exited, expected '"
                     << exit_status
                     << "' actual '"
@@ -385,7 +391,7 @@ private:
 
         if(WIFSTOPPED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child stopped by signal " << WTERMSIG(status)
                 << ": expected exit with code " << exit_status;
             throw failure(ss.str().c_str());
@@ -398,7 +404,7 @@ private:
         {
             if(WTERMSIG(status) != signal)
             {
-                std::stringstream ss;
+                std::ostringstream ss;
                 ss << "child killed by signal, expected '"
                     << signal
                     << "' actual '"
@@ -410,7 +416,7 @@ private:
 
         if(WIFEXITED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child exited with code " << WEXITSTATUS(status)
                 << ": expected signal " << signal;
 
@@ -419,7 +425,7 @@ private:
 
         if(WIFSTOPPED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child stopped by signal " << WTERMSIG(status)
                 << ": expected kill by signal " << signal;
 
@@ -453,6 +459,9 @@ namespace tut
 
 struct test_object_posix
 {
+    virtual ~test_object_posix()
+    {
+    }
 };
 
 struct test_group_posix
@@ -461,6 +470,10 @@ struct test_group_posix
     void send_result_(const T*, const test_result &)
     {
     }
+
+    virtual ~test_group_posix()
+    {
+    }
 };
 
 } // namespace tut
index eb6eb00e31e99fbfa25d5ea5f899d637293cd3c7..9f9292349454a9ef9d5afc4daf26c07a82f790c4 100644 (file)
@@ -186,7 +186,7 @@ bool deserialize(std::istream& is, tut::test_result& tr)
     }
     return true;
 }
-};
+}
 
 /**
  * Restartable test runner wrapper.
@@ -207,11 +207,12 @@ public:
      */
     restartable_wrapper(const std::string& dir = ".")
         : runner_(runner.get()),
-          dir_(dir)
+          callbacks_(),
+          dir_(dir),
+          log_( dir + '/' + "log.tut" ),
+          jrn_( dir + '/' + "journal.tut" )
     {
         // dozen: it works, but it would be better to use system path separator
-        jrn_ = dir_ + '/' + "journal.tut";
-        log_ = dir_ + '/' + "log.tut";
     }
 
     /**
index 5731802cb08ec61a1e49a9add460c83685e6ce17..e96078595c877daf969471d14dcb22b891e0f982 100644 (file)
@@ -1,11 +1,42 @@
 #ifndef TUT_RESULT_H_GUARD
 #define TUT_RESULT_H_GUARD
+#include <tut/tut_config.hpp>
 
 #include <string>
 
+#if defined(TUT_USE_RTTI)
+#if (defined(_MSC_VER) && !defined(_CPPRTTI)) || (defined(__GNUC__) && !defined(__GXX_RTTI))
+#undef TUT_USE_RTTI
+#endif
+#endif
+
+#if defined(TUT_USE_RTTI)
+#include <typeinfo>
+#endif
+
 namespace tut
 {
 
+#if defined(TUT_USE_RTTI)
+template<typename T>
+inline std::string type_name(const T& t)
+{
+    return typeid(t).name();
+}
+#else
+template<typename T>
+inline std::string type_name(const T& t)
+{
+    return "Unknown type, RTTI disabled";
+}
+
+inline std::string type_name(const std::exception&)
+{
+    return "Unknown std::exception, RTTI disabled";
+}
+#endif
+
+
 #if defined(TUT_USE_POSIX)
 struct test_result_posix
 {
@@ -14,11 +45,18 @@ struct test_result_posix
     {
     }
 
+    virtual ~test_result_posix()
+    {
+    }
+
     pid_t pid;
 };
 #else
 struct test_result_posix
 {
+    virtual ~test_result_posix()
+    {
+    }
 };
 #endif
 
@@ -46,22 +84,19 @@ struct test_result : public test_result_posix
     std::string name;
 
     /**
-     * ok - test finished successfully
-     * fail - test failed with ensure() or fail() methods
-     * ex - test throwed an exceptions
-     * warn - test finished successfully, but test destructor throwed
-     * term - test forced test application to terminate abnormally
+     * result of a test 
      */
     enum result_type
     {
-        ok,
-        fail,
-        ex,
-        warn,
-        term,
-        ex_ctor,
-        rethrown,
-        dummy
+        ok,       ///< test finished successfully
+        fail,     ///< test failed with ensure() or fail() methods
+        ex,       ///< test throwed an exceptions
+        warn,     ///< test finished successfully, but test destructor throwed
+        term,     ///< test forced test application to terminate abnormally
+        ex_ctor,  ///< 
+        rethrown, ///< 
+        skipped,  ///< 
+        dummy     ///< 
     };
 
     result_type result;
@@ -76,8 +111,12 @@ struct test_result : public test_result_posix
      * Default constructor.
      */
     test_result()
-        : test(0),
-          result(ok)
+        : group(),
+          test(0),
+          name(),
+          result(ok),
+          message(),
+          exception_typeid()
     {
     }
 
@@ -89,7 +128,9 @@ struct test_result : public test_result_posix
         : group(grp),
           test(pos),
           name(test_name),
-          result(res)
+          result(res),
+          message(),
+          exception_typeid()
     {
     }
 
@@ -104,7 +145,7 @@ struct test_result : public test_result_posix
           name(test_name),
           result(res),
           message(ex.what()),
-          exception_typeid(typeid(ex).name())
+          exception_typeid(type_name(ex))
     {
     }
 
@@ -122,6 +163,10 @@ struct test_result : public test_result_posix
           exception_typeid(ex_typeid)
     {
     }
+
+    virtual ~test_result()
+    {
+    }
 };
 
 }
index 33ffe4231124b6f08ad208f6596f2e85ae71988b..3803046e8cd5989a912fb0d70817dfe0365c3492 100644 (file)
@@ -62,24 +62,27 @@ struct callback
      * Called when a group started
      * @param name Name of the group
      */
-    virtual void group_started(const std::string& /*name*/)
+    virtual void group_started(const std::string& name)
     {
+        (void)name;
     }
 
     /**
      * Called when a test finished.
      * @param tr Test results.
      */
-    virtual void test_completed(const test_result& /*tr*/)
+    virtual void test_completed(const test_result& tr)
     {
+        (void)tr;
     }
 
     /**
      * Called when a group is completed
      * @param name Name of the group
      */
-    virtual void group_completed(const std::string& /*name*/)
+    virtual void group_completed(const std::string& name)
     {
+        (void)name;
     }
 
     /**
@@ -88,6 +91,11 @@ struct callback
     virtual void run_completed()
     {
     }
+
+    virtual bool all_ok() const
+    {
+        return true;
+    }
 private:
     callback(const callback &);
     void operator=(const callback&);
@@ -111,11 +119,15 @@ public:
      * Constructor
      */
     test_runner()
+        : groups_(),
+          callbacks_()
     {
     }
 
     /**
      * Stores another group for getting by name.
+     * @param name new group object
+     * @param gr new callback object
      */
     void register_group(const std::string& name, group_base* gr)
     {
@@ -127,15 +139,16 @@ public:
         if (groups_.find(name) != groups_.end())
         {
             std::string msg("attempt to add already existent group " + name);
-            // this exception terminates application so we use cerr also
-            // TODO: should this message appear in stream?
-            std::cerr << msg << std::endl;
             throw tut_error(msg);
         }
 
         groups_.insert( std::make_pair(name, gr) );
     }
 
+    /**
+     * Stores one callback object.
+     * @param cb new callback object
+     */
     void set_callback(callback *cb)
     {
         clear_callbacks();
@@ -143,7 +156,8 @@ public:
     }
 
     /**
-     * Stores callback object.
+     * Add callback object.
+     * @param cb new callback object
      */
     void insert_callback(callback* cb)
     {
@@ -153,11 +167,18 @@ public:
         }
     }
 
+    /**
+     * Remove callback object.
+     * @param cb callback to remove
+     */
     void erase_callback(callback* cb)
     {
         callbacks_.erase(cb);
     }
 
+    /**
+     * Remove all callback objects.
+     */
     void clear_callbacks()
     {
         callbacks_.clear();
@@ -165,12 +186,17 @@ public:
 
     /**
      * Returns callback list.
+     * @return     callback list
      */
     const callbacks &get_callbacks() const
     {
         return callbacks_;
     }
 
+    /**
+     * Set callback list.
+     * @param cb new callback list
+     */
     void set_callbacks(const callbacks &cb)
     {
         callbacks_ = cb;
@@ -178,23 +204,20 @@ public:
 
     /**
      * Returns list of known test groups.
+     * @return     groups list
      */
     const groupnames list_groups() const
     {
         groupnames ret;
-        const_iterator i = groups_.begin();
-        const_iterator e = groups_.end();
-        while (i != e)
+        for(const_iterator i = groups_.begin(); i != groups_.end(); ++i)
         {
             ret.push_back(i->first);
-            ++i;
         }
         return ret;
     }
 
     /**
      * Runs all tests in all groups.
-     * @param callback Callback object if exists; null otherwise
      */
     void run_tests() const
     {
@@ -216,6 +239,7 @@ public:
 
     /**
      * Runs all tests in specified group.
+     * @param group_name group to test
      */
     void run_tests(const std::string& group_name) const
     {
@@ -236,6 +260,10 @@ public:
 
     /**
      * Runs one test in specified group.
+     * @param group_name group to test
+     * @param n run case in test
+     * @param tr result of this case
+     * @return  true if test is ok, otherwise false
      */
     bool run_test(const std::string& group_name, int n, test_result &tr) const
     {
@@ -356,4 +384,5 @@ extern test_runner_singleton runner;
 
 }
 
-#endif
+#endif // TUT_RUNNER_H_GUARD
+
index 8a9d5deca03ad5e4754a9b987f3e58602d868f61..d0c301dd48b59969f77d609d8ffdf183e9b37fcb 100644 (file)
@@ -1,16 +1,9 @@
-/*
- * tut_xml_reporter.hpp
- *
- * ECOS Library. IPT CS R&D CET ECOS Copyright 2008 Nokia
- * Siemens Networks. All right
- *
- *
- */
-
 #ifndef TUT_XML_REPORTER
 #define TUT_XML_REPORTER
-
+#include <tut/tut_config.hpp>
 #include <tut/tut.hpp>
+#include <tut/tut_cppunit_reporter.hpp>
+#include <cassert>
 #include <string>
 #include <fstream>
 #include <vector>
@@ -26,62 +19,12 @@ namespace tut
  */
 class xml_reporter : public tut::callback
 {
-protected:
     typedef std::vector<tut::test_result> TestResults;
     typedef std::map<std::string, TestResults> TestGroups;
 
-    TestGroups all_tests; /// holds all test results
-    std::string filename; /// filename base
-
-    /**
-     * \brief Initializes object
-     * Resets counters and clears all stored test results.
-     */
-    virtual void init()
-    {
-        ok_count = 0;
-        exceptions_count = 0;
-        failures_count = 0;
-        terminations_count = 0;
-        warnings_count = 0;
-        all_tests.clear();
-    }
-
-    /**
-     * \brief Encodes text to XML
-     * XML-reserved characters (e.g. "<") are encoded according to specification
-     * @param text text to be encoded
-     * @return encoded string
-     */
-    virtual std::string encode(const std::string & text)
-    {
-        std::string out;
-
-        for (unsigned int i=0; i<text.length(); ++i) {
-            char c = text[i];
-            switch (c) {
-                case '<':
-                    out += "&lt;";
-                    break;
-                case '>':
-                    out += "&gt;";
-                    break;
-                case '&':
-                    out += "&amp;";
-                    break;
-                case '\'':
-                    out += "&apos;";
-                    break;
-                case '"':
-                    out += "&quot;";
-                    break;
-                default:
-                    out += c;
-            }
-        }
-
-        return out;
-    }
+    TestGroups all_tests_; /// holds all test results
+    const std::string filename_; /// filename base
+    std::auto_ptr<std::ostream> stream_;
 
     /**
      * \brief Builds "testcase" XML entity with given parameters
@@ -91,7 +34,7 @@ protected:
      * @param failure_msg failure message to be reported (empty, if test passed)
      * @return string with \<testcase\> entity
      */
-    virtual std::string xml_build_testcase(const tut::test_result & tr, const std::string & failure_type,
+    std::string xml_build_testcase(const tut::test_result & tr, const std::string & failure_type,
                                            const std::string & failure_msg, int pid = 0)
     {
         using std::endl;
@@ -99,17 +42,18 @@ protected:
 
         std::ostringstream out;
 
-        if (tr.result == test_result::ok)
+        if ( (tr.result == test_result::ok) ||
+             (tr.result == test_result::skipped) )
         {
-            out << "  <testcase classname=\"" << encode(tr.group) << "\" name=\"" << encode(tr.name) << "\" />";
+            out << "    <testcase classname=\"" << cppunit_reporter::encode(tr.group) << "\" name=\"" << cppunit_reporter::encode(tr.name) << "\"/>";
         }
         else
         {
-            string err_msg = encode(failure_msg + tr.message);
+            string err_msg = cppunit_reporter::encode(failure_msg + tr.message);
 
             string tag; // determines tag name: "failure" or "error"
             if ( tr.result == test_result::fail || tr.result == test_result::warn ||
-                 tr.result == test_result::ex || tr.result == test_result::ex_ctor )
+                 tr.result == test_result::ex || tr.result == test_result::ex_ctor || tr.result == test_result::rethrown )
             {
                 tag = "failure";
             }
@@ -118,16 +62,18 @@ protected:
                 tag = "error";
             }
 
-            out << "  <testcase classname=\"" << encode(tr.group) << "\" name=\"" << encode(tr.name) << "\">" << endl;
-            out << "    <" << tag << " message=\"" << err_msg << "\"" << " type=\"" << failure_type << "\"";
+            out << "    <testcase classname=\"" << cppunit_reporter::encode(tr.group) << "\" name=\"" << cppunit_reporter::encode(tr.name) << "\">" << endl;
+            out << "      <" << tag << " message=\"" << err_msg << "\"" << " type=\"" << failure_type << "\"";
 #if defined(TUT_USE_POSIX)
             if(pid != getpid())
             {
                 out << " child=\"" << pid << "\"";
             }
+#else
+            (void)pid;
 #endif
             out << ">" << err_msg << "</" << tag << ">" << endl;
-            out << "  </testcase>";
+            out << "    </testcase>";
         }
 
         return out.str();
@@ -140,17 +86,17 @@ protected:
      * @param failures number of failures to be reported
      * @param total total number of tests to be reported
      * @param name test suite name
-     * @param testcases encoded XML string containing testcases
+     * @param testcases cppunit_reporter::encoded XML string containing testcases
      * @return string with \<testsuite\> entity
      */
-    virtual std::string xml_build_testsuite(int errors, int failures, int total,
+    std::string xml_build_testsuite(int errors, int failures, int total,
                                             const std::string & name, const std::string & testcases)
     {
         std::ostringstream out;
 
-        out << "<testsuite errors=\"" << errors << "\" failures=\"" << failures << "\" tests=\"" << total << "\" name=\"" << encode(name) << "\">" << std::endl;
+        out << "  <testsuite errors=\"" << errors << "\" failures=\"" << failures << "\" tests=\"" << total << "\" name=\"" << cppunit_reporter::encode(name) << "\">" << std::endl;
         out << testcases;
-        out << "</testsuite>";
+        out << "  </testsuite>";
 
         return out.str();
     }
@@ -165,39 +111,39 @@ public:
     /**
      * \brief Default constructor
      * @param filename base filename
-     * @see setFilenameBase
      */
-    xml_reporter(const std::string & _filename = "")
+    xml_reporter(const std::string & filename)
+        : all_tests_(),
+          filename_(filename),
+          stream_(new std::ofstream(filename_.c_str())),
+          ok_count(0),
+          exceptions_count(0),
+          failures_count(0),
+          terminations_count(0),
+          warnings_count(0)
     {
-        init();
-        setFilenameBase(_filename);
+        if (!stream_->good()) {
+            throw tut_error("Cannot open output file `" + filename_ + "`");
+        }
     }
 
-    /**
-     * \brief Sets filename base for output
-     * @param _filename filename base
-     * Example usage:
-     * @code
-     * xml_reporter reporter;
-     * reporter.setFilenameBase("my_xml");
-     * @endcode
-     * The above code will instruct reporter to create my_xml_1.xml file for the first test group,
-     * my_xml_2.xml file for the second, and so on.
-     */
-    virtual void setFilenameBase(const std::string & _filename)
+    xml_reporter(std::ostream & stream)
+        : all_tests_(),
+          filename_(),
+          stream_(&stream),
+          ok_count(0),
+          exceptions_count(0),
+          failures_count(0),
+          terminations_count(0),
+          warnings_count(0)
     {
-        if (_filename == "")
-        {
-            filename = "testResult";
-        }
-        else
-        {
-            if (_filename.length() > 200)
-            {
-                throw(std::runtime_error("Filename too long!"));
-            }
+    }
 
-            filename = _filename;
+    ~xml_reporter()
+    {
+        if(filename_.empty())
+        {
+            stream_.release();
         }
     }
 
@@ -207,7 +153,12 @@ public:
      */
     virtual void run_started()
     {
-        init();
+        ok_count = 0;
+        exceptions_count = 0;
+        failures_count = 0;
+        terminations_count = 0;
+        warnings_count = 0;
+        all_tests_.clear();
     }
 
     /**
@@ -219,6 +170,7 @@ public:
         // update global statistics
         switch (tr.result) {
             case test_result::ok:
+            case test_result::skipped:
                 ok_count++;
                 break;
             case test_result::fail:
@@ -235,60 +187,52 @@ public:
             case test_result::term:
                 terminations_count++;
                 break;
+            case tut::test_result::dummy:
+                assert(!"Should never be called");
         } // switch
 
         // add test result to results table
-        (all_tests[tr.group]).push_back(tr);
+        all_tests_[tr.group].push_back(tr);
     }
 
     /**
      * \brief Callback function
      * This function is called when all tests are completed. It generates XML output
-     * to file(s). File name base can be set with \ref setFilenameBase.
+     * to file(s). File name base can be set with constructor.
      */
     virtual void run_completed()
     {
-        using std::endl;
-        using std::string;
-
-        static int number = 1;  // results file sequence number (testResult_<number>.xml)
+        /* *********************** header ***************************** */
+        *stream_ << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" << std::endl;
+        *stream_ << "<testsuites>" << std::endl;
 
         // iterate over all test groups
-        TestGroups::const_iterator tgi;
-        for (tgi = all_tests.begin(); tgi != all_tests.end(); ++tgi) {
+        for (TestGroups::const_iterator tgi = all_tests_.begin(); tgi != all_tests_.end(); ++tgi)
+        {
             /* per-group statistics */
             int passed = 0;         // passed in single group
             int exceptions = 0;     // exceptions in single group
             int failures = 0;       // failures in single group
             int terminations = 0;   // terminations in single group
             int warnings = 0;       // warnings in single group
-            int errors = 0;     // errors in single group
+            int errors = 0;         // errors in single group
 
-            /* generate output filename */
-            char fn[256];
-            sprintf(fn, "%s_%d.xml", filename.c_str(), number++);
-
-            std::ofstream xmlfile;
-            xmlfile.open(fn, std::ios::in | std::ios::trunc);
-            if (!xmlfile.is_open()) {
-                throw (std::runtime_error("Cannot open file for output"));
-            }
-
-            /* *********************** header ***************************** */
-            xmlfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
 
             // output is written to string stream buffer, because JUnit format <testsuite> tag
             // contains statistics, which aren't known yet
             std::ostringstream out;
 
             // iterate over all test cases in the current test group
-            TestResults::const_iterator tri;
-            for (tri = (*tgi).second.begin(); tri != (*tgi).second.end(); ++tri) {
-                string failure_type;    // string describing the failure type
-                string failure_msg;     // a string with failure message
+            const TestResults &results = tgi->second;
+            for (TestResults::const_iterator tri = results.begin(); tri != results.end(); ++tri)
+            {
+                std::string failure_type;    // string describing the failure type
+                std::string failure_msg;     // a string with failure message
 
-                switch ((*tri).result) {
+                switch (tri->result)
+                {
                     case test_result::ok:
+                    case test_result::skipped:
                         passed++;
                         break;
                     case test_result::fail:
@@ -298,7 +242,7 @@ public:
                         break;
                     case test_result::ex:
                         failure_type = "Assertion";
-                        failure_msg  = "Thrown exception: " + (*tri).exception_typeid + '\n';
+                        failure_msg  = "Thrown exception: " + tri->exception_typeid + '\n';
                         exceptions++;
                         break;
                     case test_result::warn:
@@ -313,28 +257,27 @@ public:
                         break;
                     case test_result::ex_ctor:
                         failure_type = "Assertion";
-                        failure_msg  = "Constructor has thrown an exception: " + (*tri).exception_typeid + '\n';
+                        failure_msg  = "Constructor has thrown an exception: " + tri->exception_typeid + ".\n";
                         exceptions++;
                         break;
                     case test_result::rethrown:
                         failure_type = "Assertion";
-                        failure_msg  = "Child failed";
+                        failure_msg  = "Child failed.\n";
                         failures++;
                         break;
                     default:
                         failure_type = "Error";
                         failure_msg  = "Unknown test status, this should have never happened. "
-                                "You may just have found a BUG in TUT XML reporter, please report it immediately.\n";
+                                       "You may just have found a bug in TUT, please report it immediately.\n";
                         errors++;
                         break;
                 } // switch
 
 #if defined(TUT_USE_POSIX)
-                out << xml_build_testcase(*tri, failure_type, failure_msg, (*tri).pid) << endl;
+                out << xml_build_testcase(*tri, failure_type, failure_msg, tri->pid) << std::endl;
 #else
-                out << xml_build_testcase(*tri, failure_type, failure_msg) << endl;
+                out << xml_build_testcase(*tri, failure_type, failure_msg) << std::endl;
 #endif
-
             } // iterate over all test cases
 
             // calculate per-group statistics
@@ -342,9 +285,10 @@ public:
             int stat_failures = failures + warnings + exceptions;
             int stat_all = stat_errors + stat_failures + passed;
 
-            xmlfile << xml_build_testsuite(stat_errors, stat_failures, stat_all, (*tgi).first/* name */, out.str()/* testcases */) << endl;
-            xmlfile.close();
+            *stream_ << xml_build_testsuite(stat_errors, stat_failures, stat_all, (*tgi).first/* name */, out.str()/* testcases */) << std::endl;
         } // iterate over all test groups
+
+        *stream_ << "</testsuites>" << std::endl;
     }
 
     /**
diff --git a/tests/tut_reporter.h b/tests/tut_reporter.h
deleted file mode 100644 (file)
index e568635..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-
-#include <tut/tut_console_reporter.hpp>
-#include <tut/tut_cppunit_reporter.hpp>
-#include <tut/tut_xml_reporter.hpp>
-#include <tut/tut_reporter.hpp>
diff --git a/tests/tut_restartable.h b/tests/tut_restartable.h
deleted file mode 100644 (file)
index c789779..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#include <tut/tut_restartable.hpp>