1 /******************************************************************************
2  *
3  *  Copyright (C) 2022 Google, Inc.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #pragma once
20 
21 #include "hal/syscall_wrapper_interface.h"
22 
23 namespace bluetooth {
24 namespace hal {
25 
26 class SyscallWrapperImpl : public SyscallWrapperInterface {
27   int Socket(int domain, int type, int protocol);
28 
29   int Bind(int fd, const struct sockaddr* addr, socklen_t len);
30 
31   int Connect(int fd, const struct sockaddr* addr, socklen_t len);
32 
33   ssize_t Send(int fd, const void* buf, size_t n, int flags);
34 
35   ssize_t Recv(int fd, void* buf, size_t n, int flags);
36 
37   int Setsockopt(int fd, int level, int optname, const void* optval, socklen_t optlen);
38 
39   int Listen(int fd, int n);
40 
41   int Accept(int fd, struct sockaddr* addr, socklen_t* addr_len, int flags);
42 
43   ssize_t Write(int, const void*, size_t);
44 
45   int Close(int fd);
46 
47   int Pipe2(int* pipefd, int flags);
48 
49   int GetErrno() const;
50 
51   int Poll(struct pollfd* fds, nfds_t nfds, int timeout);
52 
53 private:
54   int errno_;
55 };
56 
57 }  // namespace hal
58 }  // namespace bluetooth
59