2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2019-08-03 13:29:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-30 17:32:46 +00:00
|
|
|
#include <AK/Function.h>
|
2020-02-14 20:41:10 +00:00
|
|
|
#include <AK/Vector.h>
|
2019-12-30 01:41:45 +00:00
|
|
|
|
2020-02-05 18:57:18 +00:00
|
|
|
namespace IPC {
|
2019-08-03 13:29:40 +00:00
|
|
|
|
2020-11-21 18:59:12 +00:00
|
|
|
struct MessageBuffer {
|
|
|
|
Vector<u8, 1024> data;
|
|
|
|
Vector<int> fds;
|
|
|
|
};
|
2020-02-05 18:57:18 +00:00
|
|
|
|
|
|
|
class Message {
|
2019-08-03 13:29:40 +00:00
|
|
|
public:
|
2020-02-05 18:57:18 +00:00
|
|
|
virtual ~Message();
|
2019-08-03 13:29:40 +00:00
|
|
|
|
2021-04-25 11:19:53 +00:00
|
|
|
virtual u32 endpoint_magic() const = 0;
|
2019-12-02 10:07:05 +00:00
|
|
|
virtual int message_id() const = 0;
|
2020-02-15 10:16:45 +00:00
|
|
|
virtual const char* message_name() const = 0;
|
2021-05-02 03:20:28 +00:00
|
|
|
virtual bool valid() const = 0;
|
2020-02-05 18:57:18 +00:00
|
|
|
virtual MessageBuffer encode() const = 0;
|
2019-08-03 13:29:40 +00:00
|
|
|
|
|
|
|
protected:
|
2020-02-05 18:57:18 +00:00
|
|
|
Message();
|
2019-08-03 13:29:40 +00:00
|
|
|
};
|
2020-02-05 18:57:18 +00:00
|
|
|
|
|
|
|
}
|