7 #include "db/database.h"
8 #include "crypto/simpleOpensslSigner.h"
9 #include "crypto/remoteSigner.h"
10 #include "crypto/sslUtil.h"
12 #include "io/slipBio.h"
13 #include "io/recordHandler.h"
14 #include "log/logger.hpp"
24 extern std::string serialPath;
26 int main( int argc, const char* argv[] ) try {
33 path = "/etc/wpia/cassiopeia/cassiopeia.conf";
38 if( parseConfig( path ) != 0 ) {
39 logger::fatal( "Could not parse configuration file." );
43 std::shared_ptr<int> ssl_lib = ssl_lib_ref;
45 if( serialPath == "" ) {
46 logger::fatal( "Error: No device for the serial connection was given." );
50 std::shared_ptr<BIO> conn = openSerial( serialPath );
51 std::shared_ptr<BIO> slip1( BIO_new( toBio<SlipBIO>() ), BIO_free );
52 static_cast<SlipBIO*>( slip1->ptr )->setTarget( std::shared_ptr<OpensslBIO>( new OpensslBIOWrapper( conn ) ), true );
54 DefaultRecordHandler* dh = new DefaultRecordHandler( std::shared_ptr<Signer>( new SimpleOpensslSigner( ) ), slip1 );
56 logger::note( "Entering mainloop" );
60 //} catch( const std::exception &ch ) {
61 //std::cout << "Real exception: " << typeid(ch).name() << ", " << ch.what() << std::endl;
62 } catch( const std::exception& e ) {
63 logger::error( "Exception: ", e.what() );
69 } catch( std::exception& e ) {
71 logger::fatalf( "Fatal Error: %s!\n", e.what() );
72 }catch( std::exception &e){
73 printf( "Fatal Error (+logger failed): %s!\n", e.what() );
78 logger::fatal( "Fatal Error: Unknown Exception!\n" );
79 }catch( std::exception &e){
80 printf( "Fatal Error (+ logger failed): %s!\n", e.what() );