#include "secnet.h"
#include "comm-common.h"
+struct comm_clientinfo *comm_clientinfo_ignore(void *state, dict_t *dict,
+ struct cloc cloc)
+{
+ return 0;
+}
+
void comm_request_notify(void *commst, void *nst, comm_notify_fn *fn)
{
struct commcommon *st=commst;
struct buffer_if *rbuf;
};
+struct comm_clientinfo *comm_clientinfo_ignore(void *state, dict_t*,
+ struct cloc cloc);
void comm_request_notify(void *commst, void *nst, comm_notify_fn *fn);
void comm_release_notify(void *commst, void *nst, comm_notify_fn *fn);
NEW(st); \
(cc)->loc=loc; \
(cc)->cl.description=desc; \
+ (cc)->ops.clientinfo=comm_clientinfo_ignore; \
(cc)->ops.sendmsg=prefix##sendmsg; \
(cc)->ops.addr_to_string=prefix##addr_to_string; \
comm_apply((cc),(st))
/* Actual udp packet sending work */
static bool_t polypath_sendmsg(void *commst, struct buffer_if *buf,
- const struct comm_addr *dest)
+ const struct comm_addr *dest,
+ struct comm_clientinfo *clientinfo)
{
struct polypath *st=commst;
struct interf *interf;
int ix; /* see comment `Re comm_addr.ix' in udp.c */
};
+struct comm_clientinfo; /* private for comm */
+
+typedef struct comm_clientinfo *comm_clientinfo_fn(void *state, dict_t*,
+ struct cloc cloc);
+/* A comm client may call this during configuration, and then pass
+ * the resulting comm_clientinfo* to some or all sendmsg calls.
+ * The semantics depend on the dict and defined by the comm, and
+ * should be documented in README. */
+
/* Return True if the packet was processed, and shouldn't be passed to
any other potential receivers. (buf is freed iff True returned.) */
typedef bool_t comm_notify_fn(void *state, struct buffer_if *buf,
typedef void comm_release_notify_fn(void *commst, void *nst,
comm_notify_fn *fn);
typedef bool_t comm_sendmsg_fn(void *commst, struct buffer_if *buf,
- const struct comm_addr *dest);
+ const struct comm_addr *dest,
+ struct comm_clientinfo* /* 0 OK */);
/* Only returns false if (we know that) the local network
* environment is such that this address cannot work; transient
* or unknown/unexpected failures return true. */
/* Returned string is in a static buffer. */
struct comm_if {
void *st;
+ comm_clientinfo_fn *clientinfo;
comm_request_notify_fn *request_notify;
comm_release_notify_fn *release_notify;
comm_sendmsg_fn *sendmsg;
const struct comm_addr *dest,
struct buffer_if *buf)
{
- return dest->comm->sendmsg(dest->comm->st, buf, dest);
+ return dest->comm->sendmsg(dest->comm->st, buf, dest, 0);
}
static uint32_t site_status(void *st)
}
static bool_t udp_sendmsg(void *commst, struct buffer_if *buf,
- const struct comm_addr *dest)
+ const struct comm_addr *dest,
+ struct comm_clientinfo *clientinfo)
{
struct udp *st=commst;
struct udpcommon *uc=&st->uc;
" %s; sending NAK\n",
comm_addr_to_string(dest),
our_index, their_index, msgtype, logwhy);
- dest->comm->sendmsg(dest->comm->st, buf, dest);
+ dest->comm->sendmsg(dest->comm->st, buf, dest, 0);
}
int consttime_memeq(const void *s1in, const void *s2in, size_t n)