Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Any MACRO can be used in code to distuigush major SO version 4 and Majsor SO version 3? #456

Open
starx1000 opened this issue Jan 30, 2024 · 5 comments
Labels
is:question Issue is actually a question.

Comments

@starx1000
Copy link

hello,
New libnetconf2 introduced new API e.g

nc_client_ssh_set_knownhosts_mode

and obsolete some API e.g

nc_client_ssh_set_auth_hostkey_check_clb

Changed some API, e.g
from void nc_client_init() to int nc_client_init()

Is there any MACRO can be used then we can compile the code and use it with different version?

For example OPENSSL:

#if OPENSSL_VERSION_NUMBER < 0x30000000L
    CallSomeAPIOnlyAvaibleLessThanThirdZero()
#else
    CallSomeAPIOnlyAvaibleBigThanThirdZero()
#endif

Thank you.

@starx1000
Copy link
Author

Then I can write some code like e.g

#if LIBNETCONF2_VERSION_NUMBER < 0x400L
    nc_client_ssh_set_auth_hostkey_check_clb();
#else
   nc_client_ssh_set_knownhosts_mode();
#endif

@michalvasko
Copy link
Member

michalvasko commented Jan 30, 2024

There is the header nc_version.h that you can include manually and then test for NC_VERSION_MAJOR. But I think the differences are significant so I am not sure what code you will end up with when trying to support both version in a single project.

@michalvasko michalvasko added the is:question Issue is actually a question. label Jan 30, 2024
@starx1000
Copy link
Author

OK, got it. thank you.

@starx1000
Copy link
Author

I only used part of the client and all those 3 changes is what I seen from the changes.

nc_client_ssh_set_auth_hostkey_check_clb
nc_client_ssh_set_knownhosts_mode
int nc_client_init()

Other API that I used here includes:

nc_connect_ssh
nc_client_ssh_set_auth_password_clb
nc_client_ssh_set_username
nc_client_destroy

nc_session_free
nc_session_get_status

nc_send_rpc
nc_recv_reply
nc_recv_notif

nc_rpc_establishsub
nc_rpc_free
nc_rpc_getdata
nc_rpc_editdata

Looks like no changes for those APIs? Or do you see any changes inside between the APIs?

@starx1000 starx1000 reopened this Jan 30, 2024
@michalvasko
Copy link
Member

If you are using only the client API then yes, you should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:question Issue is actually a question.
Projects
None yet
Development

No branches or pull requests

2 participants