From c986b56e5d7af3b20bacea7c628a6e4a2f7cb295 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 20 Aug 2002 21:52:52 +0000 Subject: [PATCH] tabs are now spaces --- src/cas/generic/caNetAddr.h | 268 ++++++++++++++++++------------------ 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/src/cas/generic/caNetAddr.h b/src/cas/generic/caNetAddr.h index 1aca96e83..87a502f6f 100644 --- a/src/cas/generic/caNetAddr.h +++ b/src/cas/generic/caNetAddr.h @@ -12,12 +12,12 @@ // // special cas specific network address class so: // 1) we dont drag BSD socket headers into -// the server tool +// the server tool // 2) we are able to use other networking services -// besides sockets in the future +// besides sockets in the future // // get() will assert fail if the init flag has not been -// set +// set // #ifndef caNetAddrH @@ -32,46 +32,46 @@ class verifyCANetAddr { public: - inline void checkSize(); + inline void checkSize(); }; class epicsShareClass caNetAddr { - friend class verifyCANetAddr; + friend class verifyCANetAddr; public: enum caNetAddrType {casnaUDF, casnaInet}; - // - // clear() - // - inline void clear () - { - this->type = casnaUDF; - } + // + // clear() + // + inline void clear () + { + this->type = casnaUDF; + } - // - // caNetAddr() - // - inline caNetAddr () - { - this->clear(); - } + // + // caNetAddr() + // + inline caNetAddr () + { + this->clear(); + } - inline bool isInet () const - { - return this->type == casnaInet; - } + inline bool isInet () const + { + return this->type == casnaInet; + } - inline bool isValid () const - { - return this->type != casnaUDF; - } + inline bool isValid () const + { + return this->type != casnaUDF; + } - inline bool operator == (const caNetAddr &rhs) const // X aCC 361 - { + inline bool operator == (const caNetAddr &rhs) const // X aCC 361 + { if (this->type != rhs.type) { return false; } -# ifdef caNetAddrSock +# ifdef caNetAddrSock if (this->type==casnaInet) { return (this->addr.ip.sin_addr.s_addr == rhs.addr.ip.sin_addr.s_addr) && (this->addr.ip.sin_port == rhs.addr.ip.sin_port); @@ -80,138 +80,138 @@ public: else { return false; } - } + } - inline bool operator != (const caNetAddr &rhs) const + inline bool operator != (const caNetAddr &rhs) const { return ! this->operator == (rhs); } - // - // This is specified so that compilers will not use one of - // the following assignment operators after converting to a - // sockaddr_in or a sockaddr first. - // - // caNetAddr caNetAddr::operator =(const struct sockaddr_in&) - // caNetAddr caNetAddr::operator =(const struct sockaddr&) - // - inline caNetAddr operator = (const caNetAddr &naIn) - { - this->addr = naIn.addr; - this->type = naIn.type; - return *this; - } + // + // This is specified so that compilers will not use one of + // the following assignment operators after converting to a + // sockaddr_in or a sockaddr first. + // + // caNetAddr caNetAddr::operator =(const struct sockaddr_in&) + // caNetAddr caNetAddr::operator =(const struct sockaddr&) + // + inline caNetAddr operator = (const caNetAddr &naIn) + { + this->addr = naIn.addr; + this->type = naIn.type; + return *this; + } // // convert to the string equivalent of the address // void stringConvert (char *pString, unsigned stringLength) const; - // - // conditionally drag BSD socket headers into the server - // and server tool - // - // to use this #define caNetAddrSock - // -# ifdef caNetAddrSock - inline void setSockIP (unsigned long inaIn, unsigned short portIn) - { - this->type = casnaInet; - this->addr.ip.sin_family = AF_INET; - this->addr.ip.sin_addr.s_addr = inaIn; - this->addr.ip.sin_port = portIn; - } + // + // conditionally drag BSD socket headers into the server + // and server tool + // + // to use this #define caNetAddrSock + // +# ifdef caNetAddrSock + inline void setSockIP (unsigned long inaIn, unsigned short portIn) + { + this->type = casnaInet; + this->addr.ip.sin_family = AF_INET; + this->addr.ip.sin_addr.s_addr = inaIn; + this->addr.ip.sin_port = portIn; + } - inline void setSockIP (const struct sockaddr_in &sockIPIn) - { - this->type = casnaInet; - assert (sockIPIn.sin_family == AF_INET); - this->addr.ip = sockIPIn; - } + inline void setSockIP (const struct sockaddr_in &sockIPIn) + { + this->type = casnaInet; + assert (sockIPIn.sin_family == AF_INET); + this->addr.ip = sockIPIn; + } - inline void setSock (const struct sockaddr &sock) - { - assert (sock.sa_family == AF_INET); - this->type = casnaInet; - const struct sockaddr_in *psip = - reinterpret_cast (&sock); - this->addr.ip = *psip; - } + inline void setSock (const struct sockaddr &sock) + { + assert (sock.sa_family == AF_INET); + this->type = casnaInet; + const struct sockaddr_in *psip = + reinterpret_cast (&sock); + this->addr.ip = *psip; + } - inline caNetAddr (const struct sockaddr_in &sockIPIn) - { - this->setSockIP (sockIPIn); - } + inline caNetAddr (const struct sockaddr_in &sockIPIn) + { + this->setSockIP (sockIPIn); + } - inline caNetAddr operator = (const struct sockaddr_in &sockIPIn) - { - this->setSockIP (sockIPIn); - return *this; - } + inline caNetAddr operator = (const struct sockaddr_in &sockIPIn) + { + this->setSockIP (sockIPIn); + return *this; + } - inline caNetAddr operator = (const struct sockaddr &sockIn) - { - this->setSock (sockIn); - return *this; - } + inline caNetAddr operator = (const struct sockaddr &sockIn) + { + this->setSock (sockIn); + return *this; + } - inline struct sockaddr_in getSockIP() const - { - assert (this->type==casnaInet); - return this->addr.ip; - } + inline struct sockaddr_in getSockIP() const + { + assert (this->type==casnaInet); + return this->addr.ip; + } - inline struct sockaddr getSock() const - { - struct sockaddr sa; - assert (this->type==casnaInet); - struct sockaddr_in *psain = - reinterpret_cast (&sa); - *psain = this->addr.ip; + inline struct sockaddr getSock() const + { + struct sockaddr sa; + assert (this->type==casnaInet); + struct sockaddr_in *psain = + reinterpret_cast (&sa); + *psain = this->addr.ip; - return sa; - } + return sa; + } - inline operator sockaddr_in () const - { - return this->getSockIP(); - } + inline operator sockaddr_in () const + { + return this->getSockIP(); + } - inline operator sockaddr () const - { - return this->getSock(); - } + inline operator sockaddr () const + { + return this->getSock(); + } - # endif // caNetAddrSock + # endif // caNetAddrSock private: - union { -# ifdef caNetAddrSock - struct sockaddr_in ip; -# endif - // - // this must be as big or bigger - // than the largest field - // - // see checkDummySize() above - // - unsigned char dummy[16]; - } addr; + union { +# ifdef caNetAddrSock + struct sockaddr_in ip; +# endif + // + // this must be as big or bigger + // than the largest field + // + // see checkDummySize() above + // + unsigned char dummy[16]; + } addr; - caNetAddrType type; + caNetAddrType type; }; inline void verifyCANetAddr::checkSize() { - // - // temp used because brain dead - // ms compiler does not allow - // use of scope res operator - // - caNetAddr t; - size_t ds = sizeof (t.addr.dummy); - size_t as = sizeof (t.addr); - assert (ds==as); + // + // temp used because brain dead + // ms compiler does not allow + // use of scope res operator + // + caNetAddr t; + size_t ds = sizeof (t.addr.dummy); + size_t as = sizeof (t.addr); + assert (ds==as); } // @@ -219,7 +219,7 @@ inline void verifyCANetAddr::checkSize() // inline void caNetAddr::stringConvert (char *pString, unsigned stringLength) const { -# ifdef caNetAddrSock +# ifdef caNetAddrSock if (this->type==casnaInet) { ipAddrToA (&this->addr.ip, pString, stringLength); return;