ladybird/Userland/Libraries/LibIPC/Message.h
sin-ack 62af6cd4f9 IPCCompiler: Remove hardcoded endpoint magic, attempt deux
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)

Additionally, endpoint magic is now treated as a u32, because endpoint
numbers were never negative anyway.

For cases where the endpoint number does have to be hardcoded (a current
case is LookupServer because the endpoint number must be known in LibC),
the syntax has been made more explicit to avoid confusing those
unfamiliar.  To hardcode the endpoint magic, the following syntax is now
used:

endpoint EndpointName [magic=1234]
2021-04-25 14:06:56 +02:00

32 lines
534 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Function.h>
#include <AK/Vector.h>
namespace IPC {
struct MessageBuffer {
Vector<u8, 1024> data;
Vector<int> fds;
};
class Message {
public:
virtual ~Message();
virtual u32 endpoint_magic() const = 0;
virtual int message_id() const = 0;
virtual const char* message_name() const = 0;
virtual MessageBuffer encode() const = 0;
protected:
Message();
};
}