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,54 @@ |
+// 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 |
Dmitry Polukhin
2012/05/31 14:06:45
Please use guard according coding style.
vissi
2012/06/01 09:12:57
Done.
|
+#define BASE_S3_H |
+#ifdef __GLIBC__ |
+#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(FileStream* stream) = 0; |
+ virtual int read(FileStream* stream, char* buf, size_t count, |
+ size_t* nread) = 0; |
+ virtual int write(FileStream* stream, const char* buf, size_t count, |
+ size_t* nwrote) = 0; |
+ virtual int seek(FileStream* stream, nacl_abi_off_t offset, int whence, |
+ nacl_abi_off_t* new_offset) = 0; |
+ virtual int fstat(FileStream* stream, nacl_abi_stat* out) = 0; |
+ |
+ virtual int fcntl(FileStream* stream, int cmd, va_list ap) = 0; |
+ virtual int ioctl(FileStream* stream, int request, va_list ap) = 0; |
+ |
+ virtual unsigned long gethostbyname(const char* name) = 0; |
+ virtual int connect(FileStream** stream, unsigned long addr, |
+ unsigned short port) = 0; |
+ virtual int shutdown(FileStream* stream, int how) = 0; |
+ virtual int bind(FileStream** stream, unsigned long addr, |
+ unsigned short port) = 0; |
+ virtual int listen(FileStream* stream, int backlog) = 0; |
+ virtual FileStream* accept(FileStream* stream, struct sockaddr *addr, |
+ socklen_t* addrlen) = 0; |
+}; |
+ |
+#endif // __GLIBC__ |
+#endif // BASE_S3_H |
+ |