Revision 55
added comments and fixed style a little bit
trunk/code/projects/colonet/ColonetServer/client.cpp | ||
---|---|---|
3 | 3 |
* @author Jason Knichel |
4 | 4 |
* @author Eugene Marinelli |
5 | 5 |
* |
6 |
* @TODO remove dependency on connection_pool |
|
6 | 7 |
* @bug Weird segfault when processing tokens |
7 | 8 |
*/ |
8 | 9 |
|
trunk/code/projects/colonet/ColonetServer/Logging.cpp | ||
---|---|---|
1 | 1 |
/** |
2 |
* @file Logging.cpp |
|
2 | 3 |
* |
3 |
* @author Jason Knichel |
|
4 |
* @brief This file contains the code to do logging for Colonet |
|
5 |
* |
|
6 |
* @author Jason Knichel |
|
4 | 7 |
* |
5 | 8 |
*/ |
6 | 9 |
|
... | ... | |
10 | 13 |
|
11 | 14 |
#include "includes/Logging.h" |
12 | 15 |
|
16 |
/** |
|
17 |
* @brief Constructor for the Log class |
|
18 |
* |
|
19 |
* @param filename The name of the file to output log statements to |
|
20 |
*/ |
|
13 | 21 |
Log::Log(char * filename) { |
14 | 22 |
printf("Creating log object\n"); |
15 | 23 |
|
... | ... | |
28 | 36 |
logMessage(LOG_TYPE_START_LOG, "Starting server"); |
29 | 37 |
} |
30 | 38 |
|
31 |
Log::~Log() |
|
32 |
{ |
|
39 |
/** |
|
40 |
* @brief Destructor for the Log class |
|
41 |
*/ |
|
42 |
Log::~Log() { |
|
33 | 43 |
if (!logFile) |
34 | 44 |
fclose(logFile); |
35 | 45 |
} |
36 | 46 |
|
37 |
struct tm Log::getCurrentTime() |
|
38 |
{ |
|
47 |
/** |
|
48 |
* @brief A function to get the current time |
|
49 |
* |
|
50 |
* @return A struct tm that represents the current time |
|
51 |
*/ |
|
52 |
struct tm Log::getCurrentTime() { |
|
39 | 53 |
struct tm currTime; |
40 | 54 |
memset(&currTime, 0, sizeof(struct tm)); |
41 | 55 |
|
... | ... | |
45 | 59 |
return currTime; |
46 | 60 |
} |
47 | 61 |
|
48 |
int Log::logMessage(int type, char * message) |
|
49 |
{ |
|
62 |
/** |
|
63 |
* @brief This method logs a message with the specified type |
|
64 |
* |
|
65 |
* @param type The type of the message to log |
|
66 |
* @param message The message to log |
|
67 |
* |
|
68 |
* @return 0 on success, negative error code on error |
|
69 |
*/ |
|
70 |
int Log::logMessage(int type, char * message) { |
|
50 | 71 |
if (!logFile) { |
51 | 72 |
fprintf(stderr, "Tried to log a message but the file pointer was null.\n"); |
52 | 73 |
return -1; |
trunk/code/projects/colonet/ColonetServer/ConnectionPool.cpp | ||
---|---|---|
447 | 447 |
return 0; |
448 | 448 |
} |
449 | 449 |
|
450 |
/** |
|
451 |
* @brief Breaks a command up into tokens |
|
452 |
* |
|
453 |
* @param command The command to tokenize |
|
454 |
* @param tokens A two dimensional character array to store the tokens in |
|
455 |
* |
|
456 |
* @return 0 on success, negative error code on failure |
|
457 |
*/ |
|
450 | 458 |
int ConnectionPool::tokenize_command(char* command, char tokens[MAX_TOKENS][MAX_TOKEN_SIZE]) { |
451 | 459 |
char* nextToken = command; |
452 | 460 |
char* endToken = NULL; |
... | ... | |
486 | 494 |
return numTokens; |
487 | 495 |
} |
488 | 496 |
|
489 |
/** @brief checks a list of tokens to see if it's valid |
|
497 |
/** |
|
498 |
* @brief checks a list of tokens to see if it's valid |
|
490 | 499 |
* |
500 |
* @param tokens The tokens to check |
|
501 |
* @param numTokens The number of tokens contained in the tokens parameter |
|
502 |
* |
|
491 | 503 |
* @return 0 if tokens is valid |
492 | 504 |
*/ |
493 | 505 |
int ConnectionPool::check_tokens(unsigned char* tokens, int numTokens) { |
trunk/code/projects/colonet/ColonetServer/ColonetServer.cpp | ||
---|---|---|
133 | 133 |
" Dropping the new connection.\n"); |
134 | 134 |
continue; |
135 | 135 |
} else { |
136 |
printf("\tThere was an error when attempting to accept a " |
|
137 |
"connection"); |
|
136 |
printf("\tThere was an error when attempting to accept a connection"); |
|
138 | 137 |
} |
139 | 138 |
continue; |
140 | 139 |
} |
trunk/code/projects/colonet/ColonetServer/options.c | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* @file options.c |
3 |
* |
|
3 | 4 |
* @brief Options for ColonetServer |
5 |
* |
|
4 | 6 |
* @author Eugene Marinelli |
7 |
* |
|
5 | 8 |
* @date 2/13/07 |
6 | 9 |
* |
7 | 10 |
* @bug Usage not written |
... | ... | |
18 | 21 |
|
19 | 22 |
ColonetServerOptionsT optionsG; |
20 | 23 |
|
21 |
static void printUsage() |
|
22 |
{ |
|
24 |
/** |
|
25 |
* @brief Prints the usage of the program |
|
26 |
*/ |
|
27 |
static void printUsage() { |
|
23 | 28 |
printf("USAGE:\n"); |
24 | 29 |
} |
25 | 30 |
|
26 |
void parseCmdLine(int argc, char** argv) |
|
27 |
{ |
|
31 |
/** |
|
32 |
* @brief Parses the command line arguments |
|
33 |
* |
|
34 |
* @param argc The number of arguments passed to the program |
|
35 |
* @param argv The arguments passed to the program |
|
36 |
* |
|
37 |
* @return Void |
|
38 |
*/ |
|
39 |
void parseCmdLine(int argc, char** argv) { |
|
28 | 40 |
int c; |
29 | 41 |
|
30 | 42 |
memset(&optionsG, 0, sizeof(ColonetServerOptionsT)); |
Also available in: Unified diff