Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PUDPSocketParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/network/UDPSocketChild.h"
#include "mozilla/dom/network/UDPSocketParent.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/net/DNS.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "prio.h"
#include "mozilla/net/PNeckoParent.h"
#include "mozilla/ipc/PBackgroundParent.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 PUDPSocketParent::PUDPSocketParent() :
mozilla::ipc::IProtocol(PUDPSocketMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PUDPSocketParent);
}
PUDPSocketParent::~PUDPSocketParent()
{
MOZ_COUNT_DTOR(PUDPSocketParent);
}
auto PUDPSocketParent::ActorAlloc() -> void
{
}
auto PUDPSocketParent::ActorDealloc() -> void
{
if (Manager()) {
Manager()->DeallocManagee(PUDPSocketMsgStart, this);
}
}
auto PUDPSocketParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PUDPSocketParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PUDPSocketParent::SendCallbackOpened(const UDPAddressInfo& addressInfo) -> bool
{
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg_CallbackOpened(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), addressInfo);
// Sentinel = 'addressInfo'
((&(writer__)))->WriteSentinel(445580403);
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_CallbackOpened", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PUDPSocketParent::SendCallbackConnected(const UDPAddressInfo& addressInfo) -> bool
{
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg_CallbackConnected(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), addressInfo);
// Sentinel = 'addressInfo'
((&(writer__)))->WriteSentinel(445580403);
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_CallbackConnected", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PUDPSocketParent::SendCallbackClosed() -> bool
{
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg_CallbackClosed(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_CallbackClosed", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PUDPSocketParent::SendCallbackReceivedData(
const UDPAddressInfo& addressInfo,
mozilla::Span<uint8_t const> data) -> bool
{
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg_CallbackReceivedData(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), addressInfo);
// Sentinel = 'addressInfo'
((&(writer__)))->WriteSentinel(445580403);
IPC::WriteParam((&(writer__)), data);
// Sentinel = 'data'
((&(writer__)))->WriteSentinel(67109275);
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_CallbackReceivedData", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PUDPSocketParent::SendCallbackError(
const nsACString& message,
const nsACString& filename,
const uint32_t& lineNumber) -> bool
{
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg_CallbackError(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), message);
// Sentinel = 'message'
((&(writer__)))->WriteSentinel(197198566);
IPC::WriteParam((&(writer__)), filename);
// Sentinel = 'filename'
((&(writer__)))->WriteSentinel(246547266);
IPC::WriteParam((&(writer__)), lineNumber);
// Sentinel = 'lineNumber'
((&(writer__)))->WriteSentinel(374932498);
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_CallbackError", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PUDPSocketParent::Send__delete__(PUDPSocketParent* actor) -> bool
{
if (!actor || !actor->CanSend()) {
NS_WARNING("Attempt to __delete__ missing or closed actor");
return false;
}
UniquePtr<IPC::Message> msg__ = PUDPSocket::Msg___delete__((actor)->Id());
IPC::MessageWriter writer__{
(*(msg__)),
actor};
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg___delete__", OTHER);
bool sendok__ = (actor)->ChannelSend(std::move(msg__));
actor->ActorDisconnected(Deletion);
return sendok__;
}
auto PUDPSocketParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PUDPSocketParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PUDPSocketParent::OnMessageReceived(const Message& msg__) -> PUDPSocketParent::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 PUDPSocket::Msg_Bind__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_Bind", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__addressInfo = IPC::ReadParam<UDPAddressInfo>((&(reader__)));
if (!maybe__addressInfo) {
FatalError("Error deserializing 'UDPAddressInfo'");
return MsgValueError;
}
auto& addressInfo = *maybe__addressInfo;
// Sentinel = 'addressInfo'
if ((!(((&(reader__)))->ReadSentinel(445580403)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'UDPAddressInfo'");
return MsgValueError;
}
auto maybe__addressReuse = IPC::ReadParam<bool>((&(reader__)));
if (!maybe__addressReuse) {
FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& addressReuse = *maybe__addressReuse;
// Sentinel = 'addressReuse'
if ((!(((&(reader__)))->ReadSentinel(530908395)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
auto maybe__loopback = IPC::ReadParam<bool>((&(reader__)));
if (!maybe__loopback) {
FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& loopback = *maybe__loopback;
// Sentinel = 'loopback'
if ((!(((&(reader__)))->ReadSentinel(253166412)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
auto maybe__recvBufferSize = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__recvBufferSize) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& recvBufferSize = *maybe__recvBufferSize;
// Sentinel = 'recvBufferSize'
if ((!(((&(reader__)))->ReadSentinel(709100966)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto maybe__sendBufferSize = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__sendBufferSize) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& sendBufferSize = *maybe__sendBufferSize;
// Sentinel = 'sendBufferSize'
if ((!(((&(reader__)))->ReadSentinel(705693088)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvBind(std::move(addressInfo), std::move(addressReuse), std::move(loopback), std::move(recvBufferSize), std::move(sendBufferSize));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_Connect__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_Connect", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__addressInfo = IPC::ReadParam<UDPAddressInfo>((&(reader__)));
if (!maybe__addressInfo) {
FatalError("Error deserializing 'UDPAddressInfo'");
return MsgValueError;
}
auto& addressInfo = *maybe__addressInfo;
// Sentinel = 'addressInfo'
if ((!(((&(reader__)))->ReadSentinel(445580403)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'UDPAddressInfo'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvConnect(std::move(addressInfo));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_OutgoingData__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_OutgoingData", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__data = IPC::ReadParam<UDPData>((&(reader__)));
if (!maybe__data) {
FatalError("Error deserializing 'UDPData'");
return MsgValueError;
}
auto& data = *maybe__data;
// Sentinel = 'data'
if ((!(((&(reader__)))->ReadSentinel(67109275)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'UDPData'");
return MsgValueError;
}
auto maybe__addr = IPC::ReadParam<UDPSocketAddr>((&(reader__)));
if (!maybe__addr) {
FatalError("Error deserializing 'UDPSocketAddr'");
return MsgValueError;
}
auto& addr = *maybe__addr;
// Sentinel = 'addr'
if ((!(((&(reader__)))->ReadSentinel(65929628)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'UDPSocketAddr'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvOutgoingData(std::move(data), std::move(addr));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_JoinMulticast__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_JoinMulticast", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__multicastAddress = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__multicastAddress) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& multicastAddress = *maybe__multicastAddress;
// Sentinel = 'multicastAddress'
if ((!(((&(reader__)))->ReadSentinel(948700829)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto maybe__iface = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__iface) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& iface = *maybe__iface;
// Sentinel = 'iface'
if ((!(((&(reader__)))->ReadSentinel(100139513)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvJoinMulticast(std::move(multicastAddress), std::move(iface));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_LeaveMulticast__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_LeaveMulticast", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__multicastAddress = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__multicastAddress) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& multicastAddress = *maybe__multicastAddress;
// Sentinel = 'multicastAddress'
if ((!(((&(reader__)))->ReadSentinel(948700829)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto maybe__iface = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__iface) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& iface = *maybe__iface;
// Sentinel = 'iface'
if ((!(((&(reader__)))->ReadSentinel(100139513)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvLeaveMulticast(std::move(multicastAddress), std::move(iface));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_Close__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_Close", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvClose();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Msg_RequestDelete__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PUDPSocket", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PUDPSocketParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PUDPSocket::Msg_RequestDelete", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<mozilla::dom::UDPSocketParent*>(this))->RecvRequestDelete();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PUDPSocket::Reply___delete____ID:
{
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PUDPSocketParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PUDPSocketParent::Result
{
return MsgNotKnown;
}
auto PUDPSocketParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PUDPSocketParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PUDPSocketParent*>::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::PUDPSocketParent*>::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, "PUDPSocket", PUDPSocketMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PUDPSocketParent*>(actor.ref());
}
return {};
}
} // namespace IPC