Ext
 All Files Functions
Functions
net_utils.h File Reference
#include "commands.h"
#include "utils.h"

Go to the source code of this file.

Functions

void parse_address (const char *address, char **host, long *port)
 
int make_connection (const char *address)
 
void close_connection (int sockd)
 
bool send_command (int sockd, enum Command command)
 
bool send_data (int sockd, char *data, size_t size)
 
bool receive_command (int sockd, enum Command *command)
 
bool receive_data (int sockd, char **data, size_t *size)
 

Detailed Description

Author
yaishenka
Date
25.04.2021

Definition in file net_utils.h.

Function Documentation

void close_connection ( int  sockd)

Close connection

Parameters
sockd

Definition at line 60 of file net_utils.c.

int make_connection ( const char *  address)

Establish connection with address

Parameters
address
Returns
socket

Definition at line 27 of file net_utils.c.

void parse_address ( const char *  address,
char **  host,
long *  port 
)

Split address to port and host

Parameters
address
host
port
Author
yaishenka
Date
25.04.2021

Definition at line 11 of file net_utils.c.

bool receive_command ( int  sockd,
enum Command *  command 
)

Receive command from fd

Parameters
fd
command
Returns
true if all ok and false otherwise

Definition at line 84 of file net_utils.c.

bool receive_data ( int  sockd,
char **  data,
size_t *  size 
)

Receive data from socket. Write data to data and size to size

Parameters
sockd
data
size
Returns
true if all ok and false otherwise

Definition at line 94 of file net_utils.c.

bool send_command ( int  sockd,
enum Command  command 
)

Send command from Command enum to socket

Parameters
sockd
command

Definition at line 64 of file net_utils.c.

bool send_data ( int  sockd,
char *  data,
size_t  size 
)

Send data to socket

Parameters
sockd
data
size

Definition at line 75 of file net_utils.c.