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

Require support for inet_* API #3595

Closed
devendranaga opened this issue Feb 24, 2024 · 4 comments
Closed

Require support for inet_* API #3595

devendranaga opened this issue Feb 24, 2024 · 4 comments
Labels
C-API-request Category: API request

Comments

@devendranaga
Copy link

Hi,

I am using libc for writing systems programming interface for a project i am working on.

I find the lack of following very useful functions for network programming.

  1. inet_ntoa.
  2. inet_aton.
  3. inet_addr.

Are there any plans to add these?

my current Test system is Linux Fedora.

Thanks,
Dev

@devendranaga devendranaga added the C-API-request Category: API request label Feb 24, 2024
@devnexen
Copy link
Contributor

well, those are outdated, coming with their shortcomings (e.g. ipv4 only).

@devendranaga
Copy link
Author

Ok. I am mostly interested in ipv4 ones specifically. IPv4 is not going anywhere too.

Is it possible to provide support for those ? if not, can you please suggest alternatives?

thanks.

@devnexen
Copy link
Contributor

devnexen commented Mar 9, 2024

If you really want to avoid newer api inet_ntop and the rest, you can always add this in an appropriate place in your project

extern "C" {
        pub fn inet_aton(cp: *const libc::c_char, inp: *mut libc::in_addr) -> libc::c_int;
        pub fn inet_addr(cp: *const libc::c_char) -> libc::in_addr_t;
        pub fn inet_ntoa(inp: libc::in_addr) -> *mut libc::c_char;
    }

@devendranaga
Copy link
Author

extern "C" {
        pub fn inet_aton(cp: *const libc::c_char, inp: *mut libc::in_addr) -> libc::c_int;
        pub fn inet_addr(cp: *const libc::c_char) -> libc::in_addr_t;
        pub fn inet_ntoa(inp: libc::in_addr) -> *mut libc::c_char;
    }

This works !

Thank you very much for your help. I appreciate it very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request
Projects
None yet
Development

No branches or pull requests

2 participants