2 * Acess2 Common Networking Library
3 * By John Hodge (thePowersGang)
10 NET_ADDRTYPE_NULL = 0,
11 NET_ADDRTYPE_IPV4 = 4,
16 * \brief Parse a string as an IP Address
17 * \param String Input string
18 * \param Addr Output binary format of the address
19 * \return Address family (0: Invalid, 4: IPv4, 6: IPv6)
21 extern int Net_ParseAddress(const char *String, void *Addr);
24 * \brief Convert a network address into a string
25 * \param AddressType Address family as returned by Net_ParseAddress
26 * \param Address Address data
28 extern const char *Net_PrintAddress(int AddressType, void *Address);
31 * \brief Get the size in bytes of an address type
32 * \param AddressType Address type returned by Net_ParseAddress
33 * \return Size of an address in bytes
35 extern int Net_GetAddressSize(int AddressType);
38 * \brief Get the interface required to reach \a Addr
39 * \param AddrType Addresss Family (4: IPv4, 6: IPv6)
40 * \param Addr Address in binary format
41 * \return Interface number
43 extern char *Net_GetInterface(int AddrType, void *Addr);
46 * \brief Open a network socket file
47 * \param AddrType Address family
48 * \param Addr Binary address
49 * \param SocketName Socket type to open (e.g. tcpc for TCP client)
50 * If NULL, the node directory is opened
51 * \return Socket file descriptor (as returned by \a open), or -1 on error
53 * Opens a file using /Devices/ip/routes/<AddrType>:<Addr>/<SocketName>
56 extern int Net_OpenSocket(int AddrType, void *Addr, const char *SocketName);