2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
9 * Author: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or
12 * later. See the COPYING file in the top-level directory.
15 #ifndef QEMU_COLO_PROXY_H
16 #define QEMU_COLO_PROXY_H
18 #include "slirp/slirp.h"
19 #include "qemu/jhash.h"
20 #include "qemu/timer.h"
22 #define HASHTABLE_MAX_SIZE 16384
25 #define IPPROTO_DCCP 33
29 #define IPPROTO_SCTP 132
32 #ifndef IPPROTO_UDPLITE
33 #define IPPROTO_UDPLITE 136
36 typedef struct Packet
{
39 uint8_t *network_header
;
42 uint8_t *transport_header
;
44 /* Time of packet creation, in wall clock ms */
46 /* Get vnet_hdr_len from filter */
47 uint32_t vnet_hdr_len
;
50 typedef struct ConnectionKey
{
51 /* (src, dst) must be grouped, in the same way than in IP header */
57 } QEMU_PACKED ConnectionKey
;
59 typedef struct Connection
{
60 /* connection primary send queue: element type: Packet */
62 /* connection secondary send queue: element type: Packet */
63 GQueue secondary_list
;
64 /* flag to enqueue unprocessed_connections */
67 /* offset = secondary_seq - primary_seq */
70 * we use this flag update offset func
71 * run once in independent tcp connection
76 uint32_t connection_key_hash(const void *opaque
);
77 int connection_key_equal(const void *opaque1
, const void *opaque2
);
78 int parse_packet_early(Packet
*pkt
);
79 void fill_connection_key(Packet
*pkt
, ConnectionKey
*key
);
80 void reverse_connection_key(ConnectionKey
*key
);
81 Connection
*connection_new(ConnectionKey
*key
);
82 void connection_destroy(void *opaque
);
83 Connection
*connection_get(GHashTable
*connection_track_table
,
86 void connection_hashtable_reset(GHashTable
*connection_track_table
);
87 Packet
*packet_new(const void *data
, int size
, int vnet_hdr_len
);
88 void packet_destroy(void *opaque
, void *user_data
);
90 #endif /* QEMU_COLO_PROXY_H */