warden.h 1013 Bytes
/* File Name: warden.h
 * Version: 0.1
 * Author: Brodey Dover
 * Date: April 9, 2016
 */

/* standard header files */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

/* constant definitions */
#define ERROR_FATAL_NOMEMORY -2
#define ERROR_UNABLETOGETPID -1
#define ERROR_OPENING_FILE -3
#define ERROR_UNABLETOGETVERSION -6
#define ERROR_UNABLETOGETPORT -7
#define ERROR_UNABLETODETERMINE_STATUS -8
#define SERVER_NOT_STARTED -4
#define SERVER_STARTED 0
#define READ_LOG_FAIL -5
#define	SMALL_BUFFER 60
#define LINE_BUFFER 512

/* structures */
typedef struct Log {
	char  **logBuffer;
	int maxLineLength;
	int numberOfLines;
} log; 

/* function declarations */
void cleanup(struct Log *log);
int getServerPID();
int getServerPort(struct Log *log);
int getServerStatus(struct Log *log);
float getServerVersion(struct Log *log);
int readLogFile(char *fileName, struct Log *log);
int startServer();
int printBuffer(struct Log *log); /* helps with debugging the log file buffer. */