nsprpub/pr/src/cplus/rcnetio.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/src/cplus/rcnetio.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,94 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 +** Subclass definitions for network I/O (ref: prio.h)
    1.11 +*/
    1.12 +
    1.13 +#if defined(_RCNETIO_H)
    1.14 +#else
    1.15 +#define _RCNETIO_H
    1.16 +
    1.17 +#include "rcbase.h"
    1.18 +#include "rcinrval.h"
    1.19 +#include "rcio.h"
    1.20 +#include "rcnetdb.h"
    1.21 +
    1.22 +#include "prio.h"
    1.23 +
    1.24 +class RCFileInfo;
    1.25 +
    1.26 +/*
    1.27 +** Class: RCNetStreamIO (ref prio.h)
    1.28 +**
    1.29 +** Streamed (reliable) network I/O (e.g., TCP).
    1.30 +** This class hides (makes private) the functions that are not applicable
    1.31 +** to network I/O (i.e., those for file I/O).
    1.32 +*/
    1.33 +
    1.34 +class PR_IMPLEMENT(RCNetStreamIO): public RCIO
    1.35 +{
    1.36 +
    1.37 +public:
    1.38 +    RCNetStreamIO();
    1.39 +    virtual ~RCNetStreamIO();
    1.40 +
    1.41 +    virtual RCIO*       Accept(RCNetAddr* addr, const RCInterval& timeout);
    1.42 +    virtual PRInt32     AcceptRead(
    1.43 +                            RCIO **nd, RCNetAddr **raddr, void *buf,
    1.44 +                            PRSize amount, const RCInterval& timeout);
    1.45 +    virtual PRInt64     Available();
    1.46 +    virtual PRStatus    Bind(const RCNetAddr& addr);
    1.47 +    virtual PRStatus    Connect(
    1.48 +                            const RCNetAddr& addr, const RCInterval& timeout);
    1.49 +    virtual PRStatus    GetLocalName(RCNetAddr *addr) const;
    1.50 +    virtual PRStatus    GetPeerName(RCNetAddr *addr) const;
    1.51 +    virtual PRStatus    GetSocketOption(PRSocketOptionData *data) const;
    1.52 +    virtual PRStatus    Listen(PRIntn backlog);
    1.53 +    virtual PRInt16     Poll(PRInt16 in_flags, PRInt16 *out_flags);
    1.54 +    virtual PRInt32     Read(void *buf, PRSize amount);
    1.55 +    virtual PRInt32     Recv(
    1.56 +                            void *buf, PRSize amount, PRIntn flags,
    1.57 +                            const RCInterval& timeout);
    1.58 +    virtual PRInt32     Recvfrom(
    1.59 +                            void *buf, PRSize amount, PRIntn flags,
    1.60 +                            RCNetAddr* addr, const RCInterval& timeout);
    1.61 +    virtual PRInt32     Send(
    1.62 +                            const void *buf, PRSize amount, PRIntn flags,
    1.63 +                            const RCInterval& timeout);
    1.64 +    virtual PRInt32     Sendto(
    1.65 +                            const void *buf, PRSize amount, PRIntn flags,
    1.66 +                            const RCNetAddr& addr,
    1.67 +                            const RCInterval& timeout);
    1.68 +    virtual PRStatus    SetSocketOption(const PRSocketOptionData *data);
    1.69 +    virtual PRStatus    Shutdown(ShutdownHow how);
    1.70 +    virtual PRInt32     TransmitFile(
    1.71 +                            RCIO *source, const void *headers,
    1.72 +                            PRSize hlen, RCIO::FileDisposition flags,
    1.73 +                            const RCInterval& timeout);
    1.74 +    virtual PRInt32     Write(const void *buf, PRSize amount);
    1.75 +    virtual PRInt32     Writev(
    1.76 +                            const PRIOVec *iov, PRSize size,
    1.77 +                            const RCInterval& timeout);
    1.78 +
    1.79 +private:
    1.80 +    /* functions unavailable to this clients of this class */
    1.81 +    RCNetStreamIO(const RCNetStreamIO&);
    1.82 +
    1.83 +    PRStatus    Close();
    1.84 +    PRStatus    Open(const char *name, PRIntn flags, PRIntn mode);
    1.85 +    PRStatus    FileInfo(RCFileInfo *info) const;
    1.86 +    PRStatus    Fsync();
    1.87 +    PRInt64     Seek(PRInt64 offset, RCIO::Whence how);
    1.88 +
    1.89 +public:
    1.90 +    RCNetStreamIO(PRIntn protocol);
    1.91 +};  /* RCNetIO */
    1.92 +
    1.93 +#endif /* defined(_RCNETIO_H) */
    1.94 +
    1.95 +/* RCNetStreamIO.h */
    1.96 +
    1.97 +

mercurial