kolibrios/programs/develop/libraries/kos_mbedtls/kosnet/network.c
Rustem Gimadutdinov (rgimad) 748c187814 Upload MbedTLS port
nothing new since january
just upload so all devs can participate.

git-svn-id: svn://kolibrios.org@8774 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-06-06 20:21:28 +00:00

21 lines
794 B
C

#include "kosnet/network.h"
#include "kosnet/dlfcn.h"
int (*inet_addr)(const char* hostname) __attribute__ ((stdcall));
char* (*inet_ntoa)(int ip_addr) __attribute__ ((stdcall));
int (*getaddrinfo)(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res) __attribute__ ((stdcall));
void (*freeaddrinfo)(struct addrinfo* ai) __attribute__ ((stdcall));
int load_network_obj() {
void *network_lib = dlopen("/sys/lib/network.obj", RTLD_GLOBAL);
if (network_lib == NULL) {
return -1;
}
inet_addr = dlsym(network_lib, "inet_addr");
inet_ntoa = dlsym(network_lib, "inet_ntoa");
getaddrinfo = dlsym(network_lib, "getaddrinfo");
freeaddrinfo = dlsym(network_lib, "freeaddrinfo");
dlclose(network_lib);
return 0;
}