Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | #pragma once |
| 17 | |
Jorge E. Moreira | 4b9bbb1 | 2017-12-28 15:49:06 -0800 | [diff] [blame] | 18 | #include <memory> |
| 19 | |
Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 20 | #include "common/vsoc/lib/typed_region_view.h" |
| 21 | #include "common/vsoc/shm/wifi_exchange_layout.h" |
| 22 | #include "uapi/vsoc_shm.h" |
| 23 | |
| 24 | namespace vsoc { |
| 25 | namespace wifi { |
| 26 | |
| 27 | class WifiExchangeView |
Ryan Haining | 59063a9 | 2018-02-08 17:32:22 -0800 | [diff] [blame^] | 28 | : public vsoc::TypedRegionView< |
| 29 | WifiExchangeView, |
| 30 | vsoc::layout::wifi::WifiExchangeLayout> { |
Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 31 | public: |
| 32 | // Send netlink packet to peer. |
| 33 | // returns true, if operation was successful. |
Tomasz Wiszkowski | 95ee07f | 2017-12-04 12:52:15 -0800 | [diff] [blame] | 34 | intptr_t Send(const void* buffer, intptr_t length); |
Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 35 | |
| 36 | // Receive netlink packet from peer. |
| 37 | // Returns number of bytes read, or negative value, if failed. |
Tomasz Wiszkowski | 95ee07f | 2017-12-04 12:52:15 -0800 | [diff] [blame] | 38 | intptr_t Recv(void* buffer, intptr_t max_length); |
Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 39 | |
| 40 | // Set guest MAC address. |
| 41 | void SetGuestMACAddress(const uint8_t* mac_address); |
| 42 | void GetGuestMACAddress(uint8_t* mac_address); |
| 43 | |
| 44 | void SetConfigReady(); |
| 45 | void WaitConfigReady(); |
Tomasz Wiszkowski | 719ce86 | 2017-12-01 12:31:17 -0800 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | } // namespace wifi |
| 49 | } // namespace vsoc |