michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: ** Subclass definitions for network I/O (ref: prio.h) michael@0: */ michael@0: michael@0: #if defined(_RCNETIO_H) michael@0: #else michael@0: #define _RCNETIO_H michael@0: michael@0: #include "rcbase.h" michael@0: #include "rcinrval.h" michael@0: #include "rcio.h" michael@0: #include "rcnetdb.h" michael@0: michael@0: #include "prio.h" michael@0: michael@0: class RCFileInfo; michael@0: michael@0: /* michael@0: ** Class: RCNetStreamIO (ref prio.h) michael@0: ** michael@0: ** Streamed (reliable) network I/O (e.g., TCP). michael@0: ** This class hides (makes private) the functions that are not applicable michael@0: ** to network I/O (i.e., those for file I/O). michael@0: */ michael@0: michael@0: class PR_IMPLEMENT(RCNetStreamIO): public RCIO michael@0: { michael@0: michael@0: public: michael@0: RCNetStreamIO(); michael@0: virtual ~RCNetStreamIO(); michael@0: michael@0: virtual RCIO* Accept(RCNetAddr* addr, const RCInterval& timeout); michael@0: virtual PRInt32 AcceptRead( michael@0: RCIO **nd, RCNetAddr **raddr, void *buf, michael@0: PRSize amount, const RCInterval& timeout); michael@0: virtual PRInt64 Available(); michael@0: virtual PRStatus Bind(const RCNetAddr& addr); michael@0: virtual PRStatus Connect( michael@0: const RCNetAddr& addr, const RCInterval& timeout); michael@0: virtual PRStatus GetLocalName(RCNetAddr *addr) const; michael@0: virtual PRStatus GetPeerName(RCNetAddr *addr) const; michael@0: virtual PRStatus GetSocketOption(PRSocketOptionData *data) const; michael@0: virtual PRStatus Listen(PRIntn backlog); michael@0: virtual PRInt16 Poll(PRInt16 in_flags, PRInt16 *out_flags); michael@0: virtual PRInt32 Read(void *buf, PRSize amount); michael@0: virtual PRInt32 Recv( michael@0: void *buf, PRSize amount, PRIntn flags, michael@0: const RCInterval& timeout); michael@0: virtual PRInt32 Recvfrom( michael@0: void *buf, PRSize amount, PRIntn flags, michael@0: RCNetAddr* addr, const RCInterval& timeout); michael@0: virtual PRInt32 Send( michael@0: const void *buf, PRSize amount, PRIntn flags, michael@0: const RCInterval& timeout); michael@0: virtual PRInt32 Sendto( michael@0: const void *buf, PRSize amount, PRIntn flags, michael@0: const RCNetAddr& addr, michael@0: const RCInterval& timeout); michael@0: virtual PRStatus SetSocketOption(const PRSocketOptionData *data); michael@0: virtual PRStatus Shutdown(ShutdownHow how); michael@0: virtual PRInt32 TransmitFile( michael@0: RCIO *source, const void *headers, michael@0: PRSize hlen, RCIO::FileDisposition flags, michael@0: const RCInterval& timeout); michael@0: virtual PRInt32 Write(const void *buf, PRSize amount); michael@0: virtual PRInt32 Writev( michael@0: const PRIOVec *iov, PRSize size, michael@0: const RCInterval& timeout); michael@0: michael@0: private: michael@0: /* functions unavailable to this clients of this class */ michael@0: RCNetStreamIO(const RCNetStreamIO&); michael@0: michael@0: PRStatus Close(); michael@0: PRStatus Open(const char *name, PRIntn flags, PRIntn mode); michael@0: PRStatus FileInfo(RCFileInfo *info) const; michael@0: PRStatus Fsync(); michael@0: PRInt64 Seek(PRInt64 offset, RCIO::Whence how); michael@0: michael@0: public: michael@0: RCNetStreamIO(PRIntn protocol); michael@0: }; /* RCNetIO */ michael@0: michael@0: #endif /* defined(_RCNETIO_H) */ michael@0: michael@0: /* RCNetStreamIO.h */ michael@0: michael@0: