shill: LinkMonitor: Add ArpClient code
Add ArpClient class and start hooking it up to LinkMonitor.
BUG=chromium-os:32600
TEST=Unit tests. Some real-world testing using the test harness
to transmit and receive ARP on a real network.
Change-Id: Ic05d8d7eb921878e3776f35b4be285554ef86456
Reviewed-on: https://gerrit.chromium.org/gerrit/28148
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/sockets.h b/sockets.h
index e0cc70b..3dc6a4f 100644
--- a/sockets.h
+++ b/sockets.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <string>
+#include <linux/filter.h>
#include <sys/socket.h>
#include <sys/types.h>
@@ -22,6 +23,9 @@
// accept
virtual int Accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+ // getsockopt(sockfd, SOL_SOCKET, SO_ATTACH_FILTER, ...)
+ virtual int AttachFilter(int sockfd, struct sock_fprog *pf);
+
// bind
virtual int Bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
@@ -54,6 +58,10 @@
// listen
virtual int Listen(int sockfd, int backlog);
+ // recvfrom
+ virtual ssize_t RecvFrom(int sockfd, void *buf, size_t len, int flags,
+ struct sockaddr *src_addr, socklen_t *addrlen);
+
// send
virtual ssize_t Send(int sockfd, const void *buf, size_t len, int flags);