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(int fd) = 0; |
| 30 virtual int read(FileHandle* handle, char* buf, size_t count, |
| 31 size_t* nread) = 0; |
| 32 virtual int write(FileHandle* handle, const char* buf, size_t count, |
| 33 size_t* nwrote) = 0; |
| 34 virtual int seek(FileHandle* handle, nacl_abi_off_t offset, int whence, |
| 35 nacl_abi_off_t* new_offset) = 0; |
| 36 //virtual int dup(int fd, int *newfd) = 0; |
| 37 //virtual int dup2(int fd, int newfd) = 0; |
| 38 virtual int fstat(FileHandle* handle, nacl_abi_stat* out) = 0; |
| 39 |
| 40 virtual int fcntl(FileHandle* handle, int cmd, va_list ap) = 0; |
| 41 virtual int ioctl(FileHandle* handle, int request, va_list ap) = 0; |
| 42 |
| 43 virtual unsigned long gethostbyname(const char* name) = 0; |
| 44 virtual int socket(int socket_family, int socket_type, int protocol) = 0; |
| 45 virtual int connect(FileHandle* handle, unsigned long addr, |
| 46 unsigned short port) = 0; |
| 47 virtual int shutdown(int sockfd, int how) = 0; |
| 48 virtual int bind(FileHandle* handle, unsigned long addr, |
| 49 unsigned short port) = 0; |
| 50 virtual int listen(FileHandle* handle, int backlog) = 0; |
| 51 virtual int accept(FileHandle* handle, struct sockaddr *addr, |
| 52 socklen_t *addrlen) = 0; |
| 53 virtual int IsReady(int nfds, fd_set* fds, bool (FileStream::*is_ready)(), |
| 54 bool apply) = 0; |
| 55 virtual Mutex& mutex() = 0; |
| 56 virtual Cond& cond() = 0; |
| 57 }; |
| 58 |
| 59 #endif // BASE_S3_H |
| 60 |
OLD | NEW |