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" );
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() );
80 logger::fatal( "Fatal Error: Unknown Exception!\n" );
81 }catch( std::exception &e){
82 printf( "Fatal Error (+ logger failed): %s!\n", e.what() );