From a2698c7828bb48c392aaf4e0c78a3d17245ecc52 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 29 May 1998 20:08:21 +0000 Subject: [PATCH] use new sock ioctl() typedef --- src/cas/io/bsdSocket/caServerIO.cc | 5 ++- src/cas/io/bsdSocket/casDGIntfIO.cc | 53 +++++++++++++---------------- src/cas/io/bsdSocket/casIntfIO.cc | 7 ++-- src/cas/io/bsdSocket/casStreamIO.cc | 13 ++++--- 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/cas/io/bsdSocket/caServerIO.cc b/src/cas/io/bsdSocket/caServerIO.cc index 44065b03f..60cbaf638 100644 --- a/src/cas/io/bsdSocket/caServerIO.cc +++ b/src/cas/io/bsdSocket/caServerIO.cc @@ -5,6 +5,9 @@ // // // $Log$ +// Revision 1.7 1997/08/05 00:47:22 jhill +// fixed warnings +// // Revision 1.6 1997/06/30 23:40:48 jhill // use %p for pointers // @@ -136,7 +139,7 @@ caStatus caServerIO::init(caServerI &cas) } } else { - saddr.sin_addr.s_addr = INADDR_ANY; + saddr.sin_addr.s_addr = htonl(INADDR_ANY); stat = cas.addAddr(caNetAddr(saddr), autoBeaconAddr, TRUE); if (stat) { errMessage(stat, NULL); diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index 2d00b4c2b..96eb11860 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -258,7 +258,7 @@ void casDGIntfIO::osdShow (unsigned level) const void casDGIntfIO::xSetNonBlocking() { int status; - int yes = TRUE; + osiSockIoctl_t yes = TRUE; if (this->sockState!=casOnLine) { return; @@ -357,43 +357,36 @@ xSendStatus casDGIntfIO::osdSend(const char *pBuf, bufSizeT size, return xSendOK; } - // // casDGIntfIO::sendBeacon() // void casDGIntfIO::sendBeacon(char &msg, unsigned length, aitUint32 &m_ipa, aitUint16 &m_port) { - caAddrNode *pAddr; - int status; - - if (this->sockState!=casOnLine) { - return; - } - - for( pAddr = (caAddrNode *)ellFirst(&this->beaconAddrList); - pAddr; - pAddr = (caAddrNode *)ellNext(&pAddr->node)) { - - m_ipa = htonl(pAddr->srcAddr.in.sin_addr.s_addr); + caAddrNode *pAddr; + int status; + + if (this->sockState!=casOnLine) { + return; + } + + for (pAddr = (caAddrNode *)ellFirst(&this->beaconAddrList); + pAddr; pAddr = (caAddrNode *)ellNext(&pAddr->node)) { + + m_ipa = pAddr->srcAddr.in.sin_addr.s_addr; m_port = htons(this->dgPort); - status = sendto( - this->sock, - &msg, - length, - 0, - &pAddr->destAddr.sa, - sizeof(pAddr->destAddr.sa)); - if (status < 0) { + status = sendto (this->sock, &msg, length, 0, + &pAddr->destAddr.sa, sizeof(pAddr->destAddr.sa)); + if (status < 0) { char buf[64]; ipAddrToA(&pAddr->destAddr.in, buf, sizeof(buf)); - - ca_printf( - "CAS:beacon error was \"%s\" dest=%s sock=%d\n", - SOCKERRSTR, - buf, - this->sock); - } - } + + ca_printf( + "CAS:beacon error was \"%s\" dest=%s sock=%d\n", + SOCKERRSTR, + buf, + this->sock); + } + } } // diff --git a/src/cas/io/bsdSocket/casIntfIO.cc b/src/cas/io/bsdSocket/casIntfIO.cc index 949db8fab..e58fa9d7a 100644 --- a/src/cas/io/bsdSocket/casIntfIO.cc +++ b/src/cas/io/bsdSocket/casIntfIO.cc @@ -6,6 +6,9 @@ // // // $Log$ +// Revision 1.4 1998/02/05 23:11:16 jhill +// use osiSock macros +// // Revision 1.3 1997/06/13 09:16:15 jhill // connect proto changes // @@ -140,7 +143,7 @@ caStatus casIntfIO::init(const caNetAddr &addrIn, casDGClient &dgClientIn, // we will also need to bind to the broadcast address // for that interface (if it has one) // - if (this->addr.sin_addr.s_addr != INADDR_ANY) { + if (this->addr.sin_addr.s_addr != htonl(INADDR_ANY)) { this->pBCastUDP = this->newDGIntfIO(dgClientIn); if (this->pBCastUDP) { stat = this->pBCastUDP->init(addr, this->portNumber(), @@ -226,7 +229,7 @@ casStreamOS *casIntfIO::newStreamClient(caServerI &cas) const void casIntfIO::setNonBlocking() { int status; - int yes = TRUE; + osiSockIoctl_t yes = TRUE; status = socket_ioctl(this->sock, FIONBIO, &yes); if (status<0) { diff --git a/src/cas/io/bsdSocket/casStreamIO.cc b/src/cas/io/bsdSocket/casStreamIO.cc index 857485bcd..d9efd56bb 100644 --- a/src/cas/io/bsdSocket/casStreamIO.cc +++ b/src/cas/io/bsdSocket/casStreamIO.cc @@ -5,6 +5,9 @@ // // // $Log$ +// Revision 1.14 1998/02/05 23:12:01 jhill +// use osiSock macros +// // Revision 1.13 1997/06/30 23:40:50 jhill // use %p for pointers // @@ -263,11 +266,11 @@ void casStreamIO::osdShow (unsigned level) const void casStreamIO::xSetNonBlocking() { int status; - int yes = TRUE; + osiSockIoctl_t yes = TRUE; - if (this->sockState!=casOnLine) { - return; - } + if (this->sockState!=casOnLine) { + return; + } status = socket_ioctl(this->sock, FIONBIO, &yes); if (status>=0) { @@ -295,7 +298,7 @@ xBlockingStatus casStreamIO::blockingState() const bufSizeT casStreamIO::incommingBytesPresent() const { int status; - int nchars; + osiSockIoctl_t nchars; status = socket_ioctl(this->sock, FIONREAD, &nchars); if (status<0) {