Revision 154
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 |
|
|
130 | 127 |
if (number_tokens > 3 + PACKET_DATA_LEN) { |
131 | 128 |
/* Too many tokens */ |
132 |
printf("Too many tokens\n"); |
|
133 | 129 |
return -1; |
134 | 130 |
} |
135 | 131 |
|
136 | 132 |
if (number_tokens < 3) { |
137 | 133 |
/* Not enough tokens */ |
138 |
printf("Too few tokens\n"); |
|
139 | 134 |
return -1; |
140 | 135 |
} |
141 | 136 |
|
142 | 137 |
if (tokens[1] != COLONET_REQUEST && tokens[1] != COLONET_COMMAND) { |
143 | 138 |
/* Invalid message type */ |
144 |
printf("Invalid message type. Was: %i Expected: %i %i\n", tokens[1], COLONET_REQUEST, COLONET_COMMAND); |
|
145 | 139 |
return -1; |
146 | 140 |
} |
147 | 141 |
|
Also available in: Unified diff