Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PWebrtcTCPSocketParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/net/PNeckoParent.h"
#include "mozilla/net/PSocketProcessParent.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 {
MOZ_IMPLICIT PWebrtcTCPSocketParent::PWebrtcTCPSocketParent() :
mozilla::ipc::IProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PWebrtcTCPSocketParent);
}
PWebrtcTCPSocketParent::~PWebrtcTCPSocketParent()
{
MOZ_COUNT_DTOR(PWebrtcTCPSocketParent);
}
auto PWebrtcTCPSocketParent::ActorAlloc() -> void
{
}
auto PWebrtcTCPSocketParent::ActorDealloc() -> void
{
if (Manager()) {
Manager()->DeallocManagee(kProtocolId, this);
}
}
auto PWebrtcTCPSocketParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PWebrtcTCPSocketParent::OtherChildID() const -> ::GeckoChildID
{
::GeckoChildID childID =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
MOZ_RELEASE_ASSERT(childID != -1);
return childID;
}
auto PWebrtcTCPSocketParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PWebrtcTCPSocketParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PWebrtcTCPSocketParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PWebrtcTCPSocketParent::SendOnClose(const nsresult& aReason) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebrtcTCPSocket::Msg_OnClose(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aReason);
// Sentinel = 'aReason'
((&(writer__)))->WriteSentinel(180093642);
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_OnClose", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebrtcTCPSocketParent::SendOnConnected(const nsACString& aProxyType) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebrtcTCPSocket::Msg_OnConnected(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aProxyType);
// Sentinel = 'aProxyType'
((&(writer__)))->WriteSentinel(376046630);
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_OnConnected", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebrtcTCPSocketParent::SendOnRead(mozilla::Span<uint8_t const> aReadData) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebrtcTCPSocket::Msg_OnRead(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aReadData);
// Sentinel = 'aReadData'
((&(writer__)))->WriteSentinel(276497240);
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_OnRead", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebrtcTCPSocketParent::Send__delete__(PWebrtcTCPSocketParent* actor) -> bool
{
if (!actor || !actor->CanSend()) {
NS_WARNING("Attempt to __delete__ missing or closed actor");
return false;
}
UniquePtr<IPC::Message> msg__ = PWebrtcTCPSocket::Msg___delete__((actor)->Id());
IPC::MessageWriter writer__{
(*(msg__)),
actor};
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg___delete__", OTHER);
bool sendok__ = (actor)->ChannelSend(std::move(msg__));
actor->ActorDisconnected(Deletion);
return sendok__;
}
auto PWebrtcTCPSocketParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PWebrtcTCPSocketParent::OnMessageReceived(const Message& msg__) -> PWebrtcTCPSocketParent::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
this->ActorDisconnected(ManagedEndpointDropped);
return MsgProcessed;
}
case PWebrtcTCPSocket::Msg_AsyncOpen__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_AsyncOpen", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aHost = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__aHost) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& aHost = *maybe__aHost;
// Sentinel = 'aHost'
if ((!(((&(reader__)))->ReadSentinel(95486464)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto maybe__aPort = IPC::ReadParam<int32_t>((&(reader__)));
if (!maybe__aPort) {
FatalError("Error deserializing 'int32_t'");
return MsgValueError;
}
auto& aPort = *maybe__aPort;
// Sentinel = 'aPort'
if ((!(((&(reader__)))->ReadSentinel(97452551)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'int32_t'");
return MsgValueError;
}
auto maybe__aLocalAddress = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__aLocalAddress) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& aLocalAddress = *maybe__aLocalAddress;
// Sentinel = 'aLocalAddress'
if ((!(((&(reader__)))->ReadSentinel(576259347)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto maybe__aLocalPort = IPC::ReadParam<int32_t>((&(reader__)));
if (!maybe__aLocalPort) {
FatalError("Error deserializing 'int32_t'");
return MsgValueError;
}
auto& aLocalPort = *maybe__aLocalPort;
// Sentinel = 'aLocalPort'
if ((!(((&(reader__)))->ReadSentinel(351536114)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'int32_t'");
return MsgValueError;
}
auto maybe__aUseTls = IPC::ReadParam<bool>((&(reader__)));
if (!maybe__aUseTls) {
FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& aUseTls = *maybe__aUseTls;
// Sentinel = 'aUseTls'
if ((!(((&(reader__)))->ReadSentinel(180748994)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
auto maybe__aProxyConfig = IPC::ReadParam<mozilla::Maybe<WebrtcProxyConfig>>((&(reader__)));
if (!maybe__aProxyConfig) {
FatalError("Error deserializing 'WebrtcProxyConfig?'");
return MsgValueError;
}
auto& aProxyConfig = *maybe__aProxyConfig;
// Sentinel = 'aProxyConfig'
if ((!(((&(reader__)))->ReadSentinel(525468890)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'WebrtcProxyConfig?'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvAsyncOpen(std::move(aHost), std::move(aPort), std::move(aLocalAddress), std::move(aLocalPort), std::move(aUseTls), std::move(aProxyConfig));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebrtcTCPSocket::Msg_Write__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_Write", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aWriteData = IPC::ReadParam<nsTArray<uint8_t>>((&(reader__)));
if (!maybe__aWriteData) {
FatalError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
auto& aWriteData = *maybe__aWriteData;
// Sentinel = 'aWriteData'
if ((!(((&(reader__)))->ReadSentinel(360645607)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvWrite(std::move(aWriteData));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebrtcTCPSocket::Msg_Close__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebrtcTCPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebrtcTCPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebrtcTCPSocket::Msg_Close", OTHER);
mozilla::ipc::IPCResult __ok = (this)->RecvClose();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebrtcTCPSocket::Reply___delete____ID:
{
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PWebrtcTCPSocketParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PWebrtcTCPSocketParent::Result
{
return MsgNotKnown;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PWebrtcTCPSocketParent*>::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::PWebrtcTCPSocketParent*>::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, "PWebrtcTCPSocket", PWebrtcTCPSocketMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PWebrtcTCPSocketParent*>(actor.ref());
}
return {};
}
} // namespace IPC