Revision 151
trunk/code/projects/colonet/ColonetServer/Command.cpp | ||
---|---|---|
124 | 124 |
* @return 0 if tokens is valid |
125 | 125 |
*/ |
126 | 126 |
int Command::check_tokens(unsigned char* tokens, int number_tokens) { |
127 |
|
|
128 |
printf("Checking tokens\n"); |
|
129 |
|
|
127 | 130 |
if (number_tokens > 3 + PACKET_DATA_LEN) { |
128 | 131 |
/* Too many tokens */ |
132 |
printf("Too many tokens\n"); |
|
129 | 133 |
return -1; |
130 | 134 |
} |
131 | 135 |
|
132 | 136 |
if (number_tokens < 3) { |
133 | 137 |
/* Not enough tokens */ |
138 |
printf("Too few tokens\n"); |
|
134 | 139 |
return -1; |
135 | 140 |
} |
136 | 141 |
|
137 | 142 |
if (tokens[1] != COLONET_REQUEST && tokens[1] != COLONET_COMMAND) { |
138 | 143 |
/* Invalid message type */ |
144 |
printf("Invalid message type. Was: %x Expected: %x %x\n", |
|
145 |
tokens[1], COLONET_REQUEST, COLONET_COMMAND); |
|
139 | 146 |
return -1; |
140 | 147 |
} |
141 | 148 |
|
... | ... | |
168 | 175 |
|
169 | 176 |
// Check the tokens |
170 | 177 |
if (check_tokens(int_tokens, number_int_tokens) < 0) { |
171 |
fprintf(stderr, "%s: Error - Invalid command/request.\n", __FUNCTION__); |
|
178 |
fprintf(stderr, "%s: Error - Invalid robot command/request.\n", __FUNCTION__);
|
|
172 | 179 |
return -1; |
173 | 180 |
} |
174 | 181 |
|
Also available in: Unified diff