… | |
… | |
189 | uint16 ACC (RW, look_position); /* start of drawing of look window */ |
189 | uint16 ACC (RW, look_position); /* start of drawing of look window */ |
190 | uint16 ACC (RW, mss); // likely tcp maximum segment size |
190 | uint16 ACC (RW, mss); // likely tcp maximum segment size |
191 | uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ |
191 | uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ |
192 | uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ |
192 | uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ |
193 | uint8 ACC (RW, faceset); // CF+ selected faceset |
193 | uint8 ACC (RW, faceset); // CF+ selected faceset |
|
|
194 | uint8 ACC (RW, ws_version); // websocket protocol versio for framing |
194 | |
195 | |
195 | maptile_ptr ACC (RW, current_map); // CF+ last/current player map |
196 | maptile_ptr ACC (RW, current_map); // CF+ last/current player map |
196 | region_ptr ACC (RW, current_region); // CF+ last/current player region |
197 | region_ptr ACC (RW, current_region); // CF+ last/current player region |
197 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
198 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
198 | |
199 | |
… | |
… | |
204 | faceidx ACC (RW, scrub_idx); // which face to send next |
205 | faceidx ACC (RW, scrub_idx); // which face to send next |
205 | int ACC (RW, bg_scrub); // how many ticks till the next background face send |
206 | int ACC (RW, bg_scrub); // how many ticks till the next background face send |
206 | |
207 | |
207 | struct tcp_info tcpi; |
208 | struct tcp_info tcpi; |
208 | tstamp next_rate_adjust; |
209 | tstamp next_rate_adjust; |
|
|
210 | |
|
|
211 | // websocket frame buffer |
|
|
212 | uint8 ws_inbuf_type; // current frame type |
|
|
213 | uint8 *ws_inbuf; |
|
|
214 | uint32 ws_inbuf_len; |
|
|
215 | uint32 ws_inbuf_alloc; |
209 | |
216 | |
210 | unordered_vector<char *> mapinfo_queue; |
217 | unordered_vector<char *> mapinfo_queue; |
211 | void mapinfo_queue_clear (); |
218 | void mapinfo_queue_clear (); |
212 | void mapinfo_queue_run (); |
219 | void mapinfo_queue_run (); |
213 | bool mapinfo_try (char *buf); |
220 | bool mapinfo_try (char *buf); |
… | |
… | |
280 | void skip_packet (int len); // we have processed the packet, skip it |
287 | void skip_packet (int len); // we have processed the packet, skip it |
281 | |
288 | |
282 | MTH void flush (); |
289 | MTH void flush (); |
283 | MTH void write_outputbuffer (); |
290 | MTH void write_outputbuffer (); |
284 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
291 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
|
|
292 | void send_raw (void *buf_, int len); |
|
|
293 | |
285 | void send (void *buf_, int len); |
294 | void send (void *buf_, int len); |
286 | |
|
|
287 | void send_packet (const_octet_string buf); |
295 | void send_packet (const_octet_string buf); |
288 | void send_packet (const_octet_string buf, int len); |
296 | void send_packet (const_octet_string buf, int len); |
289 | void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3))); |
297 | void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3))); |
290 | void send_packet (packet &sl); |
298 | void send_packet (packet &sl); |
291 | |
299 | |
… | |
… | |
305 | MTH void tick (); // called every server tick to do housekeeping etc. |
313 | MTH void tick (); // called every server tick to do housekeeping etc. |
306 | |
314 | |
307 | MTH static client *create (int fd, const char *peername); |
315 | MTH static client *create (int fd, const char *peername); |
308 | MTH static void clock (); |
316 | MTH static void clock (); |
309 | MTH static void flush_sockets (); |
317 | MTH static void flush_sockets (); |
|
|
318 | |
|
|
319 | MTH void run (); // start handshake after init |
310 | |
320 | |
311 | protected: |
321 | protected: |
312 | client (int fd, const char *from_ip); |
322 | client (int fd, const char *from_ip); |
313 | ~client (); |
323 | ~client (); |
314 | }; |
324 | }; |