37 #ifndef INCLUDED_OSCPACK_IPENDPOINTNAME_H
38 #define INCLUDED_OSCPACK_IPENDPOINTNAME_H
42 static unsigned long GetHostByName(
const char *s );
44 static const unsigned long ANY_ADDRESS = 0xFFFFFFFF;
45 static const int ANY_PORT = -1;
48 : address( ANY_ADDRESS ), port( ANY_PORT ) {}
49 IpEndpointName(
int port_ )
50 : address( ANY_ADDRESS ), port( port_ ) {}
51 IpEndpointName(
unsigned long ipAddress_,
int port_ )
52 : address( ipAddress_ ), port( port_ ) {}
53 IpEndpointName(
const char *addressName,
int port_=ANY_PORT )
54 : address( GetHostByName( addressName ) )
56 IpEndpointName(
int addressA,
int addressB,
int addressC,
int addressD,
int port_=ANY_PORT )
57 : address( ( (addressA << 24) | (addressB << 16) | (addressC << 8) | addressD ) )
61 unsigned long address;
64 bool IsMulticastAddress()
const {
return ((address >> 24) & 0xFF) >= 224 && ((address >> 24) & 0xFF) <= 239; }
66 enum { ADDRESS_STRING_LENGTH=17 };
67 void AddressAsString(
char *s )
const;
69 enum { ADDRESS_AND_PORT_STRING_LENGTH=23};
70 void AddressAndPortAsString(
char *s )
const;
73 inline bool operator==(
const IpEndpointName& lhs,
const IpEndpointName& rhs )
75 return (lhs.address == rhs.address && lhs.port == rhs.port );
78 inline bool operator!=(
const IpEndpointName& lhs,
const IpEndpointName& rhs )
bool TTFOUNDATION_EXPORT operator!=(const TTObject &anObject, const TTObject &anotherObject)
Compare two objects for inequality.
bool TTFOUNDATION_EXPORT operator==(const TTObject &anObject, const TTObject &anotherObject)
Compare two objects for equality.