1 2005-12-14 Carl Worth <cworth@cworth.org>
3 * src/ttt-server.h: Update the documentation of these functions to
4 be more precise about what happens to client mutexes.
6 * src/ttt-board.c: (ttt_board_is_won):
8 2005-12-13 Bryan Worth <bryan@theworths.org>
9 * src/ttt-curses-client: Cleaned up text-entry code. Added support
10 for HOME, END, DELETE, and ARROW keys
13 2005-12-13 Carl Worth <cworth@cworth.org>
15 * TODO: Note that ttt-server should retry a couple times if its
16 port is not available.
18 * src/test-board.c: (main): Remove debug print messages.
20 * src/ttt-board.c: (ttt_board_make_move): Tighten up the code just
23 2005-12-10 Richard D. Worth <richard@theworths.org>
25 * TODO: check off INVITE, RETRACT, DECLINE, Game Invitation
26 notices, Connection setup errors, NO_INVITE, User information
29 * src/ttt-client.c: (_ttt_client_execute_helo),
30 (_ttt_client_execute_statistics), (_ttt_client_execute_message),
31 (_ttt_client_execute_help), (_ttt_client_execute_version),
32 (_ttt_client_execute_quit), (_ttt_client_execute_invite),
33 (_ttt_client_execute_accept), (_ttt_client_execute_retract),
34 (_ttt_client_execute_decline), (_read_request),
36 (_handle_requests_thread): Whitespace changes. Use exported get
37 methods (get_username, get_num_wins). Use strcasecmp in place of
38 toupper. Finish RETRACT, DECLINE.
42 * src/ttt-server.c: (ttt_server_init),
43 (ttt_server_register_client), (ttt_server_unregister_client),
44 (ttt_server_verify_username),
45 (ttt_server_get_client_from_username), (ttt_server_add_invite),
46 (ttt_server_remove_invite): Add invite struct. Make username case
47 insensitive (missed in register_client). Implement add_invite,
48 remove_invite. Moved statistics to ttt-client.c
50 2005-12-09 Carl Worth <cworth@cworth.org>
52 * src/ttt-server.c (ttt_server_unregister_client): Move client has
53 left message to stderr so it makes it to the log file too.
55 2005-12-09 Carl Worth <cworth@cworth.org>
57 * src/ttt-server.c (main): Put the initial server started message
58 in the log file as well.
60 2005-12-09 Carl Worth <cworth@cworth.org>
63 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add a -u,
64 --user option for controlling the uid under which the server
68 * src/ttt-server.c: (ttt_server_register_client), (main): Recert
69 the dup of stdout which wasn't working. Instead just print client
70 join information on stderr so that it goes into the log. Implement
71 support for the user option by calling setuid to drop root
72 privileges the process might start out with.
74 2005-12-09 Bryan Worth <bryan@theworths.org>
75 * src/ttt-curses-client.c: added error checking to ttt_create_client
76 call. Added ability to escape server commands by prepending with "/".
77 Added ability so override port number with port=xxxx entry in
80 2005-12-08 Carl Worth <cworth@cworth.org>
82 * src/ttt-server.c (main): When detached dup stdout to stderr so
83 that everything appears in the log file.
85 2005-12-08 Carl Worth <cworth@cworth.org>
88 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add
89 -d,--detach and --pid-file=FILE options for running the server as
92 * src/ttt-server.c: (ttt_server_statistics),
93 (ttt_server_verify_username), (_detach_and_write_child_pid_to),
94 (main): Add support for detaching and writing out the child PID to
98 * src/x.c: (xfopen), (xdup2): Two new x-functions.
100 2005-12-08 Carl Worth <cworth@cworth.org>
102 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse):
104 * src/ttt-server.c: (ttt_server_statistics),
105 (ttt_server_verify_username), (_detach_and_write_child_pid_to),
107 * src/x.c: (xfopen), (xdup2):
110 2005-12-08 Bryan Worth <bryan@theworths.org>
111 * src/ttt-curses-client.c: Multiple improvements!
112 Username taken from USER environment variable and stored as
113 preference in ~/.ttt/client.conf (username=xxxxxx). Backspace
114 should now work correctly with all term types. Status messages
115 display in seperate area. "MESSAGE" reply from server is
116 suppressed. Eliminated most global variables.
119 2005-12-08 Carl Worth <cworth@cworth.org>
121 * src/Makefile.am: Fix rule to auto-generate ttt-lex.h.
123 * src/ttt-lex.h: Remove generated file from revision control.
125 * src/ttt-lex.l: Add copyright/license blurb.
128 * src/ttt-client.c: (yy_init_globals), (use_yy_init_globals):
129 Shut off some annoying compiler warnings due to flex bugs (only
132 2005-12-07 Richard D. Worth <richard@theworths.org>
134 * PROTOCOL: Remove unused error NOT_IN_GAME. Add error
137 * TODO: Add error NOT_VALID_MOVE.
140 * src/ttt-error.c: (ttt_error_string): Add section comments. Add
141 error NOT_VALID_MOVE.
143 2005-12-06 Bryan Worth <bryan@theworths.org>
144 * src/ttt-error.c: fixed missing errors (NO_INVITE, NO_GAME)
146 2005-12-06 Richard D. Worth <richard@theworths.org>
148 * PROTOCOL: Add error NO_INVITE
150 * TODO: Uncheck INVITE, ACCEPT
152 * src/ttt-error.c: (ttt_error_string): Add errors NO_INVITE,
155 * src/ttt-client.c: (_ttt_client_execute_message),
156 (_ttt_client_execute_help), (_ttt_client_execute_version),
157 (_ttt_client_execute_invite), (_ttt_client_execute_accept),
158 (_ttt_client_execute_retract), (_ttt_client_execute_decline):
159 Whitespace changes. Partially implement RETRACT, DECLINE.
161 2005-12-05 Richard D. Worth <richard@theworths.org>
163 * PROTOCOL: Fill some missing possible error occurrences.
165 * TODO: Check off INVITE, ACCEPT, ERROR COMMAND, ERROR NO_USER
168 * src/ttt-server.c: (ttt_server_verify_username):
169 * src/ttt-client.c: (_ttt_client_execute_help),
170 (_ttt_client_execute_invite), (_ttt_client_execute_accept):
171 Implement INVITE, ACCEPT
173 2005-12-05 Richard D. Worth <richard@theworths.org>
175 * src/ttt-curses-client.c: (mvprintstr), (mvwprintstr), (wprint),
176 (main), (finish): Whitespace changes.
178 2005-12-04 Bryan Worth <bryan@theworths.org>
179 * src/ttt-socket.c: (ttt_socket_create_client) fixed socket to be
180 non-blocking. (ttt_socket_read) added return value for number
182 * Makefile.am: added necessary code for new curses-client program.
183 * src/ttt-curses-client: new ncurses based client
185 2005-12-03 Richard D. Worth <richard@theworths.org>
187 * PROTOCOL: Add RETRACT, DECLINE. Add game identifier for all game
190 * TODO: Add RETRACT, DECLINE, notices.
192 2005-12-03 Richard D. Worth <richard@theworths.org>
194 * PROTOCOL: Add underscores to error codes. Add STATISTICS
195 command. Remove statistics from WHO.
197 * TODO: Add STATISTICS. Check off STATISTICS.
199 * src/ttt.h: Define TTT_SERVER_PROTOCOL_VERSION for VERSION.
201 * src/ttt-error.c: (ttt_error_string): Add underscores to error
205 * src/ttt-client.c: (_ttt_client_execute_helo),
206 (_ttt_client_execute_statistics), (_ttt_client_execute_message),
207 (_ttt_client_execute_version), (_ttt_client_execute_quit),
208 (_ttt_client_init), (_ttt_client_fini), (ttt_client_get_username),
209 (ttt_client_set_username): Rename client->name to
210 client->username. Implement STATISTICS. Complete implementation of
214 * src/ttt-server.c: (ttt_server_register_client),
215 (ttt_server_unregister_client), (ttt_server_who),
216 (ttt_server_statistics): Track rename of client->name to
217 client->username. Add server helper for STATISTICS.
219 2005-12-02 Richard D. Worth <richard@theworths.org>
221 * TODO: Check off Global commands, HELP, VERSION.
223 * src/ttt-client.c: (_ttt_client_execute_message),
224 (_ttt_client_execute_help), (_execute_request): Whitespace
225 changes. Implement HELP with usage and short description.
227 * src/ttt-server.c: Update the server welcome message.
229 2005-12-01 Richard D. Worth <richard@theworths.org>
231 * TODO: Check off NOTICE MESSAGE, ERROR NONAMESET.
233 * PROTOCOL: Add NONAMESET error in possible errors where
234 applicable. Add description for MESSAGE.
236 * src/ttt-token.h: Add token typedef. Rename token type enum.
238 * src/ttt-lex.l: Add support for quoted string as single token.
239 * src/ttt-lex.h: Autogenerated.
241 * src/ttt-client.c: (_ttt_client_execute_helo),
242 (_ttt_client_execute_who), (_ttt_client_execute_message),
243 (_ttt_client_execute_help), (_ttt_client_execute_version),
244 (_ttt_client_execute_quit), (_ttt_client_init), (_read_request),
245 (_execute_request): Whitespace changes. Implement VERSION,
246 HELP. Change args_required back to args_min and args_max (see
247 PROTOCOL\HELP). Modify MESSAGE to accept one token arg and quote
248 output. Return NONAMESET error where applicable.
250 2005-11-29 Carl Worth <cworth@cworth.org>
253 * src/ttt-socket.c: (ttt_socket_create_client): New function for
254 creating a client socket.
257 * src/x.c: (xconnect): Add xconnect. Return a couple of useful
258 error status values so that callers can recover on connection
259 refused or host unreachable.
261 * src/ttt.h: Add TTT_STATUS_CONNECTION_REFUSED and
262 TTT_STATUS_NETWORK_UNREACHABLE.
264 2005-11-28 Kevin Worth <kevin@theworths.org>
266 * PROTOCOL: Changed board cell numbering to start with zero
270 * src/test-board.c: (main): Added new file for testing.
272 * src/ttt-board.c: (ttt_board_init), (ttt_board_to_string):
273 * src/ttt-board.h: Implemented board_to_string.
275 2005-11-28 kevin worth <kevin@theworths.org>
278 * src/ttt-board.h: Moved struct def from ttt-board.h into
279 ttt-board.c to make it private
284 2005-11-28 Carl Worth <cworth@cworth.org>
286 * TODO: Add instructions on using the first letter of our names to
287 indicate we are working on something.
289 2005-11-25 Bryan Worth <bryan@theworths.org>
290 * ttt-client.c, ttt-server.c, ttt-error.c changed line breaks to
291 <crlf> (\r\n) for network compatibility
293 2005-11-25 Bryan Worth <bryan@theworths.org>
294 * TODO: checked off NOTICE USER and NOTICE QUIT
295 *src/ttt-client.c: (_ttt_client_execute_helo): implement NOTICE USER
296 *(_ttt_client_execute_quit): implement NOTICE QUIT
298 2005-11-25 Bryan Worth <bryan@theworths.org>
299 * TODO: checked off MESSAGE
301 *src/ttt-client.c: (_ttt_client_execute_message): Implement MESSAGE
302 *(_execute_request): changed arg_required to behave as a minimum
303 instead of an absolute number to allow optional arguments such as
306 2005-11-25 Richard D. Worth <richard@theworths.org>
308 * TODO: checked off WHO, QUIT, ERROR SYNTAX
310 * src/ttt-client.c: (_ttt_client_execute_helo), (_ttt_client_init),
311 (ttt_client_get_num_wins):
313 * src/ttt-server.c: (ttt_server_who): Whitespace changes. Add
314 missing player win count for WHO.
316 2005-11-24 Richard D. Worth <richard@theworths.org>
318 * AUTHORS: Add Richard D. Worth
319 * TODO: Add newline before EOF
321 * src/ttt-client.c: (_ttt_client_execute_who):
323 * src/ttt-server.c: (ttt_server_who): Implement WHO.
325 2005-11-24 Carl Worth <cworth@cworth.org>
327 * PROTOCOL: Document QUIT.
329 * src/ttt-client.c: (_ttt_client_execute_helo),
330 (_ttt_client_execute_quit), (_ttt_client_init), (_ttt_client_fini),
331 (_execute_request), (_handle_requests_thread): Implement QUIT. Add
332 client->registered flag and unregister only if registered. Change
333 from args_min and args_max to args_required.
336 * src/ttt-error.c: (ttt_error_string):
337 * src/ttt-server.c: (ttt_server_register_client): Put underscores
338 in TTT_ERRROR names for better readability.
340 2005-11-24 Carl Worth <cworth@cworth.org>
343 * src/ttt-server.c: (ttt_server_init),
344 (ttt_server_register_client): Remove unique-name generation from
345 the server. The client is going to have to have code to do this
348 * src/ttt-client.c: Change minimum arguments for HELO from 0 to 1.
350 * TODO: Note that HELO and ERROR INVALIDNAME are implemented in
353 2005-11-23 Richard D. Worth <richard@theworths.org>
355 * PROTOCOL: Remove unused servername
357 * src/ttt-client.h: * src/ttt-client.c:
358 (_ttt_client_execute_helo), (_ttt_client_init),
359 (_ttt_client_fini), (_execute_request), (ttt_client_get_name),
360 (ttt_client_set_name): Added command descriptions structure. Match
361 command case-insensitively, dispatch to execute
362 function. Implement HELO command. Register on HELO instead of on
365 * src/ttt-server.h: * src/ttt-server.c: (ttt_server_init),
366 (ttt_server_register_client), (ttt_server_unregister_client),
367 (ttt_server_get_host), (ttt_server_get_port), (main): Added host
368 and port to server. Make client registration name-based rather
371 * src/x.c: (xstrdup): Return NULL on NULL
373 * src/ttt-lex.h: Regenerated
375 2005-11-22 Carl Worth <cworth@cworth.org>
377 * TODO: Add TODO file listing all the stuff from the protocol that
378 needs to be implemented.
385 * src/ttt-token.h: Add support for a flex-based tokenizer which
386 tokenizes newlines and space-separated strings.
388 * src/ttt-client.c: (_ttt_client_init), (_ttt_client_fini),
389 (_append_to_request), (_free_request), (_read_request),
390 (_execute_request): Use new tokenizer to tokenize input into an
391 array of request strings.
393 2005-11-15 Carl Worth <cworth@cworth.org>
397 * src/ttt-error.c: (ttt_error_string): Add error values and error
398 strings from protocol.
400 * src/ttt.h: Add typedefs for ttt_client_t and ttt_server_t so
401 that there's no problem with ttt-client.h and ttt-server.h needing
402 to mutually include each other.
405 * src/ttt-server.c: (ttt_server_register_client),
406 (ttt_server_unregister_client), (_ttt_server_accept), (main): Push
407 the client request handling thread back down into ttt-client.c
408 where it really does belong. The server code no longer ever
409 reaches down inside the ttt_client_t structure. Export
410 ttt_server_register_client and ttt_server_unregister_client. Add
411 documentation for ttt_server_broadcast. Document locking semantics
412 for all functions which acquire the server lock.
415 * src/ttt-client.c: (_ttt_client_create), (_ttt_client_destroy),
416 (_read_into_request_until), (_read_request), (_execute_request),
417 (_handle_requests_thread), (ttt_client_new), (ttt_client_get_id):
418 Pull the ttt_client structure definition back down inside the
419 ttt-client.c file. Don't export ttt_client_create and
420 ttt_client_destroy anymore, but instead just use static
421 _ttt_client_init and _ttt_client_fini. Implement the broadcast by
422 just passing a client pointer around and using client->request
423 rather than passing char *request all over. Document new
424 ttt_client_new and remove ttt_client_read_line. Add locking to
425 ttt_client_send and document it. Add ttt_client_get_id.
427 2005-11-14 Carl Worth <cworth@cworth.org>
429 Server now acts as a very simple chat server.
432 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
433 (_append_to_request), (ttt_client_read_into_request_until),
434 (ttt_client_read_line), (ttt_client_send): Add support to do a
435 buffering read within the client and to reuse the buffer (which
436 grows by doubling) from one request to the next. Add function to
437 send a message to a client.
439 * src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
440 Add support for a client idea. Resize the server's client list by
442 * src/ttt-server.c: (ttt_server_destroy_client): Add support to
444 * src/ttt-server.c: (_handle_client_requests_thread),
445 (_accept_client): Move handling of client requests up to
446 ttt-server.c from ttt-client.c. Use threads rather than a fork per
449 * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
450 message to all connected clients.
453 * src/ttt-socket.c: (ttt_socket_read),
454 (ttt_socket_write): Add functions to do blocking read or write of
455 the specified number of bytes.
457 * src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
458 accept function call can take care of anything like that itself.
461 * src/x.c: (xread), (xwrite): New wrappers for read and write.
463 * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
465 * src/ttt.c: Need to include ttt-args.h explicitly now.
467 2005-11-11 Carl Worth <cworth@cworth.org>
470 * src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
471 (_accept_client), (main): Add a new ttt_server_t object with a
472 mutex-protected list of clients. Move client handling code down
473 into new ttt-client.c.
476 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
477 (ttt_client_handle_requests): New ttt_client_t object that simply
478 holds a pointer back to the server as well as the client socket
482 * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
483 a call to fork before calling the accept callback.
485 * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
486 keep it from complaining.
488 * src/ttt.c: (main): Rename the client main program from
489 ttt-client to ttt.c, (since the server code now has its own
493 * src/Makefile.am: Include and link with pthread now that we have
494 pthread-based mutex locking.
496 2005-11-11 Carl Worth <cworth@pippin.local>
498 * src/ttt-server.c: (main): Don't assign to stderr which is
499 apparently an invalid lvalue on Mac OS X.
502 * src/x.c: (xfreopen): Change return type to void.
504 * src/ttt-board.c: (ttt_board_to_string): Add missing return
507 2005-11-11 Carl Worth <cworth@cworth.org>
509 * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
512 2005-11-11 Carl Worth <cworth@cworth.org>
516 * src/x.h: Move include of stdarg.h from x.c to ttt.h.
518 2005-11-11 Carl Worth <cworth@cworth.org>
520 * src/ttt-board.h: Include ttt.h to get standard includes.
522 * src/ttt-socket.c: Replace include of netinet/ip.h with
523 netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
526 2005-11-09 Carl Worth <cworth@cworth.org>
530 * src/ttt-server.c: (ttt_dispatch), (main):
532 * src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
533 (ttt_socket_create_server), (ttt_socket_accept): Push a lot of
534 code out of ttt-server.c down into a new ttt_socket abstraction
535 layer. The code is much easier to read now. The server also no
536 longer exits when the first client exits, but continues to listen
537 for more connections.
539 2005-11-09 Carl Worth <cworth@cworth.org>
542 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
543 for -h,--host, -p,--port, and --log-file command-line arguments.
545 * src/ttt-server.c: (main): Use host, port, and log-file
546 command-line arguments.
548 * src/ttt-client.c: (main): Track change in signature of
552 * src/x.c: (xfdopen), (xfreopen): More wrappers.
554 2005-11-08 Carl Worth <cworth@cworth.org>
557 * src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
558 (main): Add socket, bind, listen, accept calls to provide a
559 simple, functional, one-shot server demonstration.
562 * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
563 more wrapped system calls.
565 2005-11-07 Carl Worth <cworth@cworth.org>
567 * src/ttt.h: Grab some useful definitions from wdo.h:
568 ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
571 * src/Makefile.am: Rip out not-yet existing ttt-command and
574 * src/ttt-args.c: (ttt_args_parse): Track name change from
575 args_help to ttt_args_help.
577 * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
579 * src/x.h: Add prototype for xfwrite.
581 2005-11-05 Richard D. Worth <richard@theworths.org>
583 * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
584 * src/ttt-board.h: Added prototypes.
586 2005-11-05 Richard D. Worth <richard@theworths.org>
588 * src/args.c: Renamed ttt-args.c
589 * src/args.h: Renamed ttt-args.h
590 * src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
591 (ttt_args_parse): Added ttt_ prefix.
592 * src/ttt-args.h: Added ttt_, TTT_ prefix.
594 2005-11-05 Kevin Worth <kevin@cworth.org>
596 * src/ttt-board.c: (ttt_board_init): Implemented board_init.
597 * src/ttt-board.h: (ttt_board_t): Added cells array.
599 2005-11-05 Carl Worth <cworth@cworth.org>
601 * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
604 * src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
605 (ttt_board_to_string), (ttt_board_write): Add some stub functions
606 for Richard and Kevin to have some practice
607 implementing. Functions to represent a board and to go to/from a
611 * src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
612 (xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
613 utility functions that make system calls, check the result, and
614 exit on any error. This will simplify the error checking needed in
615 programs using these functions.
617 2005-11-05 Carl Worth <cworth@cworth.org>
619 * src/Makefile.am: Break things up for separate ttt-client and
620 ttt-server and programs.