]> git.cworth.org Git - ttt/blob - ChangeLog
2005-11-15 Carl Worth <cworth@cworth.org>
[ttt] / ChangeLog
1 2005-11-15  Carl Worth  <cworth@cworth.org>
2
3         * src/Makefile.am:
4         * src/ttt-error.h:
5         * src/ttt-error.c: (ttt_error_string): Add error values and error
6         strings from protocol.
7
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.
11
12         * src/ttt-server.h:
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.
21
22         * src/ttt-client.h:
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.
34
35 2005-11-14  Carl Worth  <cworth@cworth.org>
36
37         Server now acts as a very simple chat server.
38
39         * src/ttt-client.h:
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.
46
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
49         doubling.
50         * src/ttt-server.c: (ttt_server_destroy_client): Add support to
51         destroy a client.
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
55         client.
56         * src/ttt-server.h:
57         * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
58         message to all connected clients.
59
60         * src/ttt-socket.h:
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.
64
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.
67         
68         * src/x.h:
69         * src/x.c: (xread), (xwrite): New wrappers for read and write.
70
71         * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
72
73         * src/ttt.c: Need to include ttt-args.h explicitly now.
74
75 2005-11-11  Carl Worth  <cworth@cworth.org>
76
77         * src/ttt-server.h:
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.
82
83         * src/ttt-client.h:
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
87         file descriptor.
88
89         * src/ttt-socket.h:
90         * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
91         a call to fork before calling the accept callback.
92
93         * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
94         keep it from complaining.
95
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
98         ttt-client.c).
99
100         * src/ttt.h:
101         * src/Makefile.am: Include and link with pthread now that we have
102         pthread-based mutex locking.
103
104 2005-11-11  Carl Worth  <cworth@pippin.local>
105
106         * src/ttt-server.c: (main): Don't assign to stderr which is
107         apparently an invalid lvalue on Mac OS X.
108
109         * src/x.h:
110         * src/x.c: (xfreopen): Change return type to void.
111
112         * src/ttt-board.c: (ttt_board_to_string): Add missing return
113         statement.
114
115 2005-11-11  Carl Worth  <cworth@cworth.org>
116
117         * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
118         longer exists.
119
120 2005-11-11  Carl Worth  <cworth@cworth.org>
121
122         * src/ttt.h:
123         * src/x.c:
124         * src/x.h: Move include of stdarg.h from x.c to ttt.h.
125
126 2005-11-11  Carl Worth  <cworth@cworth.org>
127
128         * src/ttt-board.h: Include ttt.h to get standard includes.
129         
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
132         X).
133
134 2005-11-09  Carl Worth  <cworth@cworth.org>
135
136         * src/Makefile.am:
137         * src/ttt.h:
138         * src/ttt-server.c: (ttt_dispatch), (main):
139         * src/ttt-socket.h:
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.
146
147 2005-11-09  Carl Worth  <cworth@cworth.org>
148
149         * src/ttt-args.h:
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.
152         
153         * src/ttt-server.c: (main): Use host, port, and log-file
154         command-line arguments.
155
156         * src/ttt-client.c: (main): Track change in signature of
157         ttt_args_parse.
158         
159         * src/x.h:
160         * src/x.c: (xfdopen), (xfreopen): More wrappers.
161
162 2005-11-08  Carl Worth  <cworth@cworth.org>
163
164         * src/ttt.h:
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.
168
169         * src/x.h:
170         * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
171         more wrapped system calls.
172
173 2005-11-07  Carl Worth  <cworth@cworth.org>
174
175         * src/ttt.h: Grab some useful definitions from wdo.h:
176         ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
177         include directives.
178
179         * src/Makefile.am: Rip out not-yet existing ttt-command and
180         ttt-error.
181         
182         * src/ttt-args.c: (ttt_args_parse): Track name change from
183         args_help to ttt_args_help.
184
185         * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
186         
187         * src/x.h: Add prototype for xfwrite.
188
189 2005-11-05  Richard D. Worth  <richard@theworths.org>
190
191         * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
192         * src/ttt-board.h: Added prototypes.
193
194 2005-11-05  Richard D. Worth  <richard@theworths.org>
195
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.
201
202 2005-11-05  Kevin Worth  <kevin@cworth.org>
203
204         * src/ttt-board.c: (ttt_board_init): Implemented board_init.
205         * src/ttt-board.h: (ttt_board_t): Added cells array.
206
207 2005-11-05  Carl Worth  <cworth@cworth.org>
208
209         * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
210         
211         * src/ttt-board.h:
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
216         string.
217         
218         * src/x.h:
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.
224         
225 2005-11-05  Carl Worth  <cworth@cworth.org>
226
227         * src/Makefile.am: Break things up for separate ttt-client and
228         ttt-server and programs.
229