NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 4156


Ignore:
Timestamp:
Jul 23, 2009, 4:12:26 PM (8 years ago)
Author:
stud-lenk
Message:

Export << operator for list<hostaddress> in header file because I am interested in it too

Location:
protlib/branches/20090723-multicast
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • protlib/branches/20090723-multicast/include/address.h

    r4107 r4156  
    215215typedef list<hostaddress> hostaddresslist_t;
    216216
     217ostream &operator<<(ostream &out, const hostaddresslist_t &list);
     218
    217219/// ========================================================
    218220/// IP Application Address
  • protlib/branches/20090723-multicast/src/Makefile

    r4107 r4156  
    105105TP_QUERY_ENCAP_OBJ= tp_queryencap.o
    106106
    107 PROTLIB_OBJS    = address.o ie.o tp.o tp_over_tcp.o tp_over_tls_tcp.o \
     107PROTLIB_OBJS    = networkinterface.o address.o ie.o tp.o tp_over_tcp.o tp_over_tls_tcp.o \
    108108                  cmsghdr_util.o tp_over_udp.o $(TP_QUERY_ENCAP_OBJ) tp_over_uds.o \
    109109                  $(TP_SCTPOBJ) connectionmap.o connectionmap_uds.o queuemanager.o fqueue.o \
  • protlib/branches/20090723-multicast/src/configpar.cpp

    r4107 r4156  
    266266}
    267267
    268 
    269 
    270268// write address list quoted to a config file
    271269template <>
     
    279277}
    280278
     279// interface list
     280template <>
     281istream&
     282configpar< list<networkinterface> >::readVal(std::istream &in) {
     283        std::string tmp;
     284        bool success= false;
     285        while ( in >> tmp ) {
     286                networkinterface iface(tmp.c_str(), &success);
     287                if ( success )
     288                        value.push_back(iface);
     289                else
     290                        throw configParExceptionParseError("invalid interface `" + tmp + "'");
     291        }
     292        return in;
     293}
     294
     295template <>
     296istream&
     297configpar< list<networkinterface> >::readValFromConfig(std::istream &in) {
     298        std::string tmp= parse_quoted_string(in);
     299        stringstream inputstr(tmp);
     300
     301        bool success= false;
     302        while ( inputstr >> tmp ) {
     303                networkinterface iface(tmp.c_str(), &success);
     304                if ( success )
     305                        value.push_back(iface);
     306                else
     307                        throw configParExceptionParseError("invalid interface `" + tmp + "'");
     308        }
     309        return in;
     310}
     311
     312// write network interface list quoted to a config file
     313template <>
     314ostream&
     315configpar< list<networkinterface> >::writeValToConfig(ostream& outstream) const
     316{
     317        std::stringstream ifaceliststr;
     318        ifaceliststr << value;
     319        write_quoted_string(outstream, ifaceliststr.str());
     320        return outstream;
     321}
     322
    281323// write a string quoted (with escape chars) to a config file
    282324template <>
  • protlib/branches/20090723-multicast/test/Makefile

    r3527 r4156  
    2424CXXFLAGS = -Wall -ggdb -pedantic -Wno-long-long $(ALL_INCLUDES) \
    2525                `cppunit-config --cflags`
    26 LDFLAGS = $(ALL_LIBS) `cppunit-config --libs` -lpthread -lipq -lssl -lcrypto -lsctp
     26LDFLAGS = $(ALL_LIBS) `cppunit-config --libs` -lpthread -lipq -lssl -lcrypto
    2727
    2828TEST_DEPS = $(LIB_FASTQ) $(LIB_PROT)
  • protlib/branches/20090723-multicast/test/test_address.cpp

    r4107 r4156  
    256256                CPPUNIT_ASSERT( ta.is_multicast() );
    257257        }
    258         void test_multicast_hostaddress() {
    259                 hostaddress ta; // testaddress
    260 
    261                 // Test IPv4 addresses
    262                 ta.set_ipv4("127.0.0.1");
    263                 CPPUNIT_ASSERT( !ta.is_multicast() );
    264 
    265                 ta.set_ipv4("224.0.0.0");
    266                 CPPUNIT_ASSERT( ta.is_multicast() );
    267 
    268                 // Test IPv6 addresses
    269                 ta.set_ip("2001:638:204:1:230:48ff:fec4:813a");
    270                 CPPUNIT_ASSERT( !ta.is_multicast() );
    271                 ta.set_ip("FF01:0:0:0:0:0:0:1");
    272                 CPPUNIT_ASSERT( ta.is_multicast() );
    273         }
    274258};
    275259
  • protlib/branches/20090723-multicast/test/test_runner.cpp

    r4107 r4156  
    1616
    1717
    18 #include "threadsafe_db.h"
    1918#include "logfile.h"
    2019
     
    4342        }
    4443
    45         protlib::tsdb::init();
    46 
    4744        TestResult controller;
    4845
     
    6057        outputter.write();
    6158
    62         protlib::tsdb::end();
    63 
    6459        return result.wasSuccessful() ? 0 : 1;
    6560}
Note: See TracChangeset for help on using the changeset viewer.