Ring Daemon 16.0.0
Loading...
Searching...
No Matches
gittransport.h File Reference
Include dependency graph for gittransport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  P2PStream
 
struct  P2PSubTransport
 

Namespaces

namespace  dhtnet
 
namespace  jami
 

Functions

int generateRequest (git_buf *request, const std::string &cmd, const std::string_view &url)
 
int p2p_subtransport_cb (git_smart_subtransport **out, git_transport *owner, void *payload)
 Setup the subtransport callback.
 
int p2p_transport_cb (git_transport **out, git_remote *owner, void *param)
 Setup the transport callback.
 
void P2PStreamFree (git_smart_subtransport_stream *stream)
 Free resources used by the stream.
 
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 P2PSubTransportAction (git_smart_subtransport_stream **out, git_smart_subtransport *transport, const char *url, git_smart_service_t action)
 Handles git actions.
 
int P2PSubTransportClose (git_smart_subtransport *)
 Close a subtransport Because we use a channel socket, we need to do nothing here.
 
void P2PSubTransportFree (git_smart_subtransport *transport)
 Free resources used by a transport.
 
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.
 

Variables

constexpr auto HOST_TAG = "host="sv
 
constexpr auto UPLOAD_PACK_CMD = "git-upload-pack"sv
 

Function Documentation

◆ generateRequest()

int generateRequest ( git_buf *  request,
const std::string &  cmd,
const std::string_view &  url 
)

Definition at line 29 of file gittransport.cpp.

References HOST_TAG.

Referenced by sendCmd().

◆ p2p_subtransport_cb()

int p2p_subtransport_cb ( git_smart_subtransport **  out,
git_transport *  owner,
void *  payload 
)

Setup the subtransport callback.

Parameters
outSubtransport created
ownerTransport owning the sub transport
paramThe remote
0on success

Definition at line 238 of file gittransport.cpp.

References P2PSubTransport::base, and P2PSubTransportNew().

Referenced by p2p_transport_cb().

Here is the call graph for this function:

◆ p2p_transport_cb()

int p2p_transport_cb ( git_transport **  out,
git_remote *  owner,
void *  param 
)

Setup the transport callback.

Parameters
outTransport created
ownerRemote wanted
0on success

Definition at line 250 of file gittransport.cpp.

References p2p_subtransport_cb().

Referenced by jami::Manager::init().

Here is the call graph for this function:

◆ P2PStreamFree()

void P2PStreamFree ( git_smart_subtransport_stream *  stream)

Free resources used by the stream.

Definition at line 135 of file gittransport.cpp.

Referenced by P2PSubTransportAction().

◆ P2PStreamRead()

int P2PStreamRead ( git_smart_subtransport_stream *  stream,
char *  buffer,
size_t  buflen,
size_t *  read 
)

Read on a channel socket.

Parameters
streamRelated stream
bufferBuffer to fill
buflenMaximum buffer size
readNumber of bytes read
Returns
0 on success

Definition at line 91 of file gittransport.cpp.

References sendCmd(), and P2PStream::socket.

Referenced by P2PSubTransportAction().

Here is the call graph for this function:

◆ P2PStreamWrite()

int P2PStreamWrite ( git_smart_subtransport_stream *  stream,
const char *  buffer,
size_t  len 
)

Definition at line 117 of file gittransport.cpp.

References P2PStream::socket.

Referenced by P2PSubTransportAction().

◆ P2PSubTransportAction()

int P2PSubTransportAction ( git_smart_subtransport_stream **  out,
git_smart_subtransport *  transport,
const char *  url,
git_smart_service_t  action 
)

Handles git actions.

Parameters
outSubtransport's stream created or used by the action
transportSubtransport created or used by the action
url'deviceId/conversationId'
actionAction to perform
Returns
0 on success

Definition at line 139 of file gittransport.cpp.

References jami::Manager::gitSocket(), jami::Manager::instance(), JAMI_ERROR, P2PStreamFree(), P2PStreamRead(), P2PStreamWrite(), and UPLOAD_PACK_CMD.

Referenced by P2PSubTransportNew().

Here is the call graph for this function:

◆ P2PSubTransportClose()

int P2PSubTransportClose ( git_smart_subtransport *  )

Close a subtransport Because we use a channel socket, we need to do nothing here.

Will be shutdown by the rest of the code

Definition at line 212 of file gittransport.cpp.

Referenced by P2PSubTransportNew().

◆ P2PSubTransportFree()

void P2PSubTransportFree ( git_smart_subtransport *  transport)

Free resources used by a transport.

Parameters
transportTransport to free

Definition at line 218 of file gittransport.cpp.

References jami::Manager::eraseGitTransport(), and jami::Manager::instance().

Referenced by P2PSubTransportNew().

Here is the call graph for this function:

◆ P2PSubTransportNew()

int P2PSubTransportNew ( P2PSubTransport **  out,
git_transport *  owner,
void *  payload 
)

Create a new subtransport.

Parameters
outThe new subtransport
ownerThe transport owning this subtransport
payloadThe remote
Returns
0 on success

Definition at line 224 of file gittransport.cpp.

References jami::Manager::insertGitTransport(), jami::Manager::instance(), P2PSubTransportAction(), P2PSubTransportClose(), and P2PSubTransportFree().

Referenced by p2p_subtransport_cb().

Here is the call graph for this function:

◆ sendCmd()

int sendCmd ( P2PStream s)

Send a git command on the linked socket.

Parameters
sRelated stream
Returns
0 on success

Definition at line 64 of file gittransport.cpp.

References P2PStream::cmd, generateRequest(), P2PStream::sent_command, P2PStream::socket, and P2PStream::url.

Referenced by P2PStreamRead().

Here is the call graph for this function:

Variable Documentation

◆ HOST_TAG

constexpr auto HOST_TAG = "host="sv
constexpr

Definition at line 57 of file gittransport.h.

Referenced by generateRequest().

◆ UPLOAD_PACK_CMD

constexpr auto UPLOAD_PACK_CMD = "git-upload-pack"sv
constexpr

Definition at line 56 of file gittransport.h.

Referenced by P2PSubTransportAction(), and jami::GitServer::Impl::parseOrder().