use new sock ioctl() typedef

This commit is contained in:
Jeff Hill
1998-05-29 20:08:21 +00:00
parent 3437531581
commit a2698c7828
4 changed files with 40 additions and 38 deletions

View File

@@ -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);

View File

@@ -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);
}
}
}
//

View File

@@ -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) {

View File

@@ -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) {