Skip to content

File syn_transport_tcp.c

FileList > net > syn_transport_tcp.c

Go to the source code of this file

Bridge for syn_transport over a TCP socket.

  • #include "../util/syn_assert.h"
  • #include "syn_transport_tcp.h"
  • #include <string.h>

Public Functions

Type Name
void syn_transport_tcp_init (SYN_Transport * t, SYN_TransportTcp * tcp, SYN_Socket sock)
Initialize a TCP transport bridge.

Public Static Functions

Type Name
bool tcp_recv (uint8_t * data, size_t max_len, size_t * out_len, void * ctx)
TCP transport receive callback — length-prefixed framing.
bool tcp_send (const uint8_t * data, size_t len, void * ctx)
TCP transport send callback — length-prefixed framing.

Public Functions Documentation

function syn_transport_tcp_init

Initialize a TCP transport bridge.

void syn_transport_tcp_init (
    SYN_Transport * t,
    SYN_TransportTcp * tcp,
    SYN_Socket sock
) 

Configures the transport interface vtable with the socket-specific operations.

Parameters:

  • t Pointer to the parent transport structure to configure.
  • tcp Pointer to the TCP transport context structure to associate.
  • sock Connected TCP socket to bind to this transport.

Public Static Functions Documentation

function tcp_recv

TCP transport receive callback — length-prefixed framing.

static bool tcp_recv (
    uint8_t * data,
    size_t max_len,
    size_t * out_len,
    void * ctx
) 

Parameters:

  • data [out] Buffer for received data.
  • max_len Buffer capacity.
  • out_len [out] Received length.
  • ctx Transport context (SYN_TransportTcp *).

Returns:

true if a complete packet was received.


function tcp_send

TCP transport send callback — length-prefixed framing.

static bool tcp_send (
    const uint8_t * data,
    size_t len,
    void * ctx
) 

Parameters:

  • data Packet data.
  • len Packet length.
  • ctx Transport context (SYN_TransportTcp *).

Returns:

true if sent.



The documentation for this class was generated from the following file src/syntropic/net/syn_transport_tcp.c