Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datagram remote_key getter #122

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/oxen/quic/datagram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace oxen::quic

std::shared_ptr<connection_interface> get_conn_interface();

ustring remote_key() const;

template <
typename CharType,
std::enable_if_t<sizeof(CharType) == 1 && !std::is_same_v<CharType, std::byte>, int> = 0>
Expand Down
11 changes: 11 additions & 0 deletions src/datagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ namespace oxen::quic
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
return false;
}

bool DatagramIO::sent_fin() const
{
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
return false;
}

void DatagramIO::set_fin(bool)
{
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
}

size_t DatagramIO::unsent_impl() const
{
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
Expand All @@ -53,14 +56,17 @@ namespace oxen::quic
sum += entry.size();
return sum;
}

bool DatagramIO::has_unsent_impl() const
{
return not is_empty_impl();
}

void DatagramIO::wrote(size_t)
{
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
}

std::vector<ngtcp2_vec> DatagramIO::pending()
{
log::trace(log_cat, "{} called", __PRETTY_FUNCTION__);
Expand All @@ -74,6 +80,11 @@ namespace oxen::quic
return ci.shared_from_this();
}

ustring dgram_interface::remote_key() const
{
return ustring{ci.remote_key()};
}

void dgram_interface::reply(bstring_view data, std::shared_ptr<void> keep_alive)
{
ci.send_datagram(data, std::move(keep_alive));
Expand Down