X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibnet.so_src%2Fnet.h;h=7200efe07e93a8410c3999a9f487d6508ca46aad;hb=3e29ef3929531865fe4b669b09609baa8158af66;hp=7c7a9b5af0f683e14d6cdaee50e346232228101e;hpb=0c1bf884877e4b89eb224e91627508d42ca70974;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libnet.so_src/net.h b/Usermode/Libraries/libnet.so_src/net.h index 7c7a9b5a..7200efe0 100644 --- a/Usermode/Libraries/libnet.so_src/net.h +++ b/Usermode/Libraries/libnet.so_src/net.h @@ -6,6 +6,12 @@ #ifndef __LIBNET_H_ #define __LIBNET_H_ +enum { + NET_ADDRTYPE_NULL = 0, + NET_ADDRTYPE_IPV4 = 4, + NET_ADDRTYPE_IPV6 = 6 +}; + /** * \brief Parse a string as an IP Address * \param String Input string @@ -14,6 +20,20 @@ */ extern int Net_ParseAddress(const char *String, void *Addr); +/** + * \brief Convert a network address into a string + * \param AddressType Address family as returned by Net_ParseAddress + * \param Address Address data + */ +extern const char *Net_PrintAddress(int AddressType, void *Address); + +/** + * \brief Get the size in bytes of an address type + * \param AddressType Address type returned by Net_ParseAddress + * \return Size of an address in bytes + */ +extern int Net_GetAddressSize(int AddressType); + /** * \brief Get the interface required to reach \a Addr * \param AddrType Addresss Family (4: IPv4, 6: IPv6) @@ -22,4 +42,17 @@ extern int Net_ParseAddress(const char *String, void *Addr); */ extern char *Net_GetInterface(int AddrType, void *Addr); +/** + * \brief Open a network socket file + * \param AddrType Address family + * \param Addr Binary address + * \param SocketName Socket type to open (e.g. tcpc for TCP client) + * If NULL, the node directory is opened + * \return Socket file descriptor (as returned by \a open), or -1 on error + * + * Opens a file using /Devices/ip/routes/@:/ + * + */ +extern int Net_OpenSocket(int AddrType, void *Addr, const char *SocketName); + #endif