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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: libraries/nacl-mounts/net/BaseSocketSubSystem.h
===================================================================
--- libraries/nacl-mounts/net/BaseSocketSubSystem.h (revision 0)
+++ libraries/nacl-mounts/net/BaseSocketSubSystem.h (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_S3_H
Dmitry Polukhin 2012/05/31 14:06:45 Please use guard according coding style.
vissi 2012/06/01 09:12:57 Done.
+#define BASE_S3_H
+#ifdef __GLIBC__
+#include <assert.h>
+#include <errno.h>
+#include <memory.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <map>
+#include <string>
+
+#include "../base/PthreadHelpers.h"
+#include "../net/IOInterfaces.h"
+
+class BaseSocketSubSystem {
+ public:
+ BaseSocketSubSystem() {}
+ virtual ~BaseSocketSubSystem() {}
+
+ // Syscall implementations
+ virtual int close(FileStream* stream) = 0;
+ virtual int read(FileStream* stream, char* buf, size_t count,
+ size_t* nread) = 0;
+ virtual int write(FileStream* stream, const char* buf, size_t count,
+ size_t* nwrote) = 0;
+ virtual int seek(FileStream* stream, nacl_abi_off_t offset, int whence,
+ nacl_abi_off_t* new_offset) = 0;
+ virtual int fstat(FileStream* stream, nacl_abi_stat* out) = 0;
+
+ virtual int fcntl(FileStream* stream, int cmd, va_list ap) = 0;
+ virtual int ioctl(FileStream* stream, int request, va_list ap) = 0;
+
+ virtual unsigned long gethostbyname(const char* name) = 0;
+ virtual int connect(FileStream** stream, unsigned long addr,
+ unsigned short port) = 0;
+ virtual int shutdown(FileStream* stream, int how) = 0;
+ virtual int bind(FileStream** stream, unsigned long addr,
+ unsigned short port) = 0;
+ virtual int listen(FileStream* stream, int backlog) = 0;
+ virtual FileStream* accept(FileStream* stream, struct sockaddr *addr,
+ socklen_t* addrlen) = 0;
+};
+
+#endif // __GLIBC__
+#endif // BASE_S3_H
+

Powered by Google App Engine
This is Rietveld 408576698