UdpProcessor: virtual method HandleOne() for preprocessing.

The new method is a general-purpose hook that is run over all received
datagrams.  It may opt to not process a datagram as a Roughtime
message.

Change-Id: I7fdcaabb32fac5e0cc26a18a9ca9e3e09c83350c
diff --git a/udp_processor.cc b/udp_processor.cc
index 5a82a04..de57f6d 100644
--- a/udp_processor.cc
+++ b/udp_processor.cc
@@ -138,6 +138,11 @@
 }
 #endif
 
+bool UdpProcessor::HandleOne(const struct msghdr *from, const uint8_t *packet,
+                             size_t len, Server *server) {
+  return server->AddRequest(packet, len);
+}
+
 bool UdpProcessor::ProcessBatch(int fd, Server *server, Stats *out_stats) {
   server->Reset();
   memset(out_stats, 0, sizeof(Stats));
@@ -166,7 +171,8 @@
       out_stats->requests_truncated++;
       continue;
     }
-    if (!server->AddRequest(recv_buf_[i], recv_mmsghdrs_[i].msg_len)) {
+    if (!HandleOne(recv_header, recv_buf_[i], recv_mmsghdrs_[i].msg_len,
+                   server)) {
       out_stats->requests_invalid++;
       continue;
     }
diff --git a/udp_processor.h b/udp_processor.h
index 2f6d6e4..a418fe0 100644
--- a/udp_processor.h
+++ b/udp_processor.h
@@ -63,6 +63,11 @@
   // errors.)
   virtual bool ProcessBatch(int fd, Server* server, Stats* out_stats);
 
+  // HandleOne processes a single |packet| of length |len| received from |from|.
+  // It should return true if the message was accepted by |server|.
+  virtual bool HandleOne(const struct msghdr* from, const uint8_t* packet,
+                         size_t len, Server* server);
+
   // MakeSocket sets |*out_sock| to a UDP socket bound to the given port and
   // sets |*out_port| to the bound port number. If |port| is zero then a free
   // port number is used. It returns true on success or false on error.