/*
 * Copyright 2022 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.
 */

// C++ Client implementation for PacketStreamer gRPC.
//
// This is used by netsimd for forwarding packet to another netsimd.

#pragma once

#include "rust/cxx.h"

namespace netsim {
namespace backend {
namespace client {

uint32_t StreamPackets(const rust::String &server);

using ReadCallback = rust::Fn<void(
    uint32_t, const rust::Slice<::std::uint8_t const> proto_bytes)>;

bool ReadPacketResponseLoop(uint32_t stream_id, ReadCallback read_fn);

bool WritePacketRequest(uint32_t stream_id,
                        const rust::Slice<::std::uint8_t const> proto_bytes);

}  // namespace client
}  // namespace backend
}  // namespace netsim
