Define keepalive protocol

The keepalive program has two procedures: PING, and PONG.
Both are used only in asynchronous messages and the sender doesn't wait
for any reply. However, the party which receives PING messages is
supposed to react by sending PONG message the other party, but no
explicit binding between PING and PONG messages is made. For backward
compatibility neither server nor client are allowed to send keepalive
messages before checking that remote party supports them.
This commit is contained in:
Jiri Denemark 2011-09-22 12:51:55 +02:00
parent 2afc5a7bbf
commit 4acd358a76
3 changed files with 22 additions and 5 deletions

1
.gitignore vendored
View File

@ -65,6 +65,7 @@
/src/locking/qemu-sanlock.conf /src/locking/qemu-sanlock.conf
/src/remote/*_client_bodies.h /src/remote/*_client_bodies.h
/src/remote/*_protocol.[ch] /src/remote/*_protocol.[ch]
/src/rpc/virkeepaliveprotocol.[ch]
/src/rpc/virnetprotocol.[ch] /src/rpc/virnetprotocol.[ch]
/src/util/virkeymaps.h /src/util/virkeymaps.h
/tests/*.log /tests/*.log

View File

@ -285,7 +285,8 @@ PDWTAGS = \
PROTOCOL_STRUCTS = \ PROTOCOL_STRUCTS = \
$(srcdir)/remote_protocol-structs \ $(srcdir)/remote_protocol-structs \
$(srcdir)/qemu_protocol-structs \ $(srcdir)/qemu_protocol-structs \
$(srcdir)/virnetprotocol-structs $(srcdir)/virnetprotocol-structs \
$(srcdir)/virkeepaliveprotocol-structs
if WITH_REMOTE if WITH_REMOTE
# The .o file that pdwtags parses is created as a side effect of running # The .o file that pdwtags parses is created as a side effect of running
# libtool; but from make's perspective we depend on the .lo file. # libtool; but from make's perspective we depend on the .lo file.
@ -293,6 +294,7 @@ $(srcdir)/%_protocol-structs: libvirt_driver_remote_la-%_protocol.lo
$(PDWTAGS) $(PDWTAGS)
$(srcdir)/virnetprotocol-structs: libvirt_net_rpc_la-virnetprotocol.lo $(srcdir)/virnetprotocol-structs: libvirt_net_rpc_la-virnetprotocol.lo
$(PDWTAGS) $(PDWTAGS)
$(srcdir)/virkeepaliveprotocol-structs: libvirt_net_rpc_la-virkeepaliveprotocol.lo
else !WITH_REMOTE else !WITH_REMOTE
# These generated files must live in git, because they cannot be re-generated # These generated files must live in git, because they cannot be re-generated
# when configured --without-remote. # when configured --without-remote.
@ -1287,7 +1289,10 @@ probes.h: probes.d
probes.o: probes.d probes.o: probes.d
$(AM_V_GEN)$(DTRACE) -o $@ -G -s $< $(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x $(srcdir)/remote/remote_protocol.x $(srcdir)/remote/qemu_protocol.x RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
$(srcdir)/rpc/virkeepaliveprotocol.x \
$(srcdir)/remote/remote_protocol.x \
$(srcdir)/remote/qemu_protocol.x
libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
$(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@ $(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
@ -1366,11 +1371,14 @@ EXTRA_DIST += \
rpc/gendispatch.pl \ rpc/gendispatch.pl \
rpc/genprotocol.pl \ rpc/genprotocol.pl \
rpc/gensystemtap.pl \ rpc/gensystemtap.pl \
rpc/virnetprotocol.x rpc/virnetprotocol.x \
rpc/virkeepaliveprotocol.x
VIR_NET_RPC_GENERATED = \ VIR_NET_RPC_GENERATED = \
$(srcdir)/rpc/virnetprotocol.h \ $(srcdir)/rpc/virnetprotocol.h \
$(srcdir)/rpc/virnetprotocol.c $(srcdir)/rpc/virnetprotocol.c \
$(srcdir)/rpc/virkeepaliveprotocol.h \
$(srcdir)/rpc/virkeepaliveprotocol.c
BUILT_SOURCES += $(VIR_NET_RPC_GENERATED) BUILT_SOURCES += $(VIR_NET_RPC_GENERATED)
@ -1378,7 +1386,8 @@ libvirt_net_rpc_la_SOURCES = \
rpc/virnetmessage.h rpc/virnetmessage.c \ rpc/virnetmessage.h rpc/virnetmessage.c \
rpc/virnetprotocol.h rpc/virnetprotocol.c \ rpc/virnetprotocol.h rpc/virnetprotocol.c \
rpc/virnetsocket.h rpc/virnetsocket.c \ rpc/virnetsocket.h rpc/virnetsocket.c \
rpc/virnettlscontext.h rpc/virnettlscontext.c rpc/virnettlscontext.h rpc/virnettlscontext.c \
rpc/virkeepaliveprotocol.h rpc/virkeepaliveprotocol.c
if HAVE_SASL if HAVE_SASL
libvirt_net_rpc_la_SOURCES += \ libvirt_net_rpc_la_SOURCES += \
rpc/virnetsaslcontext.h rpc/virnetsaslcontext.c rpc/virnetsaslcontext.h rpc/virnetsaslcontext.c

View File

@ -0,0 +1,7 @@
const KEEPALIVE_PROGRAM = 0x6b656570;
const KEEPALIVE_PROTOCOL_VERSION = 1;
enum keepalive_procedure {
KEEPALIVE_PROC_PING = 1,
KEEPALIVE_PROC_PONG = 2
};