Daniel Stenberg <dan...@haxx.se> writes:

> Hey
>
> I'd like to suggest that we add a libssh2_version() function that returns 
> information about the lib. I just noticed how debian unstable got a fresh 
> libssh2 1.0, but curl is still thinking it is 0.18 since it got the version 
> number at build-time instead of run-time.

Hi!  I think this is useful, I use something similar in other projects
too.

> So I would like to see a libssh2_version() function that returns the version 
> number of libssh2, and some info about what it has been built to use.
>
> Perhaps:
>
>   struct libssh2_version_info {
>      int age;        /* always 0 in this struct layout */
>      int vernum;     /* the 24bit number from the header file */
>      char *version;  /* pointer to a human readable string */
>
>      char *ssllib;   /* pointer to a human readable string about the SSL lib
>                         and version */
>      char *libz;     /* poitner to a humanb readable libz string */
>   }
>
>   struct libssh2_version_info *libssh2_version(void);
>
>
> Is there any additional info we should add in there already from the start?

Do we need to use a struct here?  If we ever need to change the struct
(which may happen if we support some other TLS library or some other
compression, or similar), it seems we'd need to bump the ABI of the
library?

How about something like this:

const char *libssh2_check_version (int req_version_num);

Which could be used by applications like this:

if (!libssh2_check_version (LIBSSH2_VERSION_NUM)) {
  fprintf (stderr, "Runtime libssh2 version too old!\n");
  exit(1);
}

The return value could be a humanly readable string that could be
printed by applications for debugging, e.g.:

if (debug) {
  printf ("libssh2 %s\n", libssh2_check_version (0));
}

And the string could look something like:

"1.0.1-CVS/gnutls/libz"
"1.0.0/openssl"
"1.0.0/openssl/libz"

Just some ideas.

/Simon

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to