mirror of https://github.com/oxen-io/lokinet
progress (does not compile)
parent
b7d4499f43
commit
f50a49b7cb
@ -1,2 +1,4 @@
|
||||
[router]
|
||||
|
||||
|
||||
[links]
|
||||
eth0=ip
|
@ -0,0 +1,30 @@
|
||||
#ifndef LLARP_IBFQ_H_
|
||||
#define LLARP_IBFQ_H_
|
||||
#include <llarp/buffer.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// forward declare
|
||||
struct llarp_msg_muxer;
|
||||
|
||||
struct llarp_link_queue;
|
||||
|
||||
struct llarp_link_queue * llarp_init_link_queue();
|
||||
void llarp_free_link_queue(struct llarp_link_queue ** queue);
|
||||
/**
|
||||
offer a full frame to the inbound frame queue
|
||||
return true if successfully added
|
||||
return false if the queue is full
|
||||
*/
|
||||
bool llarp_link_offer_frame(struct llarp_link_queue * queue, llarp_buffer_t msg);
|
||||
/** return true if we have more messages to process */
|
||||
bool llarp_link_queue_process(struct llarp_link_queue * queue, struct llarp_msg_muxer * muxer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
#ifndef LLARP_IBMQ_H_
|
||||
#define LLARP_IBMQ_H_
|
||||
#include <llarp/buffer.h>
|
||||
#include <stdbool.h>
|
||||
#include <llarp/msg_handler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct llarp_mq;
|
||||
|
||||
struct llarp_mq * llarp_init_mq();
|
||||
void llarp_free_mq(struct llarp_mq ** queue);
|
||||
/**
|
||||
offer a full message to the inbound message queue
|
||||
return true if successfully added
|
||||
return false if the queue is full
|
||||
*/
|
||||
bool llarp_mq_offer(struct llarp_mq * queue, llarp_buffer_t msg);
|
||||
size_t llarp_mq_peek(struct llarp_mq * queue);
|
||||
/** return true if we have more messages to process */
|
||||
bool llarp_mq_process(struct llarp_mq * queue, struct llarp_msg_muxer * muxer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
#ifndef LLARP_MSG_HANDLER_H_
|
||||
#define LLARP_MSG_HANDLER_H_
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/link.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct llarp_frame_handler
|
||||
{
|
||||
struct llarp_obmd * outbound;
|
||||
struct llarp_ibmq * inbound;
|
||||
bool (*process)(struct llarp_frame_handler *, struct llarp_link_session *, llarp_buffer_t);
|
||||
};
|
||||
|
||||
struct llarp_msg_handler
|
||||
{
|
||||
struct llarp_path_context * paths;
|
||||
};
|
||||
|
||||
struct llarp_msg_muxer
|
||||
{
|
||||
/** get a message handler for a link level message given msg.a */
|
||||
struct llarp_frame_handler * (*link_handler_for)(const char *);
|
||||
/** get a message handler for a routing layer message given msg.A */
|
||||
struct llarp_msg_handler * (*routing_handler_for)(const char *);
|
||||
};
|
||||
|
||||
/** fill function pointers with default values */
|
||||
void llarp_msg_handler_mux_init(struct llarp_msg_muxer * muxer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
#ifndef LLARP_OBMD_H_
|
||||
#define LLARP_OBMD_H_
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/crypto.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// forward declair
|
||||
struct llarp_link;
|
||||
|
||||
struct llarp_link_dispatcher;
|
||||
|
||||
struct llarp_link_dispatcher * llarp_init_link_dispatcher();
|
||||
void llarp_free_link_dispatcher(struct llarp_link_dispatcher ** dispatcher);
|
||||
|
||||
void llarp_link_sendto(struct llarp_link_dispatcher * dispatcher, llarp_pubkey_t pubkey, llarp_buffer_t msg);
|
||||
|
||||
void llarp_link_register(struct llarp_link_dispatcher * dispatcher, struct llarp_link * link);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,19 @@
|
||||
#ifndef LLARP_PATH_H
|
||||
#define LLARP_PATH_H
|
||||
|
||||
#include <llarp/types.h>
|
||||
|
||||
typedef uint64_t llarp_path_id_t;
|
||||
|
||||
struct llarp_transit_hop
|
||||
{
|
||||
llarp_path_id_t id;
|
||||
llarp_sharedkey_t symkey;
|
||||
llarp_pubkey_t nextHop;
|
||||
uint64_t started;
|
||||
uint64_t lifetime;
|
||||
llarp_version_t version;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,31 @@
|
||||
#ifndef LLARP_THREADPOOL_H
|
||||
#define LLARP_THREADPOOL_H
|
||||
#include <llarp/ev.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct llarp_threadpool;
|
||||
|
||||
struct llarp_threadpool * llarp_init_threadpool(int workers);
|
||||
void llarp_free_threadpool(struct llarp_threadpool ** tp);
|
||||
|
||||
/** job to be done in worker thread */
|
||||
struct llarp_thread_job
|
||||
{
|
||||
/** calls result async after work is executed */
|
||||
struct llarp_ev_job * result;
|
||||
/** called in threadpool worker thread */
|
||||
void (*work)(struct llarp_thread_job *);
|
||||
};
|
||||
|
||||
void llarp_threadpool_queue_job(struct llarp_threadpool * tp, struct llarp_thread_job j);
|
||||
|
||||
void llarp_threadpool_start(struct llarp_threadpool * tp);
|
||||
void llarp_threadpool_join(struct llarp_threadpool * tp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,16 @@
|
||||
#ifndef LLARP_TYPES_H
|
||||
#define LLARP_TYEPS_H
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uint8_t llarp_proto_version_t;
|
||||
typedef uint64_t llarp_time_t;
|
||||
typedef uint32_t llarp_seconds_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue