34 lines
826 B
C
34 lines
826 B
C
/**
|
|
* @brief Declarations used by the server application.
|
|
**/
|
|
|
|
#ifndef _SERVE_H_
|
|
#define _SERVE_H_
|
|
|
|
#include <stdio.h>
|
|
|
|
#define USE_DEMO 0x01
|
|
|
|
#define MAX_ARGUMENT_LEN 1024
|
|
|
|
/** Structure for the arguments. */
|
|
struct arguments {
|
|
const char *port_str;
|
|
const char *command;
|
|
};
|
|
|
|
void parse_arguments(int argc, char *argv[], struct arguments *args);
|
|
void free_resources(void);
|
|
|
|
// forward declaration of student functions.
|
|
int setup_connection(const char *port_str);
|
|
void server_request_handler(int sockfd, const char *command);
|
|
FILE *execute_command(const char *command, const char *argument);
|
|
|
|
// demo solutions
|
|
int DEMO_setup_connection(const char *port_str);
|
|
void DEMO_server_request_handler(int sockfd, const char *command, int flags);
|
|
FILE *DEMO_execute_command(const char *command, const char *argument);
|
|
|
|
#endif
|