diff options
Diffstat (limited to 'modules/io-ssh/c++')
| -rw-r--r-- | modules/io-ssh/c++/SConscript | 38 | ||||
| -rw-r--r-- | modules/io-ssh/c++/ssh.hpp | 43 |
2 files changed, 81 insertions, 0 deletions
diff --git a/modules/io-ssh/c++/SConscript b/modules/io-ssh/c++/SConscript new file mode 100644 index 0000000..4af4ea3 --- /dev/null +++ b/modules/io-ssh/c++/SConscript @@ -0,0 +1,38 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +io_ssh_env = env.Clone(); + +io_ssh_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +io_ssh_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += io_ssh_env.sources; +env.headers += io_ssh_env.headers; + +## Shared lib +objects_shared = [] +io_ssh_env.add_source_files(objects_shared, io_ssh_env.sources, shared=True); +env.library_shared = io_ssh_env.SharedLibrary('#build/forstio-io-ssh', [objects_shared]); + +## Static lib +objects_static = [] +io_ssh_env.add_source_files(objects_static, io_ssh_env.sources, shared=False); +env.library_static = io_ssh_env.StaticLibrary('#build/forstio-io-ssh', [objects_static]); + +# Set Alias +env.Alias('library_io_ssh', [env.library_shared, env.library_static]); + +env.targets += ['library_io_ssh']; + +# Install +env.Install('$prefix/lib/', [env.library_shared, env.library_static]); +env.Install('$prefix/include/forstio/io/ssh/', [io_ssh_env.headers]); diff --git a/modules/io-ssh/c++/ssh.hpp b/modules/io-ssh/c++/ssh.hpp new file mode 100644 index 0000000..93c4ac0 --- /dev/null +++ b/modules/io-ssh/c++/ssh.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include <forstio/io/io.hpp> + +namespace saw { +namespace net { +struct Ssh {}; +} + +template<> +class network_address<net::Ssh> final { +private: + std::string address_; +public: + network_address(const std::string& address__): + address_{address__} + {} +}; + +template<> +class network<net::Ssh> final { +private: +public: + conveyor<own<network_address<net::Ssh>>> resolve_address(const std::string& addr){ + return make_error<err::not_implemented>("SSH resolve address not implemented"); + } + + error_or<own<network_address<net::Ssh>>> parse_address(const std::string& addr){ + return heap<network_address<net::Ssh>>(addr); + } +}; + +error_or<own<network<net::Ssh>>> setup_ssh_network(){ + own<network<net::Ssh>> ssh_net; + try{ + ssh_net = heap<network<net::Ssh>>(); + }catch(const std::exception& e){ + (void)e; + return make_error<err::critical>("Couldn't allocate ssh memory"); + } + return ssh_net; +} +} |
