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 |
| 23 class BaseSocketSubSystem { |
| 24 public: |
| 25 BaseSocketSubSystem() {} |
| 26 virtual ~BaseSocketSubSystem() {} |
| 27 |
| 28 // Syscall implementations |
| 29 virtual int close(FileStream* stream) = 0; |
| 30 virtual int read(FileStream* stream, char* buf, size_t count, |
| 31 size_t* nread) = 0; |
| 32 virtual int write(FileStream* stream, const char* buf, size_t count, |
| 33 size_t* nwrote) = 0; |
| 34 virtual int seek(FileStream* stream, nacl_abi_off_t offset, int whence, |
| 35 nacl_abi_off_t* new_offset) = 0; |
| 36 virtual int fstat(FileStream* stream, nacl_abi_stat* out) = 0; |
| 37 |
| 38 virtual int fcntl(FileStream* stream, int cmd, va_list ap) = 0; |
| 39 virtual int ioctl(FileStream* stream, int request, va_list ap) = 0; |
| 40 |
| 41 virtual unsigned long gethostbyname(const char* name) = 0; |
| 42 virtual int connect(FileStream** stream, unsigned long addr, |
| 43 unsigned short port) = 0; |
| 44 virtual int shutdown(FileStream* stream, int how) = 0; |
| 45 virtual int bind(FileStream** stream, unsigned long addr, |
| 46 unsigned short port) = 0; |
| 47 virtual int listen(FileStream* stream, int backlog) = 0; |
| 48 virtual FileStream* accept(FileStream* stream, struct sockaddr *addr, |
| 49 socklen_t* addrlen) = 0; |
| 50 }; |
| 51 |
| 52 #endif // BASE_S3_H |
| 53 |
OLD | NEW |