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

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

Issue 10556007: changes in memory mount and socket subsystem to port thttpd (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
1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. 1 // Copyright (c) 2012 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_ 5 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_
6 #define PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_ 6 #define PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_
7 7
8 #include <errno.h> 8 #include <errno.h>
9 #include <stdarg.h> 9 #include <stdarg.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 11
12 #include <map> 12 #include <map>
13 #include <string> 13 #include <string>
14 14
15 #include "../base/KernelProxy.h" 15 #include "../base/KernelProxy.h"
16 #include "../net/BaseSocketSubSystem.h" 16 #include "../net/BaseSocketSubSystem.h"
17 #include "../net/Socket.h" 17 #include "../net/Socket.h"
18 #include "../ppapi/cpp/private/host_resolver_private.h" 18 #include "../ppapi/cpp/private/host_resolver_private.h"
19 #include "ppapi/cpp/file_ref.h" 19 #include "ppapi/cpp/file_ref.h"
20 #include "ppapi/cpp/file_system.h" 20 #include "ppapi/cpp/file_system.h"
21 #include "ppapi/utility/completion_callback_factory.h" 21 #include "ppapi/utility/completion_callback_factory.h"
22 22
23 // current limitations: 23 // current limitations:
24 // cannot close in another thread 24 // cannot close in another thread
25 25
26 class SocketSubSystem : public BaseSocketSubSystem { 26 class SocketSubSystem : public BaseSocketSubSystem {
27 public: 27 public:
28 explicit SocketSubSystem(pp::Instance* instance); 28 SocketSubSystem(pp::Instance* instance);
29 virtual ~SocketSubSystem(); 29 virtual ~SocketSubSystem();
30 pp::Instance* instance() { return pp_instance_; } 30 pp::Instance* instance() { return pp_instance_; }
31 31
32 // Syscall implementations 32 // Syscall implementations
33 int close(Socket* stream); 33 int close(Socket* stream);
34 int read(Socket* stream, char* buf, size_t count, size_t* nread); 34 int read(Socket* stream, char* buf, size_t count, size_t* nread);
35 int write(Socket* stream, const char* buf, size_t count, size_t* nwrote); 35 int write(Socket* stream, const char* buf, size_t count, size_t* nwrote);
36 int seek(Socket* stream, nacl_abi_off_t offset, int whence, 36 int seek(Socket* stream, nacl_abi_off_t offset, int whence,
37 nacl_abi_off_t* new_offset); 37 nacl_abi_off_t* new_offset);
38 int fstat(Socket* stream, nacl_abi_stat* out); 38 int fstat(Socket* stream, nacl_abi_stat* out);
39 39
40 int fcntl(Socket* stream, int cmd, va_list ap); 40 int fcntl(Socket* stream, int cmd, va_list ap);
41 int ioctl(Socket* stream, int request, va_list ap); 41 int ioctl(Socket* stream, int request, va_list ap);
42 int setsockopt(Socket* stream, int level, int optname,
43 const void* optval, socklen_t optlen);
42 44
43 uint32_t gethostbyname(const char* name); 45 uint32_t gethostbyname(const char* name);
44 int connect(Socket** stream, const sockaddr* serv_addr, socklen_t addrlen); 46 int connect(Socket** stream, const sockaddr* serv_addr, socklen_t addrlen);
45 int bind(Socket** stream, const sockaddr* addr, socklen_t addrlen); 47 int bind(Socket** stream, const sockaddr* addr, socklen_t addrlen);
46 int shutdown(Socket* stream, int how); 48 int shutdown(Socket* stream, int how);
47 int listen(Socket* stream, int backlog); 49 int listen(Socket* stream, int backlog);
48 Socket* accept(Socket* stream, struct sockaddr *addr, 50 Socket* accept(Socket* stream, struct sockaddr *addr,
49 socklen_t* addrlen); 51 socklen_t* addrlen);
50 int getaddrinfo(const char* hostname, const char* servname, 52 int getaddrinfo(const char* hostname, const char* servname,
51 const addrinfo* hints, addrinfo** res); 53 const addrinfo* hints, addrinfo** res);
(...skipping 24 matching lines...) Expand all
76 void OnResolve(int32_t result, GetAddrInfoParams* params, int32_t* pres); 78 void OnResolve(int32_t result, GetAddrInfoParams* params, int32_t* pres);
77 79
78 pp::CompletionCallbackFactory<SocketSubSystem, ThreadSafeRefCount> factory_; 80 pp::CompletionCallbackFactory<SocketSubSystem, ThreadSafeRefCount> factory_;
79 pp::HostResolverPrivate* host_resolver_; 81 pp::HostResolverPrivate* host_resolver_;
80 82
81 DISALLOW_COPY_AND_ASSIGN(SocketSubSystem); 83 DISALLOW_COPY_AND_ASSIGN(SocketSubSystem);
82 }; 84 };
83 85
84 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_ 86 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_SOCKET_SUBSYSTEM_H_
85 87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698