41 #ifndef _networkutilities_cpp
42 #define _networkutilities_cpp
44 #include "Network/platformsocket.h.cpp"
46 #include "Network/networkutilities.h"
48 #include "stringtool.h"
55 {
return htons(ToConvert); }
58 {
return htonl(ToConvert); }
61 {
return ntohs(ToConvert); }
64 {
return ntohl(ToConvert); }
126 memset(&Hints,0,
sizeof(Hints));
127 Hints.ai_flags = AI_NUMERICHOST;
145 memset(&Hints,0,
sizeof(Hints));
int ConvertLayer4ProtocolType(const TransportLayerProtocol Protocol)
Converts from a Mezzanine transport protocol type to it's internal counterpart.
Thrown when an unknown internal error occurred.
short int ConvertLayer3ProtocolType(const NetworkLayerProtocol Protocol)
Converts from a Mezzanine address protocol type to it's internal counterpart.
NetworkLayerProtocol
This is an enum listing for recognized protocols on Layer 3 of the OSI model.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
int ConvertToSocketType(const TransportLayerProtocol Protocol)
Converts from a Mezzanine transport protocol type to it's internal counterpart.
int Integer
A datatype used to represent any integer close to.
SocketDescription ConvertToSocketDescription(const sockaddr_storage &BerkAddr)
Converts a Berkeley sockets address to a Mezzanine socket descriptor.
SocketResultContainer(addrinfo *Results)
Internal constructor.
A special container class used to store the results from a call to "ResolveDomainName".
UInt16 ConvertNetworkToHostByteOrder(const UInt16 ToConvert)
Converts a UInt16 from the network byte order to host byte order.
TransportLayerProtocol SocketProtocol
The protocol to used by a given socket.
uint16_t UInt16
An 16-bit unsigned integer.
TransportLayerProtocol
This is an enum listing for recognized protocols on Layer 4 of the OSI model.
uint32_t UInt32
An 32-bit unsigned integer.
void Aquire(const SocketResultContainer &Other)
Duplicates the necessary data when creating a copy instance of a set of socket results.
This is a simple class for representing IP addresses used throughout the Network subsystem.
const SocketDescription * GetNextResult()
Gets/converts the current result and increments the cursor to the next result if able.
addrinfo * Addresses
A pointer to the internal structure holding the resulting addresses.
SocketResultContainer ResolveNumericHost(const IPAddress &Address, const UInt16 Port, const TransportLayerProtocol TLP)
Performs a DNS lookup with the provided domain name and port.
String GetAsString() const
Gets this IPAddress in a human readable format.
SocketDescription CurrDescription
The converted values for the current address being presented.
Network::NetworkLayerProtocol GetProtocol() const
Gets the type of IP address this is.
void Release()
Decrements the ref count and destroys all internal data if necessary.
A convenience class storing socket data that can be returned from utility methods and used to create ...
UInt16 ConvertHostToNetworkByteOrder(const UInt16 ToConvert)
Converts a UInt16 from the host byte order to network byte order.
The bulk of the engine components go in this namspace.
~SocketResultContainer()
Class destructor.
Integer * RefCount
The count of instances that exist for these results.
void Reset()
Resets the current elements pointed to back to the beginning.
std::string String
A datatype used to a series of characters.
SocketResultContainer ResolveDomainName(const String &DomainName, const UInt16 Port, const NetworkLayerProtocol NLP, const TransportLayerProtocol TLP)
Performs a DNS lookup with the provided domain name and service.
addrinfo * CurrAddress
A pointer to the current address being presented.