all repos — circe-vpn @ 556b655293e9ce71509a72ef3c98ea334b5aa85b

Circe VPN

core/packet.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
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
#ifndef CIRCE_CORE_PACKET_H
#define CIRCE_CORE_PACKET_H

#define CIRCE_MTU 1280
#define CIRCE_MAX_UDP_PAYLOAD 1472

#include "peer_table.h"
#include <stddef.h>
#include <stdint.h>

enum circe_packet_type
{
  // Some packets need to be splintered because of UDP MTU

  CIRCE_PACKET_OPENTUNNEL = 0x0,
  CIRCE_PACKET_ACKOPEN1,
  CIRCE_PACKET_ACKOPEN2,
  CIRCE_PACKET_ACKOPEN3,
  CIRCE_PACKET_IDENTIFY1,
  CIRCE_PACKET_IDENTIFY2,
  CIRCE_PACKET_DATA,
  CIRCE_PACKET_HEARTBEAT,
  CIRCE_PACKET_CLOSETUNNEL1,
  CIRCE_PACKET_CLOSETUNNEL2,
  CIRCE_PACKET_ROUTE_CHALLENGE1,
  CIRCE_PACKET_ROUTE_CHALLENGE2,
};

enum circe_packet_field
{
  CIRCE_PACKET_FIELD_VERSION = 0x0,
  CIRCE_PACKET_FIELD_IDENTITY,
  CIRCE_PACKET_FIELD_TYPE,
  CIRCE_PACKET_FIELD_ECDH_FRAGMENT,
  CIRCE_PACKET_FIELD_MLKEM_PUBKEY,
  CIRCE_PACKET_FIELD_MLKEM_ENCAPSULATED,
  CIRCE_PACKET_FIELD_SEQ_NUMBER,
  CIRCE_PACKET_FIELD_DATA_PAYLOAD,
  CIRCE_PACKET_FIELD_ID_PAYLOAD1,
  CIRCE_PACKET_FIELD_ID_PAYLOAD2,
  CIRCE_PACKET_FIELD_OVERMAX,
};

struct circe_outgoing_packet
{
  struct circe_location destination;
  uint8_t buffer[CIRCE_MAX_UDP_PAYLOAD];
  size_t length;
};

#endif