cmUdpPort.h/c : Added cmUdpAddrIsEqual().

This commit is contained in:
kpl 2014-06-15 22:17:31 -07:00
parent c69698716c
commit 4ab2902363
2 changed files with 10 additions and 0 deletions

View File

@ -589,6 +589,14 @@ const cmChar_t* cmUdpAddrToString( cmUdpH_t h, const struct sockaddr_in* addr )
return p->ntopBuf; return p->ntopBuf;
} }
bool cmUdpAddrIsEqual( const struct sockaddr_in* a0, const struct sockaddr_in* a1 )
{
return a0->sin_family == a1->sin_family
&& a0->sin_port == a1->sin_port
&& memcmp(&a0->sin_addr,&a1->sin_addr,sizeof(a0->sin_addr))==0;
}
const cmChar_t* cmUdpHostName( cmUdpH_t h ) const cmChar_t* cmUdpHostName( cmUdpH_t h )
{ {
cmUdp_t* p = _cmUdpHandleToPtr(h); cmUdp_t* p = _cmUdpHandleToPtr(h);

View File

@ -132,6 +132,8 @@ extern "C" {
const cmChar_t* cmUdpAddrToString( cmUdpH_t h, const struct sockaddr_in* addr ); const cmChar_t* cmUdpAddrToString( cmUdpH_t h, const struct sockaddr_in* addr );
bool cmUdpAddrIsEqual( const struct sockaddr_in* a0, const struct sockaddr_in* a1 );
const cmChar_t* cmUdpHostName( cmUdpH_t h ); const cmChar_t* cmUdpHostName( cmUdpH_t h );