… | |
… | |
106 | tstamp stamp; |
106 | tstamp stamp; |
107 | const packet_type *handler; |
107 | const packet_type *handler; |
108 | char *data; |
108 | char *data; |
109 | int datalen; |
109 | int datalen; |
110 | |
110 | |
111 | command (tstamp stamp, const packet_type *handler, char *data, int datalen) |
111 | ~command () |
112 | : stamp (stamp), handler (handler), data (data), datalen (datalen) |
|
|
113 | { |
112 | { |
|
|
113 | sfree (data, datalen); |
114 | } |
114 | } |
115 | }; |
115 | }; |
116 | |
116 | |
117 | /* how many times we are allowed to give the wrong password before being kicked. */ |
117 | /* how many times we are allowed to give the wrong password before being kicked. */ |
118 | #define MAX_PASSWORD_FAILURES 5 |
118 | #define MAX_PASSWORD_FAILURES 5 |
… | |
… | |
180 | iw cmd_ev; void cmd_cb (iw &w); |
180 | iw cmd_ev; void cmd_cb (iw &w); |
181 | iow socket_ev; void socket_cb (iow &w, int got); |
181 | iow socket_ev; void socket_cb (iow &w, int got); |
182 | |
182 | |
183 | std::deque< command, slice_allocator<command> > cmd_queue; |
183 | std::deque< command, slice_allocator<command> > cmd_queue; |
184 | |
184 | |
185 | // those should probably be client methods |
185 | // resets movement state |
186 | bool may_execute (const packet_type *pkt) const; |
186 | bool may_execute (const packet_type *pkt) const; |
187 | void execute (const packet_type *pkt, char *data, int datalen); |
187 | void execute (const packet_type *pkt, char *data, int datalen); |
188 | |
188 | |
189 | void queue_command (packet_type *handler, char *data, int datalen); |
189 | void queue_command (packet_type *handler, char *data, int datalen); |
190 | bool handle_command (); |
190 | bool handle_command (); |
|
|
191 | void reset_state (); |
191 | |
192 | |
192 | bool handle_packet (); |
193 | bool handle_packet (); |
193 | int next_packet (); // returns length of packet or 0 |
194 | int next_packet (); // returns length of packet or 0 |
194 | void skip_packet (int len); // we have processed the packet, skip it |
195 | void skip_packet (int len); // we have processed the packet, skip it |
195 | |
196 | |