blob: 2658fde3233a286432902cf00dc96df2af3bb509 [file] [log] [blame]
mukesh agrawalec533e02016-09-30 19:04:33 -07001/*
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 agrawald75fd9e2016-10-26 16:34:04 -070020#include <sys/socket.h>
21#include <sys/types.h>
mukesh agrawalec533e02016-09-30 19:04:33 -070022#include <time.h>
23
24#include "android-base/macros.h"
25
26#include "wifilogd/local_utils.h"
27
28namespace android {
29namespace wifilogd {
30
31// Enables interposing on operating system calls.
32class 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 agrawala5bb08c2016-10-26 14:38:52 -070041 // See android_get_control_socket().
42 virtual int GetControlSocket(const char* socket_name);
43
mukesh agrawal960c8a82016-10-27 17:39:18 -070044 // See nanosleep().
45 virtual int Nanosleep(NONNULL const struct timespec* req,
46 struct timespec* rem);
47
mukesh agrawald75fd9e2016-10-26 16:34:04 -070048 // See recv().
49 virtual ssize_t Recv(int sockfd, void* buf, size_t buflen, int flags);
50
mukesh agrawalb8f8f6a2016-10-06 15:11:59 -070051 // See write().
52 virtual ssize_t Write(int fd, const void* buf, size_t buflen);
53
mukesh agrawalec533e02016-09-30 19:04:33 -070054 private:
55 DISALLOW_COPY_AND_ASSIGN(RawOs);
56};
57
58} // namespace wifilogd
59} // namespace android
60
61#endif // RAW_OS_H_