Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: libraries/nacl-mounts/net/BaseSocketSubSystem.h

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 PACKAGES_LIBRARIES_NACL_MOUNTS_NET_BASESOCKETSUBSYSTEM_H_
6 #define PACKAGES_LIBRARIES_NACL_MOUNTS_NET_BASESOCKETSUBSYSTEM_H_
7 #include <assert.h>
8 #include <errno.h>
9 #ifdef __GLIBC__
10 #include <memory.h>
11 #else
12 #include <nacl-mounts/net/newlib_compat.h>
13 #endif
14 #include <stdarg.h>
15 #include <stdio.h>
16 #include <sys/types.h>
17 #include <unistd.h>
18
19 #include <map>
20 #include <string>
21
22 #include <nacl-mounts/net/Socket.h>
23 #include <nacl-mounts/util/PthreadHelpers.h>
24
25 class BaseSocketSubSystem {
26 public:
27 BaseSocketSubSystem() {}
28 virtual ~BaseSocketSubSystem() {}
29
30 // Syscall implementations
31 virtual int close(Socket* stream) = 0;
32 virtual int read(Socket* stream, char* buf, size_t count,
33 size_t* nread) = 0;
34 virtual int write(Socket* stream, const char* buf, size_t count,
35 size_t* nwrote) = 0;
36 virtual int seek(Socket* stream, nacl_abi_off_t offset, int whence,
37 nacl_abi_off_t* new_offset) = 0;
38 virtual int fstat(Socket* stream, nacl_abi_stat* out) = 0;
39
40 virtual int fcntl(Socket* stream, int cmd, va_list ap) = 0;
41 virtual int ioctl(Socket* stream, int request, va_list ap) = 0;
42
43 virtual unsigned long gethostbyname(const char* name) = 0;
44 virtual int getaddrinfo(const char* hostname, const char* servname,
45 const addrinfo* hints, addrinfo** res) = 0;
46 virtual void freeaddrinfo(addrinfo* ai) = 0;
47 virtual int getnameinfo(const sockaddr *sa, socklen_t salen,
48 char *host, size_t hostlen,
49 char *serv, size_t servlen, int flags) = 0;
50 virtual int connect(Socket** stream, const sockaddr* serv_addr,
51 socklen_t addrlen) = 0;
52 virtual int bind(Socket** stream, const sockaddr* addr,
53 socklen_t addrlen) = 0;
54 virtual int shutdown(Socket* stream, int how) = 0;
55 virtual int listen(Socket* stream, int backlog) = 0;
56 virtual Socket* accept(Socket* stream, struct sockaddr *addr,
57 socklen_t* addrlen) = 0;
58 };
59
60 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_NET_BASESOCKETSUBSYSTEM_H_
61
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698