1 2005-12-08 Carl Worth <cworth@cworth.org>
3 * src/Makefile.am: Fix rule to auto-generate ttt-lex.h.
5 * src/ttt-lex.h: Remove generated file from revision control.
7 * src/ttt-lex.l: Add copyright/license blurb.
10 * src/ttt-client.c: (yy_init_globals), (use_yy_init_globals):
11 Shut off some annoying compiler warnings due to flex bugs (only
14 2005-12-07 Richard D. Worth <richard@theworths.org>
16 * PROTOCOL: Remove unused error NOT_IN_GAME. Add error
19 * TODO: Add error NOT_VALID_MOVE.
22 * src/ttt-error.c: (ttt_error_string): Add section comments. Add
25 2005-12-06 Bryan Worth <bryan@theworths.org>
26 * src/ttt-error.c: fixed missing errors (NO_INVITE, NO_GAME)
28 2005-12-06 Richard D. Worth <richard@theworths.org>
30 * PROTOCOL: Add error NO_INVITE
32 * TODO: Uncheck INVITE, ACCEPT
34 * src/ttt-error.c: (ttt_error_string): Add errors NO_INVITE,
37 * src/ttt-client.c: (_ttt_client_execute_message),
38 (_ttt_client_execute_help), (_ttt_client_execute_version),
39 (_ttt_client_execute_invite), (_ttt_client_execute_accept),
40 (_ttt_client_execute_retract), (_ttt_client_execute_decline):
41 Whitespace changes. Partially implement RETRACT, DECLINE.
43 2005-12-05 Richard D. Worth <richard@theworths.org>
45 * PROTOCOL: Fill some missing possible error occurrences.
47 * TODO: Check off INVITE, ACCEPT, ERROR COMMAND, ERROR NO_USER
50 * src/ttt-server.c: (ttt_server_verify_username):
51 * src/ttt-client.c: (_ttt_client_execute_help),
52 (_ttt_client_execute_invite), (_ttt_client_execute_accept):
53 Implement INVITE, ACCEPT
55 2005-12-05 Richard D. Worth <richard@theworths.org>
57 * src/ttt-curses-client.c: (mvprintstr), (mvwprintstr), (wprint),
58 (main), (finish): Whitespace changes.
60 2005-12-04 Bryan Worth <bryan@theworths.org>
61 * src/ttt-socket.c: (ttt_socket_create_client) fixed socket to be
62 non-blocking. (ttt_socket_read) added return value for number
64 * Makefile.am: added necessary code for new curses-client program.
65 * src/ttt-curses-client: new ncurses based client
67 2005-12-03 Richard D. Worth <richard@theworths.org>
69 * PROTOCOL: Add RETRACT, DECLINE. Add game identifier for all game
72 * TODO: Add RETRACT, DECLINE, notices.
74 2005-12-03 Richard D. Worth <richard@theworths.org>
76 * PROTOCOL: Add underscores to error codes. Add STATISTICS
77 command. Remove statistics from WHO.
79 * TODO: Add STATISTICS. Check off STATISTICS.
81 * src/ttt.h: Define TTT_SERVER_PROTOCOL_VERSION for VERSION.
83 * src/ttt-error.c: (ttt_error_string): Add underscores to error
87 * src/ttt-client.c: (_ttt_client_execute_helo),
88 (_ttt_client_execute_statistics), (_ttt_client_execute_message),
89 (_ttt_client_execute_version), (_ttt_client_execute_quit),
90 (_ttt_client_init), (_ttt_client_fini), (ttt_client_get_username),
91 (ttt_client_set_username): Rename client->name to
92 client->username. Implement STATISTICS. Complete implementation of
96 * src/ttt-server.c: (ttt_server_register_client),
97 (ttt_server_unregister_client), (ttt_server_who),
98 (ttt_server_statistics): Track rename of client->name to
99 client->username. Add server helper for STATISTICS.
101 2005-12-02 Richard D. Worth <richard@theworths.org>
103 * TODO: Check off Global commands, HELP, VERSION.
105 * src/ttt-client.c: (_ttt_client_execute_message),
106 (_ttt_client_execute_help), (_execute_request): Whitespace
107 changes. Implement HELP with usage and short description.
109 * src/ttt-server.c: Update the server welcome message.
111 2005-12-01 Richard D. Worth <richard@theworths.org>
113 * TODO: Check off NOTICE MESSAGE, ERROR NONAMESET.
115 * PROTOCOL: Add NONAMESET error in possible errors where
116 applicable. Add description for MESSAGE.
118 * src/ttt-token.h: Add token typedef. Rename token type enum.
120 * src/ttt-lex.l: Add support for quoted string as single token.
121 * src/ttt-lex.h: Autogenerated.
123 * src/ttt-client.c: (_ttt_client_execute_helo),
124 (_ttt_client_execute_who), (_ttt_client_execute_message),
125 (_ttt_client_execute_help), (_ttt_client_execute_version),
126 (_ttt_client_execute_quit), (_ttt_client_init), (_read_request),
127 (_execute_request): Whitespace changes. Implement VERSION,
128 HELP. Change args_required back to args_min and args_max (see
129 PROTOCOL\HELP). Modify MESSAGE to accept one token arg and quote
130 output. Return NONAMESET error where applicable.
132 2005-11-29 Carl Worth <cworth@cworth.org>
135 * src/ttt-socket.c: (ttt_socket_create_client): New function for
136 creating a client socket.
139 * src/x.c: (xconnect): Add xconnect. Return a couple of useful
140 error status values so that callers can recover on connection
141 refused or host unreachable.
143 * src/ttt.h: Add TTT_STATUS_CONNECTION_REFUSED and
144 TTT_STATUS_NETWORK_UNREACHABLE.
146 2005-11-28 Kevin Worth <kevin@theworths.org>
148 * PROTOCOL: Changed board cell numbering to start with zero
152 * src/test-board.c: (main): Added new file for testing.
154 * src/ttt-board.c: (ttt_board_init), (ttt_board_to_string):
155 * src/ttt-board.h: Implemented board_to_string.
157 2005-11-28 kevin worth <kevin@theworths.org>
160 * src/ttt-board.h: Moved struct def from ttt-board.h into
161 ttt-board.c to make it private
166 2005-11-28 Carl Worth <cworth@cworth.org>
168 * TODO: Add instructions on using the first letter of our names to
169 indicate we are working on something.
171 2005-11-25 Bryan Worth <bryan@theworths.org>
172 * ttt-client.c, ttt-server.c, ttt-error.c changed line breaks to
173 <crlf> (\r\n) for network compatibility
175 2005-11-25 Bryan Worth <bryan@theworths.org>
176 * TODO: checked off NOTICE USER and NOTICE QUIT
177 *src/ttt-client.c: (_ttt_client_execute_helo): implement NOTICE USER
178 *(_ttt_client_execute_quit): implement NOTICE QUIT
180 2005-11-25 Bryan Worth <bryan@theworths.org>
181 * TODO: checked off MESSAGE
183 *src/ttt-client.c: (_ttt_client_execute_message): Implement MESSAGE
184 *(_execute_request): changed arg_required to behave as a minimum
185 instead of an absolute number to allow optional arguments such as
188 2005-11-25 Richard D. Worth <richard@theworths.org>
190 * TODO: checked off WHO, QUIT, ERROR SYNTAX
192 * src/ttt-client.c: (_ttt_client_execute_helo), (_ttt_client_init),
193 (ttt_client_get_num_wins):
195 * src/ttt-server.c: (ttt_server_who): Whitespace changes. Add
196 missing player win count for WHO.
198 2005-11-24 Richard D. Worth <richard@theworths.org>
200 * AUTHORS: Add Richard D. Worth
201 * TODO: Add newline before EOF
203 * src/ttt-client.c: (_ttt_client_execute_who):
205 * src/ttt-server.c: (ttt_server_who): Implement WHO.
207 2005-11-24 Carl Worth <cworth@cworth.org>
209 * PROTOCOL: Document QUIT.
211 * src/ttt-client.c: (_ttt_client_execute_helo),
212 (_ttt_client_execute_quit), (_ttt_client_init), (_ttt_client_fini),
213 (_execute_request), (_handle_requests_thread): Implement QUIT. Add
214 client->registered flag and unregister only if registered. Change
215 from args_min and args_max to args_required.
218 * src/ttt-error.c: (ttt_error_string):
219 * src/ttt-server.c: (ttt_server_register_client): Put underscores
220 in TTT_ERRROR names for better readability.
222 2005-11-24 Carl Worth <cworth@cworth.org>
225 * src/ttt-server.c: (ttt_server_init),
226 (ttt_server_register_client): Remove unique-name generation from
227 the server. The client is going to have to have code to do this
230 * src/ttt-client.c: Change minimum arguments for HELO from 0 to 1.
232 * TODO: Note that HELO and ERROR INVALIDNAME are implemented in
235 2005-11-23 Richard D. Worth <richard@theworths.org>
237 * PROTOCOL: Remove unused servername
239 * src/ttt-client.h: * src/ttt-client.c:
240 (_ttt_client_execute_helo), (_ttt_client_init),
241 (_ttt_client_fini), (_execute_request), (ttt_client_get_name),
242 (ttt_client_set_name): Added command descriptions structure. Match
243 command case-insensitively, dispatch to execute
244 function. Implement HELO command. Register on HELO instead of on
247 * src/ttt-server.h: * src/ttt-server.c: (ttt_server_init),
248 (ttt_server_register_client), (ttt_server_unregister_client),
249 (ttt_server_get_host), (ttt_server_get_port), (main): Added host
250 and port to server. Make client registration name-based rather
253 * src/x.c: (xstrdup): Return NULL on NULL
255 * src/ttt-lex.h: Regenerated
257 2005-11-22 Carl Worth <cworth@cworth.org>
259 * TODO: Add TODO file listing all the stuff from the protocol that
260 needs to be implemented.
267 * src/ttt-token.h: Add support for a flex-based tokenizer which
268 tokenizes newlines and space-separated strings.
270 * src/ttt-client.c: (_ttt_client_init), (_ttt_client_fini),
271 (_append_to_request), (_free_request), (_read_request),
272 (_execute_request): Use new tokenizer to tokenize input into an
273 array of request strings.
275 2005-11-15 Carl Worth <cworth@cworth.org>
279 * src/ttt-error.c: (ttt_error_string): Add error values and error
280 strings from protocol.
282 * src/ttt.h: Add typedefs for ttt_client_t and ttt_server_t so
283 that there's no problem with ttt-client.h and ttt-server.h needing
284 to mutually include each other.
287 * src/ttt-server.c: (ttt_server_register_client),
288 (ttt_server_unregister_client), (_ttt_server_accept), (main): Push
289 the client request handling thread back down into ttt-client.c
290 where it really does belong. The server code no longer ever
291 reaches down inside the ttt_client_t structure. Export
292 ttt_server_register_client and ttt_server_unregister_client. Add
293 documentation for ttt_server_broadcast. Document locking semantics
294 for all functions which acquire the server lock.
297 * src/ttt-client.c: (_ttt_client_create), (_ttt_client_destroy),
298 (_read_into_request_until), (_read_request), (_execute_request),
299 (_handle_requests_thread), (ttt_client_new), (ttt_client_get_id):
300 Pull the ttt_client structure definition back down inside the
301 ttt-client.c file. Don't export ttt_client_create and
302 ttt_client_destroy anymore, but instead just use static
303 _ttt_client_init and _ttt_client_fini. Implement the broadcast by
304 just passing a client pointer around and using client->request
305 rather than passing char *request all over. Document new
306 ttt_client_new and remove ttt_client_read_line. Add locking to
307 ttt_client_send and document it. Add ttt_client_get_id.
309 2005-11-14 Carl Worth <cworth@cworth.org>
311 Server now acts as a very simple chat server.
314 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
315 (_append_to_request), (ttt_client_read_into_request_until),
316 (ttt_client_read_line), (ttt_client_send): Add support to do a
317 buffering read within the client and to reuse the buffer (which
318 grows by doubling) from one request to the next. Add function to
319 send a message to a client.
321 * src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
322 Add support for a client idea. Resize the server's client list by
324 * src/ttt-server.c: (ttt_server_destroy_client): Add support to
326 * src/ttt-server.c: (_handle_client_requests_thread),
327 (_accept_client): Move handling of client requests up to
328 ttt-server.c from ttt-client.c. Use threads rather than a fork per
331 * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
332 message to all connected clients.
335 * src/ttt-socket.c: (ttt_socket_read),
336 (ttt_socket_write): Add functions to do blocking read or write of
337 the specified number of bytes.
339 * src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
340 accept function call can take care of anything like that itself.
343 * src/x.c: (xread), (xwrite): New wrappers for read and write.
345 * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
347 * src/ttt.c: Need to include ttt-args.h explicitly now.
349 2005-11-11 Carl Worth <cworth@cworth.org>
352 * src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
353 (_accept_client), (main): Add a new ttt_server_t object with a
354 mutex-protected list of clients. Move client handling code down
355 into new ttt-client.c.
358 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
359 (ttt_client_handle_requests): New ttt_client_t object that simply
360 holds a pointer back to the server as well as the client socket
364 * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
365 a call to fork before calling the accept callback.
367 * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
368 keep it from complaining.
370 * src/ttt.c: (main): Rename the client main program from
371 ttt-client to ttt.c, (since the server code now has its own
375 * src/Makefile.am: Include and link with pthread now that we have
376 pthread-based mutex locking.
378 2005-11-11 Carl Worth <cworth@pippin.local>
380 * src/ttt-server.c: (main): Don't assign to stderr which is
381 apparently an invalid lvalue on Mac OS X.
384 * src/x.c: (xfreopen): Change return type to void.
386 * src/ttt-board.c: (ttt_board_to_string): Add missing return
389 2005-11-11 Carl Worth <cworth@cworth.org>
391 * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
394 2005-11-11 Carl Worth <cworth@cworth.org>
398 * src/x.h: Move include of stdarg.h from x.c to ttt.h.
400 2005-11-11 Carl Worth <cworth@cworth.org>
402 * src/ttt-board.h: Include ttt.h to get standard includes.
404 * src/ttt-socket.c: Replace include of netinet/ip.h with
405 netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
408 2005-11-09 Carl Worth <cworth@cworth.org>
412 * src/ttt-server.c: (ttt_dispatch), (main):
414 * src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
415 (ttt_socket_create_server), (ttt_socket_accept): Push a lot of
416 code out of ttt-server.c down into a new ttt_socket abstraction
417 layer. The code is much easier to read now. The server also no
418 longer exits when the first client exits, but continues to listen
419 for more connections.
421 2005-11-09 Carl Worth <cworth@cworth.org>
424 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
425 for -h,--host, -p,--port, and --log-file command-line arguments.
427 * src/ttt-server.c: (main): Use host, port, and log-file
428 command-line arguments.
430 * src/ttt-client.c: (main): Track change in signature of
434 * src/x.c: (xfdopen), (xfreopen): More wrappers.
436 2005-11-08 Carl Worth <cworth@cworth.org>
439 * src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
440 (main): Add socket, bind, listen, accept calls to provide a
441 simple, functional, one-shot server demonstration.
444 * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
445 more wrapped system calls.
447 2005-11-07 Carl Worth <cworth@cworth.org>
449 * src/ttt.h: Grab some useful definitions from wdo.h:
450 ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
453 * src/Makefile.am: Rip out not-yet existing ttt-command and
456 * src/ttt-args.c: (ttt_args_parse): Track name change from
457 args_help to ttt_args_help.
459 * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
461 * src/x.h: Add prototype for xfwrite.
463 2005-11-05 Richard D. Worth <richard@theworths.org>
465 * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
466 * src/ttt-board.h: Added prototypes.
468 2005-11-05 Richard D. Worth <richard@theworths.org>
470 * src/args.c: Renamed ttt-args.c
471 * src/args.h: Renamed ttt-args.h
472 * src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
473 (ttt_args_parse): Added ttt_ prefix.
474 * src/ttt-args.h: Added ttt_, TTT_ prefix.
476 2005-11-05 Kevin Worth <kevin@cworth.org>
478 * src/ttt-board.c: (ttt_board_init): Implemented board_init.
479 * src/ttt-board.h: (ttt_board_t): Added cells array.
481 2005-11-05 Carl Worth <cworth@cworth.org>
483 * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
486 * src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
487 (ttt_board_to_string), (ttt_board_write): Add some stub functions
488 for Richard and Kevin to have some practice
489 implementing. Functions to represent a board and to go to/from a
493 * src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
494 (xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
495 utility functions that make system calls, check the result, and
496 exit on any error. This will simplify the error checking needed in
497 programs using these functions.
499 2005-11-05 Carl Worth <cworth@cworth.org>
501 * src/Makefile.am: Break things up for separate ttt-client and
502 ttt-server and programs.