added generic tool code
[anytun.git] / syncCommand.h
blobdb821536e82ec826dbbbb8e4c6071a4d0f237fbe
1 #ifndef _SYNCCOMMAND_H
2 #define _SYNCCOMMAND_H
3 #include <boost/archive/text_oarchive.hpp>
4 #include <boost/archive/text_iarchive.hpp>
6 #include "connectionList.h"
7 #include "threadUtils.hpp"
8 #include "syncConnectionCommand.h"
9 #include "syncRouteCommand.h"
10 #include "networkPrefix.h"
11 #include <string>
13 class SyncCommand
15 public:
16 SyncCommand(ConnectionList & cl );
17 SyncCommand(ConnectionList & cl ,u_int16_t mux);
18 SyncCommand(NetworkPrefix);
19 ~SyncCommand();
21 private:
22 SyncCommand(const SyncCommand &);
23 SyncConnectionCommand * scc_;
24 SyncRouteCommand * src_;
25 friend class boost::serialization::access;
26 template<class Archive>
27 void serialize(Archive & ar, const unsigned int version)
29 std::string syncstr;
30 if (scc_)
32 syncstr = "connection";
34 if ( src_)
36 syncstr = "route";
38 ar & syncstr;
39 // std::cout << "syncstr received " <<syncstr << std::endl;
40 if (syncstr == "connection")
41 ar & *scc_;
42 if (syncstr == "route")
43 ar & *src_;
44 // std::cout << "syncstr done " <<syncstr << std::endl;
49 #endif // _SYNCCOMMAND_H