]> git.proxmox.com Git - mirror_qemu.git/blame - net/colo.h
iscsi: drop unused IscsiAIOCB.qiov field
[mirror_qemu.git] / net / colo.h
CommitLineData
59509ec1
ZC
1/*
2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
4 *
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
8 *
9 * Author: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
10 *
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.
13 */
14
15#ifndef QEMU_COLO_PROXY_H
16#define QEMU_COLO_PROXY_H
17
18#include "slirp/slirp.h"
ccf0426c 19#include "qemu/jhash.h"
0682e15b 20#include "qemu/timer.h"
59509ec1
ZC
21
22#define HASHTABLE_MAX_SIZE 16384
23
b6540d40
ZC
24#ifndef IPPROTO_DCCP
25#define IPPROTO_DCCP 33
26#endif
27
28#ifndef IPPROTO_SCTP
29#define IPPROTO_SCTP 132
30#endif
31
32#ifndef IPPROTO_UDPLITE
33#define IPPROTO_UDPLITE 136
34#endif
35
59509ec1
ZC
36typedef struct Packet {
37 void *data;
38 union {
39 uint8_t *network_header;
40 struct ip *ip;
41 };
42 uint8_t *transport_header;
43 int size;
0682e15b
ZC
44 /* Time of packet creation, in wall clock ms */
45 int64_t creation_ms;
59509ec1
ZC
46} Packet;
47
b6540d40
ZC
48typedef struct ConnectionKey {
49 /* (src, dst) must be grouped, in the same way than in IP header */
50 struct in_addr src;
51 struct in_addr dst;
52 uint16_t src_port;
53 uint16_t dst_port;
54 uint8_t ip_proto;
55} QEMU_PACKED ConnectionKey;
56
57typedef struct Connection {
58 /* connection primary send queue: element type: Packet */
59 GQueue primary_list;
60 /* connection secondary send queue: element type: Packet */
61 GQueue secondary_list;
62 /* flag to enqueue unprocessed_connections */
63 bool processing;
64 uint8_t ip_proto;
30656b09
ZC
65 /* offset = secondary_seq - primary_seq */
66 tcp_seq offset;
67 /*
68 * we use this flag update offset func
69 * run once in independent tcp connection
70 */
71 int syn_flag;
b6540d40
ZC
72} Connection;
73
74uint32_t connection_key_hash(const void *opaque);
75int connection_key_equal(const void *opaque1, const void *opaque2);
59509ec1 76int parse_packet_early(Packet *pkt);
b6540d40 77void fill_connection_key(Packet *pkt, ConnectionKey *key);
afe46124 78void reverse_connection_key(ConnectionKey *key);
b6540d40
ZC
79Connection *connection_new(ConnectionKey *key);
80void connection_destroy(void *opaque);
81Connection *connection_get(GHashTable *connection_track_table,
82 ConnectionKey *key,
83 GQueue *conn_list);
59509ec1
ZC
84void connection_hashtable_reset(GHashTable *connection_track_table);
85Packet *packet_new(const void *data, int size);
86void packet_destroy(void *opaque, void *user_data);
87
88#endif /* QEMU_COLO_PROXY_H */