X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibnet.so_src%2Fnet.h;h=d02da0bdf7b3402acb2e3363c32771c6ae080090;hb=846645bd8f738dc22641e96866fffd2f59b5639b;hp=f45646f3e7f42aabf73a8170bbd1f6b6b9955ed0;hpb=2bdb445efbe8a5440c5ed27acfccd32626bd67e7;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libnet.so_src/net.h b/Usermode/Libraries/libnet.so_src/net.h index f45646f3..d02da0bd 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 @@ -21,6 +27,13 @@ extern int Net_ParseAddress(const char *String, void *Addr); */ 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) @@ -29,4 +42,17 @@ extern const char *Net_PrintAddress(int AddressType, void *Address); */ 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