X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibnet.so_src%2Finclude_exp%2Fnet.h;h=3d33da0337c7a700ed2b1d470bae068145309b48;hb=508aa7d2f1f441ab4c9a7cc4540eb418bc2f9da7;hp=5fe4ba1058688e83365e6dc5df026a0108ce471d;hpb=7b64f5e7f00e445a5637e9e3289a1332a14d28e5;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libnet.so_src/include_exp/net.h b/Usermode/Libraries/libnet.so_src/include_exp/net.h index 5fe4ba10..3d33da03 100644 --- a/Usermode/Libraries/libnet.so_src/include_exp/net.h +++ b/Usermode/Libraries/libnet.so_src/include_exp/net.h @@ -6,6 +6,8 @@ #ifndef __LIBNET_H_ #define __LIBNET_H_ +#include + enum { NET_ADDRTYPE_NULL = 0, NET_ADDRTYPE_IPV4 = 4, @@ -53,8 +55,43 @@ extern char *Net_GetInterface(int AddrType, void *Addr); * Opens a file using /Devices/ip/routes/@:/ * */ -extern int Net_OpenSocket(int AddrType, void *Addr, const char *SocketName); +extern int Net_OpenSocket(int AddrType, const void *Addr, const char *SocketName); + +extern int Net_OpenSocket_TCPC(int AddrType, const void *Addr, int Port); + +extern int Net_OpenSocket_UDP(int AddrType, const void *Addr, int RAddr, int LAddr); +extern int Net_UDP_SendTo (int FD, int Port, int AddrType, const void *Addr, size_t Length, const void *Data); +extern int Net_UDP_RecvFrom(int FD, int* Port, int* AddrType, void *Addr, size_t Length, void *Data); -extern int Net_OpenSocket_TCPC(int AddrType, void *Addr, int Port); + +/** + * \name Hostnames + * \brief Handling of hostname resolution + * \{ + */ + +/** + * \brief Returns an address for the specified hostname + * \note Picks randomly if multiple addresses are present + */ +extern int Net_Lookup_AnyAddr(const char *Name, int AddrType, void *Addr); + +/** + * \brief Callback for Net_Lookup_Addrs, returns non-zero when lookup should terminate + */ +typedef int tNet_LookupAddrs_Callback(void *info, int AddrType, const void *Addr); + +/** + * \brief Enumerate addresses for a host, calling the provided function for each + */ +extern int Net_Lookup_Addrs(const char *Name, void *info, tNet_LookupAddrs_Callback* callback); + +/** + */ +extern int Net_Lookup_Name(int AddrType, const void *Addr, char *Dest[256]); + +/** + * \} + */ #endif