#include <fstream>
#include <streambuf>
-#include "database.h"
-#include "mysql.h"
-#include "simpleOpensslSigner.h"
+#include "db/database.h"
+#include "db/mysql.h"
+#include "crypto/simpleOpensslSigner.h"
+#include "crypto/remoteSigner.h"
+#include "crypto/sslUtil.h"
+#include "io/bios.h"
+#include "io/slipBio.h"
+#include "io/recordHandler.h"
#include "util.h"
-#include "bios.h"
-#include "slipBio.h"
-#include "remoteSigner.h"
-#include "sslUtil.h"
#include "config.h"
-#include "recordHandler.h"
#ifdef NO_DAEMON
#define DAEMON false
#endif
extern std::string serialPath;
-extern std::vector<Profile> profiles;
int main( int argc, const char* argv[] ) {
( void ) argc;
std::shared_ptr<BIO> conn = openSerial( serialPath );
std::shared_ptr<BIO> slip1( BIO_new( toBio<SlipBIO>() ), BIO_free );
- ( ( SlipBIO* )slip1->ptr )->setTarget( std::shared_ptr<OpensslBIO>( new OpensslBIOWrapper( conn ) ) );
+ static_cast<SlipBIO*>( slip1->ptr )->setTarget( std::shared_ptr<OpensslBIO>( new OpensslBIOWrapper( conn ) ) );
- try {
- DefaultRecordHandler* dh = new DefaultRecordHandler( std::shared_ptr<Signer>( new SimpleOpensslSigner( profiles[5] ) ), slip1 );
+ DefaultRecordHandler* dh = new DefaultRecordHandler( std::shared_ptr<Signer>( new SimpleOpensslSigner( ) ), slip1 );
- while( true ) {
+ while( true ) {
+ try {
dh->handle();
+ //} catch( const std::exception &ch ) {
+ //std::cout << "Real exception: " << typeid(ch).name() << ", " << ch.what() << std::endl;
+ } catch( char const* ch ) {
+ std::cout << "Exception: " << ch << std::endl;
}
- } catch( char const* ch ) {
- std::cout << "Exception: " << ch << std::endl;
}
return -1;