diff options
| author | Mario Kilies <MarioKilies@GMX.net> | 2011-01-25 16:08:46 +0100 |
|---|---|---|
| committer | Mario Kilies <MarioKilies@GMX.net> | 2011-01-25 16:08:46 +0100 |
| commit | 80eead4f5ab998a0e6b678f8c1c0fcd969d6b07c (patch) | |
| tree | 80e029a86b73da1a8d91eff47baadb057cf16335 /src/net | |
| parent | 9780e8c24b45cfb47085d77ae64ba1f91d31419e (diff) | |
Added documentation.
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/server.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/net/server.c b/src/net/server.c index 7e9a111..54601ed 100644 --- a/src/net/server.c +++ b/src/net/server.c @@ -10,7 +10,7 @@ #include "../data_store.h" /** - * Server side function; start server on specified port + * Starts the server. The server will listen on a specified port. * @param[in] port Port on which server should listen * @return Listening socket */ @@ -74,7 +74,7 @@ int server_start(const char* port) } /** - * Server side function; accepts connections from clients + * Waits for and accepts connections from clients. Each client connection is represented by a socket that will be stored in a list for further communication. * @param[in] serversock Socket on which server is listening * @param[out] client_socks Socket list in which to store open client connections * @param[in] count Number of clients that should connect @@ -103,9 +103,9 @@ void server_get_players(int serversock, socket_list_t* client_socks, const uint8 } /** - * Server side function; receive hello message from client and read username - * @param[in] sock Socket to use - * @return Username of client + * Parses hello message from client and store username in the global data store. + * @param[in] msg The message to parse + * @return true */ bool server_parse_hello(const msg_t *m) { @@ -126,6 +126,11 @@ bool server_parse_hello(const msg_t *m) return true; } +/** + * Parses open card message from client and stores the selected card in the global data store. + * @param[in] msg The message to parse + * @return true + */ bool server_parse_selected_card(const msg_t *m) { assert(m != NULL); @@ -137,6 +142,11 @@ bool server_parse_selected_card(const msg_t *m) return true; } +/** + * Parses selected stack message from client and stores the stack index in the global data store. + * @param[in] msg The message to parse + * @return true + */ bool server_parse_selected_stack(const msg_t *m) { assert(m != NULL); @@ -150,6 +160,10 @@ bool server_parse_selected_stack(const msg_t *m) return true; } +/** + * Prepares start game message. All player IDs, player names and name lengths will be saved in the message payload. + * @param[out] msg A preallocated message object to store header and payload information + */ void server_prep_start_game(msg_t *m) { uint16_t pos = 0; |
