Bug 1882457 - Update the release process docs for the monorepo migration. r=ahal...
[gecko.git] / security / nss / cpputil / dummy_io_fwd.cc
blob5e53d9e1bc5f75438c3083da6c5ae81ca4c1a336
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "prio.h"
7 #include "dummy_io.h"
9 static DummyIOLayerMethods *ToMethods(PRFileDesc *f) {
10 return reinterpret_cast<DummyIOLayerMethods *>(f->secret);
13 static PRStatus DummyClose(PRFileDesc *f) { return ToMethods(f)->Close(f); }
15 static int32_t DummyRead(PRFileDesc *f, void *buf, int32_t length) {
16 return ToMethods(f)->Read(f, buf, length);
19 static int32_t DummyWrite(PRFileDesc *f, const void *buf, int32_t length) {
20 return ToMethods(f)->Write(f, buf, length);
23 static int32_t DummyAvailable(PRFileDesc *f) {
24 return ToMethods(f)->Available(f);
27 static int64_t DummyAvailable64(PRFileDesc *f) {
28 return ToMethods(f)->Available64(f);
31 static PRStatus DummySync(PRFileDesc *f) { return ToMethods(f)->Sync(f); }
33 static int32_t DummySeek(PRFileDesc *f, int32_t offset, PRSeekWhence how) {
34 return ToMethods(f)->Seek(f, offset, how);
37 static int64_t DummySeek64(PRFileDesc *f, int64_t offset, PRSeekWhence how) {
38 return ToMethods(f)->Seek64(f, offset, how);
41 static PRStatus DummyFileInfo(PRFileDesc *f, PRFileInfo *info) {
42 return ToMethods(f)->FileInfo(f, info);
45 static PRStatus DummyFileInfo64(PRFileDesc *f, PRFileInfo64 *info) {
46 return ToMethods(f)->FileInfo64(f, info);
49 static int32_t DummyWritev(PRFileDesc *f, const PRIOVec *iov, int32_t iov_size,
50 PRIntervalTime to) {
51 return ToMethods(f)->Writev(f, iov, iov_size, to);
54 static PRStatus DummyConnect(PRFileDesc *f, const PRNetAddr *addr,
55 PRIntervalTime to) {
56 return ToMethods(f)->Connect(f, addr, to);
59 static PRFileDesc *DummyAccept(PRFileDesc *f, PRNetAddr *addr,
60 PRIntervalTime to) {
61 return ToMethods(f)->Accept(f, addr, to);
64 static PRStatus DummyBind(PRFileDesc *f, const PRNetAddr *addr) {
65 return ToMethods(f)->Bind(f, addr);
68 static PRStatus DummyListen(PRFileDesc *f, int32_t depth) {
69 return ToMethods(f)->Listen(f, depth);
72 static PRStatus DummyShutdown(PRFileDesc *f, int32_t how) {
73 return ToMethods(f)->Shutdown(f, how);
76 static int32_t DummyRecv(PRFileDesc *f, void *buf, int32_t buflen,
77 int32_t flags, PRIntervalTime to) {
78 return ToMethods(f)->Recv(f, buf, buflen, flags, to);
81 static int32_t DummySend(PRFileDesc *f, const void *buf, int32_t amount,
82 int32_t flags, PRIntervalTime to) {
83 return ToMethods(f)->Send(f, buf, amount, flags, to);
86 static int32_t DummyRecvfrom(PRFileDesc *f, void *buf, int32_t amount,
87 int32_t flags, PRNetAddr *addr,
88 PRIntervalTime to) {
89 return ToMethods(f)->Recvfrom(f, buf, amount, flags, addr, to);
92 static int32_t DummySendto(PRFileDesc *f, const void *buf, int32_t amount,
93 int32_t flags, const PRNetAddr *addr,
94 PRIntervalTime to) {
95 return ToMethods(f)->Sendto(f, buf, amount, flags, addr, to);
98 static int16_t DummyPoll(PRFileDesc *f, int16_t in_flags, int16_t *out_flags) {
99 return ToMethods(f)->Poll(f, in_flags, out_flags);
102 static int32_t DummyAcceptRead(PRFileDesc *f, PRFileDesc **nd,
103 PRNetAddr **raddr, void *buf, int32_t amount,
104 PRIntervalTime t) {
105 return ToMethods(f)->AcceptRead(f, nd, raddr, buf, amount, t);
108 static int32_t DummyTransmitFile(PRFileDesc *sd, PRFileDesc *f,
109 const void *headers, int32_t hlen,
110 PRTransmitFileFlags flags, PRIntervalTime t) {
111 return ToMethods(f)->TransmitFile(sd, f, headers, hlen, flags, t);
114 static PRStatus DummyGetpeername(PRFileDesc *f, PRNetAddr *addr) {
115 return ToMethods(f)->Getpeername(f, addr);
118 static PRStatus DummyGetsockname(PRFileDesc *f, PRNetAddr *addr) {
119 return ToMethods(f)->Getsockname(f, addr);
122 static PRStatus DummyGetsockoption(PRFileDesc *f, PRSocketOptionData *opt) {
123 return ToMethods(f)->Getsockoption(f, opt);
126 static PRStatus DummySetsockoption(PRFileDesc *f,
127 const PRSocketOptionData *opt) {
128 return ToMethods(f)->Setsockoption(f, opt);
131 static int32_t DummySendfile(PRFileDesc *f, PRSendFileData *in,
132 PRTransmitFileFlags flags, PRIntervalTime to) {
133 return ToMethods(f)->Sendfile(f, in, flags, to);
136 static PRStatus DummyConnectContinue(PRFileDesc *f, int16_t flags) {
137 return ToMethods(f)->ConnectContinue(f, flags);
140 static int32_t DummyReserved(PRFileDesc *f) {
141 return ToMethods(f)->Reserved(f);
144 extern const struct PRIOMethods DummyMethodsForward = {
145 PR_DESC_LAYERED, DummyClose,
146 DummyRead, DummyWrite,
147 DummyAvailable, DummyAvailable64,
148 DummySync, DummySeek,
149 DummySeek64, DummyFileInfo,
150 DummyFileInfo64, DummyWritev,
151 DummyConnect, DummyAccept,
152 DummyBind, DummyListen,
153 DummyShutdown, DummyRecv,
154 DummySend, DummyRecvfrom,
155 DummySendto, DummyPoll,
156 DummyAcceptRead, DummyTransmitFile,
157 DummyGetsockname, DummyGetpeername,
158 DummyReserved, DummyReserved,
159 DummyGetsockoption, DummySetsockoption,
160 DummySendfile, DummyConnectContinue,
161 DummyReserved, DummyReserved,
162 DummyReserved, DummyReserved};