From ee937667fd0ecd82faab4c88d756b906fb625f1a Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 17:07:47 +0000 Subject: Integration into IvyLeague Uvh -> Ivl Multiplexer.* is renamed into Scheduler.* A few name conflicts in the merger with ex-DNN have been solved Imakefile is replaced by Makefile Created InetAddress.* and UnixAddress.* from Address.* Created IrdaAddress.* OLD/TextStream has been updated --- comm/Datagram.cc | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'comm/Datagram.cc') diff --git a/comm/Datagram.cc b/comm/Datagram.cc index e7eb577..66c40df 100644 --- a/comm/Datagram.cc +++ b/comm/Datagram.cc @@ -17,7 +17,7 @@ #include #include -/*?class UchDatagram +/*?class IvlDatagram A datagram socket can send to and receive from any other datagram socket, unless it is connected. Thus, establishing a datagram connection is simple. @@ -40,23 +40,23 @@ or \fun{Open} followed by \fun{Bind} and \fun{Connect} if necessary. ?*/ /*? -These constructors are similar to those of the class \typ{UchSocket}. +These constructors are similar to those of the class \typ{IvlSocket}. ?*/ -UchDatagram :: UchDatagram (UchAddress* bound, UchAddress* connected) -: UchSocket (bound, connected), +IvlDatagram :: IvlDatagram (IvlAddress* bound, IvlAddress* connected) +: IvlSocket (bound, connected), FAddr (0) { } /*?nodoc?*/ -UchDatagram :: UchDatagram (const UchDatagram& d) -: UchSocket (d), +IvlDatagram :: IvlDatagram (const IvlDatagram& d) +: IvlSocket (d), FAddr (d.FAddr) { } /*?nodoc?*/ -UchDatagram :: ~UchDatagram () +IvlDatagram :: ~IvlDatagram () { } @@ -64,22 +64,22 @@ UchDatagram :: ~UchDatagram () /*? Return the address of the sender of the last received message. ?*/ -UchAddress* -UchDatagram :: From () +IvlAddress* +IvlDatagram :: From () { } #endif /* DOC */ /*?nodoc?*/ -UchChannel* -UchDatagram :: Copy () const +IvlChannel* +IvlDatagram :: Copy () const { - return new UchDatagram (*this); + return new IvlDatagram (*this); } /*?nodoc?*/ int -UchDatagram :: SockType () +IvlDatagram :: SockType () { return SOCK_DGRAM; } @@ -90,7 +90,7 @@ Return the number of bytes actually transferred, or -1 if a system error occurre If the datagram is connected, you must use \fun{Write} instead. ?*/ int -UchDatagram :: Send (byte* buf, int len, UchAddress& to) +IvlDatagram :: Send (byte* buf, int len, IvlAddress& to) { return sendto (FilDes (), (char*) buf, len, 0, to.GetSockAddr (), to.Length ()); } @@ -102,17 +102,17 @@ The address of the sender can be retrieved with \fun{From}. If the socket is connected, you must use \fun{Read} instead. ?*/ int -UchDatagram :: Receive (byte* buf, int len) +IvlDatagram :: Receive (byte* buf, int len) { GEN_ADDR addr; - int alen = sizeof (addr); + socklen_t alen = sizeof (addr); int ret; ret = recvfrom (Fd, (char*) buf, len, 0, &addr.sa, &alen); if (ret < 0) return ret; - FAddr = UchAddress::Decode (&addr, alen); + FAddr = IvlAddress::Decode (&addr, alen); return ret; } @@ -122,7 +122,7 @@ it sends \fun{len} bytes to the sender of the last received message. If there is no such sender, it returns -1. ?*/ int -UchDatagram :: Reply (byte* buf, int len) +IvlDatagram :: Reply (byte* buf, int len) { if (! FAddr) return -1; @@ -131,7 +131,7 @@ UchDatagram :: Reply (byte* buf, int len) /*?nextdoc?*/ int -UchDatagram :: Send (UchMsgBuffer& buf, UchAddress& to, bool peek) +IvlDatagram :: Send (IvlMsgBuffer& buf, IvlAddress& to, bool peek) { int n = Send (buf.Buffer (), buf.BufLength (), to); if (! peek) @@ -141,7 +141,7 @@ UchDatagram :: Send (UchMsgBuffer& buf, UchAddress& to, bool peek) /*?nextdoc?*/ int -UchDatagram :: Receive (UchMsgBuffer& buf) +IvlDatagram :: Receive (IvlMsgBuffer& buf) { int n = Receive (buf.Free (), buf.FreeLength ()); if (n > 0) @@ -150,11 +150,11 @@ UchDatagram :: Receive (UchMsgBuffer& buf) } /*? -The same functions but with a \typ{UchMsgBuffer} argument instead of a byte pointer and size. +The same functions but with a \typ{IvlMsgBuffer} argument instead of a byte pointer and size. As usual, if \var{peek} is true the buffer is not flushed. ?*/ int -UchDatagram :: Reply (UchMsgBuffer& buf, bool peek) +IvlDatagram :: Reply (IvlMsgBuffer& buf, bool peek) { int n = Reply (buf.Buffer (), buf.BufLength ()); if (! peek) -- cgit v1.1