OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_S3_H |
| 6 #define BASE_S3_H |
| 7 |
| 8 #include <assert.h> |
| 9 #include <errno.h> |
| 10 #include <memory.h> |
| 11 #include <stdarg.h> |
| 12 #include <stdio.h> |
| 13 #include <sys/ioctl.h> |
| 14 #include <sys/types.h> |
| 15 #include <unistd.h> |
| 16 |
| 17 #include <map> |
| 18 #include <string> |
| 19 |
| 20 #include "../base/PthreadHelpers.h" |
| 21 #include "../net/IOInterfaces.h" |
| 22 #include "ppapi/cpp/file_ref.h" |
| 23 #include "ppapi/utility/completion_callback_factory.h" |
| 24 |
| 25 class BaseSocketSubSystem { |
| 26 public: |
| 27 BaseSocketSubSystem() {} |
| 28 virtual ~BaseSocketSubSystem() {} |
| 29 virtual pp::Instance* instance() = 0; |
| 30 |
| 31 // Syscall implementations |
| 32 virtual int close(FileStream* stream) = 0; |
| 33 virtual int read(FileStream* stream, char* buf, size_t count, |
| 34 size_t* nread) = 0; |
| 35 virtual int write(FileStream* stream, const char* buf, size_t count, |
| 36 size_t* nwrote) = 0; |
| 37 virtual int seek(FileStream* stream, nacl_abi_off_t offset, int whence, |
| 38 nacl_abi_off_t* new_offset) = 0; |
| 39 virtual int fstat(FileStream* stream, nacl_abi_stat* out) = 0; |
| 40 |
| 41 virtual int fcntl(FileStream* stream, int cmd, va_list ap) = 0; |
| 42 virtual int ioctl(FileStream* stream, int request, va_list ap) = 0; |
| 43 |
| 44 virtual unsigned long gethostbyname(const char* name) = 0; |
| 45 virtual int connect(FileStream** stream, unsigned long addr, |
| 46 unsigned short port) = 0; |
| 47 virtual int shutdown(FileStream* stream, int how) = 0; |
| 48 virtual int bind(FileStream** stream, unsigned long addr, |
| 49 unsigned short port) = 0; |
| 50 virtual int listen(FileStream* stream, int backlog) = 0; |
| 51 virtual FileStream* accept(FileStream* stream, struct sockaddr *addr, |
| 52 socklen_t* addrlen) = 0; |
| 53 virtual Mutex& mutex() = 0; |
| 54 virtual Cond& cond() = 0; |
| 55 }; |
| 56 |
| 57 #endif // BASE_S3_H |
| 58 |
OLD | NEW |