diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 16:12:37 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 16:12:37 +0100 |
| commit | a659f7d045f9107dbb41d7bbf0694cc7a5c7a589 (patch) | |
| tree | 9fb891d7e3874811a090a8a846856a04622b80a9 /src/net | |
| parent | c7181ee943069bde7f5d468d11ee63c3a535980d (diff) | |
| parent | 80eead4f5ab998a0e6b678f8c1c0fcd969d6b07c (diff) | |
Merge branch 'master' of ssh://icarus-git/~git/oxen
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 335cea6..c45c796 100644 --- a/src/net/server.c +++ b/src/net/server.c @@ -25,7 +25,7 @@ int socket_for_player_id(const socket_list_t *client_socks, const player_id_t pi } /** - * 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 */ @@ -89,7 +89,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 @@ -118,9 +118,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) { @@ -141,6 +141,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); @@ -152,6 +157,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); @@ -165,6 +175,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; |
