mukesh agrawal | ec533e0 | 2016-09-30 19:04:33 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef RAW_OS_H_ |
| 18 | #define RAW_OS_H_ |
| 19 | |
mukesh agrawal | d75fd9e | 2016-10-26 16:34:04 -0700 | [diff] [blame] | 20 | #include <sys/socket.h> |
| 21 | #include <sys/types.h> |
mukesh agrawal | ec533e0 | 2016-09-30 19:04:33 -0700 | [diff] [blame] | 22 | #include <time.h> |
| 23 | |
| 24 | #include "android-base/macros.h" |
| 25 | |
| 26 | #include "wifilogd/local_utils.h" |
| 27 | |
| 28 | namespace android { |
| 29 | namespace wifilogd { |
| 30 | |
| 31 | // Enables interposing on operating system calls. |
| 32 | class RawOs { |
| 33 | public: |
| 34 | RawOs(); |
| 35 | virtual ~RawOs(); |
| 36 | |
| 37 | // See clock_gettime(). |
| 38 | virtual int ClockGettime(clockid_t clock_id, |
| 39 | NONNULL struct timespec* tspec) const; |
| 40 | |
mukesh agrawal | a5bb08c | 2016-10-26 14:38:52 -0700 | [diff] [blame] | 41 | // See android_get_control_socket(). |
| 42 | virtual int GetControlSocket(const char* socket_name); |
| 43 | |
mukesh agrawal | 960c8a8 | 2016-10-27 17:39:18 -0700 | [diff] [blame] | 44 | // See nanosleep(). |
| 45 | virtual int Nanosleep(NONNULL const struct timespec* req, |
| 46 | struct timespec* rem); |
| 47 | |
mukesh agrawal | d75fd9e | 2016-10-26 16:34:04 -0700 | [diff] [blame] | 48 | // See recv(). |
| 49 | virtual ssize_t Recv(int sockfd, void* buf, size_t buflen, int flags); |
| 50 | |
mukesh agrawal | b8f8f6a | 2016-10-06 15:11:59 -0700 | [diff] [blame] | 51 | // See write(). |
| 52 | virtual ssize_t Write(int fd, const void* buf, size_t buflen); |
| 53 | |
mukesh agrawal | ec533e0 | 2016-09-30 19:04:33 -0700 | [diff] [blame] | 54 | private: |
| 55 | DISALLOW_COPY_AND_ASSIGN(RawOs); |
| 56 | }; |
| 57 | |
| 58 | } // namespace wifilogd |
| 59 | } // namespace android |
| 60 | |
| 61 | #endif // RAW_OS_H_ |