FOSSology  4.4.0
Open Source License Compliance by Open Source Software
fo_cli.c File Reference

CLI interface for scheduler. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <libfossology.h>
#include <glib.h>
Include dependency graph for fo_cli.c:

Go to the source code of this file.

Macros

#define P_WIDTH   27
 
#define F_WIDTH   10
 
#define vprintf(...)   if(verbose) printf(__VA_ARGS__);
 

Functions

int socket_connect (char *host, char *port)
 Create a socket connection. More...
 
uint8_t receive (int s, char *buffer, size_t max, uint8_t end)
 Performs the actions necessary to receive from the scheduler. More...
 
void interface_usage ()
 Interface usage print. More...
 
int main (int argc, char **argv)
 

Variables

int response = 1
 Is a response expected from the scheduler.
 
int s
 The socket that the CLI will use to communicate.
 
int verbose
 The verbose flag for the cli.
 
fo_confconf
 The loaded configuration data.
 

Detailed Description

CLI interface for scheduler.

Definition in file fo_cli.c.

Function Documentation

◆ interface_usage()

void interface_usage ( )

Interface usage print.

Prints the usage message for the interface on stdout.

Definition at line 162 of file fo_cli.c.

◆ receive()

uint8_t receive ( int  s,
char *  buffer,
size_t  max,
uint8_t  end 
)

Performs the actions necessary to receive from the scheduler.

Parameters
sthe socket that is connected to the scheduler
bufferbuffer that is used to store messages from the scheduler
maxthe capacity of the buffer
endused to determine when this function should return
Returns

Definition at line 102 of file fo_cli.c.

◆ socket_connect()

int socket_connect ( char *  host,
char *  port 
)

Create a socket connection.

Creates a new socket that connects to the given host and port.

Parameters
hostCstring name of the host to connect to
portCstring representation of the port to connect to
Returns
The file descriptor of the new socket

Definition at line 54 of file fo_cli.c.