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