23#include <git2/remote.h>
24#include <git2/sys/transport.h>
25#include <git2/errors.h>
40 git_smart_subtransport_stream
base;
41 std::weak_ptr<dhtnet::ChannelSocket>
socket;
50 git_smart_subtransport
base;
55using namespace std::string_view_literals;
68int generateRequest(git_buf* request,
const std::string& cmd,
const std::string_view& url);
85int P2PStreamRead(git_smart_subtransport_stream* stream,
char* buffer,
size_t buflen,
size_t* read);
87int P2PStreamWrite(git_smart_subtransport_stream* stream,
const char* buffer,
size_t len);
103 git_smart_subtransport* transport,
105 git_smart_service_t action);
int P2PStreamRead(git_smart_subtransport_stream *stream, char *buffer, size_t buflen, size_t *read)
Read on a channel socket.
int P2PStreamWrite(git_smart_subtransport_stream *stream, const char *buffer, size_t len)
int P2PSubTransportClose(git_smart_subtransport *)
Close a subtransport Because we use a channel socket, we need to do nothing here.
int generateRequest(git_buf *request, const std::string &cmd, const std::string_view &url)
constexpr auto UPLOAD_PACK_CMD
int P2PSubTransportAction(git_smart_subtransport_stream **out, git_smart_subtransport *transport, const char *url, git_smart_service_t action)
Handles git actions.
int p2p_subtransport_cb(git_smart_subtransport **out, git_transport *owner, void *payload)
Setup the subtransport callback.
void P2PStreamFree(git_smart_subtransport_stream *stream)
Free resources used by the stream.
int P2PSubTransportNew(P2PSubTransport **out, git_transport *owner, void *payload)
Create a new subtransport.
int sendCmd(P2PStream *s)
Send a git command on the linked socket.
void P2PSubTransportFree(git_smart_subtransport *transport)
Free resources used by a transport.
int p2p_transport_cb(git_transport **out, git_remote *owner, void *param)
Setup the transport callback.
std::weak_ptr< dhtnet::ChannelSocket > socket
git_smart_subtransport_stream base
std::unique_ptr< P2PStream > stream
git_smart_subtransport base