Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PTCPServerSocketChild.cpp
Line
Count
Source (jump to first uncovered line)
1
//
2
// Automatically generated by ipdlc.
3
// Edit at your own risk
4
//
5
6
7
#include "mozilla/net/PTCPServerSocketChild.h"
8
9
#include "mozilla/net/PNeckoChild.h"
10
#include "mozilla/net/PTCPSocketChild.h"
11
12
#include "nsIFile.h"
13
#include "GeckoProfiler.h"
14
15
namespace mozilla {
16
namespace net {
17
18
19
auto PTCPServerSocketChild::Recv__delete__() -> mozilla::ipc::IPCResult
20
0
{
21
0
    return IPC_OK();
22
0
}
23
24
auto PTCPServerSocketChild::ActorDestroy(ActorDestroyReason aWhy) -> void
25
0
{
26
0
}
27
28
MOZ_IMPLICIT PTCPServerSocketChild::PTCPServerSocketChild() :
29
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
30
    mLivenessState(mozilla::ipc::LivenessState::Dead)
31
0
{
32
0
    MOZ_COUNT_CTOR(PTCPServerSocketChild);
33
0
}
34
35
PTCPServerSocketChild::~PTCPServerSocketChild()
36
0
{
37
0
    MOZ_COUNT_DTOR(PTCPServerSocketChild);
38
0
}
39
40
auto PTCPServerSocketChild::Manager() const -> PNeckoChild*
41
0
{
42
0
    return static_cast<PNeckoChild*>(IProtocol::Manager());
43
0
}
44
45
auto PTCPServerSocketChild::SendClose() -> bool
46
0
{
47
0
    IPC::Message* msg__ = PTCPServerSocket::Msg_Close(Id());
48
0
49
0
50
0
51
0
52
0
53
0
    if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketChild")) {
54
0
        mozilla::ipc::LogMessageForProtocol("PTCPServerSocketChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
55
0
    }
56
0
    AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_Close", OTHER);
57
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
58
0
        mozilla::ipc::LogicError("Transition error");
59
0
    }
60
0
61
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
62
0
    return sendok__;
63
0
}
64
65
auto PTCPServerSocketChild::SendRequestDelete() -> bool
66
0
{
67
0
    IPC::Message* msg__ = PTCPServerSocket::Msg_RequestDelete(Id());
68
0
69
0
70
0
71
0
72
0
73
0
    if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketChild")) {
74
0
        mozilla::ipc::LogMessageForProtocol("PTCPServerSocketChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
75
0
    }
76
0
    AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_RequestDelete", OTHER);
77
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
78
0
        mozilla::ipc::LogicError("Transition error");
79
0
    }
80
0
81
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
82
0
    return sendok__;
83
0
}
84
85
auto PTCPServerSocketChild::RemoveManagee(
86
        int32_t aProtocolId,
87
        IProtocol* aListener) -> void
88
0
{
89
0
    FatalError("unreached");
90
0
    return;
91
0
}
92
93
auto PTCPServerSocketChild::OnMessageReceived(const Message& msg__) -> PTCPServerSocketChild::Result
94
0
{
95
0
    switch ((msg__).type()) {
96
0
    case PTCPServerSocket::Msg_CallbackAccept__ID:
97
0
        {
98
0
            if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketChild")) {
99
0
                mozilla::ipc::LogMessageForProtocol("PTCPServerSocketChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
100
0
            }
101
0
            AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_CallbackAccept", OTHER);
102
0
103
0
            PickleIterator iter__(msg__);
104
0
            PTCPSocketChild* socket;
105
0
106
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(socket)))))) {
107
0
                FatalError("Error deserializing 'PTCPSocketChild'");
108
0
                return MsgValueError;
109
0
            }
110
0
            if ((!((*((&(socket))))))) {
111
0
                FatalError("Error deserializing 'PTCPSocketChild'");
112
0
                return MsgValueError;
113
0
            }
114
0
            // Sentinel = 'socket'
115
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3619774181)))) {
116
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PTCPSocketChild'");
117
0
                return MsgValueError;
118
0
            }
119
0
            (msg__).EndRead(iter__, (msg__).type());
120
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
121
0
                FatalError("Transition error");
122
0
                return MsgValueError;
123
0
            }
124
0
            if ((!(RecvCallbackAccept(socket)))) {
125
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
126
0
                // Error handled in mozilla::ipc::IPCResult
127
0
                return MsgProcessingError;
128
0
            }
129
0
130
0
            return MsgProcessed;
131
0
        }
132
0
    case PTCPServerSocket::Msg___delete____ID:
133
0
        {
134
0
            if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketChild")) {
135
0
                mozilla::ipc::LogMessageForProtocol("PTCPServerSocketChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
136
0
            }
137
0
            AUTO_PROFILER_LABEL("PTCPServerSocket::Msg___delete__", OTHER);
138
0
139
0
            PickleIterator iter__(msg__);
140
0
            PTCPServerSocketChild* actor;
141
0
142
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
143
0
                FatalError("Error deserializing 'PTCPServerSocketChild'");
144
0
                return MsgValueError;
145
0
            }
146
0
            if ((!((*((&(actor))))))) {
147
0
                FatalError("Error deserializing 'PTCPServerSocketChild'");
148
0
                return MsgValueError;
149
0
            }
150
0
            // Sentinel = 'actor'
151
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
152
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PTCPServerSocketChild'");
153
0
                return MsgValueError;
154
0
            }
155
0
            (msg__).EndRead(iter__, (msg__).type());
156
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
157
0
                FatalError("Transition error");
158
0
                return MsgValueError;
159
0
            }
160
0
            if ((!(Recv__delete__()))) {
161
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
162
0
                // Error handled in mozilla::ipc::IPCResult
163
0
                return MsgProcessingError;
164
0
            }
165
0
166
0
167
0
            IProtocol* mgr = (actor)->Manager();
168
0
            (actor)->DestroySubtree(Deletion);
169
0
            (actor)->DeallocSubtree();
170
0
            (mgr)->RemoveManagee(PTCPServerSocketMsgStart, actor);
171
0
172
0
            return MsgProcessed;
173
0
        }
174
0
    default:
175
0
        {
176
0
            return MsgNotKnown;
177
0
        }
178
0
    }
179
0
}
180
181
auto PTCPServerSocketChild::OnMessageReceived(
182
        const Message& msg__,
183
        Message*& reply__) -> PTCPServerSocketChild::Result
184
0
{
185
0
    return MsgNotKnown;
186
0
}
187
188
auto PTCPServerSocketChild::OnCallReceived(
189
        const Message& msg__,
190
        Message*& reply__) -> PTCPServerSocketChild::Result
191
0
{
192
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
193
0
    return MsgNotKnown;
194
0
}
195
196
auto PTCPServerSocketChild::GetProtocolTypeId() -> int32_t
197
0
{
198
0
    return PTCPServerSocketMsgStart;
199
0
}
200
201
auto PTCPServerSocketChild::DestroySubtree(ActorDestroyReason why) -> void
202
0
{
203
0
    // Unregister from our manager.
204
0
    Unregister(Id());
205
0
206
0
    // Reject owning pending responses.
207
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
208
0
209
0
    // Finally, destroy "us".
210
0
    ActorDestroy(why);
211
0
}
212
213
auto PTCPServerSocketChild::DeallocSubtree() -> void
214
0
{
215
0
}
216
217
218
219
} // namespace net
220
} // namespace mozilla
221
namespace mozilla {
222
namespace ipc {
223
auto IPDLParamTraits<mozilla::net::PTCPServerSocketChild>::Write(
224
        IPC::Message* aMsg,
225
        mozilla::ipc::IProtocol* aActor,
226
        const paramType& aVar) -> void
227
0
{
228
0
    int32_t id;
229
0
    if ((!(aVar))) {
230
0
        id = 0;
231
0
    }
232
0
    else {
233
0
        id = (aVar)->Id();
234
0
        if ((1) == (id)) {
235
0
            (aActor)->FatalError("actor has been |delete|d");
236
0
        }
237
0
    }
238
0
    WriteIPDLParam(aMsg, aActor, id);
239
0
}
240
241
auto IPDLParamTraits<mozilla::net::PTCPServerSocketChild>::Read(
242
        const IPC::Message* aMsg,
243
        PickleIterator* aIter,
244
        mozilla::ipc::IProtocol* aActor,
245
        paramType* aVar) -> bool
246
0
{
247
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PTCPServerSocket", PTCPServerSocketMsgStart);
248
0
    if ((actor).isNothing()) {
249
0
        return false;
250
0
    }
251
0
252
0
    (*(aVar)) = static_cast<mozilla::net::PTCPServerSocketChild*>((actor).value());
253
0
    return true;
254
0
}
255
256
} // namespace ipc
257
} // namespace mozilla