/src/nss/cpputil/dummy_io_fwd.cc
Line | Count | Source |
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/. */ |
4 | | |
5 | | #include "prio.h" |
6 | | |
7 | | #include "dummy_io.h" |
8 | | |
9 | 5.57M | static DummyIOLayerMethods *ToMethods(PRFileDesc *f) { |
10 | 5.57M | return reinterpret_cast<DummyIOLayerMethods *>(f->secret); |
11 | 5.57M | } |
12 | | |
13 | 64.0k | static PRStatus DummyClose(PRFileDesc *f) { return ToMethods(f)->Close(f); } |
14 | | |
15 | 0 | static int32_t DummyRead(PRFileDesc *f, void *buf, int32_t length) { |
16 | 0 | return ToMethods(f)->Read(f, buf, length); |
17 | 0 | } |
18 | | |
19 | 0 | static int32_t DummyWrite(PRFileDesc *f, const void *buf, int32_t length) { |
20 | 0 | return ToMethods(f)->Write(f, buf, length); |
21 | 0 | } |
22 | | |
23 | 0 | static int32_t DummyAvailable(PRFileDesc *f) { |
24 | 0 | return ToMethods(f)->Available(f); |
25 | 0 | } |
26 | | |
27 | 0 | static int64_t DummyAvailable64(PRFileDesc *f) { |
28 | 0 | return ToMethods(f)->Available64(f); |
29 | 0 | } |
30 | | |
31 | 0 | static PRStatus DummySync(PRFileDesc *f) { return ToMethods(f)->Sync(f); } |
32 | | |
33 | 0 | static int32_t DummySeek(PRFileDesc *f, int32_t offset, PRSeekWhence how) { |
34 | 0 | return ToMethods(f)->Seek(f, offset, how); |
35 | 0 | } |
36 | | |
37 | 0 | static int64_t DummySeek64(PRFileDesc *f, int64_t offset, PRSeekWhence how) { |
38 | 0 | return ToMethods(f)->Seek64(f, offset, how); |
39 | 0 | } |
40 | | |
41 | 0 | static PRStatus DummyFileInfo(PRFileDesc *f, PRFileInfo *info) { |
42 | 0 | return ToMethods(f)->FileInfo(f, info); |
43 | 0 | } |
44 | | |
45 | 0 | static PRStatus DummyFileInfo64(PRFileDesc *f, PRFileInfo64 *info) { |
46 | 0 | return ToMethods(f)->FileInfo64(f, info); |
47 | 0 | } |
48 | | |
49 | | static int32_t DummyWritev(PRFileDesc *f, const PRIOVec *iov, int32_t iov_size, |
50 | 0 | PRIntervalTime to) { |
51 | 0 | return ToMethods(f)->Writev(f, iov, iov_size, to); |
52 | 0 | } |
53 | | |
54 | | static PRStatus DummyConnect(PRFileDesc *f, const PRNetAddr *addr, |
55 | 0 | PRIntervalTime to) { |
56 | 0 | return ToMethods(f)->Connect(f, addr, to); |
57 | 0 | } |
58 | | |
59 | | static PRFileDesc *DummyAccept(PRFileDesc *f, PRNetAddr *addr, |
60 | 0 | PRIntervalTime to) { |
61 | 0 | return ToMethods(f)->Accept(f, addr, to); |
62 | 0 | } |
63 | | |
64 | 0 | static PRStatus DummyBind(PRFileDesc *f, const PRNetAddr *addr) { |
65 | 0 | return ToMethods(f)->Bind(f, addr); |
66 | 0 | } |
67 | | |
68 | 0 | static PRStatus DummyListen(PRFileDesc *f, int32_t depth) { |
69 | 0 | return ToMethods(f)->Listen(f, depth); |
70 | 0 | } |
71 | | |
72 | 23 | static PRStatus DummyShutdown(PRFileDesc *f, int32_t how) { |
73 | 23 | return ToMethods(f)->Shutdown(f, how); |
74 | 23 | } |
75 | | |
76 | | static int32_t DummyRecv(PRFileDesc *f, void *buf, int32_t buflen, |
77 | 3.99M | int32_t flags, PRIntervalTime to) { |
78 | 3.99M | return ToMethods(f)->Recv(f, buf, buflen, flags, to); |
79 | 3.99M | } |
80 | | |
81 | | static int32_t DummySend(PRFileDesc *f, const void *buf, int32_t amount, |
82 | 807k | int32_t flags, PRIntervalTime to) { |
83 | 807k | return ToMethods(f)->Send(f, buf, amount, flags, to); |
84 | 807k | } |
85 | | |
86 | | static int32_t DummyRecvfrom(PRFileDesc *f, void *buf, int32_t amount, |
87 | | int32_t flags, PRNetAddr *addr, |
88 | 0 | PRIntervalTime to) { |
89 | 0 | return ToMethods(f)->Recvfrom(f, buf, amount, flags, addr, to); |
90 | 0 | } |
91 | | |
92 | | static int32_t DummySendto(PRFileDesc *f, const void *buf, int32_t amount, |
93 | | int32_t flags, const PRNetAddr *addr, |
94 | 0 | PRIntervalTime to) { |
95 | 0 | return ToMethods(f)->Sendto(f, buf, amount, flags, addr, to); |
96 | 0 | } |
97 | | |
98 | 0 | static int16_t DummyPoll(PRFileDesc *f, int16_t in_flags, int16_t *out_flags) { |
99 | 0 | return ToMethods(f)->Poll(f, in_flags, out_flags); |
100 | 0 | } |
101 | | |
102 | | static int32_t DummyAcceptRead(PRFileDesc *f, PRFileDesc **nd, |
103 | | PRNetAddr **raddr, void *buf, int32_t amount, |
104 | 0 | PRIntervalTime t) { |
105 | 0 | return ToMethods(f)->AcceptRead(f, nd, raddr, buf, amount, t); |
106 | 0 | } |
107 | | |
108 | | static int32_t DummyTransmitFile(PRFileDesc *sd, PRFileDesc *f, |
109 | | const void *headers, int32_t hlen, |
110 | 0 | PRTransmitFileFlags flags, PRIntervalTime t) { |
111 | 0 | return ToMethods(f)->TransmitFile(sd, f, headers, hlen, flags, t); |
112 | 0 | } |
113 | | |
114 | 182k | static PRStatus DummyGetpeername(PRFileDesc *f, PRNetAddr *addr) { |
115 | 182k | return ToMethods(f)->Getpeername(f, addr); |
116 | 182k | } |
117 | | |
118 | 0 | static PRStatus DummyGetsockname(PRFileDesc *f, PRNetAddr *addr) { |
119 | 0 | return ToMethods(f)->Getsockname(f, addr); |
120 | 0 | } |
121 | | |
122 | 520k | static PRStatus DummyGetsockoption(PRFileDesc *f, PRSocketOptionData *opt) { |
123 | 520k | return ToMethods(f)->Getsockoption(f, opt); |
124 | 520k | } |
125 | | |
126 | | static PRStatus DummySetsockoption(PRFileDesc *f, |
127 | 5.14k | const PRSocketOptionData *opt) { |
128 | 5.14k | return ToMethods(f)->Setsockoption(f, opt); |
129 | 5.14k | } |
130 | | |
131 | | static int32_t DummySendfile(PRFileDesc *f, PRSendFileData *in, |
132 | 0 | PRTransmitFileFlags flags, PRIntervalTime to) { |
133 | 0 | return ToMethods(f)->Sendfile(f, in, flags, to); |
134 | 0 | } |
135 | | |
136 | 0 | static PRStatus DummyConnectContinue(PRFileDesc *f, int16_t flags) { |
137 | 0 | return ToMethods(f)->ConnectContinue(f, flags); |
138 | 0 | } |
139 | | |
140 | 0 | static int32_t DummyReserved(PRFileDesc *f) { |
141 | 0 | return ToMethods(f)->Reserved(f); |
142 | 0 | } |
143 | | |
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}; |