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

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 #include <memory.h>
10 #include <stdarg.h>
11 #include <stdio.h>
12 #include <sys/ioctl.h>
13 #include <sys/types.h>
14 #include <unistd.h>
15
16 #include <map>
17 #include <string>
18
19 #include "../net/Socket.h"
20 #include "../util/PthreadHelpers.h"
21
22 class BaseSocketSubSystem {
23 public:
24 BaseSocketSubSystem() {}
25 virtual ~BaseSocketSubSystem() {}
26
27 // Syscall implementations
28 virtual int close(Socket* stream) = 0;
29 virtual int read(Socket* stream, char* buf, size_t count,
30 size_t* nread) = 0;
31 virtual int write(Socket* stream, const char* buf, size_t count,
32 size_t* nwrote) = 0;
33 virtual int seek(Socket* stream, nacl_abi_off_t offset, int whence,
34 nacl_abi_off_t* new_offset) = 0;
35 virtual int fstat(Socket* stream, nacl_abi_stat* out) = 0;
36
37 virtual int fcntl(Socket* stream, int cmd, va_list ap) = 0;
38 virtual int ioctl(Socket* stream, int request, va_list ap) = 0;
39
40 virtual unsigned long gethostbyname(const char* name) = 0;
41 virtual int getaddrinfo(const char* hostname, const char* servname,
42 const addrinfo* hints, addrinfo** res) = 0;
43 virtual void freeaddrinfo(addrinfo* ai) = 0;
44 virtual int getnameinfo(const sockaddr *sa, socklen_t salen,
45 char *host, size_t hostlen,
46 char *serv, size_t servlen, int flags) = 0;
47 virtual int connect(Socket** stream, const sockaddr* serv_addr,
48 socklen_t addrlen) = 0;
49 virtual int bind(Socket** stream, const sockaddr* addr,
50 socklen_t addrlen) = 0;
51 virtual int shutdown(Socket* stream, int how) = 0;
52 virtual int listen(Socket* stream, int backlog) = 0;
53 virtual Socket* accept(Socket* stream, struct sockaddr *addr,
54 socklen_t* addrlen) = 0;
55 };
56
57 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_NET_BASESOCKETSUBSYSTEM_H_
58
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698