From c7396710e7bf07f947ec6e8623144acff130d920 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 25 Jun 2014 21:32:45 +0100 Subject: [PATCH] site: transport peers: Formalise interface to transport peers Make the interface to the transport peers functions more formal: define when each function is called and what (roughly) it should do. Remove the predeclaration of transport_record_peer. This is now an internal function for the transport peer management code; there are no callers in the body of site.c and we can remove the declaration. No functional change. Signed-off-by: Ian Jackson --- site.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/site.c b/site.c index f268af3..297bb74 100644 --- a/site.c +++ b/site.c @@ -198,22 +198,35 @@ typedef struct { transport_peer peers[MAX_MOBILE_PEERS_MAX]; } transport_peers; +/* Basic operations on transport peer address sets */ static void transport_peers_clear(struct site *st, transport_peers *peers); static int transport_peers_valid(transport_peers *peers); static void transport_peers_copy(struct site *st, transport_peers *dst, const transport_peers *src); +/* Record address of incoming setup packet; resp. data packet. */ static void transport_setup_msgok(struct site *st, const struct comm_addr *a); static void transport_data_msgok(struct site *st, const struct comm_addr *a); + +/* Initialise the setup addresses. Called before we send the first + * packet in a key exchange. If we are the initiator, as a result of + * resolve completing (or being determined not to be relevant) or an + * incoming PROD; if we are the responder, as a result of the MSG1. */ static bool_t transport_compute_setupinit_peers(struct site *st, const struct comm_addr *configured_addr /* 0 if none or not found */, const struct comm_addr *incoming_packet_addr /* 0 if none */); + +/* Called if we are the responder in a key setup, when the resolve + * completes. transport_compute_setupinit_peers will hvae been called + * earlier. If _complete is called, we are still doing the key setup + * (and we should use the new values for both the rest of the key + * setup and the ongoing data exchange); if _tardy is called, the key + * setup is done (either completed or not) and only the data peers are + * relevant */ static void transport_resolve_complete(struct site *st, const struct comm_addr *a); static void transport_resolve_complete_tardy(struct site *st, const struct comm_addr *ca_use); -static void transport_record_peer(struct site *st, transport_peers *peers, - const struct comm_addr *addr, const char *m); static void transport_xmit(struct site *st, transport_peers *peers, struct buffer_if *buf, bool_t candebug); -- 2.30.2