summaryrefslogtreecommitdiff
path: root/comm/OLD/PortServer.cc
diff options
context:
space:
mode:
authorchatty1994-05-10 10:02:49 +0000
committerchatty1994-05-10 10:02:49 +0000
commit054510bddc1801d3900fb0c801a0169dd588b466 (patch)
tree94a7c0dcca84f341e2e373caa4c22caea6adcf7f /comm/OLD/PortServer.cc
parentcbb1752ce6b9b55130d355469111e3aaa1a58433 (diff)
downloadivy-league-054510bddc1801d3900fb0c801a0169dd588b466.zip
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.gz
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.bz2
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.xz
replaced TRUE/FALSE by true/false
Diffstat (limited to 'comm/OLD/PortServer.cc')
-rw-r--r--comm/OLD/PortServer.cc53
1 files changed, 34 insertions, 19 deletions
diff --git a/comm/OLD/PortServer.cc b/comm/OLD/PortServer.cc
index dc4c334..d66f722 100644
--- a/comm/OLD/PortServer.cc
+++ b/comm/OLD/PortServer.cc
@@ -22,12 +22,27 @@
#include <string.h>
// sometimes, cuserid is declared in stdio.h ...
#include <stdio.h>
+#ifdef __osf__
+extern "C" {
+#endif
#include <netdb.h>
+#ifdef __osf__
+}
+#endif
+
+#ifdef __osf__
+extern "C" {
+ unsigned short htons (unsigned short);
+ unsigned short ntohs (unsigned short);
+ int gethostname (char*, int);
+}
+#endif
+
#define DEFKEY "%s:"
// *** horrible patch
-bool PortServerInquireSysError = FALSE;
+bool PortServerInquireSysError = false;
/*?class UchPortServer
The class \typ{UchPortServer} described here implements the communication with the port server.
@@ -57,7 +72,7 @@ UchPortServer :: UchPortServer (const char* serv, const char* host)
portno = atoi (port);
else
portno = 3003;
-// Error (ErrFatal, "getservbyname", "service not available");
+// ::Error (ErrFatal, "getservbyname", "service not available");
}
/* open datagram socket */
@@ -81,7 +96,7 @@ static void
SendRequest (UchDatagram* to, UchPortServerReq req)
{
UchMsgBuffer buf (256);
- buf.Append (req);
+ buf.WriteMsg (req);
to->Write (buf);
}
@@ -127,11 +142,11 @@ UchPortServer :: Remove (const char* key, UchInetAddress& addr, int id)
SendRequest (Serv, req);
}
-static bool expired = FALSE;
+static bool expired = false;
static void
Expire (Millisecond)
{
- expired = TRUE;
+ expired = true;
}
@@ -150,27 +165,27 @@ UchInetAddress*
UchPortServer :: Inquire (const char* key, int timeout)
{
// *** horrible patch
-PortServerInquireSysError = FALSE;
+PortServerInquireSysError = false;
UchPortServerReq req (PortServInquire, 0, 0, 0, MakeKey (key));
SendRequest (Serv, req);
UchMsgBuffer buf (256);
- expired = FALSE;
+ expired = false;
CcuTimer timer (timeout * 1000, Expire);
int n = Serv->Receive (buf);
if (expired) {
- Error (ErrWarn, "UchPortServer::Inquire", "timeout");
+ ::Error (ErrWarn, "UchPortServer::Inquire", "timeout");
return 0;
}
if (n <= 0) {
SysError (ErrWarn, "Inquire");
// *** horrible patch
-PortServerInquireSysError = TRUE;
+PortServerInquireSysError = true;
return 0;
}
- if (! buf.Get (req)) {
- Error (ErrWarn, "UchPortServer::Inquire", "could not read answer");
+ if (! buf.ReadMsg (req)) {
+ ::Error (ErrWarn, "UchPortServer::Inquire", "could not read answer");
return 0;
}
switch (req.Type) {
@@ -179,7 +194,7 @@ PortServerInquireSysError = TRUE;
case PortServFail :
return 0;
}
- Error (ErrWarn, "UchPortServer::Inquire", "unexpected answer type");
+ ::Error (ErrWarn, "UchPortServer::Inquire", "unexpected answer type");
return 0;
}
@@ -206,12 +221,12 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
UchMsgBuffer buf (1024);
for (;;) {
buf.Flush ();
- expired = FALSE;
+ expired = false;
CcuTimer timer (timeout * 1000, Expire);
int n = Serv->Receive (buf);
if (expired) {
- Error (ErrWarn, "UchPortServer::Match", "timeout");
+ ::Error (ErrWarn, "UchPortServer::Match", "timeout");
return 0;
}
@@ -219,8 +234,8 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
SysError (ErrWarn, "Match");
break;
}
- if (! buf.Get (req)) {
- Error (ErrWarn, "Match", "could not read message");
+ if (! buf.ReadMsg (req)) {
+ ::Error (ErrWarn, "Match", "could not read message");
continue;
}
switch (req.Type) {
@@ -231,10 +246,10 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
break;
case PortServEndMatch:
if (nb != req.Ident)
- Error (ErrWarn, "Match", "lost answers");
+ ::Error (ErrWarn, "Match", "lost answers");
return req.Ident;
default:
- Error (ErrWarn, "Match", "unexpected answer type");
+ ::Error (ErrWarn, "Match", "unexpected answer type");
return -1;
}
}
@@ -298,7 +313,7 @@ UchPortServer :: MakeKey (const char* key)
if (! l)
l = cuserid (0);
if (! l) {
- Error (ErrWarn, "UchPortServer::MakeKey", "getlogin failed");
+ ::Error (ErrWarn, "UchPortServer::MakeKey", "getlogin failed");
strcpy (p, "???");
}
strcpy (p, l);