nsprpub/pr/src/cplus/rcnetio.h

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 ** Subclass definitions for network I/O (ref: prio.h)
michael@0 8 */
michael@0 9
michael@0 10 #if defined(_RCNETIO_H)
michael@0 11 #else
michael@0 12 #define _RCNETIO_H
michael@0 13
michael@0 14 #include "rcbase.h"
michael@0 15 #include "rcinrval.h"
michael@0 16 #include "rcio.h"
michael@0 17 #include "rcnetdb.h"
michael@0 18
michael@0 19 #include "prio.h"
michael@0 20
michael@0 21 class RCFileInfo;
michael@0 22
michael@0 23 /*
michael@0 24 ** Class: RCNetStreamIO (ref prio.h)
michael@0 25 **
michael@0 26 ** Streamed (reliable) network I/O (e.g., TCP).
michael@0 27 ** This class hides (makes private) the functions that are not applicable
michael@0 28 ** to network I/O (i.e., those for file I/O).
michael@0 29 */
michael@0 30
michael@0 31 class PR_IMPLEMENT(RCNetStreamIO): public RCIO
michael@0 32 {
michael@0 33
michael@0 34 public:
michael@0 35 RCNetStreamIO();
michael@0 36 virtual ~RCNetStreamIO();
michael@0 37
michael@0 38 virtual RCIO* Accept(RCNetAddr* addr, const RCInterval& timeout);
michael@0 39 virtual PRInt32 AcceptRead(
michael@0 40 RCIO **nd, RCNetAddr **raddr, void *buf,
michael@0 41 PRSize amount, const RCInterval& timeout);
michael@0 42 virtual PRInt64 Available();
michael@0 43 virtual PRStatus Bind(const RCNetAddr& addr);
michael@0 44 virtual PRStatus Connect(
michael@0 45 const RCNetAddr& addr, const RCInterval& timeout);
michael@0 46 virtual PRStatus GetLocalName(RCNetAddr *addr) const;
michael@0 47 virtual PRStatus GetPeerName(RCNetAddr *addr) const;
michael@0 48 virtual PRStatus GetSocketOption(PRSocketOptionData *data) const;
michael@0 49 virtual PRStatus Listen(PRIntn backlog);
michael@0 50 virtual PRInt16 Poll(PRInt16 in_flags, PRInt16 *out_flags);
michael@0 51 virtual PRInt32 Read(void *buf, PRSize amount);
michael@0 52 virtual PRInt32 Recv(
michael@0 53 void *buf, PRSize amount, PRIntn flags,
michael@0 54 const RCInterval& timeout);
michael@0 55 virtual PRInt32 Recvfrom(
michael@0 56 void *buf, PRSize amount, PRIntn flags,
michael@0 57 RCNetAddr* addr, const RCInterval& timeout);
michael@0 58 virtual PRInt32 Send(
michael@0 59 const void *buf, PRSize amount, PRIntn flags,
michael@0 60 const RCInterval& timeout);
michael@0 61 virtual PRInt32 Sendto(
michael@0 62 const void *buf, PRSize amount, PRIntn flags,
michael@0 63 const RCNetAddr& addr,
michael@0 64 const RCInterval& timeout);
michael@0 65 virtual PRStatus SetSocketOption(const PRSocketOptionData *data);
michael@0 66 virtual PRStatus Shutdown(ShutdownHow how);
michael@0 67 virtual PRInt32 TransmitFile(
michael@0 68 RCIO *source, const void *headers,
michael@0 69 PRSize hlen, RCIO::FileDisposition flags,
michael@0 70 const RCInterval& timeout);
michael@0 71 virtual PRInt32 Write(const void *buf, PRSize amount);
michael@0 72 virtual PRInt32 Writev(
michael@0 73 const PRIOVec *iov, PRSize size,
michael@0 74 const RCInterval& timeout);
michael@0 75
michael@0 76 private:
michael@0 77 /* functions unavailable to this clients of this class */
michael@0 78 RCNetStreamIO(const RCNetStreamIO&);
michael@0 79
michael@0 80 PRStatus Close();
michael@0 81 PRStatus Open(const char *name, PRIntn flags, PRIntn mode);
michael@0 82 PRStatus FileInfo(RCFileInfo *info) const;
michael@0 83 PRStatus Fsync();
michael@0 84 PRInt64 Seek(PRInt64 offset, RCIO::Whence how);
michael@0 85
michael@0 86 public:
michael@0 87 RCNetStreamIO(PRIntn protocol);
michael@0 88 }; /* RCNetIO */
michael@0 89
michael@0 90 #endif /* defined(_RCNETIO_H) */
michael@0 91
michael@0 92 /* RCNetStreamIO.h */
michael@0 93
michael@0 94

mercurial