1 2005-11-15 Carl Worth <cworth@cworth.org>
5 * src/ttt-error.c: (ttt_error_string): Add error values and error
8 * src/ttt.h: Add typedefs for ttt_client_t and ttt_server_t so
9 that there's no problem with ttt-client.h and ttt-server.h needing
10 to mutually include each other.
13 * src/ttt-server.c: (ttt_server_register_client),
14 (ttt_server_unregister_client), (_ttt_server_accept), (main): Push
15 the client request handling thread back down into ttt-client.c
16 where it really does belong. The server code no longer ever
17 reaches down inside the ttt_client_t structure. Export
18 ttt_server_register_client and ttt_server_unregister_client. Add
19 documentation for ttt_server_broadcast. Document locking semantics
20 for all functions which acquire the server lock.
23 * src/ttt-client.c: (_ttt_client_create), (_ttt_client_destroy),
24 (_read_into_request_until), (_read_request), (_execute_request),
25 (_handle_requests_thread), (ttt_client_new), (ttt_client_get_id):
26 Pull the ttt_client structure definition back down inside the
27 ttt-client.c file. Don't export ttt_client_create and
28 ttt_client_destroy anymore, but instead just use static
29 _ttt_client_init and _ttt_client_fini. Implement the broadcast by
30 just passing a client pointer around and using client->request
31 rather than passing char *request all over. Document new
32 ttt_client_new and remove ttt_client_read_line. Add locking to
33 ttt_client_send and document it. Add ttt_client_get_id.
35 2005-11-14 Carl Worth <cworth@cworth.org>
37 Server now acts as a very simple chat server.
40 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
41 (_append_to_request), (ttt_client_read_into_request_until),
42 (ttt_client_read_line), (ttt_client_send): Add support to do a
43 buffering read within the client and to reuse the buffer (which
44 grows by doubling) from one request to the next. Add function to
45 send a message to a client.
47 * src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
48 Add support for a client idea. Resize the server's client list by
50 * src/ttt-server.c: (ttt_server_destroy_client): Add support to
52 * src/ttt-server.c: (_handle_client_requests_thread),
53 (_accept_client): Move handling of client requests up to
54 ttt-server.c from ttt-client.c. Use threads rather than a fork per
57 * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
58 message to all connected clients.
61 * src/ttt-socket.c: (ttt_socket_read),
62 (ttt_socket_write): Add functions to do blocking read or write of
63 the specified number of bytes.
65 * src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
66 accept function call can take care of anything like that itself.
69 * src/x.c: (xread), (xwrite): New wrappers for read and write.
71 * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
73 * src/ttt.c: Need to include ttt-args.h explicitly now.
75 2005-11-11 Carl Worth <cworth@cworth.org>
78 * src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
79 (_accept_client), (main): Add a new ttt_server_t object with a
80 mutex-protected list of clients. Move client handling code down
81 into new ttt-client.c.
84 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
85 (ttt_client_handle_requests): New ttt_client_t object that simply
86 holds a pointer back to the server as well as the client socket
90 * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
91 a call to fork before calling the accept callback.
93 * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
94 keep it from complaining.
96 * src/ttt.c: (main): Rename the client main program from
97 ttt-client to ttt.c, (since the server code now has its own
101 * src/Makefile.am: Include and link with pthread now that we have
102 pthread-based mutex locking.
104 2005-11-11 Carl Worth <cworth@pippin.local>
106 * src/ttt-server.c: (main): Don't assign to stderr which is
107 apparently an invalid lvalue on Mac OS X.
110 * src/x.c: (xfreopen): Change return type to void.
112 * src/ttt-board.c: (ttt_board_to_string): Add missing return
115 2005-11-11 Carl Worth <cworth@cworth.org>
117 * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
120 2005-11-11 Carl Worth <cworth@cworth.org>
124 * src/x.h: Move include of stdarg.h from x.c to ttt.h.
126 2005-11-11 Carl Worth <cworth@cworth.org>
128 * src/ttt-board.h: Include ttt.h to get standard includes.
130 * src/ttt-socket.c: Replace include of netinet/ip.h with
131 netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
134 2005-11-09 Carl Worth <cworth@cworth.org>
138 * src/ttt-server.c: (ttt_dispatch), (main):
140 * src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
141 (ttt_socket_create_server), (ttt_socket_accept): Push a lot of
142 code out of ttt-server.c down into a new ttt_socket abstraction
143 layer. The code is much easier to read now. The server also no
144 longer exits when the first client exits, but continues to listen
145 for more connections.
147 2005-11-09 Carl Worth <cworth@cworth.org>
150 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
151 for -h,--host, -p,--port, and --log-file command-line arguments.
153 * src/ttt-server.c: (main): Use host, port, and log-file
154 command-line arguments.
156 * src/ttt-client.c: (main): Track change in signature of
160 * src/x.c: (xfdopen), (xfreopen): More wrappers.
162 2005-11-08 Carl Worth <cworth@cworth.org>
165 * src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
166 (main): Add socket, bind, listen, accept calls to provide a
167 simple, functional, one-shot server demonstration.
170 * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
171 more wrapped system calls.
173 2005-11-07 Carl Worth <cworth@cworth.org>
175 * src/ttt.h: Grab some useful definitions from wdo.h:
176 ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
179 * src/Makefile.am: Rip out not-yet existing ttt-command and
182 * src/ttt-args.c: (ttt_args_parse): Track name change from
183 args_help to ttt_args_help.
185 * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
187 * src/x.h: Add prototype for xfwrite.
189 2005-11-05 Richard D. Worth <richard@theworths.org>
191 * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
192 * src/ttt-board.h: Added prototypes.
194 2005-11-05 Richard D. Worth <richard@theworths.org>
196 * src/args.c: Renamed ttt-args.c
197 * src/args.h: Renamed ttt-args.h
198 * src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
199 (ttt_args_parse): Added ttt_ prefix.
200 * src/ttt-args.h: Added ttt_, TTT_ prefix.
202 2005-11-05 Kevin Worth <kevin@cworth.org>
204 * src/ttt-board.c: (ttt_board_init): Implemented board_init.
205 * src/ttt-board.h: (ttt_board_t): Added cells array.
207 2005-11-05 Carl Worth <cworth@cworth.org>
209 * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
212 * src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
213 (ttt_board_to_string), (ttt_board_write): Add some stub functions
214 for Richard and Kevin to have some practice
215 implementing. Functions to represent a board and to go to/from a
219 * src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
220 (xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
221 utility functions that make system calls, check the result, and
222 exit on any error. This will simplify the error checking needed in
223 programs using these functions.
225 2005-11-05 Carl Worth <cworth@cworth.org>
227 * src/Makefile.am: Break things up for separate ttt-client and
228 ttt-server and programs.