ncsid: Import from gBMC
This is the initial code drop from gBMC.
Google-Bug-Id: 179618516
Upstream: 1e71af914bc8c54d8b91d0a1cf377e2696713c2f
Change-Id: Ic653e8271dacd205e04f2bc713071ef2ec5936a4
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/ncsid/src/net_sockio.h b/ncsid/src/net_sockio.h
new file mode 100644
index 0000000..9ed1abb
--- /dev/null
+++ b/ncsid/src/net_sockio.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <sys/types.h>
+
+namespace net
+{
+
+class SockIO
+{
+ public:
+ SockIO() = default;
+ explicit SockIO(int sockfd) : sockfd_{sockfd}
+ {}
+ virtual ~SockIO();
+
+ int get_sockfd() const
+ {
+ return sockfd_;
+ }
+
+ virtual int write(const void* buf, size_t len);
+
+ virtual int close();
+
+ virtual int recv(void* buf, size_t maxlen);
+
+ protected:
+ int sockfd_ = -1;
+};
+
+} // namespace net