all repos — circe-vpn @ bc760844555fd242ce945937d17188a123d79873

Circe VPN

core/core.h (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
#ifndef CIRCE_CORE_H
#define CIRCE_CORE_H

#include <stdint.h>

enum circe_result
{
  CIRCE_RESULT_SUCCESS = 0,
  CIRCE_RESULT_INSUFFICIENT_MEM,
  CIRCE_RESULT_INVALID_PACKET,
};

struct circe_ctx
{
};

struct circe_event
{
};

/// Process a new raw Circe packet.
enum circe_result
circe_handle_packet (struct circe_ctx *ctx, const uint8_t *in, uint32_t len,
                     uint64_t now_ms, uint8_t *out, uint32_t *out_len,
                     struct circe_event *events, uint32_t *n_events);

/// Get millisecond timestamp for next timer deadline (at which point
/// `circe_tick` should be called).
uint64_t circe_next_deadline (const struct circe_ctx *ctx);

/// Iterate the Circe core logic. Assumes `now_ms` increases monotonically with
/// time.
enum circe_result circe_tick (struct circe_ctx *ctx, uint64_t now_ms,
                              uint8_t *out, uint32_t *out_len);

#endif