1 2005-11-14 Carl Worth <cworth@cworth.org>
3 Server now acts as a very simple chat server.
6 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
7 (_append_to_request), (ttt_client_read_into_request_until),
8 (ttt_client_read_line), (ttt_client_send): Add support to do a
9 buffering read within the client and to reuse the buffer (which
10 grows by doubling) from one request to the next. Add function to
11 send a message to a client.
13 * src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
14 Add support for a client idea. Resize the server's client list by
16 * src/ttt-server.c: (ttt_server_destroy_client): Add support to
18 * src/ttt-server.c: (_handle_client_requests_thread),
19 (_accept_client): Move handling of client requests up to
20 ttt-server.c from ttt-client.c. Use threads rather than a fork per
23 * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
24 message to all connected clients.
27 * src/ttt-socket.c: (ttt_socket_read),
28 (ttt_socket_write): Add functions to do blocking read or write of
29 the specified number of bytes.
31 * src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
32 accept function call can take care of anything like that itself.
35 * src/x.c: (xread), (xwrite): New wrappers for read and write.
37 * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
39 * src/ttt.c: Need to include ttt-args.h explicitly now.
41 2005-11-11 Carl Worth <cworth@cworth.org>
44 * src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
45 (_accept_client), (main): Add a new ttt_server_t object with a
46 mutex-protected list of clients. Move client handling code down
47 into new ttt-client.c.
50 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
51 (ttt_client_handle_requests): New ttt_client_t object that simply
52 holds a pointer back to the server as well as the client socket
56 * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
57 a call to fork before calling the accept callback.
59 * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
60 keep it from complaining.
62 * src/ttt.c: (main): Rename the client main program from
63 ttt-client to ttt.c, (since the server code now has its own
67 * src/Makefile.am: Include and link with pthread now that we have
68 pthread-based mutex locking.
70 2005-11-11 Carl Worth <cworth@pippin.local>
72 * src/ttt-server.c: (main): Don't assign to stderr which is
73 apparently an invalid lvalue on Mac OS X.
76 * src/x.c: (xfreopen): Change return type to void.
78 * src/ttt-board.c: (ttt_board_to_string): Add missing return
81 2005-11-11 Carl Worth <cworth@cworth.org>
83 * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
86 2005-11-11 Carl Worth <cworth@cworth.org>
90 * src/x.h: Move include of stdarg.h from x.c to ttt.h.
92 2005-11-11 Carl Worth <cworth@cworth.org>
94 * src/ttt-board.h: Include ttt.h to get standard includes.
96 * src/ttt-socket.c: Replace include of netinet/ip.h with
97 netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
100 2005-11-09 Carl Worth <cworth@cworth.org>
104 * src/ttt-server.c: (ttt_dispatch), (main):
106 * src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
107 (ttt_socket_create_server), (ttt_socket_accept): Push a lot of
108 code out of ttt-server.c down into a new ttt_socket abstraction
109 layer. The code is much easier to read now. The server also no
110 longer exits when the first client exits, but continues to listen
111 for more connections.
113 2005-11-09 Carl Worth <cworth@cworth.org>
116 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
117 for -h,--host, -p,--port, and --log-file command-line arguments.
119 * src/ttt-server.c: (main): Use host, port, and log-file
120 command-line arguments.
122 * src/ttt-client.c: (main): Track change in signature of
126 * src/x.c: (xfdopen), (xfreopen): More wrappers.
128 2005-11-08 Carl Worth <cworth@cworth.org>
131 * src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
132 (main): Add socket, bind, listen, accept calls to provide a
133 simple, functional, one-shot server demonstration.
136 * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
137 more wrapped system calls.
139 2005-11-07 Carl Worth <cworth@cworth.org>
141 * src/ttt.h: Grab some useful definitions from wdo.h:
142 ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
145 * src/Makefile.am: Rip out not-yet existing ttt-command and
148 * src/ttt-args.c: (ttt_args_parse): Track name change from
149 args_help to ttt_args_help.
151 * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
153 * src/x.h: Add prototype for xfwrite.
155 2005-11-05 Richard D. Worth <richard@theworths.org>
157 * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
158 * src/ttt-board.h: Added prototypes.
160 2005-11-05 Richard D. Worth <richard@theworths.org>
162 * src/args.c: Renamed ttt-args.c
163 * src/args.h: Renamed ttt-args.h
164 * src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
165 (ttt_args_parse): Added ttt_ prefix.
166 * src/ttt-args.h: Added ttt_, TTT_ prefix.
168 2005-11-05 Kevin Worth <kevin@cworth.org>
170 * src/ttt-board.c: (ttt_board_init): Implemented board_init.
171 * src/ttt-board.h: (ttt_board_t): Added cells array.
173 2005-11-05 Carl Worth <cworth@cworth.org>
175 * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
178 * src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
179 (ttt_board_to_string), (ttt_board_write): Add some stub functions
180 for Richard and Kevin to have some practice
181 implementing. Functions to represent a board and to go to/from a
185 * src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
186 (xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
187 utility functions that make system calls, check the result, and
188 exit on any error. This will simplify the error checking needed in
189 programs using these functions.
191 2005-11-05 Carl Worth <cworth@cworth.org>
193 * src/Makefile.am: Break things up for separate ttt-client and
194 ttt-server and programs.