Index: libraries/nacl-mounts/net/BaseSocketSubSystem.h |
=================================================================== |
--- libraries/nacl-mounts/net/BaseSocketSubSystem.h (revision 0) |
+++ libraries/nacl-mounts/net/BaseSocketSubSystem.h (revision 0) |
@@ -0,0 +1,60 @@ |
+// 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. |
+ |
+#ifndef BASE_S3_H |
+#define BASE_S3_H |
+ |
+#include <assert.h> |
+#include <errno.h> |
+#include <memory.h> |
+#include <stdarg.h> |
+#include <stdio.h> |
+#include <sys/ioctl.h> |
+#include <sys/types.h> |
+#include <unistd.h> |
+ |
+#include <map> |
+#include <string> |
+ |
+#include "../base/PthreadHelpers.h" |
+#include "../net/IOInterfaces.h" |
+ |
+class BaseSocketSubSystem { |
+ public: |
+ BaseSocketSubSystem() {} |
+ virtual ~BaseSocketSubSystem() {} |
+ |
+ // Syscall implementations |
+ virtual int close(int fd) = 0; |
+ virtual int read(FileHandle* handle, char* buf, size_t count, |
+ size_t* nread) = 0; |
+ virtual int write(FileHandle* handle, const char* buf, size_t count, |
+ size_t* nwrote) = 0; |
+ virtual int seek(FileHandle* handle, nacl_abi_off_t offset, int whence, |
+ nacl_abi_off_t* new_offset) = 0; |
+ //virtual int dup(int fd, int *newfd) = 0; |
+ //virtual int dup2(int fd, int newfd) = 0; |
+ virtual int fstat(FileHandle* handle, nacl_abi_stat* out) = 0; |
+ |
+ virtual int fcntl(FileHandle* handle, int cmd, va_list ap) = 0; |
+ virtual int ioctl(FileHandle* handle, int request, va_list ap) = 0; |
+ |
+ virtual unsigned long gethostbyname(const char* name) = 0; |
+ virtual int socket(int socket_family, int socket_type, int protocol) = 0; |
+ virtual int connect(FileHandle* handle, unsigned long addr, |
+ unsigned short port) = 0; |
+ virtual int shutdown(int sockfd, int how) = 0; |
+ virtual int bind(FileHandle* handle, unsigned long addr, |
+ unsigned short port) = 0; |
+ virtual int listen(FileHandle* handle, int backlog) = 0; |
+ virtual int accept(FileHandle* handle, struct sockaddr *addr, |
+ socklen_t *addrlen) = 0; |
+ virtual int IsReady(int nfds, fd_set* fds, bool (FileStream::*is_ready)(), |
+ bool apply) = 0; |
+ virtual Mutex& mutex() = 0; |
+ virtual Cond& cond() = 0; |
+}; |
+ |
+#endif // BASE_S3_H |
+ |