Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » SSH package for U++ (A feature-rich ilbssh2 wrapper for Ultimate++)
Re: SSH package for U++ [message #50145 is a reply to message #50133] Tue, 07 August 2018 23:32 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello Mirek,

I'll start committing the changes in a couple of days. But before I start I'd like to clear some points and ask for your opinion on some points.

Quote:

SFtpHandle* -> SFtpHandle - if something is "HANDLE", it should not be a pointer to handle.


The thing is, libbsh2 itself returns a pointer to a handle (SFtpHandle is actually an alias for LIBSSH2_SFTP_HANDLE)
I'm reluctant to change that pointer into a real handle as it'll make the things slightly more complex.
However, if we must change the naming I would suggest we use "SFtpObject" instead, since we are dealing with remote file system objects here.

Quote:

Interestingly, it looks like the most important Gets / Puts are missing there

int Get(SFtpHandle h, void *ptr, int size);
bool Put(SFtpHandle h, const void *ptr, int size);


Easy to implement. I'll propose:

int         Get(SFtpObject* obj, void* buffer, int size);
String      Get(const String& path, int size, int64 offset = 0);
String      GetAll(const String& path);

int         Put(SFtpObject* obj, const void* buffer, int size);
int         Put(const String& path, const String& data, int size, dword flags, long mode);
int         Put(const String& path, const String& data, int size, int64 offset = 0);
bool        PutAll(const String& path, const String& data);


As for the stream versions of Gets and Puts:
Stream versions come very handy when transferring files > 2GB, and processing the I/O immediately (e.g when filtering).

I've thought about adding SFtpStream variants(eg. SFtpFileIn, SFtpFileOut, etc.) to the package, as you suggessted.
But in the end I concluded that they'll only add another layer of abstraction which can be confusing (as you know, SSH package already has a plenty of classes). Thus I propose to simply rename them and change their parameter order.

E.g.

bool GetStream(const String& path, Stream& out);
bool PutStream(const String& path, Stream& in);
// And other variants...



About the reference examples:

My idea is to create a reference -console- example for each class (SFtp, Scp, SshExec, SshShell, SshTunnel), and have them each contain separate and basic blocking, non-blocking, and multitihreaded code as functions that can be selected/compiled using preprocessor directives.(defs,e.g. BLOCKING, NONBLOCKING, MULTITHREADED). And use these examples as tutorial in Topic++.

What do you think?


Best regards,
Oblivion


[Updated on: Wed, 08 August 2018 10:51]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: WebSockets client in javascript connected to an U++ server sending binary messages
Next Topic: TURTLE high cpu usage, potential security flaw, and client handling problem
Goto Forum:
  


Current Time: Mon Jun 10 10:33:26 CEST 2024

Total time taken to generate the page: 0.02705 seconds