You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/include/llarp/msg_handler.h

57 lines
1.3 KiB
C

#ifndef LLARP_MSG_HANDLER_H_
#define LLARP_MSG_HANDLER_H_
#include <llarp/buffer.h>
7 years ago
#include <llarp/dht.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
7 years ago
/* foward declare */
struct llarp_msg_muxer;
struct llarp_link_session;
struct llarp_router;
7 years ago
7 years ago
struct llarp_frame_handler {
7 years ago
/**
* participating paths
*/
7 years ago
struct llarp_path_context *paths;
7 years ago
/**
* parent muxer
*/
7 years ago
struct llarp_msg_muxer *parent;
7 years ago
/**
handle fully formed frame from link session
*/
7 years ago
bool (*process)(struct llarp_frame_handler *, struct llarp_link_session *,
llarp_buffer_t);
};
7 years ago
struct llarp_msg_handler {
struct llarp_path_context *paths;
7 years ago
struct llarp_dht_context *dht;
bool (*process)(struct llarp_msg_handler *, llarp_buffer_t);
7 years ago
};
7 years ago
struct llarp_msg_muxer {
/** get a message handler for a link level message given msg.a */
7 years ago
struct llarp_frame_handler *(*link_handler_for)(struct llarp_router *,
const char);
7 years ago
/** get a message handler for a routing layer message given msg.A */
7 years ago
struct llarp_msg_handler *(*routing_handler_for)(struct llarp_router *,
const char);
7 years ago
};
/** fill function pointers with default values */
7 years ago
void llarp_msg_muxer_init(struct llarp_msg_muxer *muxer);
#ifdef __cplusplus
}
#endif
#endif