Module libafl::bolts::llmp [−][src]
A library for low level message passing
To send new messages, the clients place a new message at the end of their
client_out_map
. If the current map is filled up, they place an end of page (EOP
)
msg and alloc a new ShMem
.
Once the broker mapped this same page, it flags it as safe for unmapping.
[client0] [client1] ... [clientN]
| | /
[client0_out] [client1_out] ... [clientN_out]
| / /
|________________/ /
|________________________________/
\|/
[broker]
After the broker received a new message for clientN, (clientN_out->current_id != last_message->message_id
) the broker will copy the message content to its
own, centralized page.
The clients periodically check (current_broadcast_map->current_id != last_message->message_id
) for new incoming messages. If the page is filled up,
the broker instead creates a new page and places an end of page (EOP
)
message in its queue. The EOP
buf contains the new description to
access the shared map. The clients then switch over to read from that new
current map.
[broker]
|
[current_broadcast_map]
|
|___________________________________
|_________________ \
| \ \
| | |
\|/ \|/ \|/
[client0] [client1] ... [clientN]
In the future, if we would need zero copy, the current_broadcast_map
could instead
list the client_out_map
ID an offset for each message. In that case, the clients
also need to create a new ShMem
each time their bufs are filled up.
To use, you will have to create a broker using LlmpBroker::new()
.
Then, create some LlmpClient
s
in other threads and register them
with the main thread using LlmpBroker::register_client
.
Finally, call LlmpBroker::loop_forever()
.
For broker2broker communication, all messages are forwarded via network sockets.
Check out the llmp_test
example in ./examples, or build it with cargo run --example llmp_test
.
Structs
LlmpBroker | The broker (node 0) |
LlmpBrokerSignalHandler | A signal handler for the |
LlmpClient | Client side of LLMP |
LlmpClientDescription | A restorable client description |
LlmpDescription | Description of a shared map. May be used to restore the map by id. |
LlmpMsg | Message sent over the “wire” |
LlmpPage | Contents of the share mem pages, used by llmp internally |
LlmpReceiver | Receiving end on a (unidirectional) sharedmap channel |
LlmpSender | Sending end on a (unidirectional) sharedmap channel |
LlmpSharedMap | A page wrapper |
TcpRemoteNewMessage | Messages for broker 2 broker connection. |
Enums
Listener | Abstraction for listeners |
ListenerStream | A listener stream abstraction |
LlmpConnection | An Llmp instance |
LlmpMsgHookResult | Result of an LLMP Mesasge hook |
TcpRequest | This is for the server the broker will spawn. If an llmp connection is local - use sharedmaps or remote (broker2broker) - forwarded via tcp |
TcpResponse | Responses for requests to the server. |
Constants
LLMP_FLAG_COMPRESSED | This message was compressed in transit |
LLMP_FLAG_FROM_B2B | From another broker. |
LLMP_FLAG_INITIALIZED | Unused… |
Type Definitions
BrokerId | The broker ID, for broker 2 broker communication. |
ClientId | The client ID == the sender id. |
Flags | The flags, indicating, for example, enabled compression. |
MessageId | The message ID, an ever-increasing number, unique only to a sharedmap/page. |
Tag | TAGs used thorughout llmp |