SCTC
the soundcloud.com terminal client
Data Fields
network_conn Struct Reference

#include <network.h>

Collaboration diagram for network_conn:

Data Fields

void * mdata
 Pointer to data to be used by the implemention handling the actual connection. More...
 
bool(* send )(struct network_conn *nwc, char *buffer, size_t buffer_len)
 Send data (buffer_len Bytes) from buffer. More...
 
bool(* send_fmt )(struct network_conn *nwc, char *fmt,...)
 Send formatted data (string; see 'man 3 printf') More...
 
int(* recv )(struct network_conn *nwc, char *buffer, size_t buffer_len)
 Recv data (at max. buffer_len Bytes) into buffer. More...
 
int(* recv_byte )(struct network_conn *nwc)
 
char *(* get_error_str )(struct network_conn *nwc)
 
void(* disconnect )(struct network_conn *nwc)
 

Detailed Description

A struct containing all the information required to send/recv data from a remote server.
This struct is used to hide the actual implementation used for communication, such as a 'normal' TCP connection (see plain.c) or a encrypted TCP connection (see tls.c).

Conceptually only the functions supplied by network_conn may be used for communication. Directly calling a implementation-specific function, such as plain_send() / tls_send() is an error and might lead to an abort.

Field Documentation

void(* network_conn::disconnect) (struct network_conn *nwc)

Close the connection to the remote server a call to disconnect frees the nwc-struct, consequently it may no longer be accessed at all

char*(* network_conn::get_error_str) (struct network_conn *nwc)

Return a descriptive message for a previously error the returned value may NOT be freed as it is handled internally

void* network_conn::mdata

Pointer to data to be used by the implemention handling the actual connection.

int(* network_conn::recv) (struct network_conn *nwc, char *buffer, size_t buffer_len)

Recv data (at max. buffer_len Bytes) into buffer.

int(* network_conn::recv_byte) (struct network_conn *nwc)

Recv a single byte

bool(* network_conn::send) (struct network_conn *nwc, char *buffer, size_t buffer_len)

Send data (buffer_len Bytes) from buffer.

bool(* network_conn::send_fmt) (struct network_conn *nwc, char *fmt,...)

Send formatted data (string; see 'man 3 printf')


The documentation for this struct was generated from the following file: