Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PWebSocketConnectionParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/net/WebSocketConnectionParent.h"
#include "nsITransportSecurityInfo.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace net {
auto PWebSocketConnectionParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PWebSocketConnectionParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PWebSocketConnectionParent::PWebSocketConnectionParent() :
mozilla::ipc::IToplevelProtocol("PWebSocketConnectionParent", PWebSocketConnectionMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PWebSocketConnectionParent);
}
PWebSocketConnectionParent::~PWebSocketConnectionParent()
{
MOZ_COUNT_DTOR(PWebSocketConnectionParent);
}
auto PWebSocketConnectionParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PWebSocketConnectionParent'");
AddRef();
}
auto PWebSocketConnectionParent::ActorDealloc() -> void
{
Release();
}
auto PWebSocketConnectionParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PWebSocketConnectionParent::SendWriteOutputData(mozilla::Span<uint8_t const> aData) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_WriteOutputData(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aData);
// Sentinel = 'aData'
((&(writer__)))->WriteSentinel(90571228);
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_WriteOutputData", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionParent::SendStartReading() -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_StartReading(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_StartReading", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionParent::SendDrainSocketData() -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_DrainSocketData(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_DrainSocketData", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PWebSocketConnectionParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PWebSocketConnectionParent::OnMessageReceived(const Message& msg__) -> PWebSocketConnectionParent::Result
{
switch (msg__.type()) {
case PWebSocketConnection::Msg_OnTransportAvailable__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnTransportAvailable", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aSecurityInfo = IPC::ReadParam<RefPtr<nsITransportSecurityInfo>>((&(reader__)));
if (!maybe__aSecurityInfo) {
FatalError("Error deserializing 'nsITransportSecurityInfo'");
return MsgValueError;
}
auto& aSecurityInfo = *maybe__aSecurityInfo;
// Sentinel = 'aSecurityInfo'
if ((!(((&(reader__)))->ReadSentinel(610075974)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsITransportSecurityInfo'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionParent*>(this))->RecvOnTransportAvailable(aSecurityInfo);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_OnError__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnError", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aStatus = IPC::ReadParam<nsresult>((&(reader__)));
if (!maybe__aStatus) {
FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& aStatus = *maybe__aStatus;
// Sentinel = 'aStatus'
if ((!(((&(reader__)))->ReadSentinel(186712806)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionParent*>(this))->RecvOnError(std::move(aStatus));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_OnTCPClosed__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnTCPClosed", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionParent*>(this))->RecvOnTCPClosed();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_OnDataReceived__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnDataReceived", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aData = IPC::ReadParam<nsTArray<uint8_t>>((&(reader__)));
if (!maybe__aData) {
FatalError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
auto& aData = *maybe__aData;
// Sentinel = 'aData'
if ((!(((&(reader__)))->ReadSentinel(90571228)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionParent*>(this))->RecvOnDataReceived(std::move(aData));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_OnUpgradeFailed__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnUpgradeFailed", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aReason = IPC::ReadParam<nsresult>((&(reader__)));
if (!maybe__aReason) {
FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& aReason = *maybe__aReason;
// Sentinel = 'aReason'
if ((!(((&(reader__)))->ReadSentinel(180093642)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionParent*>(this))->RecvOnUpgradeFailed(std::move(aReason));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Reply___delete____ID:
{
return MsgProcessed;
}
default:
return MsgNotKnown;
case SHMEM_CREATED_MESSAGE_TYPE:
{
if (!ShmemCreated(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
case SHMEM_DESTROYED_MESSAGE_TYPE:
{
if (!ShmemDestroyed(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
}
}
auto PWebSocketConnectionParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PWebSocketConnectionParent::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PWebSocketConnectionParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PWebSocketConnectionParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PWebSocketConnectionParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::net::PWebSocketConnectionParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PWebSocketConnection", PWebSocketConnectionMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PWebSocketConnectionParent*>(actor.ref());
}
return {};
}
} // namespace IPC