From 24385005b8b58c50b47cca95211d5db153550c78 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 30 Nov 2012 10:06:07 +0100 Subject: [PATCH] Enumerate the event codes for the transport layer transmission methods. We add a new event code that indicates a one step event message. Signed-off-by: Richard Cochran --- raw.c | 2 +- transport.h | 10 ++++++++++ udp.c | 2 +- udp6.c | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/raw.c b/raw.c index 5511582..8e22be4 100644 --- a/raw.c +++ b/raw.c @@ -286,7 +286,7 @@ static int raw_send(struct transport *t, struct fdarray *fda, int event, int pee /* * Get the time stamp right away. */ - return event ? sk_receive(fd, pkt, len, hwts, MSG_ERRQUEUE) : cnt; + return event == TRANS_EVENT ? sk_receive(fd, pkt, len, hwts, MSG_ERRQUEUE) : cnt; } static void raw_release(struct transport *t) diff --git a/transport.h b/transport.h index caa07a3..bfdff3d 100644 --- a/transport.h +++ b/transport.h @@ -34,6 +34,16 @@ enum transport_type { TRANS_UDS, }; +/** + * Values for the 'event' parameter in transport_send() and + * transport_peer(). + */ +enum transport_event { + TRANS_GENERAL, + TRANS_EVENT, + TRANS_ONESTEP, +}; + enum timestamp_type { TS_SOFTWARE, TS_HARDWARE, diff --git a/udp.c b/udp.c index ea92794..e16030d 100644 --- a/udp.c +++ b/udp.c @@ -198,7 +198,7 @@ static int udp_send(struct transport *t, struct fdarray *fda, int event, int pee /* * Get the time stamp right away. */ - return event ? sk_receive(fd, junk, len, hwts, MSG_ERRQUEUE) : cnt; + return event == TRANS_EVENT ? sk_receive(fd, junk, len, hwts, MSG_ERRQUEUE) : cnt; } static void udp_release(struct transport *t) diff --git a/udp6.c b/udp6.c index 9e68574..490a780 100644 --- a/udp6.c +++ b/udp6.c @@ -224,7 +224,7 @@ static int udp6_send(struct transport *t, struct fdarray *fda, int event, int pe /* * Get the time stamp right away. */ - return event ? sk_receive(fd, junk, len, hwts, MSG_ERRQUEUE) : cnt; + return event == TRANS_EVENT ? sk_receive(fd, junk, len, hwts, MSG_ERRQUEUE) : cnt; } static void udp6_release(struct transport *t)