Set auto stop values */
| 181 | |
| 182 | /* Set auto stop values */ |
| 183 | static void auto_stop(char *opt) |
| 184 | { |
| 185 | char *value, *endp; |
| 186 | |
| 187 | value = strchr(opt, ':'); |
| 188 | if (value == NULL) |
| 189 | rte_exit(EXIT_FAILURE, |
| 190 | "Missing colon in auto stop parameter\n"); |
| 191 | |
| 192 | *value++ = '\0'; |
| 193 | if (strcmp(opt, "duration") == 0) { |
| 194 | double interval = strtod(value, &endp); |
| 195 | |
| 196 | if (*value == '\0' || *endp != '\0' || interval <= 0) |
| 197 | rte_exit(EXIT_FAILURE, |
| 198 | "Invalid duration \"%s\"\n", value); |
| 199 | stop.duration = interval; |
| 200 | } else if (strcmp(opt, "filesize") == 0) { |
| 201 | stop.size = get_uint(value, "filesize", 0) * 1024; |
| 202 | } else if (strcmp(opt, "packets") == 0) { |
| 203 | stop.packets = get_uint(value, "packets", 0); |
| 204 | } else { |
| 205 | rte_exit(EXIT_FAILURE, |
| 206 | "Unknown autostop parameter \"%s\"\n", opt); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | /* Add interface to list of interfaces to capture */ |
| 211 | static struct interface *add_interface(const char *name) |
no test coverage detected