]> git.cworth.org Git - ttt/blob - ChangeLog
bc176073fc7e0241c19ef2bfce625caaa48faf62
[ttt] / ChangeLog
1 2005-11-14  Carl Worth  <cworth@cworth.org>
2
3         Server now acts as a very simple chat server.
4
5         * src/ttt-client.h:
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.
12
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
15         doubling.
16         * src/ttt-server.c: (ttt_server_destroy_client): Add support to
17         destroy a client.
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
21         client.
22         * src/ttt-server.h:
23         * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
24         message to all connected clients.
25
26         * src/ttt-socket.h:
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.
30
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.
33         
34         * src/x.h:
35         * src/x.c: (xread), (xwrite): New wrappers for read and write.
36
37         * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
38
39         * src/ttt.c: Need to include ttt-args.h explicitly now.
40
41 2005-11-11  Carl Worth  <cworth@cworth.org>
42
43         * src/ttt-server.h:
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.
48
49         * src/ttt-client.h:
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
53         file descriptor.
54
55         * src/ttt-socket.h:
56         * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
57         a call to fork before calling the accept callback.
58
59         * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
60         keep it from complaining.
61
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
64         ttt-client.c).
65
66         * src/ttt.h:
67         * src/Makefile.am: Include and link with pthread now that we have
68         pthread-based mutex locking.
69
70 2005-11-11  Carl Worth  <cworth@pippin.local>
71
72         * src/ttt-server.c: (main): Don't assign to stderr which is
73         apparently an invalid lvalue on Mac OS X.
74
75         * src/x.h:
76         * src/x.c: (xfreopen): Change return type to void.
77
78         * src/ttt-board.c: (ttt_board_to_string): Add missing return
79         statement.
80
81 2005-11-11  Carl Worth  <cworth@cworth.org>
82
83         * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
84         longer exists.
85
86 2005-11-11  Carl Worth  <cworth@cworth.org>
87
88         * src/ttt.h:
89         * src/x.c:
90         * src/x.h: Move include of stdarg.h from x.c to ttt.h.
91
92 2005-11-11  Carl Worth  <cworth@cworth.org>
93
94         * src/ttt-board.h: Include ttt.h to get standard includes.
95         
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
98         X).
99
100 2005-11-09  Carl Worth  <cworth@cworth.org>
101
102         * src/Makefile.am:
103         * src/ttt.h:
104         * src/ttt-server.c: (ttt_dispatch), (main):
105         * src/ttt-socket.h:
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.
112
113 2005-11-09  Carl Worth  <cworth@cworth.org>
114
115         * src/ttt-args.h:
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.
118         
119         * src/ttt-server.c: (main): Use host, port, and log-file
120         command-line arguments.
121
122         * src/ttt-client.c: (main): Track change in signature of
123         ttt_args_parse.
124         
125         * src/x.h:
126         * src/x.c: (xfdopen), (xfreopen): More wrappers.
127
128 2005-11-08  Carl Worth  <cworth@cworth.org>
129
130         * src/ttt.h:
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.
134
135         * src/x.h:
136         * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
137         more wrapped system calls.
138
139 2005-11-07  Carl Worth  <cworth@cworth.org>
140
141         * src/ttt.h: Grab some useful definitions from wdo.h:
142         ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
143         include directives.
144
145         * src/Makefile.am: Rip out not-yet existing ttt-command and
146         ttt-error.
147         
148         * src/ttt-args.c: (ttt_args_parse): Track name change from
149         args_help to ttt_args_help.
150
151         * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
152         
153         * src/x.h: Add prototype for xfwrite.
154
155 2005-11-05  Richard D. Worth  <richard@theworths.org>
156
157         * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
158         * src/ttt-board.h: Added prototypes.
159
160 2005-11-05  Richard D. Worth  <richard@theworths.org>
161
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.
167
168 2005-11-05  Kevin Worth  <kevin@cworth.org>
169
170         * src/ttt-board.c: (ttt_board_init): Implemented board_init.
171         * src/ttt-board.h: (ttt_board_t): Added cells array.
172
173 2005-11-05  Carl Worth  <cworth@cworth.org>
174
175         * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
176         
177         * src/ttt-board.h:
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
182         string.
183         
184         * src/x.h:
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.
190         
191 2005-11-05  Carl Worth  <cworth@cworth.org>
192
193         * src/Makefile.am: Break things up for separate ttt-client and
194         ttt-server and programs.
195