diff options
| author | David 'Digit' Turner <digit@google.com> | 2014-03-11 19:58:51 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-03-11 19:58:51 +0000 |
| commit | 84b68033f6b92a3c35ac1d3ab7f8278c54744cff (patch) | |
| tree | ba6e795703570bd83fbfcdf92216359452ebb358 /emulator/opengl/shared/emugl/common/sockets.h | |
| parent | 81431aae3aaf95209a606511b3a81f6aa06ffe9f (diff) | |
| parent | 56b89bc863d1a5da6234f05923f63b5466e1ce3f (diff) | |
| download | sdk-84b68033f6b92a3c35ac1d3ab7f8278c54744cff.zip sdk-84b68033f6b92a3c35ac1d3ab7f8278c54744cff.tar.gz sdk-84b68033f6b92a3c35ac1d3ab7f8278c54744cff.tar.bz2 | |
Merge changes I205392bd,I84a058bb,I22c67f11,Id18319e8,I9836ed96, ... into idea133
* changes:
emulator/opengl: Allow standalone build.
emulator/opengl: Remove libcutils/libutils/liblog
emulator/opengl: Remove <utils/List.h> + <utils/String8.h>
emulator/opengl: Remove android::KeyedVector usage.
emulator/opengl: Remove android::Vector<> usage.
emulator/opengl: Remove <cutils/sockets.h>
Diffstat (limited to 'emulator/opengl/shared/emugl/common/sockets.h')
| -rw-r--r-- | emulator/opengl/shared/emugl/common/sockets.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/emulator/opengl/shared/emugl/common/sockets.h b/emulator/opengl/shared/emugl/common/sockets.h new file mode 100644 index 0000000..11e7ac7 --- /dev/null +++ b/emulator/opengl/shared/emugl/common/sockets.h @@ -0,0 +1,57 @@ +// Copyright (C) 2014 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef EMUGL_COMMON_SOCKETS_H +#define EMUGL_COMMON_SOCKETS_H + +// A set of helper functions used to deal with sockets in a portable way. + +namespace emugl { + +// Disable Nagle's algorithm for socket descriptor |s|. This assumes +// that |s| is a TCP socket descriptor. +void socketTcpDisableNagle(int s); + +// Return the port associated with a given IP or IPv6 socket, +// or -errno code on failure. +int socketGetPort(int s); + +// Bind to a local/Unix path, and return its socket descriptor on success, +// or -errno code on failure. +int socketLocalServer(const char* path, int socketType); + +// Connect to a Unix local path, and return a new socket descriptor +// on success, or -errno code on failure. +int socketLocalClient(const char* path, int socketType); + +// Bind to a localhost TCP socket, and return its socket descriptor on +// success, or -errno code on failure. +int socketTcpLoopbackServer(int port, int socketType); + +// Connect to a localhost TCP port, and return a new socket descriptor on +// success, or -errno code on failure. +int socketTcpLoopbackClient(int port, int socketType); + +// Connect to a TCP host, and return a new socket descriptor on +// success, or -errno code on failure. +int socketTcpClient(const char* hostname, int port, int socketType); + +// Accept a new connection. |serverSocket| must be a bound server socket +// descriptor. Returns new socket descriptor on success, or -errno code +// on failure. +int socketAccept(int serverSocket); + +} // namespace emugl + +#endif // EMUGL_COMMON_SOCKETS_H |
